diff options
Diffstat (limited to 'addressbook')
246 files changed, 0 insertions, 54439 deletions
diff --git a/addressbook/.cvsignore b/addressbook/.cvsignore deleted file mode 100644 index 09980ae6ba..0000000000 --- a/addressbook/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog deleted file mode 100644 index 5f86fa875b..0000000000 --- a/addressbook/ChangeLog +++ /dev/null @@ -1,2135 +0,0 @@ -2000-08-22 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/addressbook.c: Linked in the search dialog again. - It looks like some changes in the shell made this not work. - -2000-08-19 Christopher James Lahey <clahey@helixcode.com> - - * conduit/address-conduit.c, conduit/address-conduit.h: Changed - this to use ECardSimple. - - * contact-editor/e-contact-editor.c: Fixed a memory leak. - - * gui/component/addressbook.c: Added stuff to the right click - menu. Activated the new search dialog that doesn't quite work - yet. - - * gui/minicard/e-minicard-view.c: Fixed some run time warnings. - -2000-08-15 Larry Ewing <lewing@helixcode.com> - - * gui/minicard/e-minicard.c (e_minicard_event): use style colors - for the selected state. This doesn't properly redraw the minicard - when there is a style_change event, that is next. - (e_minicard_realize): use style colors. - -2000-08-14 Peter Williams <peterw@helixcode.com> - - * backend/pas/pas-backend-file.c: Include the proper db1/db.h - as in RedHat 7.0 -- patch from Kenny Graunke <kwg@teleport.com> - -2000-08-13 Chris Toshok <toshok@helixcode.com> - - * conduit/Makefile.am (libaddress_conduit_la_SOURCES): add - address-conduit.h - - * Makefile.am (CONDUIT_SUBDIR): only set subdir if - ENABLE_PILOT_CONDUITS is set. - -2000-08-13 Chris Toshok <toshok@helixcode.com> - - * Makefile.am (SUBDIRS): add conduit subdir. - -2000-08-13 Chris Toshok <toshok@helixcode.com> - - * conduit/address-conduit.c (conduit_get_gpilot_conduit): add - special oaf initialization hack so conduit can find wombat, and - accept all cookies so that we can actually talk to oaf. - -2000-08-13 Christopher James Lahey <clahey@helixcode.com> - - * backend/pas/pas-backend-file.c: Fixed a typo that cause the - wrong field to be searched. - - * gui/component/select-names/e-select-names.c: Made the select - names dialog only display entries with email addresses. - -2000-08-12 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/contact-editor.glade: Fixed a typo in the name of - the first phone entry. - -2000-08-12 Christopher James Lahey <clahey@helixcode.com> - - * gui/search/Makefile.am, - gui/search/e-addressbook-search-dialog.c, - gui/search/e-addressbook-search-dialog.h: A few small interface - fixes. - - * gui/component/Makefile.am: Link in the addressbook search - dialog. - -2000-08-12 Christopher James Lahey <clahey@helixcode.com> - - * gui/Makefile.am: Added the search directory. - - * backend/ebook/e-book.c: Fixed a potential crash. - - * gui/minicard/e-reflow-sorted.h: Fixed an include line. - - * gui/search/.cvsignore, gui/search/Makefile.am: New files. - - * gui/search/e-addressbook-search-dialog.c: Fixed compilation. - -2000-08-12 Christopher James Lahey <clahey@helixcode.com> - - * printing/Makefile.am: Ettore fixed compilation. - -2000-08-12 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/.cvsignore: Added load-gnomecard-addressbook. - -2000-08-12 Christopher James Lahey <clahey@helixcode.com> - - * gui/search/e-addressbook-search-dialog.c, - gui/search/e-addressbook-search-dialog.h: Made this into a Gtk - object. - -2000-08-12 Christopher James Lahey <clahey@helixcode.com> - - * backend/pas/pas-book-view.c: Ref our book view listener. - - * gui/component/addressbook.c: Updated to use new minicard view - widget. - - * gui/minicard/Makefile.am: Added e-minicard-view-widget.c and - e-minicard-view-widget.h. - - * gui/minicard/e-minicard-view-widget.c, - gui/minicard/e-minicard-view-widget.h: New class that's just a - minicard view in an ECanvas. - - * gui/search/e-addressbook-search-dialog.c: New file for - implementing a search dialog. - -2000-08-11 Chris Toshok <toshok@helixcode.com> - - * conduit/address-conduit.c (transmit): implement code to encode - the first email address and send to the pilot. - (get_phone_label_by_flag): rename find_phone_label_for_flags to - this, and implement by calling get_phone_label_by_name. - -2000-08-11 Chris Toshok <toshok@helixcode.com> - - * conduit/address-conduit.c (ecard_from_remote_record): add code - for handling email addresses from pilot (which stores it as a - phone number entry. go figure.) - (check_for_slow_setting): #if 0 out, since we don't use it (yet). - (update_record): un #if 0 the code to handle the case where the - pilot info has changed for a local record. - (merge_ecard_with_remote_record): implement function, but for now - just return the existing (desktop) record - we still don't allow - merge from the pilot. - - -2000-08-10 Christopher James Lahey <clahey@helixcode.com> - - * gui/search/addresstypes.xml: Changed a couple of input field - names. - -2000-08-10 Ettore Perazzoli <ettore@helixcode.com> - - * gui/component/addressbook-component.c: Remove prototype for - `setup_ldap_storage()', which shouldn't be here anyway. - -2000-08-10 Christopher James Lahey <clahey@helixcode.com> - - * gui/search/, gui/search/addresstypes.xml: New search dialog for - addressbook. - -2000-08-10 Dan Winship <danw@helixcode.com> - - * gui/component/addressbook-component.c (owner_set_cb): Update for - changed prototype, pass evolution_homedir arg to - setup_ldap_storage. - - * gui/component/e-ldap-storage.c (setup_ldap_storage): Now takes - an evolution_homedir arg, uses that to generate the path to the - ldapservers.xml file, and stores the result in a static variable. - (e_ldap_storage_add_server, e_ldap_storage_remove_server): Use that - static variable rather than hardcoding the path to the file. - -2000-08-10 Christopher James Lahey <clahey@helixcode.com> - - * backend/pas/pas-backend-file.c: Fixed any search to not crash on - missing phone numbers or email addresses. - -2000-08-09 Christopher James Lahey <clahey@helixcode.com> - - * gui/minicard/e-minicard-control.c: Added a button to save to - your addressbook. - -2000-08-09 Cody Russell <bratsche@gnome.org> - - * gui/component/addressbook.c: Make the toolbar honor the user's - gnomecc settings for detachable toolbars. - -2000-08-09 Nat Friedman <nat@helixcode.com> - - * ename/e-name-western-tables.h: Added some military prefixes. - -2000-08-09 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/addressbook.c: Fixed a warning. - -2000-08-09 Ettore Perazzoli <ettore@helixcode.com> - - * gui/component/addressbook.c (control_activate): Add the stock - print icon to the print item. - -2000-08-09 Ettore Perazzoli <ettore@helixcode.com> - - * gui/component/addressbook.c (control_activate): Put the print - item in the right placeholder so that it gets the right position - in the "File" menu. - (control_deactivate): Updated accordingly. - -2000-08-09 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/addressbook.c, gui/minicard/e-minicard.c: Changed - e_popup_menu_run call to match the new arguments. - - * gui/component/addressbook.oafinfo: Fixed this file to work - properly. - - * gui/minicard/e-minicard-control.c: Use the correct oafinfo ID - here. Also cleaned up the code a bit with the help of Michael - Meeks. - -2000-08-08 Chris Toshok <toshok@helixcode.com> - - * gui/component/e-addressbook-model.c (e_addressbook_model_init): - use x-evolution-any-field. - - * gui/component/addressbook.c (search_entry_activated): use - x-evolution-any-field. - (change_view_type): same. - - * gui/minicard/e-minicard-view.c (e_minicard_view_init): set query - to x-evolution-any-field. - - * backend/pas/pas-backend-ldap.c (func_contains): support - x-evolution-any-field for matching any evolution supported field. - - * backend/pas/pas-backend-file.c (compare_email): switch to using - ECardSimple calls. - (compare_phone): same. - (compare_address): same. - (entry_compare): switch to using ECardSimple calls, and support a - 'x-evolution-any-field' wildcard field. - (vcard_matches_search): use an ECardSimple. - -2000-08-07 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor.c: Removed the next and prev - toolbar buttons since they don't do anything. - -2000-08-07 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/contact-editor.glade, - contact-editor/e-contact-editor.c: Fixed the tab order to not - repeat the web page address field. - -2000-08-07 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor.c: Fixed the tab order for this - dialog. - -2000-08-05 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-card-simple.c: Fixed a warning. - - * backend/ebook/e-card.c: Cast to (char *) in - e_card_load_cards_from_file since libversit isn't const correct. - - * backend/pas/pas-backend-file.c: Fixed a warning. - -2000-08-04 Michael Meeks <michael@helixcode.com> - - * gui/component/addressbook.c (control_activate): unref. - - * demo/addressbook.c (control_activate): unref. - -2000-08-02 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor-categories.c, - gui/component/e-addressbook-model.c: Emit "model_pre_change" - signal as appropriate. - -2000-08-02 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/e-addressbook-model.c: Adapted this to supply the - new append_row API of ETableModel. - -2000-07-31 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/addressbook.c: Changed the default set of columns. - -2000-07-29 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/Makefile.am: Added load-gnomecard-addressbook - compilation. - - * backend/ebook/e-card.c, backend/ebook/e-card.h: Added - e_card_load_cards_from_file helper function to load multiple cards - from a single file. - - * backend/ebook/load-gnomecard-addressbook.c: New file to load - vcard files. I think this is the format that gnomecard uses so if - you copy your gnomecard file to gnomecard.vcf and then run this - program in the same directory, it'll copy all your gnome contacts - into evolution. It needs to be changed to take a filename as a - parameter. Some fields (phone and address information, for - example) aren't displayed properly, but are saved. This is new - code, so some other than phone and address may be lost. - -2000-07-28 Ettore Perazzoli <ettore@helixcode.com> - - * backend/pas/Makefile.am: Add `pas-backend-ldap.c' and - `pas-backend-ldap.h' to `EXTRA_DIST' so they get distributed even - if the OpenLDAP support is not enabled. - -2000-07-27 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/load-pine-addressbook.c: Changed the URI to load - to. - -2000-07-26 Christopher James Lahey <clahey@helixcode.com> - - * gui/minicard/e-minicard-widget-test.c: Fixed a warning. - -2000-07-26 Chris Toshok <toshok@helixcode.com> - - * backend/pas/pas-backend-ldap.c (view_destroy): wait to free the - view until we've taken care of freeing its internals. also, close - the ldap connection here. - (pas_backend_ldap_connect): rename p_b_l_ensure_connected to this, - since it's always called when we create a view. - (pas_backend_ldap_build_all_cards_list): open an ldap connection - in this function and close it at the end. - (poll_ldap): make sure to call ldap_unbind to close the view's - connection here. - (pas_backend_ldap_search): call pas_backend_ldap_connect here - - ldap_unbind will either be called from poll_ldap or from - view_destroy. - (pas_backend_ldap_get_vcard): the PASBackendLDAP no longer has an - LDAP*. - -2000-07-26 Chris Toshok <toshok@helixcode.com> - - * backend/pas/pas-backend-ldap.c - (pas_backend_ldap_build_all_cards_list): add support for user settable scope. - (pas_backend_ldap_search): same. - (pas_backend_ldap_load_uri): same. - -2000-07-26 Dan Winship <danw@helixcode.com> - - * gui/component/addressbook.oafinfo: lowercasify the - supported_mime_types - -2000-07-25 Chris Toshok <toshok@helixcode.com> - - * backend/ebook/e-card-types.h: add enum for e-card pilot status. - - * conduit/address-conduit.c: #ifdef out all the archiving code with SUPPORT_ARCHIVING. - (purge): implement correctly - deleting ecards whose pilot status is DELETED. - (set_status): implement. - (set_pilot_id): add gtk_main call here to change commit_card into a synchronous - (delete_all): implement correctly - don't delete the records, just set their status to DELETED. - (local_record_from_ecard): get the current status from the ecard. - - * backend/ebook/e-card.c (e_card_get_vcard): add vcard support for pilot status. - (parse_pilot_status): new function. - (e_card_class_init): add pilot status object arg. - (e_card_set_arg): add pilot status support. - (e_card_get_arg): same. - (e_card_init): initialize pilot_status to 0. - -2000-07-25 Chris Toshok <toshok@helixcode.com> - - * conduit/address-conduit.c: add comment headers to signals that - didn't have any. - -2000-07-25 Chris Toshok <toshok@helixcode.com> - - * conduit/address-conduit.c (start_address_server): use the user's - Contact db. not toshok's. - -2000-07-25 Michael Meeks <michael@helixcode.com> - - * backend/ebook/load-pine-addressbook.c (book_open_cb): check we - opened ok. - -2000-07-25 Seth Alves <alves@hungry.com> - - * ename/Makefile.am (libename_static_la_LDFLAGS): build static - version of the library for address conduit to use - - * backend/ebook/Makefile.am: build a static version of the library - to link into the conduit - -2000-07-25 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-card.c: Added a #define for - "X-EVOLUTION-PILOTID". Added a parse_pilot_id to read pilot id's - in properly from VCards. Rearranged some field orders. Added a - get_arg case for ARG_PILOTID. Initialize pilot_id field to 0. - -2000-07-24 Chris Toshok <toshok@helixcode.com> - - * backend/ebook/e-card.h: add pilot_id. - - * backend/ebook/e-card.c (e_card_get_vcard): add support for - X-EVOLUTION-PILOTD vcard field. - (e_card_class_init): add pilot_id arg. - (e_card_set_arg): handle pilot_id arg. - -2000-07-23 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-book-view-listener.c: Remove the idle handler - when we're destroyed. - - * printing/e-contact-print.c: Fixed the spacing on the card - header. - -2000-07-20 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/addressbook.oafinfo: Fixed the oaf info. - - * gui/minicard/.cvsignore, gui/minicard/Makefile.am, - gui/minicard/e-minicard-widget-test.c: Added a test for the - minicard widget. - - * gui/minicard/e-minicard-control.c: Fixed the mime type. - - * gui/minicard/e-minicard.c: Fixed some crashes if your parent - isn't a minicard view. - - * gui/minicard/e-minicard-control.oafinfo: Removed. - -2000-07-20 Ettore Perazzoli <ettore@helixcode.com> - - * gui/component/addressbook-component.c (factory_fn): Update for - the new `evolution_shell_component_new()'. - -2000-07-19 Fatih Demir <kabalak@gmx.net> - - * conduit/address-conduit-control-applet.desktop: - Added the Turkish desktop entry. - -2000-07-18 Christopher James Lahey <clahey@helixcode.com> - - * gui/minicard/e-minicard-control.c: Added "text/vCard" to the - list of mime types we support. - -2000-07-18 Christopher James Lahey <clahey@helixcode.com> - - * gui/minicard/Makefile.am: Added - gui/minicard/e-minicard-control.c, - gui/minicard/e-minicard-control.h, - gui/minicard/e-minicard-widget.c, and - gui/minicard/e-minicard-widget.h. - - * gui/minicard/e-minicard-control.c, - gui/minicard/e-minicard-control.h, - gui/minicard/e-minicard-widget.c, - gui/minicard/e-minicard-widget.h: Got these to compile. - - * gui/minicard/e-minicard-control.gnorba, - gui/minicard/e-minicard-control.oafinfo: Copied directly from - bonobo-clock-control. These aren't done yet. - -2000-07-18 Christopher James Lahey <clahey@helixcode.com> - - * gui/minicard/e-minicard-control.c, - gui/minicard/e-minicard-control.h, - gui/minicard/e-minicard-widget.c, - gui/minicard/e-minicard-widget.h: New files for using a minicard - as a widget or a bonobo control. - -2000-07-14 Chris Toshok <toshok@helixcode.com> - - * gui/component/e-ldap-storage.c (ldap_server_foreach): duh. - don't save the port in the host slot either. - -2000-07-13 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor-confirm-delete.glade, - contact-editor/e-contact-editor-confirm-delete.glade.h: Added - these. - -2000-07-13 Christopher James Lahey <clahey@helixcode.com> - - * Makefile.am: Switched the order of compilation of printing and - contact-editor. - - * contact-editor/Makefile.am: Added printing libraries and a - confirm delete dialog glade file. - - * contact-editor/e-contact-editor.c, - contact-editor/e-contact-editor.h: Enabled the delete and print - functions as well as providing a confirm delete dialog to the - outside world. - - * gui/component/addressbook.c: Made the delete button on new cards - active. - - * gui/minicard/Makefile.am: Added printing libraries to a number - of test programs. - - * gui/minicard/e-minicard.c: Added print and delete to the right - click menu. Made the delete button on the card editor active. - - * printing/e-contact-print.c, printing/e-contact-print.h: Added a - function to print a single card. - -2000-07-12 Chris Toshok <toshok@helixcode.com> - - * gui/component/e-ldap-storage.c (ldap_server_foreach): oops. fix - typo that was saving the port in the rootdn spot. - (save_ldap_data): make this a bit safer - writing to a new file - and renaming it. - (load_ldap_data): make this a bit smarter - if parsing the - ldapservers.xml file fails and there's a .new file there, - rename it. - -2000-07-12 Christopher James Lahey <clahey@helixcode.com> - - * backend/pas/pas-backend-file.c: Do case insensitive compares. - - * addressbook/gui/component/addressbook.c: Make quick search - search both name and company name. - -2000-07-12 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor.c: Add icons to the toolbars. - -2000-07-12 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/Makefile.am: Added installation of arrow.png. - - * contact-editor/e-contact-editor.c: Use EVOLUTIONDIR #define. - -2000-07-11 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/addressbook.c: Removed an unused function - -2000-07-10 Dan Winship <danw@helixcode.com> - - * gui/component/select-names/Makefile.am (EXTRA_DIST): add idl - file to EXTRA_DIST - -2000-07-10 Ettore Perazzoli <ettore@helixcode.com> - - * gui/component/addressbook.c (control_activate): Remove the - SelectNames test. - -2000-07-10 Peter Williams <peterw@curious-george.helixcode.com> - - * gui/component/select-names/e-select-names-model.c: (Clahey's fix) - Make multiple addresses be concatenated correctly. - -2000-07-09 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/addressbook.c, - gui/component/select-names/e-select-names.c, - gui/component/select-names/e-select-names.h: Switched from ETable - to ETableScrolled. - - * addressbook/gui/minicard/e-minicard.c: Don't display mailer or - "name or org" fields. - -2000-07-09 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h: - Added a field that gives the name if it exists and the company - name otherwise. - - * gui/component/e-addressbook-model.c: Formatting changes. - - * gui/component/select-names/e-select-names-table-model.c: Added - stripping of names and display of company name if name doesn't - exist. - - * gui/component/select-names/e-select-names.c: Fixed up the - display so that we display both name and email address. - -2000-07-09 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/select-names/e-select-names-model.c: Fixed a small - off by one error that was causing an extra character to get - deleted sometimes. - -2000-07-09 Anders Carlsson <andersca@gnu.org> - - * gui/minicard/test-reflow.c (allocate_callback): Fix off by one bug with - scroll region setting. - (resize): Likewise. - (main): Put the contacts list in an EScrolledFrame instead of using a - separate GtkScrollbar. - - * gui/minicard/e-reflow.c (e_reflow_event): Don't change mouse cursor and - don't allow drags on dividers that aren't visible. - - * gui/component/addressbook.c (allocate_callback): Fix off by one bug with - scroll region setting. - (resize): Likewise. - (create_minicard_view): Put the contacts list in an EScrolledFrame instead of - using a separate GtkScrollbar. - -2000-07-09 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/addressbook.c: Removed unused do_nothing_cb - function. - - * gui/component/select-names/e-select-names-manager.c, - gui/component/select-names/e-select-names-manager.h: Made the OK - and Cancel buttons in the ESelectNames dialog we create work - properly. - - * gui/component/select-names/e-select-names-model.c, - gui/component/select-names/e-select-names-model.h: Added - e_select_names_model_duplicate. - - * gui/component/select-names/e-select-names-text-model.c: Made the - text be set correctly if there's already data in the source when - the text model is created. - - * gui/component/select-names/e-select-names.c, - gui/component/select-names/e-select-names.h: Removed handling of - the buttons (the user of this dialog will have to handle them.) - Added e_select_names_get_source. Fixed some typos. - -2000-07-09 Not Zed <NotZed@HelixCode.com> - - * gui/component/addressbook.c: Link the toolbar print button to - the print callback. - -2000-07-08 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/select-names/e-select-names.c - (e_select_names_clicked): Hitting OK or Cancel at least closes the - dialog now. - -2000-07-08 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/select-names/e-select-names-manager.c - (e_select_names_manager_create_entry): Set the returned entry to - use the ellipsis. - -2000-07-08 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/addressbook-factory.c: Include - e-select-names-factory.h. - - * gui/component/select-names/e-select-names-model.c: Handle a NULL - iterator properly in the replace function. - - * gui/component/select-names/e-select-names-table-model.c: Fill in - info properly in the value_at function. - - * gui/component/select-names/e-select-names-text-model.c: Don't - strlen a NULL text object. - - * gui/component/select-names/e-select-names.c: Close if the person - hits ok or cancel (doesn't yet actually undo changes if Cancel is - hit.) Handle removing addresses when they're double clicked on. - - * gui/component/select-names/select-names.glade, - gui/component/select-names/select-names.glade.h: Hid some unused - fields and changed the text at the top of the dialog. - -2000-07-08 Jeffrey Stedfast <fejj@helixcode.com> - - * gui/component/select-names/.cvsignore: Ignore dynamically - created source files - -2000-07-08 Ettore Perazzoli <ettore@helixcode.com> - - * gui/component/select-names/e-select-names-bonobo.c - (entry_get_property_fn): New function to set the properties. - -2000-07-08 Ettore Perazzoli <ettore@helixcode.com> - - * gui/component/addressbook-factory.c (main): Start up the factory - for `Evolution::Addressbook::SelectNames'. - - * gui/component/select-names/evolution-addressbook-select-names.oafinfo: - New. - - * gui/component/select-names/e-select-names-factory.c: New. - * gui/component/select-names/e-select-names-factory.h: New. - - * gui/component/select-names/e-select-names-bonobo.c: New. - * gui/component/select-names/e-select-names-bonobo.h: New. - - * gui/component/addressbook-factory.c (main): Call - `e_select_names_factory_init()'. - - * gui/component/select-names/e-select-names-manager.c - (e_select_names_manager_add_section): Made const-aware. - (e_select_names_manager_create_entry): Made const-aware. - (e_select_names_manager_activate_dialog): Made const-aware. - - * gui/component/select-names/Evolution-Addressbook-SelectNames.idl: - New. - -2000-07-08 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/e-addressbook-model.c, - gui/component/e-addressbook-model.h: Added an "editable" argument. - - * gui/component/select-names/e-select-names.c: Set our - EAddressModel to not be editable. - -2000-07-07 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/select-names/e-select-names.c: Changed to line - mode. - -2000-07-07 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/select-names/e-select-names-manager.c, - gui/component/select-names/e-select-names-model.c: Implemented the - get_cards function. - - * gui/component/select-names/e-select-names.c: Implemented adding - cards through the interface. - -2000-07-07 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/select-names/e-select-names-manager.c: Make the - entry widgets we create editable. - - * gui/component/select-names/e-select-names-model.c: Use - e_strsplit instead of g_strsplit. Fixed an off by 1 error. - - * gui/component/select-names/e-select-names-table-model.c: When - the model changes, send a model changed signal. - - * gui/component/select-names/e-select-names-text-model.c: Made - changing this work correctly if it's empty. Made change signals - propagate properly. Is a bit better about freeing iterators when - done. - - * gui/component/select-names/e-select-names.c: Made the finished - lists be in order instead of being sorted. - -2000-07-07 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/addressbook.c (new_server_cb): Since - ELDAPServer->port is a char *, allocate a string with the number - 389 contained. - - * gui/component/addressbook.c: Make the select names test test the - new code instead of the old way of getting to an ESelectNames - dialog. - - * gui/component/select-names/e-select-names-manager.c: Coded - storing the model for each section, creating an entry and - returning it, and for activating the dialog. Wrote a bit of the - get_cards code, but not all of it. - - * gui/component/select-names/e-select-names-model.c, - gui/component/select-names/e-select-names-model.h: Coded all of - the code needed to make ESelectNamesTextModel work (it doesn't - yet, but all the code should be there.) Removed - E_SELECT_NAMES_MODEL_DATA_TYPE_SEPARATION_MATERIAL. - - * gui/component/select-names/e-select-names-table-model.c, - gui/component/select-names/e-select-names-text-model.c: Changed - these to compensate for removal of - E_SELECT_NAMES_MODEL_DATA_TYPE_SEPARATION_MATERIAL. - - * gui/component/select-names/e-select-names-table-model.h, - gui/component/select-names/e-select-names-text-model.h: Fixed some - silly typos. - - * gui/component/select-names/e-select-names.c, - gui/component/select-names/e-select-names.h: Added a parameter to - add_section that lets you specify the source ESelectNamesModel. - -2000-07-06 Chris Toshok <toshok@helixcode.com> - - * gui/component/e-ldap-storage.h: add scope to ELDAPServer, and - make port a string. - - * gui/component/e-ldap-storage.c (load_ldap_data): don't load a - uri, load all the bits and pieces and build up the uri when - creating the folder, according to the openldap url format. - (ldap_server_foreach): store out each of the individual uri - pieces. - (e_ldap_storage_remove_server): free the new fields. - (get_string_value): if the text is empty, return the empty string - instead of NULL. - - * gui/component/e-ldap-server-dialog.c (extract_server_info): port is a string now. - (fill_in_server_info): port is a string now. - -2000-07-06 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor.c: Changed "FIXME: Save and - Close" to "Save and Close". Removed some toolbar items that will - never be used. - - * gui/component/select-names/e-select-names-model.c, - gui/component/select-names/e-select-names-model.h: Added functions - to allow you to modify the model (not implemented yet.) - - * gui/component/select-names/e-select-names-table-model.c, - gui/component/select-names/e-select-names-table-model.h: Finished - this. Doesn't support changing the model at all. - - * gui/component/select-names/e-select-names-text-model.c: Finished - this. Changing the model by typing is done, but doesn't work - since none of the functions in the base model are implemented. - -2000-07-05 Chris Toshok <toshok@helixcode.com> - - * gui/component/addressbook.c (new_server_cb): call - e_ldap_storage_add_server call. - - * gui/component/ldap-server-dialog.glade: add name row. - - * gui/component/e-ldap-server-dialog.h: remove the ELDAPServer type. - - * gui/component/e-ldap-server-dialog.c (extract_server_info): add - support for the name-entry. - - * gui/component/e-ldap-server-dialog.c (fill_in_server_info): same. - - * gui/component/e-ldap-storage.h: add ELDAPServer type, and add - prototypes for e_ldap_storage_add_server and - e_ldap_storage_remove_server. - - * gui/component/e-ldap-storage.c (e_ldap_storage_add_server): new - function, add it to our hash table, add a shell folder, and save - out the metadata. - (ldap_server_foreach): add the ldap server info under a - "contactserver" node. - (setup_ldap_storage): create our hashtable. - -2000-07-05 Chris Toshok <toshok@helixcode.com> - - * gui/component/addressbook.c (set_prop): remove hack to read - "uri" file from local directory. - - * gui/component/Makefile.am (evolution_addressbook_SOURCES): add - e-ldap-storage.{c,h} - - * gui/component/addressbook-component.c (owner_set_cb): call - setup_ldap_storage. - - * gui/component/e-ldap-storage.c (setup_ldap_storage): Register - the LDAP storage and load the .xml file. - (load_ldap_data): function to load our xml file. - (save_ldap_data): function to save our xml file. - - * gui/component/e-ldap-storage.h: new file. - -2000-07-03 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/select-names/e-select-names-manager.c, - gui/component/select-names/e-select-names-text-model.c, - gui/component/select-names/e-select-names.c: Fixed more compile - errors. - -2000-07-03 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/select-names/Makefile.am: Fixed compile error. - -2000-07-03 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/Makefile.am: Removed e-card-iterator.c, - e-card-iterator.h, e-card-list-iterator.c, e-card-list-iterator.h, - e-card-list.c, e-card-list.h. - - * backend/ebook/e-card-iterator.c, - backend/ebook/e-card-iterator.h, - backend/ebook/e-card-list-iterator.c, - backend/ebook/e-card-list-iterator.h, backend/ebook/e-card-list.c, - backend/ebook/e-card-list.h: Removed in favor or versions without - the -card in the e-util directory since these classes are not - specific to cards at all. - - * backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h, - backend/ebook/e-card.c, backend/ebook/e-card.h, - backend/ebook/load-pine-addressbook.c, backend/ebook/test-card.c, - backend/pas/pas-backend-file.c: Changed the references to - e-card-list.c and friends to e-list.c and friends. - - * contact-editor/e-contact-editor.c: Added #include - <e-contact-save-as.h> to fix a warning. - - * gui/component/Makefile.am: Moved a number of classes associated - with the select-names object to the new select-names directory. - - * gui/component/addressbook.c: Changed the reference to - e-select-names.h. - - * gui/component/e-select-names.c, gui/component/e-select-names.h, - gui/component/select-names.glade, - gui/component/select-names.glade.h: Moved these files into - select-names/. - - * gui/component/select-names/.cvsignore, - gui/component/select-names/Makefile.am, - gui/component/select-names/e-select-names-manager.c, - gui/component/select-names/e-select-names-manager.h, - gui/component/select-names/e-select-names-model.c, - gui/component/select-names/e-select-names-model.h, - gui/component/select-names/e-select-names-table-model.c, - gui/component/select-names/e-select-names-table-model.h, - gui/component/select-names/e-select-names-text-model.c, - gui/component/select-names/e-select-names-text-model.h, - gui/component/select-names/e-select-names.c, - gui/component/select-names/e-select-names.h, - gui/component/select-names/recipient.glade, - gui/component/select-names/select-names.glade, - gui/component/select-names/select-names.glade.h: New files for - select names dialog (e-select-names.c, e-select-names.h, - select-names.glade, select-names.glade.h and recipient.glade moved - from gui/component/.) - -2000-06-29 Ettore Perazzoli <ettore@helixcode.com> - - * gui/component/addressbook-component.c (owner_set_cb): Get an - EvolutionShellClient instead of an Evolution_Shell to match the - changes in libeshell. - -2000-06-28 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/select-names/, - gui/component/select-names/e-select-names-manager.c, - gui/component/select-names/e-select-names-manager.h: New select - names manager interface (Not complete.) - -2000-06-26 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor-categories.c, - addressbook/gui/component/e-cardlist-model.c: Added - value_to_string handlers. - - * demo/addressbook-widget.c, demo/demo.c: Removed usage of "x" and - "y" arguments. - - * addressbook/gui/component/addressbook.c: Activated Click To Add - and set the click to add message. - - * addressbook/gui/component/e-addressbook-model.c: Added - value_to_string and append_row handlers. - - * addressbook/gui/component/e-select-names.c: Added a column. - -2000-06-26 Chris Toshok <toshok@helixcode.com> - - * backend/pas/pas-backend-ldap.c (poll_ldap): remove spew. - (pas_backend_ldap_ensure_connected): duh, don't access a pointer - we know to be NULL. - (query_prop_to_ldap): rename map_e_card_prop_to_ldap to this. - easier to type. - -2000-06-21 Christopher James Lahey <clahey@helixcode.com> - - * gui/minicard/test-minicard-label.c, - gui/minicard/test-minicard.c, gui/minicard/test-reflow.c: Remove - usage of "x" and "y" arguments. - -2000-06-18 <ettore@helixcode.com> - - * contact-editor/Makefile.am (INCLUDES): Use - `$(BONOBO_GNOME_CFLAGS)' so that we compile when Bonobo is not in - the default GNOME prefix. - -2000-06-17 Christopher James Lahey <clahey@helixcode.com> - - * gui/minicard/e-minicard-label.c, - gui/minicard/e-minicard-label.h, gui/minicard/e-minicard.c: Made - the left column of minicards not get any wider than the widest - possible name. - -2000-06-13 Ettore Perazzoli <ettore@helixcode.com> - - * gui/component/Makefile.am (SHELL_OBJS): Removed. - (evolution_addressbook_LDADD): Link with - `$(top_builddir)/shell/libeshell.a'. - -2000-06-12 Federico Mena Quintero <federico@helixcode.com> - - * contact-editor/e-contact-editor-categories.c: Removed the - ETableModel thaw handler. - * gui/component/e-cardlist-model.c: Likewise. - -2000-06-11 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/e-select-names.c: Fixed the widget reparenting. - -2000-06-11 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/Makefile.am: Added glade files. - - * gui/component/addressbook.c: Added a test of the Select Names - functionality. - - * gui/component/e-addressbook-model.c: Made this class_init - function a bit cleaner. - - * gui/component/e-select-names.c: Tested this and fixed some - obvious errors. - - * gui/component/select-names.glade: The main window shouldn't be - visible by default. - -2000-06-11 Ettore Perazzoli <ettore@helixcode.com> - - * contact-editor/Makefile.am (contact_editor_test_LDADD): Link - with libemiscwidgets.a. - * gui/component/Makefile.am (evolution_addressbook_LDADD): Likewise. - * gui/minicard/Makefile.am (minicard_test_LDADD): Likewise. - (reflow_test_LDADD): Likewise. - (minicard_view_test_LDADD): Likewise. - -2000-06-10 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/e-cardlist-model.c: Renamed a bunch of functions - for better readability. - - * gui/component/e-select-names.c, gui/component/e-select-names.h: - This should be a working dialog now. - - * gui/component/select-names.glade: Changed the name & creation - function of the ETable here. - -2000-06-10 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/select-names.glade, - gui/component/select-names.glade.h: Glade files for Select Names - dialog. - -2000-06-10 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor.c: Do e_card_simple_sync and - extract_info more often. - - * gui/component/addressbook.c: Added table printing code. - -2000-06-09 Ettore Perazzoli <ettore@helixcode.com> - - * gui/component/addressbook-component.c (factory_fn): Pass NULL - for the new args @create_folder_fn and @remove_folder_fn. - -2000-06-08 Ettore Perazzoli <ettore@helixcode.com> - - * gui/component/addressbook-component.c (create_view): Updated for - the new `EvolutionShellComponentCreateViewFn'. Return - `EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE' if @type is not - "contacts". - -2000-06-08 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor.c: Bind Save As to save the - current view of the contact as a vcard. - -2000-06-08 Federico Mena Quintero <federico@helixcode.com> - - * contact-editor/e-contact-editor.c (save_card): Doh, sync the - card simple and extract the card info. - -2000-06-08 Federico Mena Quintero <federico@helixcode.com> - - * contact-editor/e-contact-editor.h (EContactEditor): Now this - derives from GtkObject. It follows the same strategy as the - EventEditor in the calendar. - (EContactEditor): Added an is_new_card field so that we can know - whether to add() or commit() the card. - - * contact-editor/e-contact-editor.c (e_contact_editor_get_type): - Derive from GtkObject. - (e_contact_editor_class_init): Likewise. - (e_contact_editor_class_init): Added an "is_new_card" argument. - (e_contact_editor_set_arg): Handle ARG_IS_NEW_CARD. - (e_contact_editor_get_arg): Likewise. - (e_contact_editor_new): Take in an is_new_arg argument and set it - on the object. - (e_contact_editor_init): Load the app widget into the app field of - the EContactEditor structure. Create its UIHandler as well. - (e_contact_editor_class_init): New "add_card", "commit_card", and - "editor_closed" signals. - - * contact-editor/test-editor.c (main): Modified for the new API. - (editor_closed_cb): Tweaked for the new API. - Since this test program does not use Bonobo, it doesn't work, - though. - - * gui/component/addressbook.c (new_contact_cb): Use the new - contact editor API. - (table_double_click): Ditto. - - * gui/minicard/e-minicard-view.c (e_minicard_view_event): Use the - new contact editor API. - - * gui/minicard/e-minicard.c (e_minicard_event): Use the new - contact editor API. - -2000-06-08 Ettore Perazzoli <ettore@helixcode.com> - - * contact-editor/Makefile.am (contact_editor_test_LDADD): Remove - the `$(srcdir)/' prefix from `libecontacteditor.a' because [of - course] the library is built in the build directory, not in the - source directory. - * gui/minicard/Makefile.am (minicard_test_LDADD): Likewise with - `libeminicard.a'. - (minicard_label_test_LDADD): Likewise. - (reflow_test_LDADD): Likewise. - (minicard_view_test_LDADD): Likewise. - -2000-06-06 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/addressbook.c: Bind right click on the ETable to - "Save to VCard." - -2000-06-02 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor.c: Made phone/email/address - labels change correctly again. - -2000-06-02 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/addressbook-component.c: Made - evolution-addressbook shut down when the shell is done with it. - -2000-06-02 Christopher James Lahey <clahey@helixcode.com> - - * gui/minicard/e-minicard-view.c, gui/minicard/e-minicard.c: Made - double click only work on the first button. - -2000-06-01 Christopher James Lahey <clahey@helixcode.com> - - * gui/minicard/e-minicard.c: return TRUE if opening a contact - editor so that we don't get a "new dialog" contact editor. - -2000-06-01 Ettore Perazzoli <ettore@helixcode.com> - - * gui/component/addressbook.c (new_contact_cb): Use the stock - cancel button for the dialog. - (table_double_click): Likewise. - (find_contact_cb): Likewise. - -2000-05-31 Miguel de Icaza <miguel@helixcode.com> - - * contact-editor/contact-editor.glade: Added accelerators for - the remaining items. - - Add spacing, beautify the dialogs. - -2000-06-01 Ettore Perazzoli <ettore@helixcode.com> - - * gui/component/addressbook.c (control_activate): Put the toolbar - into a frame to make it look like standard GNOME toolbars. Also, - set `GNOME_DOCK_ITEM_BEH_NEVER_VERTICAL' so that it does not do - evil things when its moved to the left or the right of the window. - -2000-05-30 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/e-cardlist-model.c, - gui/component/e-cardlist-model.h: New files for card list. - -2000-05-30 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/addressbook.c: Fixed a memory leak. - -2000-05-30 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/alphabet.glade: Made the alphabet buttons not - focusable. - - * gui/minicard/e-minicard-view.c: Made the "123" button work. - - * gui/minicard/e-reflow-sorted.c: Made all buttons past the last - letter available work. - -2000-05-30 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/alphabet.glade: Added a bit of space around the - alphabet bar. - -2000-05-30 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/Makefile.am: Added alphabet.glade and - alphabet.glade.h. - - * gui/component/addressbook.c, gui/component/alphabet.glade, - gui/component/alphabet.glade.h: Added an alphabet bar. - - * gui/minicard/e-minicard-view.c, gui/minicard/e-minicard-view.h, - gui/minicard/e-reflow-sorted.c, gui/minicard/e-reflow-sorted.h: - Added the ability to just to a particular spot in the reflow. - -2000-05-30 Christopher James Lahey <clahey@helixcode.com> - - * printing/Makefile.am: Added BONOBO_GNOME_CFLAGS to CPPFLAGS. - -2000-05-30 Christopher James Lahey <clahey@helixcode.com> - - * gui/minicard/e-minicard-view.c: Made double clicking create a - new card. Set the empty message. - - * gui/minicard/e-minicard.c: Made sorting be case insensitive. - - * gui/minicard/e-reflow-sorted.c, e-reflow.c, e-reflow.h: Added a - message for when the reflow is empty. - - * printing/e-contact-print.c, printing/medbook.ecps: Made the - default printout be full page. Made sorting case insensitive. - -2000-05-30 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-book-view-listener.c, - backend/ebook/e-book-view-listener.h, backend/ebook/e-book-view.c, - backend/ebook/e-book-view.h, backend/idl/addressbook.idl, - backend/pas/pas-backend-file.c, backend/pas/pas-backend-ldap.c, - backend/pas/pas-book-factory.c, backend/pas/pas-book-view.c, - backend/pas/pas-book-view.h: Added "sequence_complete" signal. - - * printing/e-contact-print.c: Made printing wait for - "sequence_complete" signal and made it sort. - -2000-05-25 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/addressbook.c, - gui/component/e-addressbook-model.c, - gui/component/e-addressbook-model.h: Added double click to open - contact editor. - -2000-05-25 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/addressbook.c: Removed some columns. - -2000-05-25 Ettore Perazzoli <ettore@helixcode.com> - - * gui/component/addressbook.c (addressbook_factory_new_control): - New function. - (addressbook_factory): Use it. - - * Makefile.am (evolution_addressbook_LDADD): Link with - `evolution-shell-component.o' from the shell directory. - - * gui/component/addressbook-component.c: New. - * gui/component/addressbook-component.h: New. - -2000-05-23 Christopher James Lahey <clahey@helixcode.com> - - * Makefile.am: Switched printing and gui. - - * backend/ebook/e-book-view-listener.h, - backend/ebook/e-book-view.h, backend/ebook/e-book.h, - backend/ebook/e-card-cursor.h, backend/ebook/e-card-list.h, - backend/ebook/e-card-simple.h, backend/ebook/e-card.h: Fixed the - #defines to work elsewhere in evolution. - - * gui/component/Makefile.am: Added linking to libecontactprint. - - * gui/component/addressbook.c: Added a menu item to print the - current query. - - * printing/Makefile.am: Add linking to libebook and requirements. - Add installation of ecps files. - - * printing/e-contact-print.c, printing/e-contact-print.h: Changed - this to use real data from an EBook. - - * printing/test-print.c: Made this pass NULL, NULL to - e_contact_print_dialog_new so that it will compile. - -2000-05-23 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-save-as.c: Fixed some memory leaks. - -2000-05-23 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/Makefile.am: Added e-contact-editor-save-as.c and - e-contact-editor-save-as.h. - - * contact-editor/e-contact-save-as.c, - contact-editor/e-contact-save-as.h: New files that display a save - as dialog and then save the given card to that file. - - * gui/minicard/e-minicard.c: Call e_contact_save_as in a right - click menu. - -2000-05-19 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor-categories.c, - gui/component/e-addressbook-model.c: Added initialize_value and - value_is_empty callbacks. - -2000-05-19 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor.c: Fixed a bug that broke - address field support. - -2000-05-19 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor.c, - contact-editor/e-contact-editor.h: Added support for arbitrary - fields in the contact editor. - -2000-05-18 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-card.c: Fixed e_card_name_copy and - e_card_arbitrary_copy to deal correctly with a passed NULL. - - * contact-editor/Makefile.am: Removed imagesdir stuff. - - * contact-editor/arrow.png: Made this transparent. - - * contact-editor/contact-editor.glade, - contact-editor/e-contact-editor-strings.h: Renamed some widgets - and added custom widgets for all of the images. - - * contact-editor/e-contact-editor.c: Worked on making this work - decently well with messed up glade files. Cleaned up a lot of code. - -2000-05-18 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-card.c: Fixed the code to write out and read in - arbitrary fields. - -2000-05-18 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h, - backend/ebook/e-card-types.h, backend/ebook/e-card.c, - backend/ebook/e-card.h: Implemented "MAILER" field. Added - arbitrary field support. - - * contact-editor/e-contact-editor-categories.c: Fixed a warning. - -2000-05-16 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h: - Added E_CARD_SIMPLE_FIELD_MAILER. Not implemented yet. - -2000-05-16 Chris Toshok <toshok@helixcode.com> - - * backend/pas/pas-backend-ldap.c (construct_email_list): convert to use ECardSimple. - (poll_ldap): same. - -2000-05-16 Chris Toshok <toshok@helixcode.com> - - * backend/pas/pas-book.h: add typedefs for the can_write - functions, and add parameters to pas_book_new. - - * backend/pas/pas-book.c (pas_book_construct): add can_write/can_write_card params. - (pas_book_new): same. - (impl_Evolution_Book_can_write): new function. - (impl_Evolution_Book_can_write_card): same. - (pas_book_get_epv): assign the can_write/can_write_card slots in the epv. - - * backend/pas/pas-backend-ldap.c (pas_backend_ldap_can_write): new function. - (pas_backend_ldap_can_write_card): same. - (pas_backend_ldap_add_client): add can_write/can_write_card to pas_book_new call. - - * backend/pas/pas-backend-file.c (pas_backend_file_can_write_card): new function, calls can_write. - (pas_backend_file_can_write): same. - (can_write): return TRUE if we can write to the addressbook file. - (pas_backend_file_add_client): add can_write/can_write_card to pas_book_new call. - - * backend/idl/addressbook.idl (Evolution): add can_write and - can_write_card permission requests. - -2000-05-16 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-card.c (e_card_get_vcard): Fixed a large memory leak. - -2000-05-16 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-card.c (add_list_unique): Fixed another memory - leak. - -2000-05-16 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-card-simple.c, backend/pas/pas-backend-file.c, - contact-editor/e-contact-editor.c, ename/e-name-western.c, - gui/component/addressbook.c, gui/minicard/e-minicard-view.c: Fixed - some memory leaks. - - * backend/ebook/e-card.c: Rearranged some code. - -2000-05-16 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor-categories.c: Fixed a reference - leak. - -2000-05-16 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor-categories.c: Fixed a compile - error. - -2000-05-16 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor-categories.c: Got rid of a - memory leak. Rearranged a couple functions. - - * gui/minicard/e-minicard-view.c, gui/minicard/e-minicard-view.h: - Added some code to stop watching the EBook when the canvas is - destroyed (apparently the canvas is destroyed before our widget is - destroyed.) - -2000-05-14 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor-categories.c: Use the correct - policy for resize. - -2000-05-14 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/Makefile.am: Added libeutil for e-card's support - for categories. - - * backend/ebook/e-card-list.c, backend/ebook/e-card-list.h: Added - a function to get the length. - - * backend/ebook/e-card.c, backend/ebook/e-card.h: Added categories - support (accessible either as "categories" or "category_list".) - - * contact-editor/Makefile.am: Added e-table and all of the - categories files. - - * contact-editor/categories.glade, - contact-editor/categories-strings.h, - contact-editor/e-contact-editor-categories.c, - contact-editor/e-contact-editor-categories.h: - - * contact-editor/contact-editor.glade, - contact-editor/e-contact-editor-strings.h: Rearranged this dialog. - - * contact-editor/e-contact-editor.c: Rearranged dialog a bit. - Added opening of categories dialog. - - * gui/component/Makefile.am: Rearranged libraries so that - libetable would be available for the contact editor categories - dialog. - - * gui/component/addressbook.c: Fix for new ETable resizing. Make - contact editor dialog resizable. - - * gui/minicard/Makefile.am: Added libetable contact editor - categories dialog. - - * gui/minicard/e-minicard.c: Make contact editor dialog resizable. - -2000-05-12 Miguel de Icaza <miguel@gnu.org> - - * contact-editor/fulname.glade: Use accelerators here. - -2000-05-13 Valek Filippov <frob@df.ru> - - * gui/component/ldap-server-dialog.glade: save translatable strings - * gui/component/ldap-server-dialog.glade.h: file with strings - * printing/e-contact-print.glade: save translatable strings - * printing/e-contact-print.glade.h: file with strings - -2000-05-11 Dan Winship <danw@helixcode.com> - - * gui/component/addressbook.c (control_activate): Now that we - depend on recent gnome-libs we can make the toolbar detachable - again. - -2000-05-10 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/addressbook.c: Make the table view be sorted by - name initially. - -2000-05-10 Christopher James Lahey <clahey@helixcode.com> - - * backend/pas/pas-book-factory.c: Send a proper response when you - can't find the ldap URI. - - * gui/component/addressbook.c: Cleaned up the open error dialog a - bit. - -2000-05-10 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/addressbook.c: Added a dialog for when you can't - open an addressbook. - -2000-05-10 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/Makefile.am: Added e-book-types.h, e-card-pairs.h, - e-card-types.h. - - * backend/pas/Makefile.am: Added pas-backend-ldap.h. - - * contact-editor/Makefile.am: Added a proper EXTRA_DIST section. - Removed some old defines. - - * ename/Makefile.am: Added e-name-western-tables.h. - - * gui/component/Makefile.am: Added e-ldap-server-dialog.h. Added - a proper EXTRA_DIST section. - - * gui/minicard/e-reflow.c: Added a missed cast. - - * printing/Makefile.am: Added a proper EXTRA_DIST section. - -2000-05-09 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor.c: Make sure that the canvas - doesn't intercept keyboard focus. - -2000-05-09 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor.c: Use new art. - -2000-05-09 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/contact-editor.glade, - contact-editor/e-contact-editor-strings.h: Replaced the Address - button with a label and rearranged the address area a bit. - -2000-05-09 Christopher James Lahey <clahey@helixcode.com> - - * gui/minicard/e-minicard.c: Reenable editting. - - * gui/minicard/e-reflow-sorted.c: Make reflow flow on deletion. - -2000-05-09 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/addressbook.c: Destroy the view object when - leaving the minicard view. - -2000-05-09 Christopher James Lahey <clahey@helixcode.com> - - * gui/minicard/e-reflow-sorted.c: Fixed reflow sorting to call - reflow_request when sorting on an item changes. - -2000-05-09 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-card-simple.c: Make File As change if name or - company are changed pretty much anywhere. - - * gui/minicard/e-minicard.c: Turned off having minicard editing - effect anything since it's so crashy. - -2000-05-09 Christopher James Lahey <clahey@helixcode.com> - - * backend/pas/pas-backend-ldap.c: Enabled a couple more fields - -2000-05-09 Christopher James Lahey <clahey@helixcode.com> - - * backend/pas/pas-backend-file.c: Added a default card to all new - file backends. - -2000-05-09 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/e-addressbook-model.c: Rearranged order of things - getting destroyed. - - * gui/minicard/e-minicard-view.c: Rearranged order of things - getting destroyed. Don't set attributes of non-null or destroyed - items. Destroy parent object when destroyed. Maintain ref_count - of items in list. - - * gui/minicard/e-minicard.c: Don't set attributes of non-null - items. - - * gui/minicard/e-reflow-sorted.c: Maintain ref_count of items in - list. - - * gui/minicard/e-reflow.c: Maintain ref_count of items in list. - Destroy parent object when destroyed. - -2000-05-09 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-card-simple.c: Fixed some indentation. - - * contact-editor/contact-editor.glade, - contact-editor/e-contact-editor-strings.h: Changed Email to - Primary Email. - - * contact-editor/e-contact-editor.c: Added checkmarks to indicate - if data exists in the pull down menus for the phone, address, and - email fields. - -2000-05-09 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-card-simple.c: Fixed the string duplication - problem. Fixed the business/home address string mix up. - - * gui/component/addressbook.c: Made the minicard view the default - view. - -2000-05-08 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-card-simple.c: Fixed this up a bit. Syncing - should work better now. - -2000-05-08 Christopher James Lahey <clahey@helixcode.com> - - * gui/minicard/e-minicard-view.c, gui/minicard/e-minicard.c, - gui/minicard/e-minicard.h, gui/minicard/e-reflow-sorted.c, - gui/minicard/e-reflow-sorted.h: Made a minimal number of things be - destroyed and recreated when updating a field. - -2000-05-07 <toshok@the-dot-in.helixcode.com> - - * gui/minicard/e-minicard.c (remodel): make sure to free the - return value of e_card_simple_get. - - * gui/component/addressbook.c (teardown_table_view): destroy the - ECardSimple here, plug memory leak. - (create_table_view): use view->simple so we can destroy the - ECardSimple later on. - -2000-05-07 Chris Toshok <toshok@helixcode.com> - - * ename/e-name-western.c (e_name_western_extract_middle): comment - function, and fix an ABR. - -2000-05-07 Chris Toshok <toshok@helixcode.com> - - * ename/e-name-western.c (e_name_western_cleanup_string): comment - function, and fix an ABR. - -2000-05-08 Christopher James Lahey <clahey@helixcode.com> - - * gui/minicard/e-minicard.c: Added saving in minicard view. - -2000-05-07 Christopher James Lahey <clahey@helixcode.com> - - * backend/pas/pas-backend-file.c: Fixed an off by 2 error. - -2000-05-07 Chris Toshok <toshok@helixcode.com> - - * gui/component/addressbook.c (set_prop): don't create a new - ebook. instead, unload the current uri (if there is one) and load - the new one. - (addressbook_factory): create the ebook once. - -2000-05-07 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/e-addressbook-model.c: Replaced some model_changed - calls with row_inserted calls. - -2000-05-07 Christopher James Lahey <clahey@helixcode.com> - - * backend/pas/pas-backend-file.c, backend/pas/pas-backend-ldap.c: - Removed some code that was notifying too many clients at the wrong - times. - - * gui/component/addressbook.c: Set view->book. Unreffed - view->book. Unreffed the model instead of destroying it. Removed - the /tmp/test.db stuff. - -2000-05-07 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/addressbook.c: Make the addressbook create the - correct file uri. Added a default query. Initialize view->model - and view->view to NULL. - - * gui/component/e-addressbook-model.c, - gui/minicard/e-minicard-view.c: Only call get_book_view if both - book and query and non-null. - -2000-05-06 Chris Toshok <toshok@helixcode.com> - - * gui/component/addressbook.c (control_deactivate): remove the - separator and toggle view items as well. - (toggle_view_as_cb): callback for the "/View/Toggle View" menu - item. - (get_query): getter for the query string that takes into account - the two view types. - (set_query): setter for the query string that takes into account - the two view types. - (set_book): setter for the EBook type - not really a setter, since - the book is kept in the AddressbookView, but this method actually - sets the "book" property on the current view. - (find_contact_cb): make use of get/set_query - (search_entry_activated): make use of set_query. - (control_activate): add a menu separator and an item to toggle - between view types. - (book_open_cb): make use of set_book. - (ebook_create): no longer needs to return the EBook, since we set - the book field in our view. - (teardown_minicard_view): destructor function for the minicard - specific ui. - (create_minicard_view): constructor function for the minicard - specific ui. - (teardown_table_view): destructor function for the e-table - specific ui. - (create_table_view): constructor function for the e-table specific - ui. - (change_view_type): destroy the old and create the new view ui, - change the label of the Toggle View menu item, and reset the book - and query on the new view type. - (addressbook_factory): create an all-encompassing vbox that the - view uses to create the bonobo control, which contains 1 widget - per ui specific view (the e-table in the table case, and another - vbox in the minicard case.) use change_view_type to create the - initial view. - -2000-05-07 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-book.c: Made a NULL callback just mean to not - call back. - - * backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h: - Reordered fields. Added a get_const function to get a constant - string that persists until the simple is destroyed. - - * gui/component/Makefile.am: Added e-addressbook-model.c and - e-addressbook-model.h and all of the libraries and includes that - they are dependent on. - - * gui/component/addressbook-factory.c: Initialize e cursors. - - * gui/component/addressbook.c: Added inactive code to display an - ETable view of the addressbook. - - * gui/component/e-addressbook-model.c, - gui/component/e-addressbook-model.h: New files to implement an - ETable model with a EBook back end. - -2000-05-06 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h: - Mostly finished ECardSimple. - - * contact-editor/e-contact-editor.c: Changed this to match with - some of the changes to ECardSimple. - - * gui/component/addressbook.c: Changed this to look for - "addressbook.db" in the given directory if it doesn't find the - file "uri". - - * gui/minicard/e-minicard.c, gui/minicard/e-minicard.h: Changed - this to use ECardSimple. - -2000-05-06 Chris Toshok <toshok@helixcode.com> - - * gui/component/.cvsignore: ignore evolution-addressbook.pure - - * gui/component/Makefile.am: add support for generating - evolution-addressbook.pure. - -2000-05-06 Chris Toshok <toshok@helixcode.com> - - * backend/pas/pas-backend-ldap.c (pas_backend_ldap_load_uri): if a - port isn't specified in the uri default to 389. - -2000-05-06 Christopher James Lahey <clahey@helixcode.com> - - * gui/component/addressbook.c: Made this take a uri through its - property bag. - -2000-05-05 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/Makefile.am: Added e-card-simple.c and - e-card-simple.h. - - * backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h: - New card wrapper class to simplify things. - - * contact-editor/e-contact-editor.c, - contact-editor/e-contact-editor.h: Changed e-contact-editor to use - ECardSimple a bit. - -2000-05-03 Chris Toshok <toshok@helixcode.com> - - * gui/component/addressbook.c (control_deactivate): #ifdef - HAVE_LDAP the ldap specific stuff. - (null_cb): same. - (control_activate): same. - -2000-05-02 Ettore Perazzoli <ettore@helixcode.com> - - * backend/ebook/Makefile.am (INCLUDES): Add - `-I$(top_srcdir)/addressbook/ename'. - -2000-05-02 Matt Loper <matt@helixcode.com> - - * demo/Makefile.am: set G_LOG_DOMAIN. - * printing/Makefile.am: same. - -2000-05-01 Christopher James Lahey <clahey@helixcode.com> - - * backend/pas/pas-book-factory.c: Add back in the - CORBA_Object_release. - - * backend/pas/pas-book.c: Properly duplicate and release the - listener passed to us. - -2000-05-01 Christopher James Lahey <clahey@helixcode.com> - - * backend/pas/pas-backend-file.c, backend/pas/pas-backend-ldap.c: - Made uri slightly better managed. - - * backend/pas/pas-book-factory.c - (pas_book_factory_process_request): Remove this - CORBA_Object_release that causes things not to work. This is just - a temporary fix until we figure out what's actually wrong. - - * backend/pas/pas-book.c: Fixed a copy and paste error in a warning. - -2000-05-01 Christopher James Lahey <clahey@helixcode.com> - - * Makefile.am: Switched the subdirs order since backend depends on - ename. - -2000-05-01 Larry Ewing <lewing@helixcode.com> - - * backend/pas/pas-backend-ldap.c (pas_backend_ldap_remove_client): - fix a typo in the for loop. - -2000-05-01 Michael Meeks <michael@helixcode.com> - - * backend/pas/pas-book-factory.c: include gtk. - -2000-04-30 Federico Mena Quintero <federico@helixcode.com> - - * backend/ebook/e-book-types.h (EBookStatus): Added new status - values for the IDL stuff. - - * backend/pas/pas-book-factory.h (PASBookFactoryClass): New - "last_book_gone" signal. - - * backend/pas/pas-book-factory.c - (pas_book_factory_launch_backend): Better error handling. - (pas_book_factory_process_queue): Let - pas_book_factory_process_request() free the request. - (pas_book_factory_process_request): Free the request here. - Perform better error handling. - (free_active_server_map_entry): Free an active server map entry; - free the URI key and unref the backend value. This function was - renamed; the old one was trying to CORBA_Object_unref() a GTK+ - object! - (remove_backends_entry): Free a backend table entry; free the URI - key. - (backend_last_client_gone_cb): Remove the backend from the active - server map and emit the "last_book_gone" signal if appropriate. - (pas_book_factory_get_n_backends): New function to query the - number of running backends in an addressbook factory. - - * backend/idl/addressbook.idl (BookListener::CallStatus): Added a - ProtocolNotSupported code. This is for when the addressbook - factory cannot find a provider for the requested URI. - - * backend/pas/pas-backend.h (PASBackendClass): New - "last_client_gone" signal. - (PASBackendClass): New get_uri virtual method. - - * backend/pas/pas-backend.c (pas_backend_load_uri): Return a - gboolean success code. - (pas_backend_add_client): Return a gboolean success code. - (pas_backend_last_client_gone): New function used by backend - implementations to notify upwards when the backend's last client - is destroyed. - (pas_backend_get_uri): New function to get the URI of a backend. - - * backend/pas/pas-backend-file.c (pas_backend_file_add_client): - Pass the backend as the closure data to the "destroy" handler of - the book. We cannot call pas_book_get_backend() in the callback - since the book's private data has already been destroyed when the - callback is invoked. Alternatively, we could move the private - data destruction step to the book's ::finalize() method. - (pas_backend_file_book_destroy_cb): Get the backend from the - callback's data, not from the book. - (pas_backend_file_remove_client): Remove the book from the list of - clients. When all clients go away, call - pas_backend_last_client_gone(). - (PASBackendFilePrivate): Added an uri field. - (pas_backend_file_get_uri): Implement the get_uri method. - (pas_backend_file_load_uri): Return a gboolean success code. - Also, store the URI in the private structure. - (pas_backend_file_add_client): Return a gboolean success code. - Also, call pas_backend_last_client_gone() if appropriate. - (pas_backend_file_destroy): Free the bf->priv->uri. - - * backend/pas/pas-backend-ldap.c (pas_backend_ldap_add_client): - Pass the backend as the closure data to the "destroy" handler of - the book. See above for rationale. - (pas_backend_ldap_book_destroy_cb): Get the backend from the - callback's data. - (pas_backend_ldap_remove_client): Remove the book from the list of - clients. When all clients go away, call - pas_backend_last_client_gone(). - (pas_backend_ldap_load_uri): Return a gboolean success code. - (pas_backend_ldap_add_client): Return a gboolean success code. - Also, call pas_backend_last_client_gone() if appropriate. - (PASBackendLDAPPrivate): New uri field. - (pas_backend_ldap_get_uri): Implement the get_uri method. - (pas_backend_ldap_load_uri): Store the uri in the private - structure. - (pas_backend_ldap_destroy): Free the bl->priv->uri. - -2000-04-30 Chris Toshok <toshok@helixcode.com> - - * gui/component/Makefile.am (evolution_addressbook_SOURCES): added - e-ldap-server-dialog.c - (glade_DATA): added ldap-server-dialog.glade - - * gui/component/ldap-server-dialog.glade: new file. - - * gui/component/e-ldap-server-dialog.h: new file. - - * gui/component/e-ldap-server-dialog.c: new file, contains logic - associated with ldap server dialog. - - * gui/component/addressbook.c (control_deactivate): remove the - directory server menu item. - (null_cb): do nothing callback for e_book_load_uri call. should - change to (at the very least) pop up a dialog if there was an - error. - (new_server_cb): new function - really just switches to a - particular ldap server, since the information isn't saved - anywhere. - (control_activate): add directory server menu item. - -2000-04-30 Chris Toshok <toshok@helixcode.com> - - * backend/ebook/e-book.c (e_book_load_uri): create the book - listener here, since it's destroyed in unload_uri. - (e_book_construct): remove the book listener construction here. - -2000-04-30 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/.cvsignore: Added load-pine-addressbook. - -2000-04-30 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/contact-editor.glade, - contact-editor/e-contact-editor.c, gui/minicard/e-minicard.c: Made - some fields invisible that were visible before. - -2000-04-30 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-card.c: Make file as not have the : after it if - it's empty. If there's no name, or file_as, fill in these fields - with defaults based on full_name or name respectively. - - * backend/ebook/load-pine-addressbook.c: New file to do import of - pine .addressbook files. - - * backend/pas/pas-backend-file.c: Made empty fields act as the - empty string for searches. - - * contact-editor/e-contact-editor.c, - contact-editor/e-contact-editor.h: Made the File As field update - properly as you edit the name and company fields. Added the pull - down list of File As choices. Made sure that all fields will - be set to NULL if they are deleted to the empty string. - - * gui/minicard/e-minicard.c: Use the File As field instead of the - Full Name field for the header. Make identical compares on the - File As field do a compare on the uid. - -2000-04-30 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor-fullname.c, - contact-editor/fullname.glade: Fixed a string mismatch. - -2000-04-30 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/Makefile.am: Added ename includes and libs. - - * backend/ebook/e-card.c, backend/ebook/e-card.h: Added - e_card_name_from_string. Added header for - e_card_delivery_address_from_string, even though it's not - implemented yet. - - * contact-editor/Makefile.am: Removed the ename includes since we - no longer use ename directly here. - - * contact-editor/e-contact-editor.c: Fixed this to properly save - the address labels displayed. Updated this to use the function - e_card_name_from_string instead of doing it by hand. - - * contact-editor/fullname-strings.h, - contact-editor/fullname.glade: Deleted an unused field. Changed - the set of prefixes and suffixes. - -2000-04-30 Chris Toshok <toshok@helixcode.com> - - * backend/pas/pas-backend-ldap.c - (pas_backend_ldap_ensure_connected): add support for a rootdn in - the uri. - (pas_backend_ldap_build_all_cards_list): make use of the rootdn in - the call to ldap_search_s. - (pas_backend_ldap_search): same. - (pas_backend_ldap_load_uri): get the rootdn out of the passed in uri. - -2000-04-29 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-card.c, backend/ebook/e-card.h: Added - e_card_phone_new e_card_delivery_address_new, - e_card_delivery_address_to_string, e_card_name_copy, - e_card_name_new, e_card_name_to_string, and made e_card_name_free - public. Removed some unused code. - - * backend/pas/pas-backend-file.c: Fixed a warning. - - * contact-editor/Makefile.am: Added e-contact-editor-fullname.[ch] - and fullname.glade. Added e-name libs and includes. - - * contact-editor/e-contact-editor-fullname.c, - contact-editor/e-contact-editor-fullname.h, - contact-editor/fullname-strings.h, contact-editor/fullname.glade: - New dialog for editing the fields of a name separately. - - * contact-editor/e-contact-editor.c, - contact-editor/e-contact-editor.h: Create an - EContactEditorFullname when you click on the Full Name button. - Maintain a parsed name at all times. - - * gui/component/Makefile.am, gui/minicard/Makefile.am: Added - e-name libs. - -2000-04-28 Larry Ewing <lewing@helixcode.com> - - * backend/pas/pas-book-factory.c (register_factory): fix the - `USING_OAF' changes so that they work for when we are not using - oaf. - -2000-04-27 Ettore Perazzoli <ettore@helixcode.com> - - * ename/Makefile.am - (gnome_libs): Use `BONOBO_GNOME_LIBS'. - (INCLUDES): Add `-I$(srcdir)/..'. - - * backend/pas/pas-book-factory.c - (register_factory): New function to register the factory. - Implementation different according to `USING_OAF'. - (pas_book_factory_activate): Use `register_factory()'. - - * gui/component/addressbook.c: New #define `CONTROL_FACTORY_ID', - varying depending on whether we are `USING_OAF'. - (addressbook_factory_init): Use `CONTROL_FACTORY_ID'. - - * backend/ebook/test-client.c (init_corba): New function, - implemented differently according to the `USING_OAF' #define. - - * backend/ebook/e-book.c: New #define `CARDSERVER_OAF_ID'. - (e_book_construct): Work with OAF #if `USING_OAF'. - - * backend/ebook/Makefile.am (gnome_libs): Removed. - (corbadir): Removed. - (ebook_libs): Removed. - (test_client_LDADD): Just add `libebook.la'. - (test_card_LDADD): Likewise. - (test_client_list_LDADD): Likewise. - - * gui/component/addressbook-factory.c - (init_corba): New helper function, implemented differently - according to `USING_OAF'. - (main): Call `init_corba()'. - -2000-04-27 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-card.c, backend/ebook/e-card.h: Added file as, - office, manager, assistant, spouse, and anniversary fields. These - all use "X-EVOLUTION-" fields in the VCards. - - * backend/pas/pas-backend-file.c: Added all the new fields (except - anniversary) to the list of fields. - - * contact-editor/contact-editor.glade, - contact-editor/e-contact-editor-strings.h: Fixed some misnamed - fields and fixed the placement of the comments field. - - * contact-editor/e-contact-editor.c: Made the newly added fields - display properly. - - * Makefile.am: Added ename. - - * ename/e-name-western.h, ename/test-ename-western-gtk.c, - ename/test-ename-western.c: Fixed up some #includes. - - * ename/.cvsignore: Added .cvsignore. - -2000-04-26 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-card-types.h, backend/ebook/e-card.c, - backend/ebook/e-card.h: Added an address label field. - - * contact-editor/contact-editor.glade, - contact-editor/e-contact-editor-strings.h: Got rid of some unused - fields. - - * contact-editor/e-contact-editor.c, - contact-editor/e-contact-editor.h: Added the address label field. - Load only. Editing these fields seems to mess things up. - -2000-04-26 Christopher James Lahey <clahey@helixcode.com> - - * contact-editor/e-contact-editor.c: Added proper handling of the - email field. - -2000-04-26 Christopher James Lahey <clahey@helixcode.com> - - * backend/ebook/e-card-types.h, backend/ebook/e-card.c, - gui/minicard/e-minicard.c: Prefixed the ADDR_ flags. - - * contact-editor/contact-editor.glade, - contact-editor/e-contact-editor-strings.h: Edited the glade file. - Removed all the fields that we don't use. - - * contact-editor/e-contact-editor.c, - contact-editor/e-contact-editor.h: Made the phone fields work - properly. The address and email fields are temporarily turned off - until they can be made to work as the phone fields do. - -2000-04-25 Ettore Perazzoli <ettore@helixcode.com> - - * gui/minicard/Makefile.am (INCLUDES): Use - `$(BONOBO_GNOME_CFLAGS)'. - - * backend/pas/Makefile.am (idl_flags): Add `-I $(datadir)/idl' to - pick up IDL files in the installation prefix as well. - (INCLUDES): Use `$(BONOBO_GNOME_CFLAGS)'. - - * backend/ebook/Makefile.am (ORBIT_IDL): Use `-I $(datadir)/idl' - to get the IDLs from the installation prefix as well. - (INCLUDES): Add `$(BONOBO_GNOME_CFLAGS)'. - (test_client_LDADD): Use `$(BONOBO_GNOME_LIBS)' instead of - hardcoding `-lbonobo'! Also get rid of some other useless flags, - as `$(BONOBO_GNOME_LIBS)' really has all what we need. - (test_client_list_LDADD): Likewise. - (test_card_LDADD): Likewise. - -2000-04-18 Federico Mena Quintero <federico@helixcode.com> - - * gui/minicard/Makefile.am (INCLUDES): Use "e-minicard" as the log - domain. - - * gui/component/Makefile.am (INCLUDES): Use - "evolution-addressbook" as the log domain. - - * backend/pas/Makefile.am: Build libpas.a, not a shared library. - Do not install any header files. - (INCLUDES): Remove spurious include paths. - - * backend/pas/*.[ch]: Fix includes. - - * backend/ebook/Makefile.am: Do not install the test programs. - Fixed some include weirdness. - - * backend/ebook/*.[ch]: Fix includes. - - * contact-editor/Makefile.am (INCLUDES): Set the log domain to - "contact-editor". - (INCLUDES): Fix. - - * contact-editor/*.[ch]: Fix includes. - - * gui/minicard/*.[ch]: Fix includes. - - * ChangeLog: Started a ChangeLog here. diff --git a/addressbook/Makefile.am b/addressbook/Makefile.am deleted file mode 100644 index 66581af8ed..0000000000 --- a/addressbook/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -if ENABLE_PILOT_CONDUITS -CONDUIT_SUBDIR=conduit -endif - -SUBDIRS = \ - ename backend printing contact-editor gui $(CONDUIT_SUBDIR) - diff --git a/addressbook/backend/.cvsignore b/addressbook/backend/.cvsignore deleted file mode 100644 index 09980ae6ba..0000000000 --- a/addressbook/backend/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la diff --git a/addressbook/backend/Makefile.am b/addressbook/backend/Makefile.am deleted file mode 100644 index b2807b2480..0000000000 --- a/addressbook/backend/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = idl ebook pas diff --git a/addressbook/backend/ebook/.cvsignore b/addressbook/backend/ebook/.cvsignore deleted file mode 100644 index 1abc66db18..0000000000 --- a/addressbook/backend/ebook/.cvsignore +++ /dev/null @@ -1,16 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -*.lo -*.la -addressbook-stubs.c -addressbook-skels.c -addressbook-common.c -addressbook.h -test-card -test-client -test-client-list -load-pine-addressbook -load-gnomecard-addressbook diff --git a/addressbook/backend/ebook/Makefile.am b/addressbook/backend/ebook/Makefile.am deleted file mode 100644 index 12f35d0b94..0000000000 --- a/addressbook/backend/ebook/Makefile.am +++ /dev/null @@ -1,116 +0,0 @@ -noinst_PROGRAMS = test-card test-client test-client-list load-pine-addressbook load-gnomecard-addressbook - -CORBA_SOURCE = \ - addressbook.h \ - addressbook-common.c \ - addressbook-stubs.c \ - addressbook-skels.c - -idls = \ - $(srcdir)/../idl/addressbook.idl - -idl_flags = `$(GNOME_CONFIG) --cflags idl` -I $(datadir)/idl - -$(CORBA_SOURCE): $(idls) - $(ORBIT_IDL) $(srcdir)/../idl/addressbook.idl $(idl_flags) - -INCLUDES = \ - -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ - -DG_LOG_DOMAIN=\"EBook\" \ - -I$(top_srcdir) \ - -I$(top_srcdir)/addressbook/backend \ - -I$(top_srcdir)/addressbook/ename \ - -I$(top_builddir)/addressbook/backend \ - -I$(top_builddir)/addressbook/ename \ - $(BONOBO_GNOME_CFLAGS) - -lib_LTLIBRARIES = libebook.la - -libebook_la_SOURCES = \ - $(CORBA_SOURCE) \ - e-book-listener.c \ - e-book-view-listener.c \ - e-book-view.c \ - e-book.c \ - e-card-cursor.c \ - e-card-simple.c \ - e-card.c - -libebookincludedir = $(includedir)/evolution/ebook - -libebookinclude_HEADERS = \ - e-book-listener.h \ - e-book-types.h \ - e-book-view-listener.h \ - e-book-view.h \ - e-book.h \ - e-card-cursor.h \ - e-card-pairs.h \ - e-card-simple.h \ - e-card-types.h \ - e-card.h - - -# -# make a static library for use by addressbook's conduit's shared library -# -noinst_LTLIBRARIES = libebook-static.la -libebook_static_la_SOURCES = $(libebook_la_SOURCES) -libebook_static_la_LDFLAGS = --all-static - - -test_client_SOURCES = \ - test-client.c - -test_client_LDADD = \ - libebook.la \ - $(BONOBO_GNOME_LIBS) \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/addressbook/ename/libename.la \ - $(top_builddir)/e-util/libeutil.la - -test_client_list_SOURCES = \ - test-client-list.c - -test_client_list_LDADD = \ - libebook.la \ - $(BONOBO_GNOME_LIBS) \ - $(top_builddir)/addressbook/ename/libename.la \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/e-util/libeutil.la - -test_card_SOURCES = \ - test-card.c - -test_card_LDADD = \ - libebook.la \ - $(BONOBO_GNOME_LIBS) \ - $(top_builddir)/addressbook/ename/libename.la \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/e-util/libeutil.la - - -load_pine_addressbook_SOURCES = \ - load-pine-addressbook.c - -load_pine_addressbook_LDADD = \ - libebook.la \ - $(BONOBO_GNOME_LIBS) \ - $(top_builddir)/addressbook/ename/libename.la \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/e-util/libeutil.la - - -load_gnomecard_addressbook_SOURCES = \ - load-gnomecard-addressbook.c - -load_gnomecard_addressbook_LDADD = \ - libebook.la \ - $(BONOBO_GNOME_LIBS) \ - $(top_builddir)/addressbook/ename/libename.la \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/e-util/libeutil.la - - -BUILT_SOURCES = $(CORBA_SOURCE) -CLEANFILES += $(BUILT_SOURCES) diff --git a/addressbook/backend/ebook/TODO b/addressbook/backend/ebook/TODO deleted file mode 100644 index a69703cd92..0000000000 --- a/addressbook/backend/ebook/TODO +++ /dev/null @@ -1,2 +0,0 @@ -* Make sure open_book_progress does not use the EBook op queue; make - sure it works. diff --git a/addressbook/backend/ebook/e-book-listener.c b/addressbook/backend/ebook/e-book-listener.c deleted file mode 100644 index 5efdaa37df..0000000000 --- a/addressbook/backend/ebook/e-book-listener.c +++ /dev/null @@ -1,587 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Exports the BookListener interface. Maintains a queue of messages - * which come in on the interface. - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#include <config.h> -#include <gtk/gtksignal.h> -#include "e-book-listener.h" - -static EBookStatus e_book_listener_convert_status (Evolution_BookListener_CallStatus status); - -enum { - RESPONSES_QUEUED, - LAST_SIGNAL -}; - -static guint e_book_listener_signals [LAST_SIGNAL]; - -static BonoboObjectClass *e_book_listener_parent_class; -POA_Evolution_BookListener__vepv e_book_listener_vepv; - -struct _EBookListenerPrivate { - GList *response_queue; - gint idle_id; -}; - -static gboolean -e_book_listener_check_queue (EBookListener *listener) -{ - if (listener->priv->response_queue != NULL) { - gtk_signal_emit (GTK_OBJECT (listener), - e_book_listener_signals [RESPONSES_QUEUED]); - } - - if (listener->priv->response_queue == NULL) { - listener->priv->idle_id = 0; - return FALSE; - } - - return TRUE; -} - -static void -e_book_listener_queue_response (EBookListener *listener, - EBookListenerResponse *response) -{ - listener->priv->response_queue = - g_list_append (listener->priv->response_queue, - response); - - if (listener->priv->idle_id == 0) { - listener->priv->idle_id = g_idle_add ( - (GSourceFunc) e_book_listener_check_queue, listener); - } -} - -/* Add, Remove, Modify */ -static void -e_book_listener_queue_generic_response (EBookListener *listener, - EBookListenerOperation op, - EBookStatus status) -{ - EBookListenerResponse *resp; - - resp = g_new0 (EBookListenerResponse, 1); - - resp->op = op; - resp->status = status; - - e_book_listener_queue_response (listener, resp); -} - -static void -e_book_listener_queue_open_response (EBookListener *listener, - EBookStatus status, - Evolution_Book book) -{ - EBookListenerResponse *resp; - - resp = g_new0 (EBookListenerResponse, 1); - - resp->op = OpenBookResponse; - resp->status = status; - resp->book = book; - - e_book_listener_queue_response (listener, resp); -} - -static void -e_book_listener_queue_open_progress (EBookListener *listener, - const char *msg, - short percent) -{ - EBookListenerResponse *resp; - - resp = g_new0 (EBookListenerResponse, 1); - - resp->op = OpenProgressEvent; - resp->msg = g_strdup (msg); - resp->percent = percent; - - e_book_listener_queue_response (listener, resp); -} - - -static void -e_book_listener_queue_create_card_response (EBookListener *listener, - EBookStatus status, - const char *id) -{ - EBookListenerResponse *resp; - - resp = g_new0 (EBookListenerResponse, 1); - - resp->op = CreateCardResponse; - resp->status = status; - resp->id = g_strdup (id); - - e_book_listener_queue_response (listener, resp); -} - -static void -e_book_listener_queue_get_cursor_response (EBookListener *listener, - EBookStatus status, - Evolution_CardCursor cursor) -{ - EBookListenerResponse *resp; - - resp = g_new0 (EBookListenerResponse, 1); - - resp->op = GetCursorResponse; - resp->status = status; - resp->cursor = cursor; - - e_book_listener_queue_response (listener, resp); -} - -static void -e_book_listener_queue_get_view_response (EBookListener *listener, - EBookStatus status, - Evolution_BookView book_view) -{ - EBookListenerResponse *resp; - - resp = g_new0 (EBookListenerResponse, 1); - - resp->op = GetBookViewResponse; - resp->status = status; - resp->book_view = book_view; - - e_book_listener_queue_response (listener, resp); -} - -static void -e_book_listener_queue_link_status (EBookListener *listener, - gboolean connected) -{ - EBookListenerResponse *resp; - - resp = g_new0 (EBookListenerResponse, 1); - - resp->op = LinkStatusEvent; - resp->connected = connected; - - e_book_listener_queue_response (listener, resp); -} - -static void -impl_BookListener_respond_create_card (PortableServer_Servant servant, - const Evolution_BookListener_CallStatus status, - const Evolution_CardId id, - CORBA_Environment *ev) -{ - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); - - e_book_listener_queue_create_card_response ( - listener, - e_book_listener_convert_status (status), - id); -} - -static void -impl_BookListener_respond_remove_card (PortableServer_Servant servant, - const Evolution_BookListener_CallStatus status, - CORBA_Environment *ev) -{ - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); - - e_book_listener_queue_generic_response ( - listener, RemoveCardResponse, - e_book_listener_convert_status (status)); -} - -static void -impl_BookListener_respond_modify_card (PortableServer_Servant servant, - const Evolution_BookListener_CallStatus status, - CORBA_Environment *ev) -{ - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); - - e_book_listener_queue_generic_response ( - listener, ModifyCardResponse, - e_book_listener_convert_status (status)); -} - -static void -impl_BookListener_respond_get_cursor (PortableServer_Servant servant, - const Evolution_BookListener_CallStatus status, - const Evolution_CardCursor cursor, - CORBA_Environment *ev) -{ - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); - Evolution_CardCursor cursor_copy; - - cursor_copy = CORBA_Object_duplicate (cursor, ev); - - if (ev->_major != CORBA_NO_EXCEPTION) { - g_warning ("EBookListener: Exception while duplicating CardCursor!\n"); - return; - } - - e_book_listener_queue_get_cursor_response ( - listener, - e_book_listener_convert_status (status), - cursor_copy); -} - -static void -impl_BookListener_respond_get_view (PortableServer_Servant servant, - const Evolution_BookListener_CallStatus status, - const Evolution_BookView book_view, - CORBA_Environment *ev) -{ - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); - Evolution_BookView book_view_copy; - - book_view_copy = CORBA_Object_duplicate (book_view, ev); - - if (ev->_major != CORBA_NO_EXCEPTION) { - g_warning ("EBookListener: Exception while duplicating BookView.\n"); - return; - } - - e_book_listener_queue_get_view_response ( - listener, - e_book_listener_convert_status (status), - book_view_copy); -} - -static void -impl_BookListener_respond_open_book (PortableServer_Servant servant, - const Evolution_BookListener_CallStatus status, - const Evolution_Book book, - CORBA_Environment *ev) -{ - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); - Evolution_Book book_copy; - - book_copy = CORBA_Object_duplicate (book, ev); - - if (ev->_major != CORBA_NO_EXCEPTION) { - g_warning ("EBookListener: Exception while duplicating Book!\n"); - return; - } - - e_book_listener_queue_open_response ( - listener, - e_book_listener_convert_status (status), - book_copy); -} - -static void -impl_BookListener_report_open_book_progress (PortableServer_Servant servant, - const CORBA_char *status_message, - const CORBA_short percent, - CORBA_Environment *ev) -{ - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); - - e_book_listener_queue_open_progress ( - listener, status_message, percent); -} - -static void -impl_BookListener_report_connection_status (PortableServer_Servant servant, - const CORBA_boolean connected, - CORBA_Environment *ev) -{ - EBookListener *listener = E_BOOK_LISTENER (bonobo_object_from_servant (servant)); - - e_book_listener_queue_link_status ( - listener, connected); -} - -/** - * e_book_listener_check_pending: - * @listener: the #EBookListener - * - * Returns: the number of items on the response queue, - * or -1 if the @listener is isn't an #EBookListener. - */ -int -e_book_listener_check_pending (EBookListener *listener) -{ - g_return_val_if_fail (listener != NULL, -1); - g_return_val_if_fail (E_IS_BOOK_LISTENER (listener), -1); - - return g_list_length (listener->priv->response_queue); -} - -/** - * e_book_listener_pop_response: - * @listener: the #EBookListener for which a request is to be popped - * - * Returns: an #EBookListenerResponse if there are responses on the - * queue to be returned; %NULL if there aren't, or if the @listener - * isn't an EBookListener. - */ -EBookListenerResponse * -e_book_listener_pop_response (EBookListener *listener) -{ - EBookListenerResponse *resp; - GList *popped; - - g_return_val_if_fail (listener != NULL, NULL); - g_return_val_if_fail (E_IS_BOOK_LISTENER (listener), NULL); - - if (listener->priv->response_queue == NULL) - return NULL; - - resp = listener->priv->response_queue->data; - - popped = listener->priv->response_queue; - listener->priv->response_queue = - g_list_remove_link (listener->priv->response_queue, - listener->priv->response_queue); - g_list_free_1 (popped); - - return resp; -} - -static EBookStatus -e_book_listener_convert_status (const Evolution_BookListener_CallStatus status) -{ - switch (status) { - case Evolution_BookListener_Success: - return E_BOOK_STATUS_SUCCESS; - case Evolution_BookListener_RepositoryOffline: - return E_BOOK_STATUS_REPOSITORY_OFFLINE; - case Evolution_BookListener_PermissionDenied: - return E_BOOK_STATUS_PERMISSION_DENIED; - case Evolution_BookListener_CardNotFound: - return E_BOOK_STATUS_CARD_NOT_FOUND; - case Evolution_BookListener_ProtocolNotSupported: - return E_BOOK_STATUS_PROTOCOL_NOT_SUPPORTED; - case Evolution_BookListener_OtherError: - return E_BOOK_STATUS_OTHER_ERROR; - default: - g_warning ("e_book_listener_convert_status: Unknown status " - "from card server: %d\n", (int) status); - return E_BOOK_STATUS_UNKNOWN; - - } -} - -static EBookListener * -e_book_listener_construct (EBookListener *listener) -{ - POA_Evolution_BookListener *servant; - CORBA_Environment ev; - CORBA_Object obj; - - g_assert (listener != NULL); - g_assert (E_IS_BOOK_LISTENER (listener)); - - servant = (POA_Evolution_BookListener *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &e_book_listener_vepv; - - CORBA_exception_init (&ev); - - POA_Evolution_BookListener__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - - return NULL; - } - - CORBA_exception_free (&ev); - - obj = bonobo_object_activate_servant (BONOBO_OBJECT (listener), servant); - if (obj == CORBA_OBJECT_NIL) { - g_free (servant); - - return NULL; - } - - bonobo_object_construct (BONOBO_OBJECT (listener), obj); - - return listener; -} - -/** - * e_book_listener_new: - * @book: the #EBook for which the listener is to be bound - * - * Creates and returns a new #EBookListener for the book. - * - * Returns: a new #EBookListener - */ -EBookListener * -e_book_listener_new () -{ - EBookListener *listener; - EBookListener *retval; - - listener = gtk_type_new (E_BOOK_LISTENER_TYPE); - - retval = e_book_listener_construct (listener); - - if (retval == NULL) { - g_warning ("e_book_listener_new: Error constructing " - "EBookListener!\n"); - gtk_object_unref (GTK_OBJECT (listener)); - return NULL; - } - - return retval; -} - -static void -e_book_listener_init (EBookListener *listener) -{ - listener->priv = g_new0 (EBookListenerPrivate, 1); -} - -static void -e_book_listener_destroy (GtkObject *object) -{ - EBookListener *listener = E_BOOK_LISTENER (object); - GList *l; - - for (l = listener->priv->response_queue; l != NULL; l = l->next) { - EBookListenerResponse *resp = l->data; - - g_free (resp->msg); - g_free (resp->id); - - if (resp->book != CORBA_OBJECT_NIL) { - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - CORBA_Object_release (resp->book, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_listener_destroy: " - "Exception destroying book " - "in response queue!\n"); - } - - CORBA_exception_free (&ev); - } - - if (resp->cursor != CORBA_OBJECT_NIL) { - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - CORBA_Object_release (resp->cursor, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_listener_destroy: " - "Exception destroying cursor " - "in response queue!\n"); - } - - CORBA_exception_free (&ev); - } - - if (resp->book_view != CORBA_OBJECT_NIL) { - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - CORBA_Object_release (resp->book_view, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_listener_destroy: " - "Exception destroying book_view " - "in response queue!\n"); - } - - CORBA_exception_free (&ev); - } - - g_free (resp); - } - g_list_free (listener->priv->response_queue); - - g_free (listener->priv); - - GTK_OBJECT_CLASS (e_book_listener_parent_class)->destroy (object); -} - -POA_Evolution_BookListener__epv * -e_book_listener_get_epv (void) -{ - POA_Evolution_BookListener__epv *epv; - - epv = g_new0 (POA_Evolution_BookListener__epv, 1); - - epv->report_open_book_progress = impl_BookListener_report_open_book_progress; - epv->respond_open_book = impl_BookListener_respond_open_book; - - epv->respond_create_card = impl_BookListener_respond_create_card; - epv->respond_remove_card = impl_BookListener_respond_remove_card; - epv->respond_modify_card = impl_BookListener_respond_modify_card; - - epv->respond_get_cursor = impl_BookListener_respond_get_cursor; - epv->respond_get_view = impl_BookListener_respond_get_view; - - epv->report_connection_status = impl_BookListener_report_connection_status; - - return epv; -} - -static void -e_book_listener_corba_class_init (void) -{ - e_book_listener_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - e_book_listener_vepv.Evolution_BookListener_epv = e_book_listener_get_epv (); -} - -static void -e_book_listener_class_init (EBookListenerClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - - e_book_listener_parent_class = gtk_type_class (bonobo_object_get_type ()); - - e_book_listener_signals [RESPONSES_QUEUED] = - gtk_signal_new ("responses_queued", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EBookListenerClass, responses_queued), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, e_book_listener_signals, LAST_SIGNAL); - - object_class->destroy = e_book_listener_destroy; - - e_book_listener_corba_class_init (); -} - -/** - * e_book_listener_get_type: - */ -GtkType -e_book_listener_get_type (void) -{ - static GtkType type = 0; - - if (! type) { - GtkTypeInfo info = { - "EBookListener", - sizeof (EBookListener), - sizeof (EBookListenerClass), - (GtkClassInitFunc) e_book_listener_class_init, - (GtkObjectInitFunc) e_book_listener_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (bonobo_object_get_type (), &info); - } - - return type; -} diff --git a/addressbook/backend/ebook/e-book-listener.h b/addressbook/backend/ebook/e-book-listener.h deleted file mode 100644 index eb0432e360..0000000000 --- a/addressbook/backend/ebook/e-book-listener.h +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * A client-side GtkObject which exposes the - * Evolution:BookListener interface. - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#ifndef __E_BOOK_LISTENER_H__ -#define __E_BOOK_LISTENER_H__ - -#include <libgnome/gnome-defs.h> -#include <bonobo/bonobo-object.h> -#include <ebook/addressbook.h> -#include <ebook/e-book-types.h> - -BEGIN_GNOME_DECLS - -typedef struct _EBookListener EBookListener; -typedef struct _EBookListenerClass EBookListenerClass; -typedef struct _EBookListenerPrivate EBookListenerPrivate; - -struct _EBookListener { - BonoboObject parent; - EBookListenerPrivate *priv; -}; - -struct _EBookListenerClass { - BonoboObjectClass parent; - - /* - * Signals - */ - void (*responses_queued) (void); -}; - -typedef enum { - /* Async responses */ - OpenBookResponse, - CreateCardResponse, - RemoveCardResponse, - ModifyCardResponse, - GetCursorResponse, - GetBookViewResponse, - - /* Async events */ - LinkStatusEvent, - OpenProgressEvent, -} EBookListenerOperation; - -typedef struct { - EBookListenerOperation op; - - /* For most Response notifications */ - EBookStatus status; - - /* For OpenBookResponse */ - Evolution_Book book; - - /* For GetCursorResponse */ - Evolution_CardCursor cursor; - - /* For GetBookViewReponse */ - Evolution_BookView book_view; - - /* For OpenProgressEvent */ - char *msg; - short percent; - - /* For LinkStatusEvent */ - gboolean connected; - - /* For Card[Added|Removed|Modified]Event */ - char *id; -} EBookListenerResponse; - -EBookListener *e_book_listener_new (void); -int e_book_listener_check_pending (EBookListener *listener); -EBookListenerResponse *e_book_listener_pop_response (EBookListener *listener); -GtkType e_book_listener_get_type (void); - -POA_Evolution_BookListener__epv *e_book_listener_get_epv (void); - -#define E_BOOK_LISTENER_TYPE (e_book_listener_get_type ()) -#define E_BOOK_LISTENER(o) (GTK_CHECK_CAST ((o), E_BOOK_LISTENER_TYPE, EBookListener)) -#define E_BOOK_LISTENER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_BOOK_LISTENER_TYPE, EBookListenerClass)) -#define E_IS_BOOK_LISTENER(o) (GTK_CHECK_TYPE ((o), E_BOOK_LISTENER_TYPE)) -#define E_IS_BOOK_LISTENER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_BOOK_LISTENER_TYPE)) - -END_GNOME_DECLS - -#endif /* ! __E_BOOK_LISTENER_H__ */ diff --git a/addressbook/backend/ebook/e-book-types.h b/addressbook/backend/ebook/e-book-types.h deleted file mode 100644 index a3e8bbc032..0000000000 --- a/addressbook/backend/ebook/e-book-types.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * A client-side GtkObject which exposes the - * Evolution:BookListener interface. - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#ifndef __E_BOOK_TYPES_H__ -#define __E_BOOK_TYPES_H__ - -#include <libgnome/gnome-defs.h> - -BEGIN_GNOME_DECLS - -typedef enum { - E_BOOK_STATUS_SUCCESS, - E_BOOK_STATUS_UNKNOWN, - E_BOOK_STATUS_REPOSITORY_OFFLINE, - E_BOOK_STATUS_PERMISSION_DENIED, - E_BOOK_STATUS_CARD_NOT_FOUND, - E_BOOK_STATUS_PROTOCOL_NOT_SUPPORTED, - E_BOOK_STATUS_OTHER_ERROR -} EBookStatus; - -END_GNOME_DECLS - -#endif /* ! __E_BOOK_TYPES_H__ */ diff --git a/addressbook/backend/ebook/e-book-view-listener.c b/addressbook/backend/ebook/e-book-view-listener.c deleted file mode 100644 index be871d65d7..0000000000 --- a/addressbook/backend/ebook/e-book-view-listener.c +++ /dev/null @@ -1,374 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Exports the BookViewListener interface. Maintains a queue of messages - * which come in on the interface. - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#include <config.h> -#include <gtk/gtksignal.h> -#include "e-book-view-listener.h" -#include "e-book-view.h" -#include "e-card.h" - -enum { - RESPONSES_QUEUED, - LAST_SIGNAL -}; - -static guint e_book_view_listener_signals [LAST_SIGNAL]; - -static BonoboObjectClass *e_book_view_listener_parent_class; -POA_Evolution_BookViewListener__vepv e_book_view_listener_vepv; - -struct _EBookViewListenerPrivate { - GList *response_queue; - gint idle_id; -}; - -static gboolean -e_book_view_listener_check_queue (EBookViewListener *listener) -{ - if (listener->priv->response_queue != NULL) { - gtk_signal_emit (GTK_OBJECT (listener), - e_book_view_listener_signals [RESPONSES_QUEUED]); - } - - if (listener->priv->response_queue == NULL) { - listener->priv->idle_id = 0; - return FALSE; - } - - return TRUE; -} - -static void -e_book_view_listener_queue_response (EBookViewListener *listener, - EBookViewListenerResponse *response) -{ - listener->priv->response_queue = - g_list_append (listener->priv->response_queue, - response); - - if (listener->priv->idle_id == 0) { - listener->priv->idle_id = g_idle_add ( - (GSourceFunc) e_book_view_listener_check_queue, listener); - } -} - -/* Add, Remove, Modify */ -static void -e_book_view_listener_queue_empty_event (EBookViewListener *listener, - EBookViewListenerOperation op) -{ - EBookViewListenerResponse *resp; - - resp = g_new0 (EBookViewListenerResponse, 1); - - resp->op = op; - resp->id = NULL; - resp->cards = NULL; - - e_book_view_listener_queue_response (listener, resp); -} - -/* Add, Remove, Modify */ -static void -e_book_view_listener_queue_id_event (EBookViewListener *listener, - EBookViewListenerOperation op, - const char *id) -{ - EBookViewListenerResponse *resp; - - resp = g_new0 (EBookViewListenerResponse, 1); - - resp->op = op; - resp->id = g_strdup (id); - resp->cards = NULL; - - e_book_view_listener_queue_response (listener, resp); -} - -/* Add, Remove, Modify */ -static void -e_book_view_listener_queue_sequence_event (EBookViewListener *listener, - EBookViewListenerOperation op, - const Evolution_VCardList *cards) -{ - EBookViewListenerResponse *resp; - int i; - - resp = g_new0 (EBookViewListenerResponse, 1); - - resp->op = op; - resp->id = NULL; - resp->cards = NULL; - - for ( i = 0; i < cards->_length; i++ ) { - resp->cards = g_list_append(resp->cards, e_card_new(cards->_buffer[i])); - } - - e_book_view_listener_queue_response (listener, resp); -} - -static void -impl_BookViewListener_signal_card_added (PortableServer_Servant servant, - const Evolution_VCardList *cards, - CORBA_Environment *ev) -{ - EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object_from_servant (servant)); - - e_book_view_listener_queue_sequence_event ( - listener, CardAddedEvent, cards); -} - -static void -impl_BookViewListener_signal_card_removed (PortableServer_Servant servant, - const Evolution_CardId id, - CORBA_Environment *ev) -{ - EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object_from_servant (servant)); - - e_book_view_listener_queue_id_event ( - listener, CardRemovedEvent, (const char *) id); -} - -static void -impl_BookViewListener_signal_card_changed (PortableServer_Servant servant, - const Evolution_VCardList *cards, - CORBA_Environment *ev) -{ - EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object_from_servant (servant)); - - e_book_view_listener_queue_sequence_event ( - listener, CardModifiedEvent, cards); -} - -static void -impl_BookViewListener_signal_sequence_complete (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - EBookViewListener *listener = E_BOOK_VIEW_LISTENER (bonobo_object_from_servant (servant)); - - e_book_view_listener_queue_empty_event (listener, SequenceCompleteEvent); -} - -/** - * e_book_view_listener_check_pending: - * @listener: the #EBookViewListener - * - * Returns: the number of items on the response queue, - * or -1 if the @listener is isn't an #EBookViewListener. - */ -int -e_book_view_listener_check_pending (EBookViewListener *listener) -{ - g_return_val_if_fail (listener != NULL, -1); - g_return_val_if_fail (E_IS_BOOK_VIEW_LISTENER (listener), -1); - - return g_list_length (listener->priv->response_queue); -} - -/** - * e_book_view_listener_pop_response: - * @listener: the #EBookViewListener for which a request is to be popped - * - * Returns: an #EBookViewListenerResponse if there are responses on the - * queue to be returned; %NULL if there aren't, or if the @listener - * isn't an EBookViewListener. - */ -EBookViewListenerResponse * -e_book_view_listener_pop_response (EBookViewListener *listener) -{ - EBookViewListenerResponse *resp; - GList *popped; - - g_return_val_if_fail (listener != NULL, NULL); - g_return_val_if_fail (E_IS_BOOK_VIEW_LISTENER (listener), NULL); - - if (listener->priv->response_queue == NULL) - return NULL; - - resp = listener->priv->response_queue->data; - - popped = listener->priv->response_queue; - listener->priv->response_queue = - g_list_remove_link (listener->priv->response_queue, - listener->priv->response_queue); - g_list_free_1 (popped); - - return resp; -} - -static EBookViewListener * -e_book_view_listener_construct (EBookViewListener *listener) -{ - POA_Evolution_BookViewListener *servant; - CORBA_Environment ev; - CORBA_Object obj; - - g_assert (listener != NULL); - g_assert (E_IS_BOOK_VIEW_LISTENER (listener)); - - servant = (POA_Evolution_BookViewListener *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &e_book_view_listener_vepv; - - CORBA_exception_init (&ev); - - POA_Evolution_BookViewListener__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - - return NULL; - } - - CORBA_exception_free (&ev); - - obj = bonobo_object_activate_servant (BONOBO_OBJECT (listener), servant); - if (obj == CORBA_OBJECT_NIL) { - g_free (servant); - - return NULL; - } - - bonobo_object_construct (BONOBO_OBJECT (listener), obj); - - return listener; -} - -/** - * e_book_view_listener_new: - * @book: the #EBookView for which the listener is to be bound - * - * Creates and returns a new #EBookViewListener for the book. - * - * Returns: a new #EBookViewListener - */ -EBookViewListener * -e_book_view_listener_new () -{ - EBookViewListener *listener; - EBookViewListener *retval; - - listener = gtk_type_new (E_BOOK_VIEW_LISTENER_TYPE); - - retval = e_book_view_listener_construct (listener); - - if (retval == NULL) { - g_warning ("e_book_view_listener_new: Error constructing " - "EBookViewListener!\n"); - gtk_object_unref (GTK_OBJECT (listener)); - return NULL; - } - - return retval; -} - -static void -e_book_view_listener_init (EBookViewListener *listener) -{ - listener->priv = g_new0 (EBookViewListenerPrivate, 1); - listener->priv->response_queue = NULL; - listener->priv->idle_id = 0; -} - -static void -e_book_view_listener_destroy (GtkObject *object) -{ - EBookViewListener *listener = E_BOOK_VIEW_LISTENER (object); - GList *l; - - if (listener->priv->idle_id) - g_source_remove(listener->priv->idle_id); - - for (l = listener->priv->response_queue; l != NULL; l = l->next) { - EBookViewListenerResponse *resp = l->data; - if (resp->id) - g_free(resp->id); - if (resp->cards) { - g_list_foreach(resp->cards, (GFunc) gtk_object_unref, NULL); - g_list_free(resp->cards); - } - g_free (resp); - } - g_list_free (listener->priv->response_queue); - - g_free (listener->priv); - - GTK_OBJECT_CLASS (e_book_view_listener_parent_class)->destroy (object); -} - -POA_Evolution_BookViewListener__epv * -e_book_view_listener_get_epv (void) -{ - POA_Evolution_BookViewListener__epv *epv; - - epv = g_new0 (POA_Evolution_BookViewListener__epv, 1); - - epv->signal_card_changed = impl_BookViewListener_signal_card_changed; - epv->signal_card_removed = impl_BookViewListener_signal_card_removed; - epv->signal_card_added = impl_BookViewListener_signal_card_added; - epv->signal_sequence_complete = impl_BookViewListener_signal_sequence_complete; - - return epv; -} - -static void -e_book_view_listener_corba_class_init (void) -{ - e_book_view_listener_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - e_book_view_listener_vepv.Evolution_BookViewListener_epv = e_book_view_listener_get_epv (); -} - -static void -e_book_view_listener_class_init (EBookViewListenerClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - - e_book_view_listener_parent_class = gtk_type_class (bonobo_object_get_type ()); - - e_book_view_listener_signals [RESPONSES_QUEUED] = - gtk_signal_new ("responses_queued", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EBookViewListenerClass, responses_queued), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, e_book_view_listener_signals, LAST_SIGNAL); - - object_class->destroy = e_book_view_listener_destroy; - - e_book_view_listener_corba_class_init (); -} - -/** - * e_book_view_listener_get_type: - */ -GtkType -e_book_view_listener_get_type (void) -{ - static GtkType type = 0; - - if (! type) { - GtkTypeInfo info = { - "EBookViewListener", - sizeof (EBookViewListener), - sizeof (EBookViewListenerClass), - (GtkClassInitFunc) e_book_view_listener_class_init, - (GtkObjectInitFunc) e_book_view_listener_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (bonobo_object_get_type (), &info); - } - - return type; -} diff --git a/addressbook/backend/ebook/e-book-view-listener.h b/addressbook/backend/ebook/e-book-view-listener.h deleted file mode 100644 index 65e5f8eb5b..0000000000 --- a/addressbook/backend/ebook/e-book-view-listener.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * A client-side GtkObject which exposes the - * Evolution:BookViewListener interface. - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#ifndef __E_BOOK_VIEW_LISTENER_H__ -#define __E_BOOK_VIEW_LISTENER_H__ - -#include <libgnome/gnome-defs.h> -#include <bonobo/bonobo-object.h> -#include <addressbook/backend/ebook/addressbook.h> - -BEGIN_GNOME_DECLS - -typedef struct _EBookViewListener EBookViewListener; -typedef struct _EBookViewListenerClass EBookViewListenerClass; -typedef struct _EBookViewListenerPrivate EBookViewListenerPrivate; - -struct _EBookViewListener { - BonoboObject parent; - EBookViewListenerPrivate *priv; -}; - -struct _EBookViewListenerClass { - BonoboObjectClass parent; - - /* - * Signals - */ - void (*responses_queued) (void); -}; - -typedef enum { - /* Async events */ - CardAddedEvent, - CardRemovedEvent, - CardModifiedEvent, - SequenceCompleteEvent, -} EBookViewListenerOperation; - -typedef struct { - EBookViewListenerOperation op; - - /* For CardRemovedEvent */ - char *id; - - /* For Card[Added|Modified]Event */ - GList *cards; /* Of type ECard. */ - -} EBookViewListenerResponse; - -EBookViewListener *e_book_view_listener_new (void); -int e_book_view_listener_check_pending (EBookViewListener *listener); -EBookViewListenerResponse *e_book_view_listener_pop_response (EBookViewListener *listener); -GtkType e_book_view_listener_get_type (void); - -POA_Evolution_BookViewListener__epv *e_book_view_listener_get_epv (void); - -#define E_BOOK_VIEW_LISTENER_TYPE (e_book_view_listener_get_type ()) -#define E_BOOK_VIEW_LISTENER(o) (GTK_CHECK_CAST ((o), E_BOOK_VIEW_LISTENER_TYPE, EBookViewListener)) -#define E_BOOK_VIEW_LISTENER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_BOOK_VIEW_LISTENER_TYPE, EBookViewListenerClass)) -#define E_IS_BOOK_VIEW_LISTENER(o) (GTK_CHECK_TYPE ((o), E_BOOK_VIEW_LISTENER_TYPE)) -#define E_IS_BOOK_VIEW_LISTENER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_BOOK_VIEW_LISTENER_TYPE)) - -END_GNOME_DECLS - -#endif /* ! __E_BOOK_VIEW_LISTENER_H__ */ diff --git a/addressbook/backend/ebook/e-book-view.c b/addressbook/backend/ebook/e-book-view.c deleted file mode 100644 index f00a2efb08..0000000000 --- a/addressbook/backend/ebook/e-book-view.c +++ /dev/null @@ -1,300 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * The Evolution addressbook client object. - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 1999, 2000, Helix Code, Inc. - */ - -#include <config.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkmarshal.h> - -#include "addressbook.h" -#include "e-card-cursor.h" -#include "e-book-view-listener.h" -#include "e-book-view.h" - -GtkObjectClass *e_book_view_parent_class; - -struct _EBookViewPrivate { - Evolution_BookView corba_book_view; - - EBookViewListener *listener; - - int responses_queued_id; -}; - -enum { - CARD_CHANGED, - CARD_REMOVED, - CARD_ADDED, - SEQUENCE_COMPLETE, - LAST_SIGNAL -}; - -static guint e_book_view_signals [LAST_SIGNAL]; - -static void -e_book_view_do_added_event (EBookView *book_view, - EBookViewListenerResponse *resp) -{ - gtk_signal_emit (GTK_OBJECT (book_view), e_book_view_signals [CARD_ADDED], - resp->cards); - - g_list_foreach (resp->cards, (GFunc) gtk_object_unref, NULL); - g_list_free (resp->cards); -} - -static void -e_book_view_do_modified_event (EBookView *book_view, - EBookViewListenerResponse *resp) -{ - gtk_signal_emit (GTK_OBJECT (book_view), e_book_view_signals [CARD_CHANGED], - resp->cards); - - g_list_foreach (resp->cards, (GFunc) gtk_object_unref, NULL); - g_list_free (resp->cards); -} - -static void -e_book_view_do_removed_event (EBookView *book_view, - EBookViewListenerResponse *resp) -{ - gtk_signal_emit (GTK_OBJECT (book_view), e_book_view_signals [CARD_REMOVED], - resp->id); - - g_free(resp->id); -} - -static void -e_book_view_do_complete_event (EBookView *book_view, - EBookViewListenerResponse *resp) -{ - gtk_signal_emit (GTK_OBJECT (book_view), e_book_view_signals [SEQUENCE_COMPLETE]); -} - - -/* - * Reading notices out of the EBookViewListener's queue. - */ -static void -e_book_view_check_listener_queue (EBookViewListener *listener, EBookView *book_view) -{ - EBookViewListenerResponse *resp; - - resp = e_book_view_listener_pop_response (listener); - - if (resp == NULL) - return; - - switch (resp->op) { - case CardAddedEvent: - e_book_view_do_added_event (book_view, resp); - break; - case CardModifiedEvent: - e_book_view_do_modified_event (book_view, resp); - break; - case CardRemovedEvent: - e_book_view_do_removed_event (book_view, resp); - break; - case SequenceCompleteEvent: - e_book_view_do_complete_event (book_view, resp); - break; - default: - g_error ("EBookView: Unknown operation %d in listener queue!\n", - resp->op); - } - - g_free (resp); -} - -static gboolean -e_book_view_construct (EBookView *book_view, Evolution_BookView corba_book_view, EBookViewListener *listener) -{ - CORBA_Environment ev; - g_return_val_if_fail (book_view != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK_VIEW (book_view), FALSE); - - /* - * Copy in the corba_book_view. - */ - CORBA_exception_init (&ev); - - book_view->priv->corba_book_view = CORBA_Object_duplicate(corba_book_view, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_view_construct: Exception duplicating corba_book_view.\n"); - CORBA_exception_free (&ev); - return FALSE; - } - - Evolution_BookView_ref(book_view->priv->corba_book_view, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_view_construct: Exception reffing corba_book_view.\n"); - CORBA_exception_free (&ev); - CORBA_exception_init (&ev); - CORBA_Object_release (book_view->priv->corba_book_view, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_view_construct: Exception releasing corba_book_view.\n"); - } - CORBA_exception_free (&ev); - book_view->priv->corba_book_view = NULL; - return FALSE; - } - - CORBA_exception_free (&ev); - - /* - * Create our local BookListener interface. - */ - book_view->priv->listener = listener; - - bonobo_object_ref(BONOBO_OBJECT(book_view->priv->listener)); - book_view->priv->responses_queued_id = gtk_signal_connect (GTK_OBJECT (book_view->priv->listener), "responses_queued", - e_book_view_check_listener_queue, book_view); - - return TRUE; -} - -/** - * e_book_view_new: - */ -EBookView * -e_book_view_new (Evolution_BookView corba_book_view, EBookViewListener *listener) -{ - EBookView *book_view; - - book_view = gtk_type_new (E_BOOK_VIEW_TYPE); - - if (! e_book_view_construct (book_view, corba_book_view, listener)) { - gtk_object_unref (GTK_OBJECT (book_view)); - return NULL; - } - - return book_view; -} - -static void -e_book_view_init (EBookView *book_view) -{ - book_view->priv = g_new0 (EBookViewPrivate, 1); - book_view->priv->corba_book_view = CORBA_OBJECT_NIL; - book_view->priv->listener = NULL; - book_view->priv->responses_queued_id = 0; -} - -static void -e_book_view_destroy (GtkObject *object) -{ - EBookView *book_view = E_BOOK_VIEW (object); - CORBA_Environment ev; - - if (book_view->priv->corba_book_view) { - CORBA_exception_init (&ev); - - Evolution_BookView_unref(book_view->priv->corba_book_view, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("EBookView: Exception while unreffing BookView\n"); - - CORBA_exception_free (&ev); - CORBA_exception_init (&ev); - } - - CORBA_Object_release (book_view->priv->corba_book_view, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("EBookView: Exception while releasing BookView\n"); - } - - CORBA_exception_free (&ev); - } - - if (book_view->priv->listener) { - if (book_view->priv->responses_queued_id) - gtk_signal_disconnect(GTK_OBJECT(book_view->priv->listener), - book_view->priv->responses_queued_id); - bonobo_object_unref (BONOBO_OBJECT(book_view->priv->listener)); - } - - g_free (book_view->priv); - - if (GTK_OBJECT_CLASS (e_book_view_parent_class)->destroy) - GTK_OBJECT_CLASS (e_book_view_parent_class)->destroy (object); -} - -static void -e_book_view_class_init (EBookViewClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - - e_book_view_parent_class = gtk_type_class (gtk_object_get_type ()); - - e_book_view_signals [CARD_CHANGED] = - gtk_signal_new ("card_changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EBookViewClass, card_changed), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - - e_book_view_signals [CARD_ADDED] = - gtk_signal_new ("card_added", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EBookViewClass, card_added), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, - GTK_TYPE_STRING); - - e_book_view_signals [CARD_REMOVED] = - gtk_signal_new ("card_removed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EBookViewClass, card_removed), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); - - e_book_view_signals [SEQUENCE_COMPLETE] = - gtk_signal_new ("sequence_complete", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EBookViewClass, sequence_complete), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, e_book_view_signals, - LAST_SIGNAL); - - object_class->destroy = e_book_view_destroy; -} - -/** - * e_book_view_get_type: - */ -GtkType -e_book_view_get_type (void) -{ - static GtkType type = 0; - - if (! type) { - GtkTypeInfo info = { - "EBookView", - sizeof (EBookView), - sizeof (EBookViewClass), - (GtkClassInitFunc) e_book_view_class_init, - (GtkObjectInitFunc) e_book_view_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (gtk_object_get_type (), &info); - } - - return type; -} diff --git a/addressbook/backend/ebook/e-book-view.h b/addressbook/backend/ebook/e-book-view.h deleted file mode 100644 index b8edc68018..0000000000 --- a/addressbook/backend/ebook/e-book-view.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * The Evolution addressbook client object. - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 1999, 2000, Helix Code, Inc. - */ - -#ifndef __E_BOOK_VIEW_H__ -#define __E_BOOK_VIEW_H__ - -#include <libgnome/gnome-defs.h> - -#include <addressbook/backend/ebook/e-card.h> -#include <addressbook/backend/ebook/e-book-view-listener.h> - -BEGIN_GNOME_DECLS - -typedef struct _EBookView EBookView; -typedef struct _EBookViewClass EBookViewClass; -typedef struct _EBookViewPrivate EBookViewPrivate; - -struct _EBookView { - GtkObject parent; - EBookViewPrivate *priv; -}; - -struct _EBookViewClass { - GtkObjectClass parent; - - /* - * Signals. - */ - void (* card_changed) (EBookView *book_view, const GList *cards); - void (* card_removed) (EBookView *book_view, const char *id); - void (* card_added) (EBookView *book_view, const GList *cards); - void (* sequence_complete) (EBookView *book_view); -}; - -/* Creating a new addressbook. */ -EBookView *e_book_view_new (Evolution_BookView corba_book_view, EBookViewListener *listener); - -GtkType e_book_view_get_type (void); -void e_book_view_get_book_view_listener (EBookView *book_view); - -#define E_BOOK_VIEW_TYPE (e_book_view_get_type ()) -#define E_BOOK_VIEW(o) (GTK_CHECK_CAST ((o), E_BOOK_VIEW_TYPE, EBookView)) -#define E_BOOK_VIEW_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_BOOK_VIEW_TYPE, EBookViewClass)) -#define E_IS_BOOK_VIEW(o) (GTK_CHECK_TYPE ((o), E_BOOK_VIEW_TYPE)) -#define E_IS_BOOK_VIEW_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_BOOK_VIEW_TYPE)) - -END_GNOME_DECLS - -#endif /* ! __E_BOOK_VIEW_H__ */ diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c deleted file mode 100644 index 38179559ba..0000000000 --- a/addressbook/backend/ebook/e-book.c +++ /dev/null @@ -1,1010 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * The Evolution addressbook client object. - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 1999, 2000, Helix Code, Inc. - */ - -#include <config.h> -#include <gtk/gtksignal.h> -#include <gtk/gtkmarshal.h> - -#include "addressbook.h" -#include "e-card-cursor.h" -#include "e-book-listener.h" -#include "e-book.h" - -GtkObjectClass *e_book_parent_class; - -#ifdef USING_OAF -#include <liboaf/liboaf.h> -#define CARDSERVER_OAF_ID "OAFIID:evolution:addressbook-server:0fbc844d-c721-4615-98d0-d67eacf42d80" -#else -#include <libgnorba/gnorba.h> -#define CARDSERVER_GOAD_ID "evolution:addressbook-server" -#endif - -typedef enum { - URINotLoaded, - URILoading, - URILoaded -} EBookLoadState; - -struct _EBookPrivate { - Evolution_BookFactory book_factory; - EBookListener *listener; - - Evolution_Book corba_book; - - EBookLoadState load_state; - - /* - * The operation queue. New operations are appended to the - * end of the queue. When responses come back from the PAS, - * the op structures are popped off the front of the queue. - */ - GList *pending_ops; -}; - -enum { - OPEN_PROGRESS, - LINK_STATUS, - LAST_SIGNAL -}; - -static guint e_book_signals [LAST_SIGNAL]; - -typedef struct { - gpointer cb; - gpointer closure; - EBookViewListener *listener; -} EBookOp; - -/* - * Local response queue management. - */ -static void -e_book_queue_op (EBook *book, - gpointer cb, - gpointer closure, - EBookViewListener *listener) -{ - EBookOp *op; - - op = g_new0 (EBookOp, 1); - op->cb = cb; - op->closure = closure; - op->listener = listener; - - book->priv->pending_ops = - g_list_append (book->priv->pending_ops, op); -} - -static EBookOp * -e_book_pop_op (EBook *book) -{ - GList *popped; - EBookOp *op; - - if (book->priv->pending_ops == NULL) - return NULL; - - op = book->priv->pending_ops->data; - - popped = book->priv->pending_ops; - book->priv->pending_ops = - g_list_remove_link (book->priv->pending_ops, - book->priv->pending_ops); - - g_list_free_1 (popped); - - return op; -} - -static void -e_book_do_response_create_card (EBook *book, - EBookListenerResponse *resp) -{ - EBookOp *op; - - op = e_book_pop_op (book); - - if (op == NULL) { - g_warning ("e_book_do_response_create_card: Cannot find operation " - "in local op queue!\n"); - return; - } - - if (op->cb) - ((EBookIdCallback) op->cb) (book, resp->status, resp->id, op->closure); - g_free (resp->id); - g_free (op); -} - -static void -e_book_do_response_generic (EBook *book, - EBookListenerResponse *resp) -{ - EBookOp *op; - - op = e_book_pop_op (book); - - if (op == NULL) { - g_warning ("e_book_do_response_generic: Cannot find operation " - "in local op queue!\n"); - } - - if (op->cb) - ((EBookCallback) op->cb) (book, resp->status, op->closure); - - g_free (op); -} - -static void -e_book_do_response_get_cursor (EBook *book, - EBookListenerResponse *resp) -{ - CORBA_Environment ev; - EBookOp *op; - ECardCursor *cursor; - - op = e_book_pop_op (book); - - if (op == NULL) { - g_warning ("e_book_do_response_get_cursor: Cannot find operation " - "in local op queue!\n"); - return; - } - - cursor = e_card_cursor_new(resp->cursor); - - if (op->cb) - ((EBookCursorCallback) op->cb) (book, resp->status, cursor, op->closure); - - /* - * Release the remote Evolution_Book in the PAS. - */ - CORBA_exception_init (&ev); - - Bonobo_Unknown_unref (resp->cursor, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_do_response_get_cursor: Exception unref'ing " - "remote Evolution_CardCursor interface!\n"); - CORBA_exception_free (&ev); - CORBA_exception_init (&ev); - } - - CORBA_Object_release (resp->cursor, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_do_response_get_cursor: Exception releasing " - "remote Evolution_CardCursor interface!\n"); - } - - CORBA_exception_free (&ev); - - gtk_object_unref(GTK_OBJECT(cursor)); - - g_free (op); -} - -static void -e_book_do_response_get_view (EBook *book, - EBookListenerResponse *resp) -{ - CORBA_Environment ev; - EBookOp *op; - EBookView *book_view; - - op = e_book_pop_op (book); - - if (op == NULL) { - g_warning ("e_book_do_response_get_view: Cannot find operation " - "in local op queue!\n"); - return; - } - - book_view = e_book_view_new(resp->book_view, op->listener); - - if (op->cb) - ((EBookBookViewCallback) op->cb) (book, resp->status, book_view, op->closure); - - /* - * Release the remote Evolution_Book in the PAS. - */ - CORBA_exception_init (&ev); - - Bonobo_Unknown_unref (resp->book_view, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_do_response_get_view: Exception unref'ing " - "remote Evolution_BookView interface!\n"); - CORBA_exception_free (&ev); - CORBA_exception_init (&ev); - } - - CORBA_Object_release (resp->book_view, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_do_response_get_view: Exception releasing " - "remote Evolution_BookView interface!\n"); - } - - CORBA_exception_free (&ev); - - gtk_object_unref(GTK_OBJECT(book_view)); - bonobo_object_unref(BONOBO_OBJECT(op->listener)); - - g_free (op); -} - -static void -e_book_do_response_open (EBook *book, - EBookListenerResponse *resp) -{ - EBookOp *op; - - if (resp->status == E_BOOK_STATUS_SUCCESS) { - book->priv->corba_book = resp->book; - book->priv->load_state = URILoaded; - } - - op = e_book_pop_op (book); - - if (op == NULL) { - g_warning ("e_book_do_response_open: Cannot find operation " - "in local op queue!\n"); - return; - } - - if (op->cb) - ((EBookCallback) op->cb) (book, resp->status, op->closure); - g_free (op); -} - -static void -e_book_do_progress_event (EBook *book, - EBookListenerResponse *resp) -{ - gtk_signal_emit (GTK_OBJECT (book), e_book_signals [OPEN_PROGRESS], - resp->msg, resp->percent); - - g_free (resp->msg); -} - -static void -e_book_do_link_event (EBook *book, - EBookListenerResponse *resp) -{ - gtk_signal_emit (GTK_OBJECT (book), e_book_signals [LINK_STATUS], - resp->connected); -} - - -/* - * Reading notices out of the EBookListener's queue. - */ -static void -e_book_check_listener_queue (EBookListener *listener, EBook *book) -{ - EBookListenerResponse *resp; - - resp = e_book_listener_pop_response (listener); - - if (resp == NULL) - return; - - switch (resp->op) { - case CreateCardResponse: - e_book_do_response_create_card (book, resp); - break; - case RemoveCardResponse: - case ModifyCardResponse: - e_book_do_response_generic (book, resp); - break; - case GetCursorResponse: - e_book_do_response_get_cursor (book, resp); - break; - case GetBookViewResponse: - e_book_do_response_get_view(book, resp); - break; - case OpenBookResponse: - e_book_do_response_open (book, resp); - break; - - case OpenProgressEvent: - e_book_do_progress_event (book, resp); - break; - case LinkStatusEvent: - e_book_do_link_event (book, resp); - break; - default: - g_error ("EBook: Unknown operation %d in listener queue!\n", - resp->op); - } - - g_free (resp); -} - -/** - * e_book_load_uri: - */ -gboolean -e_book_load_uri (EBook *book, - const char *uri, - EBookCallback open_response, - gpointer closure) -{ - CORBA_Environment ev; - - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - g_return_val_if_fail (uri != NULL, FALSE); - g_return_val_if_fail (open_response != NULL, FALSE); - - if (book->priv->load_state != URINotLoaded) { - g_warning ("e_book_load_uri: Attempted to load a URI " - "on a book which already has a URI loaded!\n"); - return FALSE; - } - - /* - * Create our local BookListener interface. - */ - book->priv->listener = e_book_listener_new (); - if (book->priv->listener == NULL) { - g_warning ("e_book_load_uri: Could not create EBookListener!\n"); - return FALSE; - } - - gtk_signal_connect (GTK_OBJECT (book->priv->listener), "responses_queued", - e_book_check_listener_queue, book); - - /* - * Load the addressbook into the PAS. - */ - CORBA_exception_init (&ev); - - Evolution_BookFactory_open_book ( - book->priv->book_factory, uri, - bonobo_object_corba_objref (BONOBO_OBJECT (book->priv->listener)), - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_load_uri: CORBA exception while opening addressbook!\n"); - CORBA_exception_free (&ev); - return FALSE; - } - - CORBA_exception_free (&ev); - - book->priv->load_state = URILoading; - - e_book_queue_op (book, open_response, closure, NULL); - - /* Now we play the waiting game. */ - - return TRUE; -} - -/** - * e_book_unload_uri: - */ -void -e_book_unload_uri (EBook *book) -{ - CORBA_Environment ev; - - g_return_if_fail (book != NULL); - g_return_if_fail (E_IS_BOOK (book)); - - /* - * FIXME: Make sure this works if the URI is still being - * loaded. - */ - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_unload_uri: No URI is loaded!\n"); - return; - } - - /* - * Release the remote Evolution_Book in the PAS. - */ - CORBA_exception_init (&ev); - - Bonobo_Unknown_unref (book->priv->corba_book, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_unload_uri: Exception unref'ing " - "remote Evolution_Book interface!\n"); - CORBA_exception_free (&ev); - CORBA_exception_init (&ev); - } - - CORBA_Object_release (book->priv->corba_book, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_unload_uri: Exception releasing " - "remote book interface!\n"); - } - - CORBA_exception_free (&ev); - - bonobo_object_unref (BONOBO_OBJECT (book->priv->listener)); - - book->priv->listener = NULL; - book->priv->load_state = URINotLoaded; -} - -static gboolean -e_book_construct (EBook *book) -{ - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - - /* - * Connect to the Personal Addressbook Server. - */ - -#ifdef USING_OAF - book->priv->book_factory = (Evolution_BookFactory) - oaf_activate_from_id (CARDSERVER_OAF_ID, 0, NULL, NULL); -#else - book->priv->book_factory = (Evolution_BookFactory) - goad_server_activate_with_id (NULL, CARDSERVER_GOAD_ID, 0, NULL); -#endif - - if (book->priv->book_factory == CORBA_OBJECT_NIL) { - g_warning ("e_book_construct: Could not obtain a handle " - "to the Personal Addressbook Server!\n"); - return FALSE; - } - - return TRUE; -} - -/** - * e_book_new: - */ -EBook * -e_book_new (void) -{ - EBook *book; - - book = gtk_type_new (E_BOOK_TYPE); - - if (! e_book_construct (book)) { - gtk_object_unref (GTK_OBJECT (book)); - return NULL; - } - - return book; -} - -/* Fetching cards */ - -/** - * e_book_get_card: - */ -ECard * -e_book_get_card (EBook *book, - const char *id) -{ - char *vcard; - ECard *card; - - g_return_val_if_fail (book != NULL, NULL); - g_return_val_if_fail (E_IS_BOOK (book), NULL); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_get_card: No URI loaded!\n"); - return NULL; - } - - vcard = e_book_get_vcard (book, id); - - if (vcard == NULL) { - g_warning ("e_book_get_card: Got bogus VCard from PAS!\n"); - return NULL; - } - - card = e_card_new (vcard); - g_free(vcard); - - e_card_set_id(card, id); - - return card; -} - -/** - * e_book_get_vcard: - */ -char * -e_book_get_vcard (EBook *book, - const char *id) -{ - CORBA_Environment ev; - char *retval; - char *vcard; - - g_return_val_if_fail (book != NULL, NULL); - g_return_val_if_fail (E_IS_BOOK (book), NULL); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_get_vcard: No URI loaded!\n"); - return NULL; - } - - CORBA_exception_init (&ev); - - vcard = Evolution_Book_get_vcard (book->priv->corba_book, - (Evolution_CardId) id, - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_get_vcard: Exception getting VCard from PAS!\n"); - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - if (vcard == NULL || strlen (vcard) == 0) { - g_warning ("e_book_get_vcard: Got NULL VCard from PAS!\n"); - return NULL; - } - - retval = g_strdup (vcard); - CORBA_free (vcard); - - return retval; -} - -/* Deleting cards. */ - -/** - * e_book_remove_card: - */ -gboolean -e_book_remove_card (EBook *book, - ECard *card, - EBookCallback cb, - gpointer closure) -{ - const char *id; - - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - g_return_val_if_fail (card != NULL, FALSE); - g_return_val_if_fail (E_IS_CARD (card), FALSE); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_remove_card: No URI loaded!\n"); - return FALSE; - } - - id = e_card_get_id (card); - g_assert (id != NULL); - - return e_book_remove_card_by_id (book, id, cb, closure); -} - -/** - * e_book_remove_card_by_id: - */ -gboolean -e_book_remove_card_by_id (EBook *book, - const char *id, - EBookCallback cb, - gpointer closure) - -{ - CORBA_Environment ev; - - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - g_return_val_if_fail (id != NULL, FALSE); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_remove_card_by_id: No URI loaded!\n"); - return FALSE; - } - - CORBA_exception_init (&ev); - - Evolution_Book_remove_card ( - book->priv->corba_book, (const Evolution_CardId) id, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_remove_card_by_id: CORBA exception " - "talking to PAS!\n"); - CORBA_exception_free (&ev); - return FALSE; - } - - CORBA_exception_free (&ev); - - e_book_queue_op (book, cb, closure, NULL); - - return TRUE; -} - -/* Adding cards. */ - -/** - * e_book_add_card: - */ -gboolean -e_book_add_card (EBook *book, - ECard *card, - EBookIdCallback cb, - gpointer closure) - -{ - char *vcard; - gboolean retval; - - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - g_return_val_if_fail (card != NULL, FALSE); - g_return_val_if_fail (E_IS_CARD (card), FALSE); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_add_card: No URI loaded!\n"); - return FALSE; - } - - vcard = e_card_get_vcard (card); - - if (vcard == NULL) { - g_warning ("e_book_add_card: Cannot convert card to VCard string!\n"); - return FALSE; - } - - retval = e_book_add_vcard (book, vcard, cb, closure); - - g_free (vcard); - - return retval; -} - -/** - * e_book_add_vcard: - */ -gboolean -e_book_add_vcard (EBook *book, - const char *vcard, - EBookIdCallback cb, - gpointer closure) -{ - CORBA_Environment ev; - - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - g_return_val_if_fail (vcard != NULL, FALSE); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_add_vcard: No URI loaded!\n"); - return FALSE; - } - - CORBA_exception_init (&ev); - - Evolution_Book_create_card ( - book->priv->corba_book, (const Evolution_VCard) vcard, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_add_vcard: Exception adding card to PAS!\n"); - CORBA_exception_free (&ev); - return FALSE; - } - - CORBA_exception_free (&ev); - - e_book_queue_op (book, (EBookCallback) cb, closure, NULL); - - return TRUE; -} - -/* Modifying cards. */ - -/** - * e_book_commit_card: - */ -gboolean -e_book_commit_card (EBook *book, - ECard *card, - EBookCallback cb, - gpointer closure) -{ - char *vcard; - gboolean retval; - - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - g_return_val_if_fail (card != NULL, FALSE); - g_return_val_if_fail (E_IS_CARD (card), FALSE); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_commit_card: No URI loaded!\n"); - return FALSE; - } - - vcard = e_card_get_vcard (card); - - if (vcard == NULL) { - g_warning ("e_book_commit_card: Error " - "getting VCard for card!\n"); - return FALSE; - } - - retval = e_book_commit_vcard (book, vcard, cb, closure); - - g_free (vcard); - - return retval; -} - -/** - * e_book_commit_vcard: - */ -gboolean -e_book_commit_vcard (EBook *book, - const char *vcard, - EBookCallback cb, - gpointer closure) -{ - CORBA_Environment ev; - - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - g_return_val_if_fail (vcard != NULL, FALSE); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_commit_vcard: No URI loaded!\n"); - return FALSE; - } - - CORBA_exception_init (&ev); - - Evolution_Book_modify_card ( - book->priv->corba_book, (const Evolution_VCard) vcard, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_commit_vcard: Exception " - "modifying card in PAS!\n"); - CORBA_exception_free (&ev); - return FALSE; - } - - CORBA_exception_free (&ev); - - e_book_queue_op (book, cb, closure, NULL); - - return TRUE; -} - -/** - * e_book_check_connection: - */ -gboolean -e_book_check_connection (EBook *book) -{ - CORBA_Environment ev; - - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_check_connection: No URI loaded!\n"); - return FALSE; - } - - CORBA_exception_init (&ev); - - Evolution_Book_check_connection (book->priv->corba_book, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_check_connection: Exception " - "querying the PAS!\n"); - CORBA_exception_free (&ev); - return FALSE; - } - - CORBA_exception_free (&ev); - - return TRUE; -} - -gboolean e_book_get_cursor (EBook *book, - gchar *query, - EBookCursorCallback cb, - gpointer closure) -{ - CORBA_Environment ev; - - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_check_connection: No URI loaded!\n"); - return FALSE; - } - - CORBA_exception_init (&ev); - - Evolution_Book_get_cursor (book->priv->corba_book, query, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_get_all_cards: Exception " - "querying list of cards!\n"); - CORBA_exception_free (&ev); - return FALSE; - } - - CORBA_exception_free (&ev); - - e_book_queue_op (book, cb, closure, NULL); - - return TRUE; -} - -gboolean e_book_get_book_view (EBook *book, - gchar *query, - EBookBookViewCallback cb, - gpointer closure) -{ - CORBA_Environment ev; - EBookViewListener *listener; - - g_return_val_if_fail (book != NULL, FALSE); - g_return_val_if_fail (E_IS_BOOK (book), FALSE); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_get_book_view: No URI loaded!\n"); - return FALSE; - } - - listener = e_book_view_listener_new(); - - CORBA_exception_init (&ev); - - Evolution_Book_get_book_view (book->priv->corba_book, bonobo_object_corba_objref(BONOBO_OBJECT(listener)), query, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_get_book_view: Exception " - "getting book_view!\n"); - CORBA_exception_free (&ev); - return FALSE; - } - - CORBA_exception_free (&ev); - - e_book_queue_op (book, cb, closure, listener); - - return TRUE; -} - -/** - * e_book_get_name: - */ -char * -e_book_get_name (EBook *book) -{ - CORBA_Environment ev; - char *retval; - char *name; - - g_return_val_if_fail (book != NULL, NULL); - g_return_val_if_fail (E_IS_BOOK (book), NULL); - - if (book->priv->load_state != URILoaded) { - g_warning ("e_book_get_name: No URI loaded!\n"); - return NULL; - } - - CORBA_exception_init (&ev); - - name = Evolution_Book_get_name (book->priv->corba_book, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("e_book_get_name: Exception getting name from PAS!\n"); - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - if (name == NULL) { - g_warning ("e_book_get_name: Got NULL name from PAS!\n"); - return NULL; - } - - retval = g_strdup (name); - CORBA_free (name); - - return retval; -} - -static void -e_book_init (EBook *book) -{ - book->priv = g_new0 (EBookPrivate, 1); - book->priv->load_state = URINotLoaded; -} - -static void -e_book_destroy (GtkObject *object) -{ - EBook *book = E_BOOK (object); - CORBA_Environment ev; - - if (book->priv->load_state == URILoaded) - e_book_unload_uri (book); - - CORBA_exception_init (&ev); - - CORBA_Object_release (book->priv->book_factory, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("EBook: Exception while releasing BookFactory\n"); - - CORBA_exception_free (&ev); - CORBA_exception_init (&ev); - } - - g_free (book->priv); - - GTK_OBJECT_CLASS (e_book_parent_class)->destroy (object); -} - -static void -e_book_class_init (EBookClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - - e_book_parent_class = gtk_type_class (gtk_object_get_type ()); - - e_book_signals [LINK_STATUS] = - gtk_signal_new ("link_status", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EBookClass, link_status), - gtk_marshal_NONE__BOOL, - GTK_TYPE_NONE, 1, - GTK_TYPE_BOOL); - - gtk_object_class_add_signals (object_class, e_book_signals, - LAST_SIGNAL); - - object_class->destroy = e_book_destroy; -} - -/** - * e_book_get_type: - */ -GtkType -e_book_get_type (void) -{ - static GtkType type = 0; - - if (! type) { - GtkTypeInfo info = { - "EBook", - sizeof (EBook), - sizeof (EBookClass), - (GtkClassInitFunc) e_book_class_init, - (GtkObjectInitFunc) e_book_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (gtk_object_get_type (), &info); - } - - return type; -} diff --git a/addressbook/backend/ebook/e-book.h b/addressbook/backend/ebook/e-book.h deleted file mode 100644 index a57c7263b3..0000000000 --- a/addressbook/backend/ebook/e-book.h +++ /dev/null @@ -1,123 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * The Evolution addressbook client object. - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 1999, 2000, Helix Code, Inc. - */ - -#ifndef __E_BOOK_H__ -#define __E_BOOK_H__ - -#include <libgnome/gnome-defs.h> - -#include <addressbook/backend/ebook/e-card.h> -#include <addressbook/backend/ebook/e-card-cursor.h> -#include <addressbook/backend/ebook/e-book-view.h> -#include <addressbook/backend/ebook/e-book-types.h> - -BEGIN_GNOME_DECLS - -typedef struct _EBook EBook; -typedef struct _EBookClass EBookClass; -typedef struct _EBookPrivate EBookPrivate; - -struct _EBook { - GtkObject parent; - EBookPrivate *priv; -}; - -struct _EBookClass { - GtkObjectClass parent; - - /* - * Signals. - */ - void (* open_progress) (EBook *book, const char *msg, short percent); - void (* link_status) (EBook *book, gboolean connected); -}; - -/* Callbacks for asynchronous functions. */ -typedef void (*EBookCallback) (EBook *book, EBookStatus status, gpointer closure); -typedef void (*EBookOpenProgressCallback) (EBook *book, - const char *status_message, - short percent, - gpointer closure); -typedef void (*EBookIdCallback) (EBook *book, EBookStatus status, const char *id, gpointer closure); -typedef void (*EBookCursorCallback) (EBook *book, EBookStatus status, ECardCursor *cursor, gpointer closure); -typedef void (*EBookBookViewCallback) (EBook *book, EBookStatus status, EBookView *book_view, gpointer closure); - - -/* Creating a new addressbook. */ -EBook *e_book_new (void); -gboolean e_book_load_uri (EBook *book, - const char *uri, - EBookCallback open_response, - gpointer closure); -void e_book_unload_uri (EBook *book); - -/* Fetching cards. */ -ECard *e_book_get_card (EBook *book, - const char *id); -char *e_book_get_vcard (EBook *book, - const char *id); - -/* Deleting cards. */ -gboolean e_book_remove_card (EBook *book, - ECard *card, - EBookCallback cb, - gpointer closure); -gboolean e_book_remove_card_by_id (EBook *book, - const char *id, - EBookCallback cb, - gpointer closure); - -/* Adding cards. */ -gboolean e_book_add_card (EBook *book, - ECard *card, - EBookIdCallback cb, - gpointer closure); -gboolean e_book_add_vcard (EBook *book, - const char *vcard, - EBookIdCallback cb, - gpointer closure); - -/* Modifying cards. */ -gboolean e_book_commit_card (EBook *book, - ECard *card, - EBookCallback cb, - gpointer closure); -gboolean e_book_commit_vcard (EBook *book, - const char *vcard, - EBookCallback cb, - gpointer closure); - -/* Checking to see if we're connected to the card repository. */ -gboolean e_book_check_connection (EBook *book); - -gboolean e_book_get_cursor (EBook *book, - char *query, - EBookCursorCallback cb, - gpointer closure); - -gboolean e_book_get_book_view (EBook *book, - char *query, - EBookBookViewCallback cb, - gpointer closure); - -/* Getting the name of the repository. */ -char *e_book_get_name (EBook *book); - -GtkType e_book_get_type (void); - -#define E_BOOK_TYPE (e_book_get_type ()) -#define E_BOOK(o) (GTK_CHECK_CAST ((o), E_BOOK_TYPE, EBook)) -#define E_BOOK_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_BOOK_TYPE, EBookClass)) -#define E_IS_BOOK(o) (GTK_CHECK_TYPE ((o), E_BOOK_TYPE)) -#define E_IS_BOOK_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_BOOK_TYPE)) - -END_GNOME_DECLS - -#endif /* ! __E_BOOK_H__ */ diff --git a/addressbook/backend/ebook/e-card-cursor.c b/addressbook/backend/ebook/e-card-cursor.c deleted file mode 100644 index 1618a6ddee..0000000000 --- a/addressbook/backend/ebook/e-card-cursor.c +++ /dev/null @@ -1,235 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-card-cursor.c: Implements card cursors. - * - * Author: - * Christopher James Lahey <clahey@helixcode.com. - */ - -#include <config.h> -#include <gtk/gtk.h> -#include "addressbook.h" -#include "e-card-cursor.h" - -struct _ECardCursorPrivate { - Evolution_CardCursor corba_cursor; -}; - -/* - * A pointer to our parent object class - */ -static GtkObjectClass *parent_class; - -/* - * Implemented GtkObject::destroy - */ -static void -e_card_cursor_destroy (GtkObject *object) -{ - ECardCursor *cursor = E_CARD_CURSOR (object); - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - Evolution_CardCursor_unref( cursor->priv->corba_cursor, &ev ); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning("e_card_cursor_destroy: Exception unreffing " - "corba cursor.\n"); - CORBA_exception_free (&ev); - CORBA_exception_init (&ev); - } - - CORBA_Object_release (cursor->priv->corba_cursor, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning("e_card_cursor_destroy: Exception releasing " - "corba cursor.\n"); - } - - CORBA_exception_free (&ev); - - if ( cursor->priv ) - g_free ( cursor->priv ); - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -/** - * e_card_cursor_get_length: - * @cursor: the #ECardCursor whose length is being queried - * - * Returns: the number of items the cursor references, or -1 there's - * an error. - */ -long -e_card_cursor_get_length (ECardCursor *cursor) -{ - if ( cursor->priv->corba_cursor != CORBA_OBJECT_NIL ) { - CORBA_Environment ev; - long ret_val; - - CORBA_exception_init (&ev); - - ret_val = Evolution_CardCursor_get_length(cursor->priv->corba_cursor, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning("e_card_cursor_get_length: Exception during " - "get_length corba call.\n"); - ret_val = -1; - } - - CORBA_exception_free (&ev); - - return ret_val; - } - else - return -1; -} - -/** - * e_card_cursor_get_nth: - * @cursor: an #ECardCursor object - * @n: the index of the item requested - * - * Gets an #ECard based on an index. - * - * Returns: a new #ECard on success, or %NULL on failure. - */ -ECard * -e_card_cursor_get_nth (ECardCursor *cursor, - const long n) -{ - if ( cursor->priv->corba_cursor != CORBA_OBJECT_NIL ) { - CORBA_Environment en; - CORBA_char *vcard; - ECard *card; - - CORBA_exception_init (&en); - - vcard = Evolution_CardCursor_get_nth(cursor->priv->corba_cursor, n, &en); - - if (en._major != CORBA_NO_EXCEPTION) { - g_warning("e_card_cursor_get_nth: Exception during " - "get_nth corba call.\n"); - } - - CORBA_exception_free (&en); - - card = e_card_new (vcard); - - CORBA_free(vcard); - - return card; - } - else - return e_card_new(""); -} - -static void -e_card_cursor_class_init (ECardCursorClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - - parent_class = gtk_type_class (gtk_object_get_type ()); - - object_class->destroy = e_card_cursor_destroy; -} - -static void -e_card_cursor_init (ECardCursor *cursor) -{ - cursor->priv = g_new(ECardCursorPrivate, 1); - cursor->priv->corba_cursor = CORBA_OBJECT_NIL; -} - -GtkType -e_card_cursor_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "ECardCursor", - sizeof (ECardCursor), - sizeof (ECardCursorClass), - (GtkClassInitFunc) e_card_cursor_class_init, - (GtkObjectInitFunc) e_card_cursor_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (gtk_object_get_type (), &info); - } - - return type; -} - -/** - * e_card_cursor_construct: - * @cursor: an #ECardCursor object - * @corba_cursor: an #Evolution_CardCursor - * - * Wraps an #Evolution_CardCursor object inside the #ECardCursor - * @cursor object. - * - * Returns: a new #ECardCursor on success, or %NULL on failure. - */ -ECardCursor * -e_card_cursor_construct (ECardCursor *cursor, - Evolution_CardCursor corba_cursor) -{ - CORBA_Environment ev; - g_return_val_if_fail (cursor != NULL, NULL); - g_return_val_if_fail (E_IS_CARD_CURSOR (cursor), NULL); - g_return_val_if_fail (corba_cursor != CORBA_OBJECT_NIL, NULL); - - CORBA_exception_init (&ev); - - /* - * Initialize cursor - */ - cursor->priv->corba_cursor = CORBA_Object_duplicate(corba_cursor, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning("e_card_cursor_construct: Exception duplicating " - "corba cursor.\n"); - CORBA_exception_free (&ev); - CORBA_exception_init (&ev); - } - - Evolution_CardCursor_ref(cursor->priv->corba_cursor, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning("e_card_cursor_construct: Exception reffing " - "corba cursor.\n"); - } - - CORBA_exception_free (&ev); - - /* - * Success: return the GtkType we were given - */ - return cursor; -} - -/** - * e_card_cursor_new: - * @cursor: the #Evolution_CardCursor to be wrapped - * - * Creates a new #ECardCursor, which wraps an #Evolution_CardCursor - * object. - * - * Returns: a new #ECardCursor on success, or %NULL on failure. - */ -ECardCursor * -e_card_cursor_new (Evolution_CardCursor corba_cursor) -{ - ECardCursor *cursor; - - cursor = gtk_type_new (e_card_cursor_get_type ()); - - return e_card_cursor_construct (cursor, - corba_cursor); -} diff --git a/addressbook/backend/ebook/e-card-cursor.h b/addressbook/backend/ebook/e-card-cursor.h deleted file mode 100644 index b318e646c4..0000000000 --- a/addressbook/backend/ebook/e-card-cursor.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#ifndef __E_CARD_CURSOR_H__ -#define __E_CARD_CURSOR_H__ - -#include <libgnome/gnome-defs.h> -#include <gtk/gtk.h> -#include <addressbook/backend/ebook/addressbook.h> -#include <addressbook/backend/ebook/e-card.h> - -BEGIN_GNOME_DECLS - -typedef struct _ECardCursor ECardCursor; -typedef struct _ECardCursorPrivate ECardCursorPrivate; -typedef struct _ECardCursorClass ECardCursorClass; - -struct _ECardCursor { - GtkObject parent; - ECardCursorPrivate *priv; -}; - -struct _ECardCursorClass { - GtkObjectClass parent; -}; - -/* Creating a new addressbook. */ -ECardCursor *e_card_cursor_new (Evolution_CardCursor corba_cursor); -ECardCursor *e_card_cursor_construct (ECardCursor *cursor, - Evolution_CardCursor corba_cursor); - -GtkType e_card_cursor_get_type (void); - -/* Fetching cards. */ -long e_card_cursor_get_length (ECardCursor *cursor); -ECard *e_card_cursor_get_nth (ECardCursor *cursor, - const long nth); -#define E_CARD_CURSOR_TYPE (e_card_cursor_get_type ()) -#define E_CARD_CURSOR(o) (GTK_CHECK_CAST ((o), E_CARD_CURSOR_TYPE, ECardCursor)) -#define E_CARD_CURSOR_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CARD_CURSOR_TYPE, ECardCursorClass)) -#define E_IS_CARD_CURSOR(o) (GTK_CHECK_TYPE ((o), E_CARD_CURSOR_TYPE)) -#define E_IS_CARD_CURSOR_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CARD_CURSOR_TYPE)) - -END_GNOME_DECLS - -#endif /* ! __E_CARD_CURSOR_H__ */ diff --git a/addressbook/backend/ebook/e-card-pairs.h b/addressbook/backend/ebook/e-card-pairs.h deleted file mode 100644 index 0f379d3477..0000000000 --- a/addressbook/backend/ebook/e-card-pairs.h +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* GnomeCard - a graphical contact manager. - * - * pairs.h: This file is part of GnomeCard. - * - * Copyright (C) 1999 The Free Software Foundation - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __E_CARD_PAIRS_H__ -#define __E_CARD_PAIRS_H__ - -#include <libversit/vcc.h> -#include <ebook/e-card.h> - - -#if 0 -struct pair -{ - char *str; - ECardPropertyType i ; -}; - -struct pair prop_lookup[] = { - { VCFullNameProp, PROP_FNAME }, - { VCNameProp, PROP_NAME }, - { VCPhotoProp, PROP_PHOTO }, - { VCBirthDateProp, PROP_BDAY }, - { VCAdrProp, PROP_DELADDR }, - { VCDeliveryLabelProp, PROP_DELLABEL }, - { VCTelephoneProp, PROP_PHONE }, - { VCEmailAddressProp, PROP_EMAIL }, - { VCMailerProp, PROP_MAILER }, - { VCTimeZoneProp, PROP_TIMEZN }, - { VCGeoProp, PROP_GEOPOS }, - { VCTitleProp, PROP_TITLE }, - { VCBusinessRoleProp, PROP_ROLE }, - { VCLogoProp, PROP_LOGO }, - { VCAgentProp, PROP_AGENT }, - { VCOrgProp, PROP_ORG }, - { VCCategoriesProp, PROP_CATEGORIES }, - { VCCommentProp, PROP_COMMENT }, - { VCLastRevisedProp, PROP_REV }, - { VCPronunciationProp, PROP_SOUND }, - { VCURLProp, PROP_URL }, - { VCUniqueStringProp, PROP_UID }, - { VCVersionProp, PROP_VERSION }, - { VCPublicKeyProp, PROP_KEY }, - { VCValueProp, PROP_VALUE }, - { VCEncodingProp, PROP_ENCODING }, - { VCQuotedPrintableProp, PROP_QUOTED_PRINTABLE }, - { VC8bitProp, PROP_8BIT }, - { VCBase64Prop, PROP_BASE64 }, - { VCLanguageProp, PROP_LANG }, - { VCCharSetProp, PROP_CHARSET }, - { NULL, PROP_NONE} }; - -struct pair photo_pairs[] = { - { VCGIFProp, PHOTO_GIF }, - { VCCGMProp, PHOTO_CGM }, - { VCWMFProp, PHOTO_WMF }, - { VCBMPProp, PHOTO_BMP }, - { VCMETProp, PHOTO_MET }, - { VCPMBProp, PHOTO_PMB }, - { VCDIBProp, PHOTO_DIB }, - { VCPICTProp, PHOTO_PICT }, - { VCTIFFProp, PHOTO_TIFF }, - { VCPDFProp, PHOTO_PDF }, - { VCPSProp, PHOTO_PS }, - { VCJPEGProp, PHOTO_JPEG }, - { VCMPEGProp, PHOTO_MPEG }, - { VCMPEG2Prop, PHOTO_MPEG2 }, - { VCAVIProp, PHOTO_AVI }, - { VCQuickTimeProp, PHOTO_QTIME }, - { NULL, 0 } }; - -struct pair email_pairs[] = { - { VCAOLProp, EMAIL_AOL }, - { VCAppleLinkProp, EMAIL_APPLE_LINK }, - { VCATTMailProp, EMAIL_ATT }, - { VCCISProp, EMAIL_CIS }, - { VCEWorldProp, EMAIL_EWORLD }, - { VCInternetProp, EMAIL_INET }, - { VCIBMMailProp, EMAIL_IBM }, - { VCMCIMailProp, EMAIL_MCI }, - { VCPowerShareProp, EMAIL_POWERSHARE }, - { VCProdigyProp, EMAIL_PRODIGY }, - { VCTLXProp, EMAIL_TLX }, - { VCX400Prop, EMAIL_X400 }, - { NULL, 0 } }; - -struct pair sound_pairs[] = { - { VCAIFFProp, SOUND_AIFF }, - { VCPCMProp, SOUND_PCM }, - { VCWAVEProp, SOUND_WAVE }, - { NULL, 0 } }; - -struct pair key_pairs[] = { - { VCX509Prop, KEY_X509 }, - { VCPGPProp, KEY_PGP }, - { NULL, 0 } }; - - -#endif -#endif /* ! __E_CARD_PAIRS_H__ */ diff --git a/addressbook/backend/ebook/e-card-simple.c b/addressbook/backend/ebook/e-card-simple.c deleted file mode 100644 index 0efda1a8d7..0000000000 --- a/addressbook/backend/ebook/e-card-simple.c +++ /dev/null @@ -1,1208 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@helixcode.com> - * Arturo Espinosa (arturo@nuclecu.unam.mx) - * Nat Friedman (nat@helixcode.com) - * - * Copyright (C) 2000 Helix Code, Inc. - * Copyright (C) 1999 The Free Software Foundation - */ - -#include <config.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <gtk/gtk.h> - -#include <libversit/vcc.h> -#include "e-card-simple.h" - -/* Object argument IDs */ -enum { - ARG_0, - ARG_CARD, -#if 0 - ARG_FILE_AS, - ARG_FULL_NAME, - ARG_NAME, - ARG_ADDRESS, - ARG_ADDRESS_LABEL, - ARG_PHONE, - ARG_EMAIL, - ARG_BIRTH_DATE, - ARG_URL, - ARG_ORG, - ARG_ORG_UNIT, - ARG_OFFICE, - ARG_TITLE, - ARG_ROLE, - ARG_MANAGER, - ARG_ASSISTANT, - ARG_NICKNAME, - ARG_SPOUSE, - ARG_ANNIVERSARY, - ARG_FBURL, - ARG_NOTE, - ARG_ID -#endif -}; - - -typedef enum _ECardSimpleInternalType ECardSimpleInternalType; -typedef struct _ECardSimpleFieldData ECardSimpleFieldData; - -enum _ECardSimpleInternalType { - E_CARD_SIMPLE_INTERNAL_TYPE_STRING, - E_CARD_SIMPLE_INTERNAL_TYPE_DATE, - E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS, - E_CARD_SIMPLE_INTERNAL_TYPE_PHONE, - E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL, - E_CARD_SIMPLE_INTERNAL_TYPE_SPECIAL, -}; - -struct _ECardSimpleFieldData { - ECardSimpleField field; - char *ecard_field; - char *name; - char *short_name; - int list_type_index; - ECardSimpleInternalType type; -}; - -/* This order must match the order in the .h. */ - -static ECardSimpleFieldData field_data[] = -{ - { E_CARD_SIMPLE_FIELD_FILE_AS, "file_as", "File As", "", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING }, - { E_CARD_SIMPLE_FIELD_FULL_NAME, "full_name", "Name", "Name", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING }, - { E_CARD_SIMPLE_FIELD_EMAIL, "", "Email", "Email", E_CARD_SIMPLE_EMAIL_ID_EMAIL, E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL }, - { E_CARD_SIMPLE_FIELD_PHONE_PRIMARY, "", "Primary", "Prim", E_CARD_SIMPLE_PHONE_ID_PRIMARY, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE }, - { E_CARD_SIMPLE_FIELD_PHONE_BUSINESS, "", "Business", "Bus", E_CARD_SIMPLE_PHONE_ID_BUSINESS, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE }, - { E_CARD_SIMPLE_FIELD_PHONE_HOME, "", "Home", "Home", E_CARD_SIMPLE_PHONE_ID_HOME, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE }, - { E_CARD_SIMPLE_FIELD_ORG, "org", "Organization", "Org", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING }, - { E_CARD_SIMPLE_FIELD_ADDRESS_BUSINESS, "", "Business", "Bus", E_CARD_SIMPLE_ADDRESS_ID_BUSINESS, E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS }, - { E_CARD_SIMPLE_FIELD_ADDRESS_HOME, "", "Home", "Home", E_CARD_SIMPLE_ADDRESS_ID_HOME, E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS }, - { E_CARD_SIMPLE_FIELD_PHONE_MOBILE, "", "Mobile", "Mobile", E_CARD_SIMPLE_PHONE_ID_MOBILE, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE }, - { E_CARD_SIMPLE_FIELD_PHONE_CAR, "", "Car", "Car", E_CARD_SIMPLE_PHONE_ID_CAR, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE }, - { E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_FAX, "", "Business Fax", "Bus Fax", E_CARD_SIMPLE_PHONE_ID_BUSINESS_FAX, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE }, - { E_CARD_SIMPLE_FIELD_PHONE_HOME_FAX, "", "Home Fax", "Home Fax", E_CARD_SIMPLE_PHONE_ID_HOME_FAX, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE }, - { E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_2, "", "Business 2", "Bus 2", E_CARD_SIMPLE_PHONE_ID_BUSINESS_2, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE }, - { E_CARD_SIMPLE_FIELD_PHONE_HOME_2, "", "Home 2", "Home 2", E_CARD_SIMPLE_PHONE_ID_HOME_2, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE }, - { E_CARD_SIMPLE_FIELD_PHONE_ISDN, "", "ISDN", "ISDN", E_CARD_SIMPLE_PHONE_ID_ISDN, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE }, - { E_CARD_SIMPLE_FIELD_PHONE_OTHER, "", "Other", "Other", E_CARD_SIMPLE_PHONE_ID_OTHER, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE }, - { E_CARD_SIMPLE_FIELD_PHONE_PAGER, "", "Pager", "Pager", E_CARD_SIMPLE_PHONE_ID_PAGER, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE }, - { E_CARD_SIMPLE_FIELD_ADDRESS_OTHER, "", "Other", "Other", E_CARD_SIMPLE_ADDRESS_ID_OTHER, E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS }, - { E_CARD_SIMPLE_FIELD_EMAIL_2, "", "Email 2", "Email 2", E_CARD_SIMPLE_EMAIL_ID_EMAIL_2, E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL }, - { E_CARD_SIMPLE_FIELD_EMAIL_3, "", "Email 3", "Email 3", E_CARD_SIMPLE_EMAIL_ID_EMAIL_3, E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL }, - { E_CARD_SIMPLE_FIELD_URL, "url", "Web Site", "Url", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING }, - { E_CARD_SIMPLE_FIELD_ORG_UNIT, "org_unit", "Department", "Dep", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING }, - { E_CARD_SIMPLE_FIELD_OFFICE, "office", "Office", "Off", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING }, - { E_CARD_SIMPLE_FIELD_TITLE, "title", "Title", "Title", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING }, - { E_CARD_SIMPLE_FIELD_ROLE, "role", "Profession", "Prof", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING }, - { E_CARD_SIMPLE_FIELD_MANAGER, "manager", "Manager", "Man", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING }, - { E_CARD_SIMPLE_FIELD_ASSISTANT, "assistant", "Assistant", "Ass", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING }, - { E_CARD_SIMPLE_FIELD_NICKNAME, "nickname", "Nickname", "Nick", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING }, - { E_CARD_SIMPLE_FIELD_SPOUSE, "spouse", "Spouse", "Spouse", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING }, - { E_CARD_SIMPLE_FIELD_NOTE, "note", "Note", "Note", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING }, - { E_CARD_SIMPLE_FIELD_FBURL, "fburl", "Free-busy URL", "FBUrl", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING }, - { E_CARD_SIMPLE_FIELD_ANNIVERSARY, "anniversary", "Anniversary", "Anniv", 0, E_CARD_SIMPLE_INTERNAL_TYPE_DATE }, - { E_CARD_SIMPLE_FIELD_BIRTH_DATE, "birth_date", "Birth Date", "", 0, E_CARD_SIMPLE_INTERNAL_TYPE_DATE }, - { E_CARD_SIMPLE_FIELD_MAILER, "mailer", "", "", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING }, - { E_CARD_SIMPLE_FIELD_NAME_OR_ORG, "nameororg", "", "", 0, E_CARD_SIMPLE_INTERNAL_TYPE_SPECIAL }, -}; - -static void e_card_simple_init (ECardSimple *simple); -static void e_card_simple_class_init (ECardSimpleClass *klass); - -static void e_card_simple_destroy (GtkObject *object); -static void e_card_simple_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_card_simple_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - -static void fill_in_info(ECardSimple *simple); - -ECardPhoneFlags phone_correspondences[] = { - 0xFF, /* E_CARD_SIMPLE_PHONE_ID_ASSISTANT, */ - E_CARD_PHONE_WORK | E_CARD_PHONE_VOICE, /* E_CARD_SIMPLE_PHONE_ID_BUSINESS, */ - E_CARD_PHONE_WORK | E_CARD_PHONE_VOICE, /* E_CARD_SIMPLE_PHONE_ID_BUSINESS_2, */ - E_CARD_PHONE_WORK | E_CARD_PHONE_FAX, /* E_CARD_SIMPLE_PHONE_ID_BUSINESS_FAX, */ - 0xFF, /* E_CARD_SIMPLE_PHONE_ID_CALLBACK, */ - E_CARD_PHONE_CAR | E_CARD_PHONE_VOICE, /* E_CARD_SIMPLE_PHONE_ID_CAR, */ - 0xFF, /* E_CARD_SIMPLE_PHONE_ID_COMPANY, */ - E_CARD_PHONE_HOME | E_CARD_PHONE_VOICE, /* E_CARD_SIMPLE_PHONE_ID_HOME, */ - E_CARD_PHONE_HOME | E_CARD_PHONE_VOICE, /* E_CARD_SIMPLE_PHONE_ID_HOME_2, */ - E_CARD_PHONE_HOME | E_CARD_PHONE_FAX, /* E_CARD_SIMPLE_PHONE_ID_HOME_FAX, */ - E_CARD_PHONE_ISDN, /* E_CARD_SIMPLE_PHONE_ID_ISDN, */ - E_CARD_PHONE_CELL | E_CARD_PHONE_VOICE, /* E_CARD_SIMPLE_PHONE_ID_MOBILE, */ - E_CARD_PHONE_VOICE, /* E_CARD_SIMPLE_PHONE_ID_OTHER, */ - 0xFF, /* E_CARD_SIMPLE_PHONE_ID_OTHER_FAX, */ - E_CARD_PHONE_PAGER | E_CARD_PHONE_VOICE, /* E_CARD_SIMPLE_PHONE_ID_PAGER, */ - E_CARD_PHONE_PREF, /* E_CARD_SIMPLE_PHONE_ID_PRIMARY, */ - 0xFF, /* E_CARD_SIMPLE_PHONE_ID_RADIO, */ - 0xFF, /* E_CARD_SIMPLE_PHONE_ID_TELEX, */ - 0xFF, /* E_CARD_SIMPLE_PHONE_ID_TTYTTD, */ -}; - -char *phone_names[] = { - NULL, /* E_CARD_SIMPLE_PHONE_ID_ASSISTANT, */ - "Business", - "Business 2", - "Business Fax", - NULL, /* E_CARD_SIMPLE_PHONE_ID_CALLBACK, */ - "Car", - NULL, /* E_CARD_SIMPLE_PHONE_ID_COMPANY, */ - "Home", - "Home 2", - "Home Fax", - "ISDN", - "Mobile", - "Other", - NULL, /* E_CARD_SIMPLE_PHONE_ID_OTHER_FAX, */ - "Pager", - "Primary", - NULL, /* E_CARD_SIMPLE_PHONE_ID_RADIO, */ - NULL, /* E_CARD_SIMPLE_PHONE_ID_TELEX, */ - NULL, /* E_CARD_SIMPLE_PHONE_ID_TTYTTD, */ -}; - -char *phone_short_names[] = { - NULL, /* E_CARD_SIMPLE_PHONE_ID_ASSISTANT, */ - "Bus", - "Bus 2", - "Bus Fax", - NULL, /* E_CARD_SIMPLE_PHONE_ID_CALLBACK, */ - "Car", - NULL, /* E_CARD_SIMPLE_PHONE_ID_COMPANY, */ - "Home", - "Home 2", - "Home Fax", - "ISDN", - "Mob", - "Other", - NULL, /* E_CARD_SIMPLE_PHONE_ID_OTHER_FAX, */ - "Pag", - "Prim", - NULL, /* E_CARD_SIMPLE_PHONE_ID_RADIO, */ - NULL, /* E_CARD_SIMPLE_PHONE_ID_TELEX, */ - NULL, /* E_CARD_SIMPLE_PHONE_ID_TTYTTD, */ -}; - -ECardAddressFlags addr_correspondences[] = { - E_CARD_ADDR_WORK, /* E_CARD_SIMPLE_ADDRESS_ID_BUSINESS, */ - E_CARD_ADDR_HOME, /* E_CARD_SIMPLE_ADDRESS_ID_HOME, */ - E_CARD_ADDR_POSTAL, /* E_CARD_SIMPLE_ADDRESS_ID_OTHER, */ -}; - -char *address_names[] = { - "Business", - "Home", - "Other", -}; - -/** - * e_card_simple_get_type: - * @void: - * - * Registers the &ECardSimple class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &ECardSimple class. - **/ -GtkType -e_card_simple_get_type (void) -{ - static GtkType simple_type = 0; - - if (!simple_type) { - GtkTypeInfo simple_info = { - "ECardSimple", - sizeof (ECardSimple), - sizeof (ECardSimpleClass), - (GtkClassInitFunc) e_card_simple_class_init, - (GtkObjectInitFunc) e_card_simple_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - simple_type = gtk_type_unique (gtk_object_get_type (), &simple_info); - } - - return simple_type; -} - -/** - * e_card_simple_new: - * @VCard: a string in vCard format - * - * Returns: a new #ECardSimple that wraps the @VCard. - */ -ECardSimple * -e_card_simple_new (ECard *card) -{ - ECardSimple *simple = E_CARD_SIMPLE(gtk_type_new(e_card_simple_get_type())); - gtk_object_set(GTK_OBJECT(simple), - "card", card, - NULL); - return simple; -} - -ECardSimple *e_card_simple_duplicate(ECardSimple *simple) -{ - char *vcard = e_card_simple_get_vcard(simple); - ECard *card = e_card_new(vcard); - ECardSimple *new_simple = e_card_simple_new(card); - g_free (vcard); - return new_simple; -} - -/** - * e_card_simple_get_id: - * @simple: an #ECardSimple - * - * Returns: a string representing the id of the simple, which is unique - * within its book. - */ -char * -e_card_simple_get_id (ECardSimple *simple) -{ - if (simple->card) - return e_card_get_id(simple->card); - else - return ""; -} - -/** - * e_card_simple_get_id: - * @simple: an #ECardSimple - * @id: a id in string format - * - * Sets the identifier of a simple, which should be unique within its - * book. - */ -void -e_card_simple_set_id (ECardSimple *simple, const char *id) -{ - if ( simple->card ) - e_card_set_id(simple->card, id); -} - -/** - * e_card_simple_get_vcard: - * @simple: an #ECardSimple - * - * Returns: a string in vcard format, which is wrapped by the @simple. - */ -char -*e_card_simple_get_vcard (ECardSimple *simple) -{ - if (simple->card) - return e_card_get_vcard(simple->card); - else - return g_strdup(""); -} - -static void -e_card_simple_class_init (ECardSimpleClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS(klass); - - gtk_object_add_arg_type ("ECardSimple::card", - GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CARD); -#if 0 - gtk_object_add_arg_type ("ECardSimple::file_as", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FILE_AS); - gtk_object_add_arg_type ("ECardSimple::full_name", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FULL_NAME); - gtk_object_add_arg_type ("ECardSimple::name", - GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_NAME); - gtk_object_add_arg_type ("ECardSimple::address", - GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_ADDRESS); - gtk_object_add_arg_type ("ECardSimple::address_label", - GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_ADDRESS_LABEL); - gtk_object_add_arg_type ("ECardSimple::phone", - GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_PHONE); - gtk_object_add_arg_type ("ECardSimple::email", - GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_EMAIL); - gtk_object_add_arg_type ("ECardSimple::birth_date", - GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_BIRTH_DATE); - gtk_object_add_arg_type ("ECardSimple::url", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_URL); - gtk_object_add_arg_type ("ECardSimple::org", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ORG); - gtk_object_add_arg_type ("ECardSimple::org_unit", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ORG_UNIT); - gtk_object_add_arg_type ("ECardSimple::office", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_OFFICE); - gtk_object_add_arg_type ("ECardSimple::title", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TITLE); - gtk_object_add_arg_type ("ECardSimple::role", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ROLE); - gtk_object_add_arg_type ("ECardSimple::manager", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_MANAGER); - gtk_object_add_arg_type ("ECardSimple::assistant", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ASSISTANT); - gtk_object_add_arg_type ("ECardSimple::nickname", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_NICKNAME); - gtk_object_add_arg_type ("ECardSimple::spouse", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_SPOUSE); - gtk_object_add_arg_type ("ECardSimple::anniversary", - GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_ANNIVERSARY); - gtk_object_add_arg_type ("ECardSimple::fburl", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FBURL); - gtk_object_add_arg_type ("ECardSimple::note", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_NOTE); - gtk_object_add_arg_type ("ECardSimple::id", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ID); -#endif - - object_class->destroy = e_card_simple_destroy; - object_class->get_arg = e_card_simple_get_arg; - object_class->set_arg = e_card_simple_set_arg; -} - -/* - * ECardSimple lifecycle management and vcard loading/saving. - */ - -static void -e_card_simple_destroy (GtkObject *object) -{ - ECardSimple *simple; - int i; - - simple = E_CARD_SIMPLE (object); - - if (simple->card) - gtk_object_unref(GTK_OBJECT(simple->card)); - g_list_foreach(simple->temp_fields, (GFunc) g_free, NULL); - g_list_free(simple->temp_fields); - simple->temp_fields = NULL; - - for(i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i++) - g_free(simple->phone[i]); - for(i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i++) - g_free(simple->email[i]); - for(i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) - g_free(simple->address[i]); -} - - -/* Set_arg handler for the simple */ -static void -e_card_simple_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ECardSimple *simple; - - simple = E_CARD_SIMPLE (object); - - switch (arg_id) { - case ARG_CARD: - if (simple->card) - gtk_object_unref(GTK_OBJECT(simple->card)); - g_list_foreach(simple->temp_fields, (GFunc) g_free, NULL); - g_list_free(simple->temp_fields); - simple->temp_fields = NULL; - if (GTK_VALUE_OBJECT(*arg)) - simple->card = E_CARD(GTK_VALUE_OBJECT(*arg)); - else - simple->card = NULL; - if(simple->card) - gtk_object_ref(GTK_OBJECT(simple->card)); - fill_in_info(simple); - break; -#if 0 - case ARG_FILE_AS: - if (simple->file_as) - g_free(simple->file_as); - simple->file_as = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_FULL_NAME: - if ( simple->fname ) - g_free(simple->fname); - simple->fname = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_NAME: - if ( simple->name ) - e_card_simple_name_free(simple->name); - simple->name = GTK_VALUE_POINTER(*arg); - break; - case ARG_BIRTH_DATE: - if ( simple->bday ) - g_free(simple->bday); - simple->bday = GTK_VALUE_POINTER(*arg); - break; - case ARG_URL: - if ( simple->url ) - g_free(simple->url); - simple->url = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_ORG: - if (simple->org) - g_free(simple->org); - simple->org = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_ORG_UNIT: - if (simple->org_unit) - g_free(simple->org_unit); - simple->org_unit = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_OFFICE: - if (simple->office) - g_free(simple->office); - simple->office = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_TITLE: - if ( simple->title ) - g_free(simple->title); - simple->title = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_ROLE: - if (simple->role) - g_free(simple->role); - simple->role = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_MANAGER: - if (simple->manager) - g_free(simple->manager); - simple->manager = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_ASSISTANT: - if (simple->assistant) - g_free(simple->assistant); - simple->assistant = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_NICKNAME: - if (simple->nickname) - g_free(simple->nickname); - simple->nickname = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_SPOUSE: - if (simple->spouse) - g_free(simple->spouse); - simple->spouse = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_ANNIVERSARY: - if ( simple->anniversary ) - g_free(simple->anniversary); - simple->anniversary = GTK_VALUE_POINTER(*arg); - break; - case ARG_FBURL: - if (simple->fburl) - g_free(simple->fburl); - simple->fburl = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_NOTE: - if (simple->note) - g_free (simple->note); - simple->note = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_ID: - if (simple->id) - g_free(simple->id); - simple->id = g_strdup(GTK_VALUE_STRING(*arg)); - break; -#endif - default: - return; - } -} - -/* Get_arg handler for the simple */ -static void -e_card_simple_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ECardSimple *simple; - - simple = E_CARD_SIMPLE (object); - - switch (arg_id) { - case ARG_CARD: - e_card_simple_sync_card(simple); - if (simple->card) - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(simple->card); - else - GTK_VALUE_OBJECT (*arg) = NULL; - break; -#if 0 - case ARG_FILE_AS: - GTK_VALUE_STRING (*arg); - break; - case ARG_FULL_NAME: - GTK_VALUE_STRING (*arg) = simple->fname; - break; - case ARG_NAME: - GTK_VALUE_POINTER(*arg) = simple->name; - break; - case ARG_ADDRESS: - if (!simple->address) - simple->address = e_card_simple_list_new((ECardSimpleListCopyFunc) e_card_simple_delivery_address_copy, - (ECardSimpleListFreeFunc) e_card_simple_delivery_address_free, - NULL); - GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(simple->address); - break; - case ARG_ADDRESS_LABEL: - if (!simple->address_label) - simple->address_label = e_card_simple_list_new((ECardSimpleListCopyFunc) e_card_simple_address_label_copy, - (ECardSimpleListFreeFunc) e_card_simple_address_label_free, - NULL); - GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(simple->address_label); - break; - case ARG_PHONE: - if (!simple->phone) - simple->phone = e_card_simple_list_new((ECardSimpleListCopyFunc) e_card_simple_phone_copy, - (ECardSimpleListFreeFunc) e_card_simple_phone_free, - NULL); - GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(simple->phone); - break; - case ARG_EMAIL: - if (!simple->email) - simple->email = e_card_simple_list_new((ECardSimpleListCopyFunc) g_strdup, - (ECardSimpleListFreeFunc) g_free, - NULL); - GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(simple->email); - break; - case ARG_BIRTH_DATE: - GTK_VALUE_POINTER(*arg) = simple->bday; - break; - case ARG_URL: - GTK_VALUE_STRING(*arg) = simple->url; - break; - case ARG_ORG: - GTK_VALUE_STRING(*arg) = simple->org; - break; - case ARG_ORG_UNIT: - GTK_VALUE_STRING(*arg) = simple->org_unit; - break; - case ARG_OFFICE: - GTK_VALUE_STRING(*arg) = simple->office; - break; - case ARG_TITLE: - GTK_VALUE_STRING(*arg) = simple->title; - break; - case ARG_ROLE: - GTK_VALUE_STRING(*arg) = simple->role; - break; - case ARG_MANAGER: - GTK_VALUE_STRING(*arg) = simple->manager; - break; - case ARG_ASSISTANT: - GTK_VALUE_STRING(*arg) = simple->assistant; - break; - case ARG_NICKNAME: - GTK_VALUE_STRING(*arg) = simple->nickname; - break; - case ARG_SPOUSE: - GTK_VALUE_STRING(*arg) = simple->spouse; - break; - case ARG_ANNIVERSARY: - GTK_VALUE_POINTER(*arg) = simple->anniversary; - break; - case ARG_FBURL: - GTK_VALUE_STRING(*arg) = simple->fburl; - break; - case ARG_NOTE: - GTK_VALUE_STRING(*arg) = simple->note; - break; - case ARG_ID: - GTK_VALUE_STRING(*arg) = simple->id; - break; -#endif - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - - -/** - * e_card_simple_init: - */ -static void -e_card_simple_init (ECardSimple *simple) -{ - int i; - simple->card = NULL; - for(i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i++) - simple->phone[i] = NULL; - for(i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i++) - simple->email[i] = NULL; - for(i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) - simple->address[i] = NULL; - simple->temp_fields = NULL; -} - -static void -fill_in_info(ECardSimple *simple) -{ - ECard *card = simple->card; - if (card) { - EList *address_list; - EList *phone_list; - EList *email_list; - const ECardPhone *phone; - const char *email; - const ECardAddrLabel *address; - int i; - - EIterator *iterator; - - gtk_object_get(GTK_OBJECT(card), - "address_label", &address_list, - "phone", &phone_list, - "email", &email_list, - NULL); - for (i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i++) { - e_card_phone_free(simple->phone[i]); - simple->phone[i] = NULL; - } - for (iterator = e_list_get_iterator(phone_list); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - phone = e_iterator_get(iterator); - for (i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i ++) { - if (((phone->flags & phone_correspondences[i]) == phone_correspondences[i]) && (simple->phone[i] == NULL)) { - simple->phone[i] = e_card_phone_copy(phone); - break; - } - } - } - gtk_object_unref(GTK_OBJECT(iterator)); - - for (i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i++) { - g_free(simple->email[i]); - simple->email[i] = NULL; - } - for (iterator = e_list_get_iterator(email_list); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - email = e_iterator_get(iterator); - for (i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i ++) { - if ((simple->email[i] == NULL)) { - simple->email[i] = g_strdup(email); - break; - } - } - } - gtk_object_unref(GTK_OBJECT(iterator)); - - for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) { - e_card_address_label_free(simple->address[i]); - simple->address[i] = NULL; - } - for (iterator = e_list_get_iterator(address_list); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - address = e_iterator_get(iterator); - for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i ++) { - if (((address->flags & addr_correspondences[i]) == addr_correspondences[i]) && (simple->address[i] == NULL)) { - simple->address[i] = e_card_address_label_copy(address); - break; - } - } - } - gtk_object_unref(GTK_OBJECT(iterator)); - } -} - -void -e_card_simple_sync_card(ECardSimple *simple) -{ - ECard *card = simple->card; - if (card) { - EList *address_list; - EList *phone_list; - EList *email_list; - const ECardPhone *phone; - const ECardAddrLabel *address; - const char *email; - int i; - int iterator_next = 1; - - EIterator *iterator; - - gtk_object_get(GTK_OBJECT(card), - "address_label", &address_list, - "phone", &phone_list, - "email", &email_list, - NULL); - - for (iterator = e_list_get_iterator(phone_list); e_iterator_is_valid(iterator); iterator_next ? e_iterator_next(iterator) : FALSE ) { - int i; - phone = e_iterator_get(iterator); - iterator_next = 1; - for (i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i ++) { - if ((phone->flags & phone_correspondences[i]) == phone_correspondences[i]) { - if (simple->phone[i]) { - simple->phone[i]->flags = phone_correspondences[i]; - if (simple->phone[i]->number && *simple->phone[i]->number) { - e_iterator_set(iterator, simple->phone[i]); - } else { - e_iterator_delete(iterator); - iterator_next = 0; - } - e_card_phone_free(simple->phone[i]); - simple->phone[i] = NULL; - break; - } - } - } - } - gtk_object_unref(GTK_OBJECT(iterator)); - for (i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i ++) { - if (simple->phone[i]) { - simple->phone[i]->flags = phone_correspondences[i]; - e_list_append(phone_list, simple->phone[i]); - e_card_phone_free(simple->phone[i]); - simple->phone[i] = NULL; - } - } - - for (iterator = e_list_get_iterator(email_list); e_iterator_is_valid(iterator); iterator_next ? e_iterator_next(iterator) : FALSE ) { - int i; - email = e_iterator_get(iterator); - iterator_next = 1; - for (i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i ++) { - if (simple->email[i]) { - if (*simple->email[i]) { - e_iterator_set(iterator, simple->email[i]); - } else { - e_iterator_delete(iterator); - iterator_next = 0; - } - g_free(simple->email[i]); - simple->email[i] = NULL; - break; - } - } - } - gtk_object_unref(GTK_OBJECT(iterator)); - for (i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i ++) { - if (simple->email[i]) { - e_list_append(email_list, simple->email[i]); - g_free(simple->email[i]); - simple->email[i] = NULL; - } - } - - for (iterator = e_list_get_iterator(address_list); e_iterator_is_valid(iterator); iterator_next ? e_iterator_next(iterator) : FALSE ) { - int i; - address = e_iterator_get(iterator); - iterator_next = 1; - for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i ++) { - if ((address->flags & addr_correspondences[i]) == addr_correspondences[i]) { - if (simple->address[i]) { - simple->address[i]->flags = addr_correspondences[i]; - if (simple->address[i]->data && *simple->address[i]->data) { - e_iterator_set(iterator, simple->address[i]); - } else { - e_iterator_delete(iterator); - iterator_next = 0; - } - e_card_address_label_free(simple->address[i]); - simple->address[i] = NULL; - break; - } - } - } - } - gtk_object_unref(GTK_OBJECT(iterator)); - for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i ++) { - if (simple->address[i]) { - simple->address[i]->flags = addr_correspondences[i]; - e_list_append(address_list, simple->address[i]); - e_card_address_label_free(simple->address[i]); - simple->address[i] = NULL; - } - } - fill_in_info(simple); - } -} - -const ECardPhone *e_card_simple_get_phone (ECardSimple *simple, - ECardSimplePhoneId id) -{ - return simple->phone[id]; -} - -const char *e_card_simple_get_email (ECardSimple *simple, - ECardSimpleEmailId id) -{ - return simple->email[id]; -} - -const ECardAddrLabel *e_card_simple_get_address (ECardSimple *simple, - ECardSimpleAddressId id) -{ - return simple->address[id]; -} - -void e_card_simple_set_phone (ECardSimple *simple, - ECardSimplePhoneId id, - const ECardPhone *phone) -{ - if (simple->phone[id]) - e_card_phone_free(simple->phone[id]); - simple->phone[id] = e_card_phone_copy(phone); -} - -void e_card_simple_set_email (ECardSimple *simple, - ECardSimpleEmailId id, - const char *email) -{ - if (simple->email[id]) - g_free(simple->email[id]); - simple->email[id] = g_strdup(email); -} - -void e_card_simple_set_address (ECardSimple *simple, - ECardSimpleAddressId id, - const ECardAddrLabel *address) -{ - if (simple->address[id]) - e_card_address_label_free(simple->address[id]); - simple->address[id] = e_card_address_label_copy(address); -} - -const char *e_card_simple_get_const (ECardSimple *simple, - ECardSimpleField field) -{ - char *ret_val = e_card_simple_get(simple, field); - if (ret_val) - simple->temp_fields = g_list_prepend(simple->temp_fields, ret_val); - return ret_val; -} - -char *e_card_simple_get (ECardSimple *simple, - ECardSimpleField field) -{ - ECardSimpleInternalType type = field_data[field].type; - const ECardAddrLabel *addr; - const ECardPhone *phone; - const char *string; - ECardDate *date; - switch(type) { - case E_CARD_SIMPLE_INTERNAL_TYPE_STRING: - gtk_object_get(GTK_OBJECT(simple->card), - field_data[field].ecard_field, &string, - NULL); - return g_strdup(string); - case E_CARD_SIMPLE_INTERNAL_TYPE_DATE: - gtk_object_get(GTK_OBJECT(simple->card), - field_data[field].ecard_field, &date, - NULL); - return NULL; /* FIXME!!!! */ - case E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS: - addr = e_card_simple_get_address(simple, - field_data[field].list_type_index); - if (addr) - return g_strdup(addr->data); - else - return NULL; - case E_CARD_SIMPLE_INTERNAL_TYPE_PHONE: - phone = e_card_simple_get_phone(simple, - field_data[field].list_type_index); - if (phone) - return g_strdup(phone->number); - else - return NULL; - case E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL: - string = e_card_simple_get_email(simple, - field_data[field].list_type_index); - return g_strdup(string); - case E_CARD_SIMPLE_INTERNAL_TYPE_SPECIAL: - switch (field) { - case E_CARD_SIMPLE_FIELD_NAME_OR_ORG: - gtk_object_get(GTK_OBJECT(simple->card), - "full_name", &string, - NULL); - if (string && *string) - return g_strdup(string); - gtk_object_get(GTK_OBJECT(simple->card), - "org", &string, - NULL); - return g_strdup(string); - default: - return NULL; - } - default: - return NULL; - } -} - -static char * -name_to_style(const ECardName *name, char *company, int style) -{ - char *string; - char *strings[4], **stringptr; - char *substring; - switch (style) { - case 0: - stringptr = strings; - if (name->family && *name->family) - *(stringptr++) = name->family; - if (name->given && *name->given) - *(stringptr++) = name->given; - *stringptr = NULL; - string = g_strjoinv(", ", strings); - break; - case 1: - stringptr = strings; - if (name->given && *name->given) - *(stringptr++) = name->given; - if (name->family && *name->family) - *(stringptr++) = name->family; - *stringptr = NULL; - string = g_strjoinv(" ", strings); - break; - case 2: - string = g_strdup(company); - break; - case 3: /* Fall Through */ - case 4: - stringptr = strings; - if (name->family && *name->family) - *(stringptr++) = name->family; - if (name->given && *name->given) - *(stringptr++) = name->given; - *stringptr = NULL; - substring = g_strjoinv(", ", strings); - if (!(company && *company)) - company = ""; - if (style == 3) - string = g_strdup_printf("%s (%s)", substring, company); - else - string = g_strdup_printf("%s (%s)", company, substring); - g_free(substring); - break; - default: - string = g_strdup(""); - } - return string; -} - -static int -file_as_get_style (ECardSimple *simple) -{ - char *filestring = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_FILE_AS); - char *trystring; - char *full_name = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_FULL_NAME); - char *company = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_ORG); - ECardName *name = NULL; - int i; - int style; - style = 0; - if (!full_name) - full_name = g_strdup(""); - if (!company) - company = g_strdup(""); - if (filestring) { - - name = e_card_name_from_string(full_name); - - if (!name) { - goto end; - } - - style = -1; - - for (i = 0; i < 5; i++) { - trystring = name_to_style(name, company, i); - if (!strcmp(trystring, filestring)) { - g_free(trystring); - style = i; - goto end; - } - g_free(trystring); - } - } - end: - - g_free(filestring); - g_free(full_name); - g_free(company); - if (name) - e_card_name_free(name); - - return style; -} - -static void -file_as_set_style(ECardSimple *simple, int style) -{ - if (style != -1) { - char *string; - char *full_name = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_FULL_NAME); - char *company = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_ORG); - ECardName *name; - - if (!full_name) - full_name = g_strdup(""); - if (!company) - company = g_strdup(""); - name = e_card_name_from_string(full_name); - if (name) { - string = name_to_style(name, company, style); - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_FILE_AS, string); - g_free(string); - } - g_free(full_name); - g_free(company); - e_card_name_free(name); - } -} - -void e_card_simple_set (ECardSimple *simple, - ECardSimpleField field, - const char *data) -{ - ECardSimpleInternalType type = field_data[field].type; - ECardAddrLabel *address; - ECardPhone *phone; - int style; - switch (field) { - case E_CARD_SIMPLE_FIELD_FULL_NAME: - case E_CARD_SIMPLE_FIELD_ORG: - style = file_as_get_style(simple); - gtk_object_set(GTK_OBJECT(simple->card), - field_data[field].ecard_field, data, - NULL); - file_as_set_style(simple, style); - break; - default: - switch(type) { - case E_CARD_SIMPLE_INTERNAL_TYPE_STRING: - gtk_object_set(GTK_OBJECT(simple->card), - field_data[field].ecard_field, data, - NULL); - break; - case E_CARD_SIMPLE_INTERNAL_TYPE_DATE: - break; /* FIXME!!!! */ - case E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS: - address = e_card_address_label_new(); - address->data = (char *) data; - e_card_simple_set_address(simple, - field_data[field].list_type_index, - address); - address->data = NULL; - e_card_address_label_free(address); - break; - case E_CARD_SIMPLE_INTERNAL_TYPE_PHONE: - phone = e_card_phone_new(); - phone->number = (char *) data; - e_card_simple_set_phone(simple, - field_data[field].list_type_index, - phone); - phone->number = NULL; - e_card_phone_free(phone); - break; - case E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL: - e_card_simple_set_email(simple, - field_data[field].list_type_index, - data); - break; - case E_CARD_SIMPLE_INTERNAL_TYPE_SPECIAL: - break; - } - break; - } -} - -ECardSimpleType e_card_simple_type (ECardSimple *simple, - ECardSimpleField field) -{ - ECardSimpleInternalType type = field_data[field].type; - switch(type) { - case E_CARD_SIMPLE_INTERNAL_TYPE_STRING: - case E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS: - case E_CARD_SIMPLE_INTERNAL_TYPE_PHONE: - case E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL: - default: - return E_CARD_SIMPLE_TYPE_STRING; - - case E_CARD_SIMPLE_INTERNAL_TYPE_DATE: - return E_CARD_SIMPLE_TYPE_DATE; - - case E_CARD_SIMPLE_INTERNAL_TYPE_SPECIAL: - return E_CARD_SIMPLE_TYPE_STRING; - } -} - -const char *e_card_simple_get_name (ECardSimple *simple, - ECardSimpleField field) -{ - return field_data[field].name; -} - -const char *e_card_simple_get_short_name (ECardSimple *simple, - ECardSimpleField field) -{ - return field_data[field].short_name; -} - -void e_card_simple_arbitrary_foreach (ECardSimple *simple, - ECardSimpleArbitraryCallback *callback, - gpointer closure) -{ - if (simple->card) { - EList *list; - EIterator *iterator; - gtk_object_get(GTK_OBJECT(simple->card), - "arbitrary", &list, - NULL); - for (iterator = e_list_get_iterator(list); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - const ECardArbitrary *arbitrary = e_iterator_get(iterator); - if (callback) - (*callback) (arbitrary, closure); - } - } -} - -const ECardArbitrary *e_card_simple_get_arbitrary (ECardSimple *simple, - const char *key) -{ - if (simple->card) { - EList *list; - EIterator *iterator; - gtk_object_get(GTK_OBJECT(simple->card), - "arbitrary", &list, - NULL); - for (iterator = e_list_get_iterator(list); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - const ECardArbitrary *arbitrary = e_iterator_get(iterator); - if (!strcasecmp(arbitrary->key, key)) - return arbitrary; - } - } - return NULL; -} - -/* Any of these except key can be NULL */ -void e_card_simple_set_arbitrary (ECardSimple *simple, - const char *key, - const char *type, - const char *value) -{ - if (simple->card) { - ECardArbitrary *new_arb; - EList *list; - EIterator *iterator; - gtk_object_get(GTK_OBJECT(simple->card), - "arbitrary", &list, - NULL); - for (iterator = e_list_get_iterator(list); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - const ECardArbitrary *arbitrary = e_iterator_get(iterator); - if (!strcasecmp(arbitrary->key, key)) { - new_arb = e_card_arbitrary_new(); - new_arb->key = g_strdup(key); - new_arb->type = g_strdup(type); - new_arb->value = g_strdup(value); - e_iterator_set(iterator, new_arb); - e_card_arbitrary_free(new_arb); - return; - } - } - new_arb = e_card_arbitrary_new(); - new_arb->key = g_strdup(key); - new_arb->type = g_strdup(type); - new_arb->value = g_strdup(value); - e_list_append(list, new_arb); - e_card_arbitrary_free(new_arb); - } -} - diff --git a/addressbook/backend/ebook/e-card-simple.h b/addressbook/backend/ebook/e-card-simple.h deleted file mode 100644 index 2d3b1cb4f4..0000000000 --- a/addressbook/backend/ebook/e-card-simple.h +++ /dev/null @@ -1,198 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@helixcode.com> - * Arturo Espinosa - * Nat Friedman (nat@helixcode.com) - * - * Copyright (C) 2000 Helix Code, Inc. - * Copyright (C) 1999 The Free Software Foundation - */ - -#ifndef __E_CARD_SIMPLE_H__ -#define __E_CARD_SIMPLE_H__ - -#include <time.h> -#include <gtk/gtk.h> -#include <stdio.h> -#include <addressbook/backend/ebook/e-card.h> -#include <addressbook/backend/ebook/e-card-types.h> -#include <e-util/e-list.h> - -#define E_TYPE_CARD_SIMPLE (e_card_simple_get_type ()) -#define E_CARD_SIMPLE(obj) (GTK_CHECK_CAST ((obj), E_TYPE_CARD_SIMPLE, ECardSimple)) -#define E_CARD_SIMPLE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_CARD_SIMPLE, ECardSimpleClass)) -#define E_IS_CARD_SIMPLE(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_CARD_SIMPLE)) -#define E_IS_CARD_SIMPLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_CARD_SIMPLE)) - -typedef enum _ECardSimplePhoneId ECardSimplePhoneId; -typedef enum _ECardSimpleEmailId ECardSimpleEmailId; -typedef enum _ECardSimpleAddressId ECardSimpleAddressId; -typedef enum _ECardSimpleType ECardSimpleType; -typedef enum _ECardSimpleField ECardSimpleField; - -enum _ECardSimplePhoneId { - E_CARD_SIMPLE_PHONE_ID_ASSISTANT, - E_CARD_SIMPLE_PHONE_ID_BUSINESS, - E_CARD_SIMPLE_PHONE_ID_BUSINESS_2, - E_CARD_SIMPLE_PHONE_ID_BUSINESS_FAX, - E_CARD_SIMPLE_PHONE_ID_CALLBACK, - E_CARD_SIMPLE_PHONE_ID_CAR, - E_CARD_SIMPLE_PHONE_ID_COMPANY, - E_CARD_SIMPLE_PHONE_ID_HOME, - E_CARD_SIMPLE_PHONE_ID_HOME_2, - E_CARD_SIMPLE_PHONE_ID_HOME_FAX, - E_CARD_SIMPLE_PHONE_ID_ISDN, - E_CARD_SIMPLE_PHONE_ID_MOBILE, - E_CARD_SIMPLE_PHONE_ID_OTHER, - E_CARD_SIMPLE_PHONE_ID_OTHER_FAX, - E_CARD_SIMPLE_PHONE_ID_PAGER, - E_CARD_SIMPLE_PHONE_ID_PRIMARY, - E_CARD_SIMPLE_PHONE_ID_RADIO, - E_CARD_SIMPLE_PHONE_ID_TELEX, - E_CARD_SIMPLE_PHONE_ID_TTYTTD, - E_CARD_SIMPLE_PHONE_ID_LAST -}; - -/* We need HOME and WORK email addresses here. */ -enum _ECardSimpleEmailId { - E_CARD_SIMPLE_EMAIL_ID_EMAIL, - E_CARD_SIMPLE_EMAIL_ID_EMAIL_2, - E_CARD_SIMPLE_EMAIL_ID_EMAIL_3, - E_CARD_SIMPLE_EMAIL_ID_LAST -}; - -/* Should this include (BILLING/SHIPPING)? */ -enum _ECardSimpleAddressId { - E_CARD_SIMPLE_ADDRESS_ID_BUSINESS, - E_CARD_SIMPLE_ADDRESS_ID_HOME, - E_CARD_SIMPLE_ADDRESS_ID_OTHER, - E_CARD_SIMPLE_ADDRESS_ID_LAST -}; - -enum _ECardSimpleType { - E_CARD_SIMPLE_TYPE_STRING, - E_CARD_SIMPLE_TYPE_DATE, -}; - -enum _ECardSimpleField { - E_CARD_SIMPLE_FIELD_FILE_AS, - E_CARD_SIMPLE_FIELD_FULL_NAME, - E_CARD_SIMPLE_FIELD_EMAIL, - E_CARD_SIMPLE_FIELD_PHONE_PRIMARY, - E_CARD_SIMPLE_FIELD_PHONE_BUSINESS, - E_CARD_SIMPLE_FIELD_PHONE_HOME, - E_CARD_SIMPLE_FIELD_ORG, - E_CARD_SIMPLE_FIELD_ADDRESS_BUSINESS, - E_CARD_SIMPLE_FIELD_ADDRESS_HOME, - E_CARD_SIMPLE_FIELD_PHONE_MOBILE, - E_CARD_SIMPLE_FIELD_PHONE_CAR, - E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_FAX, - E_CARD_SIMPLE_FIELD_PHONE_HOME_FAX, - E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_2, - E_CARD_SIMPLE_FIELD_PHONE_HOME_2, - E_CARD_SIMPLE_FIELD_PHONE_ISDN, - E_CARD_SIMPLE_FIELD_PHONE_OTHER, - E_CARD_SIMPLE_FIELD_PHONE_PAGER, - E_CARD_SIMPLE_FIELD_ADDRESS_OTHER, - E_CARD_SIMPLE_FIELD_EMAIL_2, - E_CARD_SIMPLE_FIELD_EMAIL_3, - E_CARD_SIMPLE_FIELD_URL, - E_CARD_SIMPLE_FIELD_ORG_UNIT, - E_CARD_SIMPLE_FIELD_OFFICE, - E_CARD_SIMPLE_FIELD_TITLE, - E_CARD_SIMPLE_FIELD_ROLE, - E_CARD_SIMPLE_FIELD_MANAGER, - E_CARD_SIMPLE_FIELD_ASSISTANT, - E_CARD_SIMPLE_FIELD_NICKNAME, - E_CARD_SIMPLE_FIELD_SPOUSE, - E_CARD_SIMPLE_FIELD_NOTE, - E_CARD_SIMPLE_FIELD_FBURL, - E_CARD_SIMPLE_FIELD_ANNIVERSARY, - E_CARD_SIMPLE_FIELD_BIRTH_DATE, - E_CARD_SIMPLE_FIELD_MAILER, - E_CARD_SIMPLE_FIELD_NAME_OR_ORG, - E_CARD_SIMPLE_FIELD_LAST -}; - -typedef struct _ECardSimple ECardSimple; -typedef struct _ECardSimpleClass ECardSimpleClass; - -struct _ECardSimple { - GtkObject object; - ECard *card; - - GList *temp_fields; - - ECardPhone *phone[E_CARD_SIMPLE_PHONE_ID_LAST]; - char *email[E_CARD_SIMPLE_EMAIL_ID_LAST]; - ECardAddrLabel *address[E_CARD_SIMPLE_ADDRESS_ID_LAST]; -}; - -struct _ECardSimpleClass { - GtkObjectClass parent_class; -}; - -typedef void (*ECardSimpleArbitraryCallback) (const ECardArbitrary *arbitrary, gpointer closure); - -ECardSimple *e_card_simple_new (ECard *card); -char *e_card_simple_get_id (ECardSimple *simple); -void e_card_simple_set_id (ECardSimple *simple, - const gchar *character); -char *e_card_simple_get_vcard (ECardSimple *simple); - -ECardSimple *e_card_simple_duplicate (ECardSimple *simple); - -char *e_card_simple_get (ECardSimple *simple, - ECardSimpleField field); -const char *e_card_simple_get_const (ECardSimple *simple, - ECardSimpleField field); -void e_card_simple_set (ECardSimple *simple, - ECardSimpleField field, - const char *data); - -ECardSimpleType e_card_simple_type (ECardSimple *simple, - ECardSimpleField field); -const char *e_card_simple_get_name (ECardSimple *simple, - ECardSimpleField field); -const char *e_card_simple_get_short_name (ECardSimple *simple, - ECardSimpleField field); - - -/* Use these only if building lists of specific types. It should be - * easier to use the above if you consider a phone field to be the - * same as any other field. - */ -const ECardPhone *e_card_simple_get_phone (ECardSimple *simple, - ECardSimplePhoneId id); -const char *e_card_simple_get_email (ECardSimple *simple, - ECardSimpleEmailId id); -const ECardAddrLabel *e_card_simple_get_address (ECardSimple *simple, - ECardSimpleAddressId id); -void e_card_simple_set_phone (ECardSimple *simple, - ECardSimplePhoneId id, - const ECardPhone *phone); -void e_card_simple_set_email (ECardSimple *simple, - ECardSimpleEmailId id, - const char *email); -void e_card_simple_set_address (ECardSimple *simple, - ECardSimpleAddressId id, - const ECardAddrLabel *address); - -void e_card_simple_arbitrary_foreach (ECardSimple *simple, - ECardSimpleArbitraryCallback *callback, - gpointer closure); -const ECardArbitrary *e_card_simple_get_arbitrary (ECardSimple *simple, - const char *key); -/* Any of these except key can be NULL */ -void e_card_simple_set_arbitrary (ECardSimple *simple, - const char *key, - const char *type, - const char *value); - -void e_card_simple_sync_card (ECardSimple *simple); - -/* Standard Gtk function */ -GtkType e_card_simple_get_type (void); - -#endif /* ! __E_CARD_SIMPLE_H__ */ diff --git a/addressbook/backend/ebook/e-card-types.h b/addressbook/backend/ebook/e-card-types.h deleted file mode 100644 index a2563d4bf6..0000000000 --- a/addressbook/backend/ebook/e-card-types.h +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Arturo Espinosa - * Nat Friedman (nat@helixcode.com) - * - * Copyright (C) 2000 Helix Code, Inc. - * Copyright (C) 1999 The Free Software Foundation - */ - -#ifndef __E_CARD_TYPES_H__ -#define __E_CARD_TYPES_H__ - -/* IDENTIFICATION PROPERTIES */ - -typedef struct { - char *prefix; /* Mr. */ - char *given; /* John */ - char *additional; /* Quinlan */ - char *family; /* Public */ - char *suffix; /* Esq. */ -} ECardName; - -typedef struct { - int year; - int month; - int day; -} ECardDate; - -/* TELECOMMUNICATIONS ADDRESSING PROPERTIES */ - -typedef enum { - E_CARD_PHONE_PREF = 1 << 0, - E_CARD_PHONE_WORK = 1 << 1, - E_CARD_PHONE_HOME = 1 << 2, - E_CARD_PHONE_VOICE = 1 << 3, - E_CARD_PHONE_FAX = 1 << 4, - E_CARD_PHONE_MSG = 1 << 5, - E_CARD_PHONE_CELL = 1 << 6, - E_CARD_PHONE_PAGER = 1 << 7, - E_CARD_PHONE_BBS = 1 << 8, - E_CARD_PHONE_MODEM = 1 << 9, - E_CARD_PHONE_CAR = 1 << 10, - E_CARD_PHONE_ISDN = 1 << 11, - E_CARD_PHONE_VIDEO = 1 << 12 -} ECardPhoneFlags; - -typedef struct { - ECardPhoneFlags flags; - char *number; -} ECardPhone; - -/* DELIVERY ADDRESSING PROPERTIES */ - -typedef enum { - E_CARD_ADDR_HOME = 1 << 0, - E_CARD_ADDR_WORK = 1 << 1, - E_CARD_ADDR_POSTAL = 1 << 2, - E_CARD_ADDR_PARCEL = 1 << 3, - E_CARD_ADDR_DOM = 1 << 4, - E_CARD_ADDR_INTL = 1 << 5 -} ECardAddressFlags; - -typedef struct { - ECardAddressFlags flags; - - char *po; - char *ext; - char *street; - char *city; - char *region; - char *code; - char *country; -} ECardDeliveryAddress; - -typedef struct { - ECardAddressFlags flags; - char *data; -} ECardAddrLabel; - -/* ARBITRARY PROPERTIES */ - -typedef struct { - char *key; - char *type; - char *value; -} ECardArbitrary; - -/* PILOT SYNC STATUS */ - -enum { - E_CARD_PILOT_STATUS_NONE, - E_CARD_PILOT_STATUS_MOD, - E_CARD_PILOT_STATUS_DEL -}; - -#endif /* __E_CARD_TYPES_H__ */ diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c deleted file mode 100644 index a81544dcd3..0000000000 --- a/addressbook/backend/ebook/e-card.c +++ /dev/null @@ -1,3295 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Arturo Espinosa (arturo@nuclecu.unam.mx) - * Nat Friedman (nat@helixcode.com) - * - * Copyright (C) 2000 Helix Code, Inc. - * Copyright (C) 1999 The Free Software Foundation - */ - -#include <config.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <gtk/gtk.h> - -#include <libversit/vcc.h> -#include "e-card.h" -#include "e-card-pairs.h" -#include "e-name-western.h" - -#include <e-util/e-util.h> - -#define is_a_prop_of(obj,prop) (isAPropertyOf ((obj),(prop))) -#define str_val(obj) (the_str = (vObjectValueType (obj))? fakeCString (vObjectUStringZValue (obj)) : calloc (1, 1)) -#define has(obj,prop) (vo = isAPropertyOf ((obj), (prop))) - -#define XEV_PILOT_ID "X-EVOLUTION-PILOTID" -#define XEV_PILOT_STATUS "X-EVOLUTION-PILOTSTATUS" -#define XEV_ARBITRARY "X-EVOLUTION-ARBITRARY" - -/* Object argument IDs */ -enum { - ARG_0, - ARG_FILE_AS, - ARG_FULL_NAME, - ARG_NAME, - ARG_ADDRESS, - ARG_ADDRESS_LABEL, - ARG_PHONE, - ARG_EMAIL, - ARG_BIRTH_DATE, - ARG_URL, - ARG_ORG, - ARG_ORG_UNIT, - ARG_OFFICE, - ARG_TITLE, - ARG_ROLE, - ARG_MANAGER, - ARG_ASSISTANT, - ARG_NICKNAME, - ARG_SPOUSE, - ARG_ANNIVERSARY, - ARG_MAILER, - ARG_FBURL, - ARG_NOTE, - ARG_CATEGORIES, - ARG_CATEGORY_LIST, - ARG_PILOTID, - ARG_PILOTSTATUS, - ARG_ARBITRARY, - ARG_ID, -}; - -#if 0 -static VObject *card_convert_to_vobject (ECard *crd); -#endif -static void parse(ECard *card, VObject *vobj); -static void e_card_init (ECard *card); -static void e_card_class_init (ECardClass *klass); - -static void e_card_destroy (GtkObject *object); -static void e_card_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - -static void assign_string(VObject *vobj, char **string); - -char *e_v_object_get_child_value(VObject *vobj, char *name); -static ECardDate e_card_date_from_string (char *str); - -static void parse_bday(ECard *card, VObject *object); -static void parse_full_name(ECard *card, VObject *object); -static void parse_file_as(ECard *card, VObject *object); -static void parse_name(ECard *card, VObject *object); -static void parse_email(ECard *card, VObject *object); -static void parse_phone(ECard *card, VObject *object); -static void parse_address(ECard *card, VObject *object); -static void parse_address_label(ECard *card, VObject *object); -static void parse_url(ECard *card, VObject *object); -static void parse_org(ECard *card, VObject *object); -static void parse_office(ECard *card, VObject *object); -static void parse_title(ECard *card, VObject *object); -static void parse_role(ECard *card, VObject *object); -static void parse_manager(ECard *card, VObject *object); -static void parse_assistant(ECard *card, VObject *object); -static void parse_nickname(ECard *card, VObject *object); -static void parse_spouse(ECard *card, VObject *object); -static void parse_anniversary(ECard *card, VObject *object); -static void parse_mailer(ECard *card, VObject *object); -static void parse_fburl(ECard *card, VObject *object); -static void parse_note(ECard *card, VObject *object); -static void parse_categories(ECard *card, VObject *object); -static void parse_pilot_id(ECard *card, VObject *object); -static void parse_pilot_status(ECard *card, VObject *object); -static void parse_arbitrary(ECard *card, VObject *object); -static void parse_id(ECard *card, VObject *object); - -static ECardPhoneFlags get_phone_flags (VObject *vobj); -static void set_phone_flags (VObject *vobj, ECardPhoneFlags flags); -static ECardAddressFlags get_address_flags (VObject *vobj); -static void set_address_flags (VObject *vobj, ECardAddressFlags flags); - -typedef void (* ParsePropertyFunc) (ECard *card, VObject *object); - -struct { - char *key; - ParsePropertyFunc function; -} attribute_jump_array[] = -{ - { VCFullNameProp, parse_full_name }, - { "X-EVOLUTION-FILE-AS", parse_file_as }, - { VCNameProp, parse_name }, - { VCBirthDateProp, parse_bday }, - { VCEmailAddressProp, parse_email }, - { VCTelephoneProp, parse_phone }, - { VCAdrProp, parse_address }, - { VCDeliveryLabelProp, parse_address_label }, - { VCURLProp, parse_url }, - { VCOrgProp, parse_org }, - { "X-EVOLUTION-OFFICE", parse_office }, - { VCTitleProp, parse_title }, - { VCBusinessRoleProp, parse_role }, - { "X-EVOLUTION-MANAGER", parse_manager }, - { "X-EVOLUTION-ASSISTANT", parse_assistant }, - { "NICKNAME", parse_nickname }, - { "X-EVOLUTION-SPOUSE", parse_spouse }, - { "X-EVOLUTION-ANNIVERSARY", parse_anniversary }, - { VCMailerProp, parse_mailer }, - { "FBURL", parse_fburl }, - { VCNoteProp, parse_note }, - { "CATEGORIES", parse_categories }, - { XEV_PILOT_ID, parse_pilot_id }, - { XEV_PILOT_STATUS, parse_pilot_status }, - { XEV_ARBITRARY, parse_arbitrary }, - { VCUniqueStringProp, parse_id } -}; - -/** - * e_card_get_type: - * @void: - * - * Registers the &ECard class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &ECard class. - **/ -GtkType -e_card_get_type (void) -{ - static GtkType card_type = 0; - - if (!card_type) { - GtkTypeInfo card_info = { - "ECard", - sizeof (ECard), - sizeof (ECardClass), - (GtkClassInitFunc) e_card_class_init, - (GtkObjectInitFunc) e_card_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - card_type = gtk_type_unique (gtk_object_get_type (), &card_info); - } - - return card_type; -} - -/** - * e_card_new: - * @vcard: a string in vCard format - * - * Returns: a new #ECard that wraps the @vcard. - */ -ECard * -e_card_new (char *vcard) -{ - ECard *card = E_CARD(gtk_type_new(e_card_get_type())); - VObject *vobj = Parse_MIME(vcard, strlen(vcard)); - while(vobj) { - VObject *next; - parse(card, vobj); - next = nextVObjectInList(vobj); - cleanVObject(vobj); - vobj = next; - } - return card; -} - -ECard *e_card_duplicate(ECard *card) -{ - char *vcard = e_card_get_vcard(card); - ECard *new_card = e_card_new(vcard); - g_free (vcard); - return new_card; -} - -/** - * e_card_get_id: - * @card: an #ECard - * - * Returns: a string representing the id of the card, which is unique - * within its book. - */ -char * -e_card_get_id (ECard *card) -{ - return card->id; -} - -/** - * e_card_get_id: - * @card: an #ECard - * @id: a id in string format - * - * Sets the identifier of a card, which should be unique within its - * book. - */ -void -e_card_set_id (ECard *card, const char *id) -{ - if ( card->id ) - g_free(card->id); - card->id = g_strdup(id); -} - -/** - * e_card_get_vcard: - * @card: an #ECard - * - * Returns: a string in vCard format, which is wrapped by the @card. - */ -char -*e_card_get_vcard (ECard *card) -{ - VObject *vobj; /*, *vprop; */ - char *temp, *ret_val; - - vobj = newVObject (VCCardProp); - - if ( card->file_as && *card->file_as ) - addPropValue(vobj, "X-EVOLUTION-FILE-AS", card->file_as); - else if (card->file_as) - addProp(vobj, "X-EVOLUTION-FILE_AS"); - - if ( card->fname ) - addPropValue(vobj, VCFullNameProp, card->fname); - - if ( card->name && (card->name->prefix || card->name->given || card->name->additional || card->name->family || card->name->suffix) ) { - VObject *nameprop; - nameprop = addProp(vobj, VCNameProp); - if ( card->name->prefix ) - addPropValue(nameprop, VCNamePrefixesProp, card->name->prefix); - if ( card->name->given ) - addPropValue(nameprop, VCGivenNameProp, card->name->given); - if ( card->name->additional ) - addPropValue(nameprop, VCAdditionalNamesProp, card->name->additional); - if ( card->name->family ) - addPropValue(nameprop, VCFamilyNameProp, card->name->family); - if ( card->name->suffix ) - addPropValue(nameprop, VCNameSuffixesProp, card->name->suffix); - } - - - if ( card->address ) { - EIterator *iterator = e_list_get_iterator(card->address); - for ( ; e_iterator_is_valid(iterator) ;e_iterator_next(iterator) ) { - VObject *addressprop; - ECardDeliveryAddress *address = (ECardDeliveryAddress *) e_iterator_get(iterator); - addressprop = addProp(vobj, VCAdrProp); - - set_address_flags (addressprop, address->flags); - if ( address->po ) - addPropValue(addressprop, VCPostalBoxProp, address->po); - if ( address->ext ) - addPropValue(addressprop, VCExtAddressProp, address->ext); - if ( address->street ) - addPropValue(addressprop, VCStreetAddressProp, address->street); - if ( address->city ) - addPropValue(addressprop, VCCityProp, address->city); - if ( address->region ) - addPropValue(addressprop, VCRegionProp, address->region); - if ( address->code ) - addPropValue(addressprop, VCPostalCodeProp, address->code); - if ( address->country ) - addPropValue(addressprop, VCCountryNameProp, address->country); - } - gtk_object_unref(GTK_OBJECT(iterator)); - } - - if ( card->address_label ) { - EIterator *iterator = e_list_get_iterator(card->address_label); - for ( ; e_iterator_is_valid(iterator) ;e_iterator_next(iterator) ) { - VObject *labelprop; - ECardAddrLabel *address_label = (ECardAddrLabel *) e_iterator_get(iterator); - if (address_label->data) - labelprop = addPropValue(vobj, VCDeliveryLabelProp, address_label->data); - else - labelprop = addProp(vobj, VCDeliveryLabelProp); - - set_address_flags (labelprop, address_label->flags); - addProp(labelprop, VCQuotedPrintableProp); - } - gtk_object_unref(GTK_OBJECT(iterator)); - } - - if ( card->phone ) { - EIterator *iterator = e_list_get_iterator(card->phone); - for ( ; e_iterator_is_valid(iterator) ;e_iterator_next(iterator) ) { - VObject *phoneprop; - ECardPhone *phone = (ECardPhone *) e_iterator_get(iterator); - phoneprop = addPropValue(vobj, VCTelephoneProp, phone->number); - - set_phone_flags (phoneprop, phone->flags); - } - gtk_object_unref(GTK_OBJECT(iterator)); - } - - if ( card->email ) { - EIterator *iterator = e_list_get_iterator(card->email); - for ( ; e_iterator_is_valid(iterator) ;e_iterator_next(iterator) ) { - VObject *emailprop; - emailprop = addPropValue(vobj, VCEmailAddressProp, (char *) e_iterator_get(iterator)); - addProp (emailprop, VCInternetProp); - } - gtk_object_unref(GTK_OBJECT(iterator)); - } - - if ( card->bday ) { - ECardDate date; - char *value; - date = *card->bday; - date.year = MIN(date.year, 9999); - date.month = MIN(date.month, 12); - date.day = MIN(date.day, 31); - value = g_strdup_printf("%04d-%02d-%02d", date.year, date.month, date.day); - addPropValue(vobj, VCBirthDateProp, value); - g_free(value); - } - - if (card->url) - addPropValue(vobj, VCURLProp, card->url); - - if (card->org || card->org_unit) { - VObject *orgprop; - orgprop = addProp(vobj, VCOrgProp); - - if (card->org) - addPropValue(orgprop, VCOrgNameProp, card->org); - if (card->org_unit) - addPropValue(orgprop, VCOrgUnitProp, card->org_unit); - } - - if (card->office) - addPropValue(vobj, "X-EVOLUTION-OFFICE", card->office); - - if (card->title) - addPropValue(vobj, VCTitleProp, card->title); - - if (card->role) - addPropValue(vobj, VCBusinessRoleProp, card->role); - - if (card->manager) - addPropValue(vobj, "X-EVOLUTION-MANAGER", card->manager); - - if (card->assistant) - addPropValue(vobj, "X-EVOLUTION-ASSISTANT", card->assistant); - - if (card->nickname) - addPropValue(vobj, "NICKNAME", card->nickname); - - if (card->spouse) - addPropValue(vobj, "X-EVOLUTION-SPOUSE", card->spouse); - - if ( card->anniversary ) { - ECardDate date; - char *value; - date = *card->anniversary; - date.year = MIN(date.year, 9999); - date.month = MIN(date.month, 12); - date.day = MIN(date.day, 31); - value = g_strdup_printf("%04d-%02d-%02d", date.year, date.month, date.day); - addPropValue(vobj, "X-EVOLUTION-ANNIVERSARY", value); - g_free(value); - } - - if (card->mailer) { - addPropValue(vobj, VCMailerProp, card->mailer); - } - - if (card->fburl) - addPropValue(vobj, "FBURL", card->fburl); - - if (card->note) - addPropValue(vobj, VCNoteProp, card->note); - - if (card->categories) { - EIterator *iterator; - int length = 0; - char *string; - char *stringptr; - for (iterator = e_list_get_iterator(card->categories); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - length += strlen(e_iterator_get(iterator)) + 1; - } - string = g_new(char, length + 1); - stringptr = string; - *stringptr = 0; - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - strcpy(stringptr, e_iterator_get(iterator)); - stringptr += strlen(stringptr); - *stringptr = ','; - stringptr++; - *stringptr = 0; - } - if (stringptr > string) { - stringptr --; - *stringptr = 0; - } - addPropValue (vobj, "CATEGORIES", string); - g_free(string); - } - - if (card->pilot_id) { - gchar *pilotid_str; - pilotid_str = g_strdup_printf ("%d", card->pilot_id); - addPropValue (vobj, XEV_PILOT_ID, pilotid_str); - g_free (pilotid_str); - } - - if (card->pilot_status) { - gchar *pilotstatus_str; - pilotstatus_str = g_strdup_printf ("%d", card->pilot_status); - addPropValue (vobj, XEV_PILOT_STATUS, pilotstatus_str); - g_free (pilotstatus_str); - } - - if (card->arbitrary) { - EIterator *iterator; - for (iterator = e_list_get_iterator(card->arbitrary); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - const ECardArbitrary *arbitrary = e_iterator_get(iterator); - VObject *arb_object; - if (arbitrary->value) { - arb_object = addPropValue (vobj, XEV_ARBITRARY, arbitrary->value); - } else { - arb_object = addProp (vobj, XEV_ARBITRARY); - } - if (arbitrary->type) { - addPropValue (arb_object, "TYPE", arbitrary->type); - } - if (arbitrary->key) { - addProp (arb_object, arbitrary->key); - } - } - } - - if (card->id) - addPropValue (vobj, VCUniqueStringProp, card->id); -#if 0 - - - if (crd->photo.prop.used) { - vprop = addPropSizedValue (vobj, VCPhotoProp, - crd->photo.data, crd->photo.size); - add_PhotoType (vprop, crd->photo.type); - add_CardProperty (vprop, &crd->photo.prop); - } - - if (crd->xtension.l) { - GList *node; - - for (node = crd->xtension.l; node; node = node->next) { - CardXProperty *xp = (CardXProperty *) node->data; - addPropValue (vobj, xp->name, xp->data); - add_CardProperty (vobj, &xp->prop); - } - } - - if (crd->timezn.prop.used) { - char *str; - - str = card_timezn_str (crd->timezn); - vprop = addPropValue (vobj, VCTimeZoneProp, str); - free (str); - add_CardProperty (vprop, &crd->timezn.prop); - } - - if (crd->geopos.prop.used) { - char *str; - - str = card_geopos_str (crd->geopos); - vprop = addPropValue (vobj, VCGeoLocationProp, str); - free (str); - add_CardProperty (vprop, &crd->geopos.prop); - } - - if (crd->logo.prop.used) { - vprop = addPropSizedValue (vobj, VCLogoProp, - crd->logo.data, crd->logo.size); - add_PhotoType (vprop, crd->logo.type); - add_CardProperty (vprop, &crd->logo.prop); - } - - if (crd->agent) - addVObjectProp (vobj, card_convert_to_vobject (crd->agent)); - - if (crd->sound.prop.used) { - if (crd->sound.type != SOUND_PHONETIC) - vprop = addPropSizedValue (vobj, VCPronunciationProp, - crd->sound.data, crd->sound.size); - else - vprop = addPropValue (vobj, VCPronunciationProp, - crd->sound.data); - - add_SoundType (vprop, crd->sound.type); - add_CardProperty (vprop, &crd->sound.prop); - } - - if (crd->key.prop.used) { - vprop = addPropValue (vobj, VCPublicKeyProp, crd->key.data); - add_KeyType (vprop, crd->key.type); - add_CardProperty (vprop, &crd->key.prop); - } -#endif - temp = writeMemVObject(NULL, NULL, vobj); - ret_val = g_strdup(temp); - free(temp); - cleanVObject(vobj); - return ret_val; -} - -static void -parse_file_as(ECard *card, VObject *vobj) -{ - if ( card->file_as ) - g_free(card->file_as); - assign_string(vobj, &(card->file_as)); -} - -static void -parse_name(ECard *card, VObject *vobj) -{ - if ( card->name ) { - e_card_name_free(card->name); - } - card->name = g_new(ECardName, 1); - - card->name->family = e_v_object_get_child_value (vobj, VCFamilyNameProp); - card->name->given = e_v_object_get_child_value (vobj, VCGivenNameProp); - card->name->additional = e_v_object_get_child_value (vobj, VCAdditionalNamesProp); - card->name->prefix = e_v_object_get_child_value (vobj, VCNamePrefixesProp); - card->name->suffix = e_v_object_get_child_value (vobj, VCNameSuffixesProp); -} - -static void -parse_full_name(ECard *card, VObject *vobj) -{ - if ( card->fname ) - g_free(card->fname); - assign_string(vobj, &(card->fname)); -} - -static void -parse_email(ECard *card, VObject *vobj) -{ - char *next_email; - EList *list; - - assign_string(vobj, &next_email); - gtk_object_get(GTK_OBJECT(card), - "email", &list, - NULL); - e_list_append(list, next_email); - g_free (next_email); -} - -static void -parse_bday(ECard *card, VObject *vobj) -{ - if ( vObjectValueType (vobj) ) { - char *str = fakeCString (vObjectUStringZValue (vobj)); - if ( card->bday ) - g_free(card->bday); - card->bday = g_new(ECardDate, 1); - *(card->bday) = e_card_date_from_string(str); - free(str); - } -} - -static void -parse_phone(ECard *card, VObject *vobj) -{ - ECardPhone *next_phone = g_new(ECardPhone, 1); - EList *list; - - assign_string(vobj, &(next_phone->number)); - next_phone->flags = get_phone_flags(vobj); - - gtk_object_get(GTK_OBJECT(card), - "phone", &list, - NULL); - e_list_append(list, next_phone); - e_card_phone_free (next_phone); -} - -static void -parse_address(ECard *card, VObject *vobj) -{ - ECardDeliveryAddress *next_addr = g_new(ECardDeliveryAddress, 1); - EList *list; - - next_addr->flags = get_address_flags (vobj); - next_addr->po = e_v_object_get_child_value (vobj, VCPostalBoxProp); - next_addr->ext = e_v_object_get_child_value (vobj, VCExtAddressProp); - next_addr->street = e_v_object_get_child_value (vobj, VCStreetAddressProp); - next_addr->city = e_v_object_get_child_value (vobj, VCCityProp); - next_addr->region = e_v_object_get_child_value (vobj, VCRegionProp); - next_addr->code = e_v_object_get_child_value (vobj, VCPostalCodeProp); - next_addr->country = e_v_object_get_child_value (vobj, VCCountryNameProp); - - gtk_object_get(GTK_OBJECT(card), - "address", &list, - NULL); - e_list_append(list, next_addr); - e_card_delivery_address_free (next_addr); -} - -static void -parse_address_label(ECard *card, VObject *vobj) -{ - ECardAddrLabel *next_addr = g_new(ECardAddrLabel, 1); - EList *list; - - next_addr->flags = get_address_flags (vobj); - assign_string(vobj, &next_addr->data); - - gtk_object_get(GTK_OBJECT(card), - "address_label", &list, - NULL); - e_list_append(list, next_addr); - e_card_address_label_free (next_addr); -} - -static void -parse_url(ECard *card, VObject *vobj) -{ - if (card->url) - g_free(card->url); - assign_string(vobj, &(card->url)); -} - -static void -parse_org(ECard *card, VObject *vobj) -{ - char *temp; - - temp = e_v_object_get_child_value(vobj, VCOrgNameProp); - if (temp) { - if (card->org) - g_free(card->org); - card->org = temp; - } - temp = e_v_object_get_child_value(vobj, VCOrgUnitProp); - if (temp) { - if (card->org_unit) - g_free(card->org_unit); - card->org_unit = temp; - } -} - -static void -parse_office(ECard *card, VObject *vobj) -{ - if ( card->office ) - g_free(card->office); - assign_string(vobj, &(card->office)); -} - -static void -parse_title(ECard *card, VObject *vobj) -{ - if ( card->title ) - g_free(card->title); - assign_string(vobj, &(card->title)); -} - -static void -parse_role(ECard *card, VObject *vobj) -{ - if (card->role) - g_free(card->role); - assign_string(vobj, &(card->role)); -} - -static void -parse_manager(ECard *card, VObject *vobj) -{ - if ( card->manager ) - g_free(card->manager); - assign_string(vobj, &(card->manager)); -} - -static void -parse_assistant(ECard *card, VObject *vobj) -{ - if ( card->assistant ) - g_free(card->assistant); - assign_string(vobj, &(card->assistant)); -} - -static void -parse_nickname(ECard *card, VObject *vobj) -{ - if (card->nickname) - g_free(card->nickname); - assign_string(vobj, &(card->nickname)); -} - -static void -parse_spouse(ECard *card, VObject *vobj) -{ - if ( card->spouse ) - g_free(card->spouse); - assign_string(vobj, &(card->spouse)); -} - -static void -parse_anniversary(ECard *card, VObject *vobj) -{ - if ( vObjectValueType (vobj) ) { - char *str = fakeCString (vObjectUStringZValue (vobj)); - if (card->anniversary) - g_free(card->anniversary); - card->anniversary = g_new(ECardDate, 1); - *(card->anniversary) = e_card_date_from_string(str); - free(str); - } -} - -static void -parse_mailer(ECard *card, VObject *vobj) -{ - if ( card->mailer ) - g_free(card->mailer); - assign_string(vobj, &(card->mailer)); -} - -static void -parse_fburl(ECard *card, VObject *vobj) -{ - g_free(card->fburl); - assign_string(vobj, &(card->fburl)); -} - -static void -parse_note(ECard *card, VObject *vobj) -{ - g_free(card->note); - assign_string(vobj, &(card->note)); -} - -static void -add_list_unique(ECard *card, EList *list, char *string) -{ - char *temp = e_strdup_strip(string); - EIterator *iterator; - - if (!*temp) { - g_free(temp); - return; - } - for ( iterator = e_list_get_iterator(list); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - if (!strcmp(e_iterator_get(iterator), temp)) { - break; - } - } - if (!e_iterator_is_valid(iterator)) { - e_list_append(list, temp); - } - g_free(temp); - gtk_object_unref(GTK_OBJECT(iterator)); -} - -static void -do_parse_categories(ECard *card, char *str) -{ - int length = strlen(str); - char *copy = g_new(char, length + 1); - int i, j; - EList *list; - gtk_object_get(GTK_OBJECT(card), - "category_list", &list, - NULL); - for (i = 0, j = 0; str[i]; i++, j++) { - switch (str[i]) { - case '\\': - i++; - if (str[i]) { - copy[j] = str[i]; - } else - i--; - break; - case ',': - copy[j] = 0; - add_list_unique(card, list, copy); - j = -1; - break; - default: - copy[j] = str[i]; - break; - } - } - copy[j] = 0; - add_list_unique(card, list, copy); - g_free(copy); -} - -static void -parse_categories(ECard *card, VObject *vobj) -{ - if ( vObjectValueType (vobj) ) { - char *str = fakeCString (vObjectUStringZValue (vobj)); - do_parse_categories(card, str); - free(str); - } -} - -static void -parse_pilot_id(ECard *card, VObject *vobj) -{ - if ( vObjectValueType (vobj) ) { - char *str = fakeCString (vObjectUStringZValue (vobj)); - card->pilot_id = atoi(str); - free(str); - } -} - -static void -parse_pilot_status(ECard *card, VObject *vobj) -{ - if ( vObjectValueType (vobj) ) { - char *str = fakeCString (vObjectUStringZValue (vobj)); - card->pilot_status = atoi(str); - free(str); - } -} - -typedef union ValueItem { - const char *strs; - const wchar_t *ustrs; - unsigned int i; - unsigned long l; - void *any; - VObject *vobj; -} ValueItem; - -struct VObject { - VObject *next; - const char *id; - VObject *prop; - unsigned short valType; - ValueItem val; -}; - -static void -parse_arbitrary(ECard *card, VObject *vobj) -{ - ECardArbitrary *arbitrary = e_card_arbitrary_new(); - VObjectIterator iterator; - EList *list; - for ( initPropIterator (&iterator, vobj); moreIteration(&iterator); ) { - VObject *temp = nextVObject(&iterator); - const char *name = vObjectName(temp); - if (name && !strcmp(name, "TYPE")) { - g_free(arbitrary->type); - assign_string(temp, &(arbitrary->type)); - } else { - g_free(arbitrary->key); - arbitrary->key = g_strdup(name); - } - } - - assign_string(vobj, &(arbitrary->value)); - - gtk_object_get(GTK_OBJECT(card), - "arbitrary", &list, - NULL); - e_list_append(list, arbitrary); - e_card_arbitrary_free(arbitrary); -} - -static void -parse_id(ECard *card, VObject *vobj) -{ - if ( card->id ) - g_free(card->id); - assign_string(vobj, &(card->id)); -} - -static void -parse_attribute(ECard *card, VObject *vobj) -{ - ParsePropertyFunc function = g_hash_table_lookup(E_CARD_CLASS(GTK_OBJECT(card)->klass)->attribute_jump_table, vObjectName(vobj)); - if ( function ) - function(card, vobj); -} - -static void -parse(ECard *card, VObject *vobj) -{ - VObjectIterator iterator; - initPropIterator(&iterator, vobj); - while(moreIteration (&iterator)) { - parse_attribute(card, nextVObject(&iterator)); - } - if (!card->name) { - if (card->fname) { - card->name = e_card_name_from_string(card->fname); - } - } - if (!card->file_as) { - if (card->name) { - ECardName *name = card->name; - char *strings[3], **stringptr; - char *string; - stringptr = strings; - if (name->family && *name->family) - *(stringptr++) = name->family; - if (name->given && *name->given) - *(stringptr++) = name->given; - *stringptr = NULL; - string = g_strjoinv(", ", strings); - card->file_as = string; - } else - card->file_as = g_strdup(""); - } -} - -static void -e_card_class_init (ECardClass *klass) -{ - int i; - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS(klass); - - klass->attribute_jump_table = g_hash_table_new(g_str_hash, g_str_equal); - - for ( i = 0; i < sizeof(attribute_jump_array) / sizeof(attribute_jump_array[0]); i++ ) { - g_hash_table_insert(klass->attribute_jump_table, attribute_jump_array[i].key, attribute_jump_array[i].function); - } - - gtk_object_add_arg_type ("ECard::file_as", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FILE_AS); - gtk_object_add_arg_type ("ECard::full_name", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FULL_NAME); - gtk_object_add_arg_type ("ECard::name", - GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_NAME); - gtk_object_add_arg_type ("ECard::address", - GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_ADDRESS); - gtk_object_add_arg_type ("ECard::address_label", - GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_ADDRESS_LABEL); - gtk_object_add_arg_type ("ECard::phone", - GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_PHONE); - gtk_object_add_arg_type ("ECard::email", - GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_EMAIL); - gtk_object_add_arg_type ("ECard::birth_date", - GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_BIRTH_DATE); - gtk_object_add_arg_type ("ECard::url", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_URL); - gtk_object_add_arg_type ("ECard::org", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ORG); - gtk_object_add_arg_type ("ECard::org_unit", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ORG_UNIT); - gtk_object_add_arg_type ("ECard::office", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_OFFICE); - gtk_object_add_arg_type ("ECard::title", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TITLE); - gtk_object_add_arg_type ("ECard::role", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ROLE); - gtk_object_add_arg_type ("ECard::manager", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_MANAGER); - gtk_object_add_arg_type ("ECard::assistant", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ASSISTANT); - gtk_object_add_arg_type ("ECard::nickname", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_NICKNAME); - gtk_object_add_arg_type ("ECard::spouse", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_SPOUSE); - gtk_object_add_arg_type ("ECard::anniversary", - GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_ANNIVERSARY); - gtk_object_add_arg_type ("ECard::mailer", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_MAILER); - gtk_object_add_arg_type ("ECard::fburl", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FBURL); - gtk_object_add_arg_type ("ECard::note", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_NOTE); - gtk_object_add_arg_type ("ECard::categories", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_CATEGORIES); - gtk_object_add_arg_type ("ECard::category_list", - GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CATEGORY_LIST); - gtk_object_add_arg_type ("ECard::pilot_id", - GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_PILOTID); - gtk_object_add_arg_type ("ECard::pilot_status", - GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_PILOTSTATUS); - gtk_object_add_arg_type ("ECard::arbitrary", - GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_ARBITRARY); - gtk_object_add_arg_type ("ECard::id", - GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ID); - - - object_class->destroy = e_card_destroy; - object_class->get_arg = e_card_get_arg; - object_class->set_arg = e_card_set_arg; -} - -ECardPhone * -e_card_phone_new (void) -{ - ECardPhone *newphone = g_new(ECardPhone, 1); - - newphone->number = NULL; - newphone->flags = 0; - - return newphone; -} - -void -e_card_phone_free (ECardPhone *phone) -{ - if ( phone ) { - g_free(phone->number); - - g_free(phone); - } -} - -ECardPhone * -e_card_phone_copy (const ECardPhone *phone) -{ - if ( phone ) { - ECardPhone *phone_copy = g_new(ECardPhone, 1); - phone_copy->number = g_strdup(phone->number); - phone_copy->flags = phone->flags; - return phone_copy; - } else - return NULL; -} - -ECardDeliveryAddress * -e_card_delivery_address_new (void) -{ - ECardDeliveryAddress *newaddr = g_new(ECardDeliveryAddress, 1); - - newaddr->po = NULL; - newaddr->ext = NULL; - newaddr->street = NULL; - newaddr->city = NULL; - newaddr->region = NULL; - newaddr->code = NULL; - newaddr->country = NULL; - newaddr->flags = 0; - - return newaddr; -} - -void -e_card_delivery_address_free (ECardDeliveryAddress *addr) -{ - if ( addr ) { - g_free(addr->po); - g_free(addr->ext); - g_free(addr->street); - g_free(addr->city); - g_free(addr->region); - g_free(addr->code); - g_free(addr->country); - - g_free(addr); - } -} - -ECardDeliveryAddress * -e_card_delivery_address_copy (const ECardDeliveryAddress *addr) -{ - if ( addr ) { - ECardDeliveryAddress *addr_copy = g_new(ECardDeliveryAddress, 1); - addr_copy->po = g_strdup(addr->po ); - addr_copy->ext = g_strdup(addr->ext ); - addr_copy->street = g_strdup(addr->street ); - addr_copy->city = g_strdup(addr->city ); - addr_copy->region = g_strdup(addr->region ); - addr_copy->code = g_strdup(addr->code ); - addr_copy->country = g_strdup(addr->country); - addr_copy->flags = addr->flags; - return addr_copy; - } else - return NULL; -} - -char * -e_card_delivery_address_to_string(const ECardDeliveryAddress *addr) -{ - char *strings[4], **stringptr = strings; - char *line1, *line22, *line2; - char *final; - if (addr->po && *addr->po) - *(stringptr++) = addr->po; - if (addr->street && *addr->street) - *(stringptr++) = addr->street; - if (addr->ext && *addr->ext) - *(stringptr++) = addr->ext; - *stringptr = NULL; - line1 = g_strjoinv(" ", strings); - stringptr = strings; - if (addr->region && *addr->region) - *(stringptr++) = addr->region; - if (addr->code && *addr->code) - *(stringptr++) = addr->code; - *stringptr = NULL; - line22 = g_strjoinv(" ", strings); - stringptr = strings; - if (addr->city && *addr->city) - *(stringptr++) = addr->city; - if (line22 && *line22) - *(stringptr++) = line22; - *stringptr = NULL; - line2 = g_strjoinv(", ", strings); - stringptr = strings; - if (line1 && *line1) - *(stringptr++) = line1; - if (line2 && *line2) - *(stringptr++) = line2; - if (addr->country && *addr->country) - *(stringptr++) = addr->country; - *stringptr = NULL; - final = g_strjoinv("\n", strings); - g_free(line1); - g_free(line22); - g_free(line2); - return final; -} - -ECardAddrLabel * -e_card_address_label_new (void) -{ - ECardAddrLabel *newaddr = g_new(ECardAddrLabel, 1); - - newaddr->data = NULL; - newaddr->flags = 0; - - return newaddr; -} - -void -e_card_address_label_free (ECardAddrLabel *addr) -{ - if ( addr ) { - g_free(addr->data); - - g_free(addr); - } -} - -ECardAddrLabel * -e_card_address_label_copy (const ECardAddrLabel *addr) -{ - if ( addr ) { - ECardAddrLabel *addr_copy = g_new(ECardAddrLabel, 1); - addr_copy->data = g_strdup(addr->data); - addr_copy->flags = addr->flags; - return addr_copy; - } else - return NULL; -} - -ECardName *e_card_name_new(void) -{ - ECardName *newname = g_new(ECardName, 1); - - newname->prefix = NULL; - newname->given = NULL; - newname->additional = NULL; - newname->family = NULL; - newname->suffix = NULL; - - return newname; -} - -void -e_card_name_free(ECardName *name) -{ - if (name) { - if ( name->prefix ) - g_free(name->prefix); - if ( name->given ) - g_free(name->given); - if ( name->additional ) - g_free(name->additional); - if ( name->family ) - g_free(name->family); - if ( name->suffix ) - g_free(name->suffix); - g_free ( name ); - } -} - -ECardName * -e_card_name_copy(const ECardName *name) -{ - if (name) { - ECardName *newname = g_new(ECardName, 1); - - newname->prefix = g_strdup(name->prefix); - newname->given = g_strdup(name->given); - newname->additional = g_strdup(name->additional); - newname->family = g_strdup(name->family); - newname->suffix = g_strdup(name->suffix); - - return newname; - } else - return NULL; -} - -char * -e_card_name_to_string(const ECardName *name) -{ - char *strings[6], **stringptr = strings; - if (name->prefix && *name->prefix) - *(stringptr++) = name->prefix; - if (name->given && *name->given) - *(stringptr++) = name->given; - if (name->additional && *name->additional) - *(stringptr++) = name->additional; - if (name->family && *name->family) - *(stringptr++) = name->family; - if (name->suffix && *name->suffix) - *(stringptr++) = name->suffix; - *stringptr = NULL; - return g_strjoinv(" ", strings); -} - -ECardName * -e_card_name_from_string(const char *full_name) -{ - ECardName *name = g_new(ECardName, 1); - ENameWestern *western = e_name_western_parse (full_name); - - name->prefix = g_strdup (western->prefix); - name->given = g_strdup (western->first ); - name->additional = g_strdup (western->middle); - name->family = g_strdup (western->last ); - name->suffix = g_strdup (western->suffix); - - e_name_western_free(western); - - return name; -} - -ECardArbitrary * -e_card_arbitrary_new(void) -{ - ECardArbitrary *arbitrary = g_new(ECardArbitrary, 1); - arbitrary->key = NULL; - arbitrary->type = NULL; - arbitrary->value = NULL; - return arbitrary; -} - -ECardArbitrary * -e_card_arbitrary_copy(const ECardArbitrary *arbitrary) -{ - if (arbitrary) { - ECardArbitrary *arb_copy = g_new(ECardArbitrary, 1); - arb_copy->key = g_strdup(arbitrary->key); - arb_copy->type = g_strdup(arbitrary->type); - arb_copy->value = g_strdup(arbitrary->value); - return arb_copy; - } else - return NULL; -} - -void -e_card_arbitrary_free(ECardArbitrary *arbitrary) -{ - if (arbitrary) { - g_free(arbitrary->key); - g_free(arbitrary->type); - g_free(arbitrary->value); - } - g_free(arbitrary); -} - -/* - * ECard lifecycle management and vCard loading/saving. - */ - -static void -e_card_destroy (GtkObject *object) -{ - ECard *card = E_CARD(object); - g_free(card->id); - g_free(card->file_as); - g_free(card->fname); - if ( card->name ) - e_card_name_free(card->name); - g_free(card->bday); - - g_free(card->url); - g_free(card->org); - g_free(card->org_unit); - g_free(card->office); - g_free(card->title); - g_free(card->role); - g_free(card->manager); - g_free(card->assistant); - g_free(card->nickname); - g_free(card->spouse); - g_free(card->anniversary); - g_free(card->fburl); - g_free(card->note); - - if (card->categories) - gtk_object_unref(GTK_OBJECT(card->categories)); - if (card->email) - gtk_object_unref(GTK_OBJECT(card->email)); - if (card->phone) - gtk_object_unref(GTK_OBJECT(card->phone)); - if (card->address) - gtk_object_unref(GTK_OBJECT(card->address)); - if (card->address_label) - gtk_object_unref(GTK_OBJECT(card->address_label)); -} - - -/* Set_arg handler for the card */ -static void -e_card_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ECard *card; - - card = E_CARD (object); - - switch (arg_id) { - case ARG_FILE_AS: - g_free(card->file_as); - card->file_as = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_FULL_NAME: - g_free(card->fname); - card->fname = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_NAME: - if ( card->name ) - e_card_name_free(card->name); - card->name = GTK_VALUE_POINTER(*arg); - break; - case ARG_CATEGORIES: - if (card->categories) - gtk_object_unref(GTK_OBJECT(card->categories)); - card->categories = NULL; - if (GTK_VALUE_STRING(*arg)) - do_parse_categories(card, GTK_VALUE_STRING(*arg)); - break; - case ARG_CATEGORY_LIST: - if (card->categories) - gtk_object_unref(GTK_OBJECT(card->categories)); - card->categories = E_LIST(GTK_VALUE_OBJECT(*arg)); - if (card->categories) - gtk_object_ref(GTK_OBJECT(card->categories)); - break; - case ARG_BIRTH_DATE: - g_free(card->bday); - card->bday = GTK_VALUE_POINTER(*arg); - break; - case ARG_URL: - g_free(card->url); - card->url = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_ORG: - g_free(card->org); - card->org = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_ORG_UNIT: - g_free(card->org_unit); - card->org_unit = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_OFFICE: - g_free(card->office); - card->office = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_TITLE: - g_free(card->title); - card->title = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_ROLE: - g_free(card->role); - card->role = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_MANAGER: - g_free(card->manager); - card->manager = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_ASSISTANT: - g_free(card->assistant); - card->assistant = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_NICKNAME: - g_free(card->nickname); - card->nickname = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_SPOUSE: - g_free(card->spouse); - card->spouse = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_ANNIVERSARY: - g_free(card->anniversary); - card->anniversary = GTK_VALUE_POINTER(*arg); - break; - case ARG_MAILER: - g_free(card->mailer); - card->mailer = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_FBURL: - g_free(card->fburl); - card->fburl = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_NOTE: - g_free (card->note); - card->note = g_strdup(GTK_VALUE_STRING(*arg)); - break; - case ARG_PILOTID: - card->pilot_id = GTK_VALUE_INT(*arg); - break; - case ARG_PILOTSTATUS: - card->pilot_status = GTK_VALUE_INT(*arg); - break; - case ARG_ARBITRARY: - if (card->arbitrary) - gtk_object_unref(GTK_OBJECT(card->arbitrary)); - card->arbitrary = E_LIST(GTK_VALUE_OBJECT(*arg)); - if (card->arbitrary) - gtk_object_ref(GTK_OBJECT(card->arbitrary)); - break; - case ARG_ID: - g_free(card->id); - card->id = g_strdup(GTK_VALUE_STRING(*arg)); - break; - default: - return; - } -} - -/* Get_arg handler for the card */ -static void -e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ECard *card; - - card = E_CARD (object); - - switch (arg_id) { - case ARG_FILE_AS: - GTK_VALUE_STRING (*arg) = card->file_as; - break; - case ARG_FULL_NAME: - GTK_VALUE_STRING (*arg) = card->fname; - break; - case ARG_NAME: - GTK_VALUE_POINTER(*arg) = card->name; - break; - case ARG_ADDRESS: - if (!card->address) - card->address = e_list_new((EListCopyFunc) e_card_delivery_address_copy, - (EListFreeFunc) e_card_delivery_address_free, - NULL); - GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->address); - break; - case ARG_ADDRESS_LABEL: - if (!card->address_label) - card->address_label = e_list_new((EListCopyFunc) e_card_address_label_copy, - (EListFreeFunc) e_card_address_label_free, - NULL); - GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->address_label); - break; - case ARG_PHONE: - if (!card->phone) - card->phone = e_list_new((EListCopyFunc) e_card_phone_copy, - (EListFreeFunc) e_card_phone_free, - NULL); - GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->phone); - break; - case ARG_EMAIL: - if (!card->email) - card->email = e_list_new((EListCopyFunc) g_strdup, - (EListFreeFunc) g_free, - NULL); - GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->email); - break; - case ARG_CATEGORIES: - { - int i; - char ** strs; - int length; - EIterator *iterator; - if (!card->categories) - card->categories = e_list_new((EListCopyFunc) g_strdup, - (EListFreeFunc) g_free, - NULL); - length = e_list_length(card->categories); - strs = g_new(char *, length + 1); - for (iterator = e_list_get_iterator(card->categories), i = 0; e_iterator_is_valid(iterator); e_iterator_next(iterator), i++) { - strs[i] = (char *)e_iterator_get(iterator); - } - strs[i] = 0; - GTK_VALUE_STRING(*arg) = g_strjoinv(", ", strs); - g_free(strs); - } - break; - case ARG_CATEGORY_LIST: - if (!card->categories) - card->categories = e_list_new((EListCopyFunc) g_strdup, - (EListFreeFunc) g_free, - NULL); - GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->categories); - break; - case ARG_BIRTH_DATE: - GTK_VALUE_POINTER(*arg) = card->bday; - break; - case ARG_URL: - GTK_VALUE_STRING(*arg) = card->url; - break; - case ARG_ORG: - GTK_VALUE_STRING(*arg) = card->org; - break; - case ARG_ORG_UNIT: - GTK_VALUE_STRING(*arg) = card->org_unit; - break; - case ARG_OFFICE: - GTK_VALUE_STRING(*arg) = card->office; - break; - case ARG_TITLE: - GTK_VALUE_STRING(*arg) = card->title; - break; - case ARG_ROLE: - GTK_VALUE_STRING(*arg) = card->role; - break; - case ARG_MANAGER: - GTK_VALUE_STRING(*arg) = card->manager; - break; - case ARG_ASSISTANT: - GTK_VALUE_STRING(*arg) = card->assistant; - break; - case ARG_NICKNAME: - GTK_VALUE_STRING(*arg) = card->nickname; - break; - case ARG_SPOUSE: - GTK_VALUE_STRING(*arg) = card->spouse; - break; - case ARG_ANNIVERSARY: - GTK_VALUE_POINTER(*arg) = card->anniversary; - break; - case ARG_MAILER: - GTK_VALUE_STRING(*arg) = card->mailer; - break; - case ARG_FBURL: - GTK_VALUE_STRING(*arg) = card->fburl; - break; - case ARG_NOTE: - GTK_VALUE_STRING(*arg) = card->note; - break; - case ARG_PILOTID: - GTK_VALUE_INT(*arg) = card->pilot_id; - break; - case ARG_PILOTSTATUS: - GTK_VALUE_INT(*arg) = card->pilot_status; - break; - case ARG_ARBITRARY: - if (!card->arbitrary) - card->arbitrary = e_list_new((EListCopyFunc) e_card_arbitrary_copy, - (EListFreeFunc) e_card_arbitrary_free, - NULL); - - GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->arbitrary); - break; - case ARG_ID: - GTK_VALUE_STRING(*arg) = card->id; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - - -/** - * e_card_init: - */ -static void -e_card_init (ECard *card) -{ - card->id = g_strdup(""); - - card->file_as = NULL; - card->fname = NULL; - card->name = NULL; - card->bday = NULL; - card->email = NULL; - card->phone = NULL; - card->address = NULL; - card->address_label = NULL; - card->url = NULL; - card->org = NULL; - card->org_unit = NULL; - card->office = NULL; - card->title = NULL; - card->role = NULL; - card->manager = NULL; - card->assistant = NULL; - card->nickname = NULL; - card->spouse = NULL; - card->anniversary = NULL; - card->mailer = NULL; - card->fburl = NULL; - card->note = NULL; - card->categories = NULL; - card->pilot_id = 0; - card->pilot_status = 0; - card->arbitrary = NULL; -#if 0 - - c = g_new0 (ECard, 1); - - c->fname = - c->mailer = - c->role = - c->comment = - c->categories = - c->uid = e_card_prop_str_empty (); - - c->photo.type = PHOTO_JPEG; - c->logo.type = PHOTO_JPEG; - c->rev.utc = -1; - c->sound.type = SOUND_PHONETIC; - c->key.type = KEY_PGP; - - c->categories.prop.encod = ENC_QUOTED_PRINTABLE; - c->comment.prop.encod = ENC_QUOTED_PRINTABLE; - - c->name.prop = c->photo.prop = c->bday.prop = c->timezn.prop = - c->geopos.prop = c->logo.prop = c->org.prop = c->rev.prop = - c->sound.prop = c->key.prop = c->deladdr.prop = c->dellabel.prop = - c->phone.prop = c->email.prop = c->xtension.prop = c->prop = e_card_prop_empty (); - - c->prop.type = PROP_CARD; - c->fname.prop.type = PROP_FNAME; - c->name.prop.type = PROP_NAME; - c->photo.prop.type = PROP_PHOTO; - c->bday.prop.type = PROP_BDAY; - - c->deladdr.prop.type = PROP_DELADDR_LIST; - c->dellabel.prop.type = PROP_DELLABEL_LIST; - c->phone.prop.type = PROP_PHONE_LIST; - c->email.prop.type = PROP_EMAIL_LIST; - c->xtension.prop.type = PROP_XTENSION_LIST; - c->mailer.prop.type = PROP_MAILER; - c->timezn.prop.type = PROP_TIMEZN; - c->geopos.prop.type = PROP_GEOPOS; - c->role.prop.type = PROP_ROLE; - c->logo.prop.type = PROP_LOGO; - c->org.prop.type = PROP_ORG; - c->categories.prop.type = PROP_CATEGORIES; - c->comment.prop.type = PROP_COMMENT; - c->rev.prop.type = PROP_REV; - c->sound.prop.type = PROP_SOUND; - c->uid.prop.type = PROP_UID; - c->key.prop.type = PROP_KEY; - - return c; -#endif -} - -GList * -e_card_load_cards_from_file(const char *filename) -{ - VObject *vobj = Parse_MIME_FromFileName((char *) filename); - GList *list = NULL; - while(vobj) { - VObject *next; - ECard *card = E_CARD(gtk_type_new(e_card_get_type())); - parse(card, vobj); - next = nextVObjectInList(vobj); - cleanVObject(vobj); - vobj = next; - list = g_list_prepend(list, card); - } - list = g_list_reverse(list); - return list; -} - -static void -assign_string(VObject *vobj, char **string) -{ - int type = vObjectValueType(vobj); - char *str; - - switch(type) { - case VCVT_STRINGZ: - *string = g_strdup (vObjectStringZValue(vobj)); - break; - case VCVT_USTRINGZ: - str = (vObjectValueType (vobj) ? fakeCString (vObjectUStringZValue (vobj)) : calloc(1, 1)); - *string = g_strdup(str); - free(str); - break; - default: - *string = g_strdup(""); - break; - } -} - -#if 0 -static void -e_card_str_free (CardStrProperty *sp) -{ - g_free (sp->str); - - e_card_prop_free (sp->prop); -} - -static void -e_card_photo_free (CardPhoto *photo) -{ - g_free (photo->data); - - e_card_prop_free (photo->prop); -} - -/** - * e_card_free: - */ -void -e_card_free (ECard *card) -{ - GList *l; - - g_return_if_fail (card != NULL); - - e_card_name_free (& card->name); - e_card_str_free (& card->fname); - - e_card_photo_free (card->photo); - - e_card_logo_free (card->logo); - e_card_org_free (card->org); - e_card_key_free (card->key); - e_card_sound_free (card->sound); - - e_card_prop_str_free (& card->mailer); - e_card_prop_str_free (& card->role); - e_card_prop_str_free (& card->categories); - e_card_prop_str_free (& card->comment); - e_card_prop_str_free (& card->uid); - - /* address is a little more complicated */ - card_prop_free (card->deladdr.prop); - while ((l = card->deladdr.l)) { - - e_card_deladdr_free ((CardDelAddr *) l->data); - - card->deladdr.l = g_list_remove_link (card->deladdr.l, l); - g_list_free (l); - } - - g_free (card); -} - -typedef struct -{ - char c; - int id; - - GList *sons; -} tree; - -extern CardProperty -e_card_prop_empty (void) -{ - CardProperty prop; - - prop.used = FALSE; - - prop.type = PROP_NONE; - prop.encod = ENC_7BIT; - prop.value = VAL_INLINE; - prop.charset = NULL; - prop.lang = NULL; - prop.grp = NULL; - prop.xtension = NULL; - - prop.user_data = NULL; - - return prop; -} - -static CardStrProperty -e_card_prop_str_empty (void) -{ - CardStrProperty strprop; - - strprop.prop = card_prop_empty (); - strprop.str = NULL; - - return strprop; -} - -/* Intended to check asserts. */ -extern int card_check_prop (ECardProperty prop) -{ - if (((prop.used == FALSE) || (prop.used == TRUE)) && - ((prop.type >= PROP_NONE) && (prop.type <= PROP_LAST)) && - ((prop.encod >= ENC_NONE) && (prop.encod <= ENC_LAST)) && - ((prop.value >= VAL_NONE) && (prop.value <= VAL_LAST))) - return TRUE; - - return FALSE; -} - -extern void -card_prop_free (CardProperty prop) -{ - GList *l; - - g_free (prop.charset); - g_free (prop.lang); - - for (l = prop.xtension; l; l = l->next) { - CardXAttribute *xa = (CardXAttribute *) l->data; - g_free (xa->name); - g_free (xa->data); - } - - g_list_free (l); - - prop.used = FALSE; -} - -e_card_deladdr_free (ECardDelAddr *c) -{ - card_prop_free (c->prop); - - g_free (p->pobox); - g_free (p->ext); - g_free (p->street); - g_free (p->city); - g_free (p->region); - g_free (p->code); - g_free (p->country); -} - -void -card_free (Card *crd) -{ -} - -static tree * -new_tree (char c, int id) -{ - tree *t; - - t = malloc (sizeof (tree)); - t->c = c; - t->id = id; - t->sons = NULL; - - return t; -} - -static void -add_branch (tree *t, char *str, int id) -{ - tree *tmp; - char *end; - - end = str + strlen (str) + 1; - - while (str != end) { - tmp = new_tree (*str, id); - t->sons = g_list_append (t->sons, (gpointer) tmp); - t = tmp; - - str ++; - } -} - -static tree * -add_to_tree (tree *t, struct pair p) -{ - GList *node; - char *c, *end; - tree *tmp; - - c = p.str; - end = c + strlen (c) + 1; - tmp = t; - - while (c != end) { - for (node = tmp->sons; node; node = node->next) - if (((tree *) node->data)->c == *c) { - break; - } - - if (node) { - tmp = (tree *) node->data; - tmp->id = 0; - c++; - } - else { - add_branch (tmp, c, p.id); - break; - } - } - - return t; -} - -static tree * -create_search_tree (void) -{ - tree *t; - int i; - - t = new_tree (0, 0); - for (i = 0; prop_lookup[i].str; i++) - t = add_to_tree (t, prop_lookup[i]); - - return t; -} - -static int -card_lookup_name (const char *c) -{ - static tree *search_tree = NULL; - GList *node; - tree *tmp; - const char *end; - - if (!search_tree) - search_tree = create_search_tree (); - - tmp = search_tree; - end = c + strlen (c) + 1; - - while (tmp->id == 0 && c != end) { - for (node = tmp->sons; node; node = node->next) - if (((tree *) node->data)->c == *c) { - break; - } - - if (node) { - tmp = (tree *) node->data; - c++; - } - else - return 0; - } - - return tmp->id; -} - -static enum PhotoType -get_photo_type (VObject *o) -{ - VObject *vo; - int i; - - for (i = 0; photo_pairs[i].str; i++) - if (has (o, photo_pairs[i].str)) - return photo_pairs[i].id; - - g_warning ("? < No PhotoType for Photo property. Falling back to JPEG."); - return PHOTO_JPEG; -} - -static CardProperty -get_CardProperty (VObject *o) -{ - VObjectIterator i; - CardProperty prop; - - prop = card_prop_empty (); - prop.used = TRUE; - - initPropIterator (&i, o); - while (moreIteration (&i)) { - VObject *vo = nextVObject (&i); - const char *n = vObjectName (vo); - int propid; - - propid = card_lookup_name (n); - - switch (propid) { - - case PROP_VALUE: - - if (has (vo, VCContentIDProp)) - prop.value = VAL_CID; - break; - - case PROP_ENCODING: - if (has (vo, VCQuotedPrintableProp)) - prop.encod = ENC_QUOTED_PRINTABLE; - else if (has (vo, VC8bitProp)) - prop.encod = ENC_8BIT; - else if (has (vo, VCBase64Prop)) - prop.encod = ENC_BASE64; - break; - - case PROP_QUOTED_PRINTABLE: - prop.encod = ENC_QUOTED_PRINTABLE; - break; - - case PROP_8BIT: - prop.encod = ENC_8BIT; - break; - - case PROP_BASE64: - prop.encod = ENC_BASE64; - break; - - case PROP_LANG: - if (vObjectValueType (vo)) { - prop.lang = - g_strdup (vObjectStringZValue (vo)); - } else - g_warning ("? < No value for LANG attribute."); - break; - - case PROP_CHARSET: - if (vObjectValueType (vo)) { - prop.charset = - g_strdup (vObjectStringZValue (vo)); - g_warning (prop.charset); - } else - g_warning ("? < No value for CHARSET attribute."); - break; - default: - { - CardXAttribute *c; - - c = malloc (sizeof (CardXAttribute)); - c->name = g_strdup (n); - - if (vObjectValueType (vo)) - c->data = - g_strdup (vObjectStringZValue (vo)); - else - c->data = NULL; - - prop.xtension = - g_list_append (prop.xtension, c); - } - } - } - - return prop; -} - -static gboolean -e_card_prop_has (VObject *o, - const char *id) -{ - g_assert (o != NULL); - g_assert (id != NULL); - - if (isAPropertyOf (o, id) == NULL) - return FALSE; - - return TRUE; -} - -static const char * -e_card_prop_get_str (VObject *o, - const char *id) -{ - VObject *strobj; - - g_assert (o != NULL); - g_assert (id != NULL); - - strobj = isAPropertyOf (o, id); - - if (strobj == NULL) - return g_strdup (""); - - if (vObjectValueType (strobj) != NULL) { - char *str; - char *g_str; - - str = fakeCString (vObjectStringZValue (strobj)); - g_str = g_strdup (str); - free (str); - - return g_str; - } - - return g_strdup (""); -} - -static ECardName * -e_card_get_name (VObject *o) -{ - CardName *name; - VObject *vo; - char *the_str; - - name = g_new0 (ECardName, 1); - - name->family = e_card_prop_get_substr (o, VCFamilyNameProp); - name->given = e_card_prop_get_substr (o, VCGivenNameProp); - name->additional = e_card_prop_get_substr (o, VCAdditionalNamesProp); - name->prefix = e_card_prop_get_substr (o, VCNamePrefixesProp); - name->suffix = e_card_prop_get_substr (o, VCNameSuffixesProp); - - return name; -} - -static CardDelLabel * -get_CardDelLabel (VObject *o) -{ - CardDelLabel *dellabel; - char *the_str; - - dellabel = malloc (sizeof (CardDelLabel)); - - dellabel->type = get_addr_type (o); - dellabel->data = g_strdup (str_val (o)); - - free (the_str); - return dellabel; -} - -static CardPhone * -get_CardPhone (VObject *o) -{ - CardPhone *ret; - char *the_str; - - ret = malloc (sizeof (CardPhone)); - ret->type = get_phone_type (o); - ret->data = g_strdup (str_val (o)); - - free (the_str); - - return ret; -} - -static CardEMail * -get_CardEMail (VObject *o) -{ - CardEMail *ret; - char *the_str; - - ret = malloc (sizeof (CardEMail)); - ret->type = get_email_type (o); - ret->data = g_strdup (str_val (o)); - - free (the_str); - - return ret; -} - -static CardTimeZone -strtoCardTimeZone (char *str) -{ - char s[3]; - CardTimeZone tz; - - if (*str == '-') { - tz.sign = -1; - str++; - } else - tz.sign = 1; - - tz.hours = 0; - tz.mins = 0; - - s[2] = 0; - if (strlen (str) > 2) { - s[0] = str[0]; - s[1] = str[1]; - tz.hours = atoi (s); - } else { - g_warning ("? < TimeZone value is too short."); - return tz; - } - - str += 2; - if (*str == ':') - str++; - - if (strlen (str) >= 2) { - s[0] = str[0]; - s[1] = str[1]; - tz.mins = atoi (s); - } else { - g_warning ("? < TimeZone value is too short."); - return tz; - } - - if (strlen (str) > 3) - g_warning ("? < TimeZone value is too long."); - - return tz; -} - -static CardGeoPos -strtoCardGeoPos (char *str) -{ - CardGeoPos gp; - char *s; - - gp.lon = 0; - gp.lat = 0; - - s = strchr (str, ','); - - if (! s) { - g_warning ("? < Bad format for GeoPos property."); - return gp; - } - - *s = 0; - s++; - - gp.lon = atof (str); - gp.lat = atof (s); - - return gp; -} - -static CardOrg * -e_card_vobject_to_org (VObject *o) -{ - VObject *vo; - char *the_str; - CardOrg *org; - - org = g_new0 (CardOrg, 1); - - if (has (o, VCOrgNameProp)) { - org.name = g_strdup (str_val (vo)); - free (the_str); - } - if (has (o, VCOrgUnitProp)) { - org.unit1 = g_strdup (str_val (vo)); - free (the_str); - } - if (has (o, VCOrgUnit2Prop)) { - org.unit2 = g_strdup (str_val (vo)); - free (the_str); - } - if (has (o, VCOrgUnit3Prop)) { - org.unit3 = g_strdup (str_val (vo)); - free (the_str); - } - if (has (o, VCOrgUnit4Prop)) { - org.unit4 = g_strdup (str_val (vo)); - free (the_str); - } - - return org; -} - -static CardXProperty * -get_XProp (VObject *o) -{ - char *the_str; - CardXProperty *ret; - - ret = malloc (sizeof (CardXProperty)); - ret->name = g_strdup (vObjectName (o)); - ret->data = g_strdup (str_val (o)); - free (the_str); - - return ret; -} - -static CardRev -strtoCardRev (char *str) -{ - char s[3], *t, *ss; - int len, i; - CardRev rev; - - rev.utc = 0; - len = strlen (str); - - if (str[len] == 'Z') { /* Is it UTC? */ - rev.utc = 1; - str[len] = 0; - } - - s[2] = 0; - t = strchr (str, 'T'); - if (t) { /* Take the Time */ - *t = 0; - t++; - if (strlen (t) > 2) { - s[0] = t[0]; - s[1] = t[1]; - rev.tm.tm_hour = atoi (s); - } else { - g_warning ("? < Rev value is too short."); - return rev; - } - - t += 2; - if (*t == ':') /* Ignore ':' separator */ - t++; - - if (strlen (t) > 2) { - s[0] = t[0]; - s[1] = t[1]; - rev.tm.tm_min = atoi (s); - } else { - g_warning ("? < Rev value is too short."); - return rev; - } - - t += 2; - if (*t == ':') - t++; - - if (strlen (t) > 2) { - s[0] = t[0]; - s[1] = t[1]; - rev.tm.tm_sec = atoi (s); - } else { - g_warning ("? < Rev value is too short."); - return rev; - } - - if (strlen (str) > 3) - g_warning ("? < Rev value is too long."); - - } else { - g_warning ("? < No time value for Rev property."); - } - - /* Now the date (the part before the T) */ - - if (strchr (str, '-')) { /* extended iso 8601 */ - for (ss = strtok (str, "-"), i = 0; ss; - ss = strtok (NULL, "-"), i++) - switch (i) { - case 0: - rev.tm.tm_year = atoi (ss); - break; - case 1: - rev.tm.tm_mon = atoi (ss); - break; - case 2: - rev.tm.tm_mday = atoi (ss); - break; - default: - g_warning ("? < Too many values for Rev property."); - } - - if (i < 2) - g_warning ("? < Too few values for Rev property."); - } else { - if (strlen (str) >= 8) { /* short representation */ - rev.tm.tm_mday = atoi (str + 6); - str[6] = 0; - rev.tm.tm_mon = atoi (str + 4); - str[4] = 0; - rev.tm.tm_year = atoi (str); - } else - g_warning ("? < Bad format for Rev property."); - } - - return rev; -} - -static enum KeyType -get_key_type (VObject *o) -{ - VObject *vo; - int i; - - for (i = 0; key_pairs[i].str; i++) - if (has (o, key_pairs[i].str)) - return key_pairs[i].id; - - g_warning ("? < No KeyType for Key property. Falling back to PGP."); - return KEY_PGP; -} - -static CardPhoto -get_CardPhoto (VObject *o) -{ - VObject *vo; - char *the_str; - CardPhoto photo; - - photo.type = get_photo_type (o); - - if (has (o, VCDataSizeProp)) { - photo.size = vObjectIntegerValue (vo); - photo.data = malloc (photo.size); - memcpy (photo.data, vObjectAnyValue (o), photo.size); - } else { - photo.size = strlen (str_val (o)) + 1; - photo.data = g_strdup (the_str); - free (the_str); - } - - return photo; -} - -static enum SoundType -get_sound_type (VObject *o) -{ - VObject *vo; - int i; - - for (i = 0; sound_pairs[i].str; i++) - if (has (o, sound_pairs[i].str)) - return sound_pairs[i].id; - - return SOUND_PHONETIC; -} - -static CardSound -get_CardSound (VObject *o) -{ - VObject *vo; - char *the_str; - CardSound sound; - - sound.type = get_sound_type (o); - - if (has (o, VCDataSizeProp)) { - sound.size = vObjectIntegerValue (vo); - sound.data = malloc (sound.size); - memcpy (sound.data, vObjectAnyValue (o), sound.size); - } else { - sound.size = strlen (str_val (o)); - sound.data = g_strdup (the_str); - free (the_str); - } - - return sound; -} - -/* Loads our card contents from a VObject */ -static ECard * -e_card_construct_from_vobject (ECard *card, - VObject *vcrd) -{ - VObjectIterator i; - Card *crd; - char *the_str; - - initPropIterator (&i, vcrd); - crd = card_new (); - - while (moreIteration (&i)) { - VObject *o = nextVObject (&i); - const char *n = vObjectName (o); - int propid; - CardProperty *prop = NULL; - - propid = card_lookup_name (n); - - switch (propid) { - case PROP_FNAME: - prop = &crd->fname.prop; - crd->fname.str = g_strdup (str_val (o)); - free (the_str); - break; - case PROP_NAME: - prop = &crd->name.prop; - crd->name = e_card_get_name (o); - break; - case PROP_PHOTO: - prop = &crd->photo.prop; - crd->photo = get_CardPhoto (o); - break; - case PROP_BDAY: - prop = &crd->bday.prop; - crd->bday = strtoCardBDay (str_val (o)); - free (the_str); - break; - case PROP_DELADDR: - { - CardDelAddr *c; - c = get_CardDelAddr (o); - prop = &c->prop; - crd->deladdr.l = g_list_append (crd->deladdr.l, c); - } - break; - case PROP_DELLABEL: - { - CardDelLabel *c; - c = get_CardDelLabel (o); - prop = &c->prop; - crd->dellabel.l = g_list_append (crd->dellabel.l, c); - } - break; - case PROP_PHONE: - { - CardPhone *c; - - c = get_CardPhone (o); - prop = &c->prop; - crd->phone.l = g_list_append (crd->phone.l, c); - } - break; - case PROP_EMAIL: - { - CardEMail *c; - - c = get_CardEMail (o); - prop = &c->prop; - crd->email.l = g_list_append (crd->email.l, c); - } - break; - case PROP_MAILER: - prop = &crd->mailer.prop; - crd->mailer.str = g_strdup (str_val (o)); - free (the_str); - break; - case PROP_TIMEZN: - prop = &crd->timezn.prop; - crd->timezn = strtoCardTimeZone (str_val (o)); - free (the_str); - break; - case PROP_GEOPOS: - prop = &crd->geopos.prop; - crd->geopos = strtoCardGeoPos (str_val (o)); - break; - case PROP_ROLE: - prop = &crd->role.prop; - crd->role.str = g_strdup (str_val (o)); - free (the_str); - break; - case PROP_LOGO: - prop = &crd->logo.prop; - crd->logo = get_CardPhoto (o); - break; - case PROP_AGENT: - crd->agent = card_create_from_vobject (o); - break; - case PROP_ORG: - prop = &crd->org.prop; - crd->org = get_CardOrg (o); - break; - case PROP_CATEGORIES: - prop = &crd->categories.prop; - crd->categories.str = g_strdup (str_val (o)); - crd->categories.prop.encod = ENC_QUOTED_PRINTABLE; - free (the_str); - break; - case PROP_COMMENT: - prop = &crd->comment.prop; - crd->comment.str = g_strdup (str_val (o)); - crd->comment.prop.encod = ENC_QUOTED_PRINTABLE; - free (the_str); - break; - case PROP_REV: - prop = &crd->rev.prop; - crd->rev = strtoCardRev (str_val (o)); - free (the_str); - break; - case PROP_SOUND: - prop = &crd->sound.prop; - crd->sound = get_CardSound (o); - break; - case PROP_VERSION: - { - char *str; - str = str_val (o); - if (strcmp (str, "2.1")) - g_warning ("? < Version doesn't match."); - free (the_str); - } - break; - case PROP_KEY: - prop = &crd->key.prop; - crd->key.type = get_key_type (o); - crd->key.data = g_strdup (str_val (o)); - free (the_str); - break; - default: - { - CardXProperty *c; - - c = get_XProp (o); - prop = &c->prop; - crd->xtension.l = g_list_append (crd->xtension.l, c); - } - break; - } - - if (prop) { - *prop = get_CardProperty (o); - prop->type = propid; - } - } - - return crd; -} - -/* Loads a card from a file */ -GList * -card_load (GList *crdlist, char *fname) -{ - VObject *vobj, *tmp; - - vobj = Parse_MIME_FromFileName (fname); - if (!vobj) { - g_warning ("Could not load the cardfile"); - return NULL; - } - - while (vobj) { - const char *n = vObjectName (vobj); - - if (strcmp (n, VCCardProp) == 0) { - crdlist = g_list_append (crdlist, (gpointer) - card_create_from_vobject (vobj)); - } - tmp = vobj; - vobj = nextVObjectInList (vobj); - cleanVObject (tmp); - } - - cleanVObject (vobj); - cleanStrTbl (); - return crdlist; -} - -static VObject * -add_strProp (VObject *o, const char *id, char *val) -{ - VObject *vo = NULL; - - if (val) - vo = addPropValue (o, id, val); - - return vo; -} - -static VObject * -add_CardProperty (VObject *o, CardProperty *prop) -{ - GList *node; - - switch (prop->encod) { - case ENC_BASE64: - addProp (o, VCBase64Prop); - break; - case ENC_QUOTED_PRINTABLE: - addProp (o, VCQuotedPrintableProp); - break; - case ENC_8BIT: - addProp (o, VC8bitProp); - break; - case ENC_7BIT: - /* Do nothing: 7BIT is the default. Avoids file clutter. */ - break; - default: - g_warning ("? < Card had invalid encoding type."); - } - - switch (prop->value) { - case VAL_CID: - addProp (o, VCContentIDProp); - break; - case VAL_INLINE: - /* Do nothing: INLINE is the default. Avoids file clutter. */ - break; - default: - g_warning ("? < Card had invalid value type."); - } - - for (node = prop->xtension; node; node = node->next) { - CardXAttribute *xa = (CardXAttribute *) node->data; - if (xa->data) - addPropValue (o, xa->name, xa->data); - else - addProp (o, xa->name); - } - - add_strProp (o, VCCharSetProp, prop->charset); - add_strProp (o, VCLanguageProp, prop->lang); - - return o; -} - -static VObject * -add_CardStrProperty (VObject *vobj, const char *id, CardStrProperty *strprop) -{ - VObject *vprop; - - if (strprop->prop.used) { - vprop = add_strProp (vobj, id, strprop->str); - add_CardProperty (vprop, &strprop->prop); - } - - return vobj; -} - -static VObject * -add_PhotoType (VObject *o, enum PhotoType photo_type) -{ - int i; - - for (i = 0; photo_pairs[i].str; i++) - if (photo_type == photo_pairs[i].id) { - addProp (o, photo_pairs[i].str); - return o; - } - - g_warning ("? > No PhotoType for Photo property. Falling back to JPEG."); - addProp (o, VCJPEGProp); - - return o; -} - -static VObject * -add_AddrType (VObject *o, int addr_type) -{ - int i; - - for (i = 0; addr_pairs[i].str; i++) - if (addr_type & addr_pairs[i].id) - addProp (o, addr_pairs[i].str); - - return o; -} - -static void -add_strAddrType (GString *string, int addr_type) -{ - int i, first = 1; - char *str; - - if (addr_type) { - g_string_append (string, " ("); - - for (i = 0; addr_pairs[i].str; i++) - if (addr_type & addr_pairs[i].id) { - if (!first) - g_string_append (string, ", "); - first = 0; - str = my_cap (addr_pairs[i].str); - g_string_append (string, str); - g_free (str); - } - - g_string_append_c (string, ')'); - } -} - -static VObject * -add_PhoneType (VObject *o, int phone_type) -{ - int i; - - for (i = 0; phone_pairs[i].str; i++) - if (phone_type & phone_pairs[i].id) - addProp (o, phone_pairs[i].str); - - return o; -} - -static void -add_strPhoneType (GString *string, int phone_type) -{ - int i, first = 1; - char *str; - - if (phone_type) { - g_string_append (string, " ("); - - for (i = 0; phone_pairs[i].str; i++) - if (phone_type & phone_pairs[i].id) { - if (!first) - g_string_append (string, ", "); - first = 0; - str = my_cap (phone_pairs[i].str); - g_string_append (string, str); - g_free (str); - } - - g_string_append_c (string, ')'); - } -} - -static VObject * -add_EMailType (VObject *o, enum EMailType email_type) -{ - int i; - - for (i = 0; email_pairs[i].str; i++) - if (email_type == email_pairs[i].id) { - addProp (o, email_pairs[i].str); - return o; - } - - g_warning ("? > No EMailType for EMail property. Falling back to INET."); - addProp (o, VCInternetProp); - - return o; -} - -static void -add_strEMailType (GString *string, int email_type) -{ - int i; - char *str; - - if (email_type) { - g_string_append (string, " ("); - - for (i = 0; email_pairs[i].str; i++) - if (email_type == email_pairs[i].id) { - str = my_cap (email_pairs[i].str); - g_string_append (string, str); - g_free (str); - break; - } - - g_string_append_c (string, ')'); - } -} - -static VObject * -add_KeyType (VObject *o, enum KeyType key_type) -{ - int i; - - for (i = 0; key_pairs[i].str; i++) - if (key_type == key_pairs[i].id) { - addProp (o, key_pairs[i].str); - return o; - } - - g_warning ("? > No KeyType for Key property. Falling back to PGP."); - addProp (o, VCPGPProp); - - return o; -} - -static void -add_strKeyType (GString *string, int key_type) -{ - int i; - char *str; - - if (key_type) { - g_string_append (string, " ("); - - for (i = 0; key_pairs[i].str; i++) - if (key_type == key_pairs[i].id) { - str = my_cap (key_pairs[i].str); - g_string_append (string, str); - g_free (str); - break; - } - - g_string_append_c (string, ')'); - } -} - -static VObject * -add_SoundType (VObject *o, enum SoundType sound_type) -{ - int i; - - for (i = 0; sound_pairs[i].str; i++) - if (sound_type == sound_pairs[i].id) { - addProp (o, sound_pairs[i].str); - return o; - } - - return o; -} - -char *card_timezn_str (CardTimeZone timezn) -{ - char *str; - - str = malloc (7); - snprintf (str, 7, (timezn.sign == -1)? "-%02d:%02d" : "%02d:%02d", - timezn.hours, timezn.mins); - return str; -} - -char *card_geopos_str (CardGeoPos geopos) -{ - char *str; - - str = malloc (15); - snprintf (str, 15, "%03.02f,%03.02f", geopos.lon, geopos.lat); - return str; -} - -static void add_CardStrProperty_to_string (GString *string, char *prop_name, - CardStrProperty *strprop) -{ - if (strprop->prop.used) { - if (prop_name) - g_string_append (string, prop_name); - - g_string_append (string, strprop->str); - } -} - -static void add_strProp_to_string (GString *string, char *prop_name, char *val) -{ - if (val) { - if (prop_name) - g_string_append (string, prop_name); - - g_string_append (string, val); - } -} - -static void addProp_to_string (GString *string, char *prop_name) -{ - if (prop_name) - g_string_append (string, prop_name); -} - -char * -card_to_string (Card *crd) -{ - GString *string; - char *ret; - - string = g_string_new (""); - - add_CardStrProperty_to_string (string, _ ("Card: "), &crd->fname); - if (crd->name.prop.used) { - addProp_to_string (string, _ ("\nName: ")); - add_strProp_to_string (string, _ ("\n Prefix: "), crd->name.prefix); - add_strProp_to_string (string, _ ("\n Given: "), crd->name.given); - add_strProp_to_string (string, _ ("\n Additional: "), crd->name.additional); - add_strProp_to_string (string, _ ("\n Family: "), crd->name.family); - add_strProp_to_string (string, _ ("\n Suffix: "), crd->name.suffix); - g_string_append_c (string, '\n'); - } - -/* if (crd->photo.prop.used) { - addPropSizedValue (string, _ ("\nPhoto: "), - crd->photo.data, crd->photo.size); - add_PhotoType (string, crd->photo.type); - }*/ - - if (crd->bday.prop.used) { - char *date_str; - - date_str = card_bday_str (crd->bday); - add_strProp_to_string (string, _ ("\nBirth Date: "), date_str); - free (date_str); - } - - if (crd->deladdr.l) { - GList *node; - - for (node = crd->deladdr.l; node; node = node->next) { - CardDelAddr *deladdr = (CardDelAddr *) node->data; - - if (deladdr->prop.used) { - addProp_to_string (string, _ ("\nAddress:")); - add_strAddrType (string, deladdr->type); - add_strProp_to_string (string, _ ("\n Postal Box: "), deladdr->po); - add_strProp_to_string (string, _ ("\n Ext: "),deladdr->ext); - add_strProp_to_string (string, _ ("\n Street: "),deladdr->street); - add_strProp_to_string (string, _ ("\n City: "), deladdr->city); - add_strProp_to_string (string, _ ("\n Region: "), deladdr->region); - add_strProp_to_string (string, _ ("\n Postal Code: "), deladdr->code); - add_strProp_to_string (string, _ ("\n Country: "), deladdr->country); - } - } - - g_string_append_c (string, '\n'); - } - - if (crd->dellabel.l) { - GList *node; - - for (node = crd->dellabel.l; node; node = node->next) { - CardDelLabel *dellabel = (CardDelLabel *) node->data; - - add_strProp_to_string (string, _ ("\nDelivery Label: "), - dellabel->data); - add_strAddrType (string, dellabel->type); - } - } - - if (crd->phone.l) { - GList *node; - char *sep; - - if (crd->phone.l->next) { - sep = " "; - g_string_append (string, _ ("\nTelephones:\n")); - } else { - sep = " "; - g_string_append (string, _ ("\nTelephone:")); - } - - for (node = crd->phone.l; node; node = node->next) { - CardPhone *phone = (CardPhone *) node->data; - - if (phone->prop.used) { - g_string_append (string, sep); - g_string_append (string, phone->data); - add_strPhoneType (string, phone->type); - g_string_append_c (string, '\n'); - } - } - - if (crd->phone.l->next) - g_string_append_c (string, '\n'); - } - - if (crd->email.l) { - GList *node; - char *sep; - - if (crd->email.l->next) { - sep = " "; - g_string_append (string, _ ("\nE-mail:\n")); - } else { - sep = " "; - g_string_append (string, _ ("\nE-mail:")); - } - - - for (node = crd->email.l; node; node = node->next) { - CardEMail *email = (CardEMail *) node->data; - - if (email->prop.used) { - g_string_append (string, sep); - g_string_append (string, email->data); - add_strEMailType (string, email->type); - g_string_append_c (string, '\n'); - } - } - - if (crd->email.l->next) - g_string_append_c (string, '\n'); - } - - add_CardStrProperty_to_string (string, _ ("\nMailer: "), &crd->mailer); - - if (crd->timezn.prop.used) { - char *str; - - str = card_timezn_str (crd->timezn); - add_strProp_to_string (string, _ ("\nTime Zone: "), str); - free (str); - } - - if (crd->geopos.prop.used) { - char *str; - - str = card_geopos_str (crd->geopos); - add_strProp_to_string (string, _ ("\nGeo Location: "), str); - free (str); - } - - add_CardStrProperty_to_string (string, _ ("\nBusiness Role: "), &crd->role); - -/* if (crd->logo.prop.used) { - addPropSizedValue (string, _ ("\nLogo: "), - crd->logo.data, crd->logo.size); - add_PhotoType (string, crd->logo.type); - }*/ - -/* if (crd->agent) - addstringectProp (string, card_convert_to_stringect (crd->agent));*/ - - if (crd->org.prop.used) { - addProp_to_string (string, _ ("\nOrg: ")); - add_strProp_to_string (string, _ ("\n Name: "), crd->org.name); - add_strProp_to_string (string, _ ("\n Unit: "), crd->org.unit1); - add_strProp_to_string (string, _ ("\n Unit2: "), crd->org.unit2); - add_strProp_to_string (string, _ ("\n Unit3: "), crd->org.unit3); - add_strProp_to_string (string, _ ("\n Unit4: "), crd->org.unit4); - g_string_append_c (string, '\n'); - } - - add_CardStrProperty_to_string (string, _ ("\nCategories: "), &crd->categories); - add_CardStrProperty_to_string (string, _ ("\nComment: "), &crd->comment); - -/* if (crd->sound.prop.used) { - if (crd->sound.type != SOUND_PHONETIC) - addPropSizedValue (string, _ ("\nPronunciation: "), - crd->sound.data, crd->sound.size); - else - add_strProp_to_string (string, _ ("\nPronunciation: "), - crd->sound.data); - - add_SoundType (string, crd->sound.type); - }*/ - - add_CardStrProperty_to_string (string, _ ("\nUnique String: "), &crd->uid); - - if (crd->key.prop.used) { - add_strProp_to_string (string, _ ("\nPublic Key: "), crd->key.data); - add_strKeyType (string, crd->key.type); - } - - ret = g_strdup (string->str); - g_string_free (string, TRUE); - - return ret; -} -#endif - -static ECardDate -e_card_date_from_string (char *str) -{ - ECardDate date; - int length; - - date.year = 0; - date.month = 0; - date.day = 0; - - length = strlen(str); - - if (length == 10 ) { - date.year = str[0] * 1000 + str[1] * 100 + str[2] * 10 + str[3] - '0' * 1111; - date.month = str[5] * 10 + str[6] - '0' * 11; - date.day = str[8] * 10 + str[9] - '0' * 11; - } else if ( length == 8 ) { - date.year = str[0] * 1000 + str[1] * 100 + str[2] * 10 + str[3] - '0' * 1111; - date.month = str[4] * 10 + str[5] - '0' * 11; - date.day = str[6] * 10 + str[7] - '0' * 11; - } - - return date; -} - -char * -e_v_object_get_child_value(VObject *vobj, char *name) -{ - char *ret_val; - VObjectIterator iterator; - initPropIterator(&iterator, vobj); - while(moreIteration (&iterator)) { - VObject *attribute = nextVObject(&iterator); - const char *id = vObjectName(attribute); - if ( ! strcmp(id, name) ) { - assign_string(attribute, &ret_val); - return ret_val; - } - } - ret_val = g_new(char, 1); - *ret_val = 0; - return ret_val; -} - -static ECardPhoneFlags -get_phone_flags (VObject *vobj) -{ - ECardPhoneFlags ret = 0; - int i; - - struct { - char *id; - ECardPhoneFlags flag; - } phone_pairs[] = { - { VCPreferredProp, E_CARD_PHONE_PREF }, - { VCWorkProp, E_CARD_PHONE_WORK }, - { VCHomeProp, E_CARD_PHONE_HOME }, - { VCVoiceProp, E_CARD_PHONE_VOICE }, - { VCFaxProp, E_CARD_PHONE_FAX }, - { VCMessageProp, E_CARD_PHONE_MSG }, - { VCCellularProp, E_CARD_PHONE_CELL }, - { VCPagerProp, E_CARD_PHONE_PAGER }, - { VCBBSProp, E_CARD_PHONE_BBS }, - { VCModemProp, E_CARD_PHONE_MODEM }, - { VCCarProp, E_CARD_PHONE_CAR }, - { VCISDNProp, E_CARD_PHONE_ISDN }, - { VCVideoProp, E_CARD_PHONE_VIDEO }, - }; - - for (i = 0; i < sizeof(phone_pairs) / sizeof(phone_pairs[0]); i++) { - if (isAPropertyOf (vobj, phone_pairs[i].id)) { - ret |= phone_pairs[i].flag; - } - } - - return ret; -} - -static void -set_phone_flags (VObject *vobj, ECardPhoneFlags flags) -{ - int i; - - struct { - char *id; - ECardPhoneFlags flag; - } phone_pairs[] = { - { VCPreferredProp, E_CARD_PHONE_PREF }, - { VCWorkProp, E_CARD_PHONE_WORK }, - { VCHomeProp, E_CARD_PHONE_HOME }, - { VCVoiceProp, E_CARD_PHONE_VOICE }, - { VCFaxProp, E_CARD_PHONE_FAX }, - { VCMessageProp, E_CARD_PHONE_MSG }, - { VCCellularProp, E_CARD_PHONE_CELL }, - { VCPagerProp, E_CARD_PHONE_PAGER }, - { VCBBSProp, E_CARD_PHONE_BBS }, - { VCModemProp, E_CARD_PHONE_MODEM }, - { VCCarProp, E_CARD_PHONE_CAR }, - { VCISDNProp, E_CARD_PHONE_ISDN }, - { VCVideoProp, E_CARD_PHONE_VIDEO }, - }; - - for (i = 0; i < sizeof(phone_pairs) / sizeof(phone_pairs[0]); i++) { - if (flags & phone_pairs[i].flag) { - addProp (vobj, phone_pairs[i].id); - } - } -} - -static ECardAddressFlags -get_address_flags (VObject *vobj) -{ - ECardAddressFlags ret = 0; - int i; - - struct { - char *id; - ECardAddressFlags flag; - } addr_pairs[] = { - { VCDomesticProp, E_CARD_ADDR_DOM }, - { VCInternationalProp, E_CARD_ADDR_INTL }, - { VCPostalProp, E_CARD_ADDR_POSTAL }, - { VCParcelProp, E_CARD_ADDR_PARCEL }, - { VCHomeProp, E_CARD_ADDR_HOME }, - { VCWorkProp, E_CARD_ADDR_WORK }, - }; - - for (i = 0; i < sizeof(addr_pairs) / sizeof(addr_pairs[0]); i++) { - if (isAPropertyOf (vobj, addr_pairs[i].id)) { - ret |= addr_pairs[i].flag; - } - } - - return ret; -} - -static void -set_address_flags (VObject *vobj, ECardAddressFlags flags) -{ - int i; - - struct { - char *id; - ECardAddressFlags flag; - } addr_pairs[] = { - { VCDomesticProp, E_CARD_ADDR_DOM }, - { VCInternationalProp, E_CARD_ADDR_INTL }, - { VCPostalProp, E_CARD_ADDR_POSTAL }, - { VCParcelProp, E_CARD_ADDR_PARCEL }, - { VCHomeProp, E_CARD_ADDR_HOME }, - { VCWorkProp, E_CARD_ADDR_WORK }, - }; - - for (i = 0; i < sizeof(addr_pairs) / sizeof(addr_pairs[0]); i++) { - if (flags & addr_pairs[i].flag) { - addProp (vobj, addr_pairs[i].id); - } - } -} diff --git a/addressbook/backend/ebook/e-card.h b/addressbook/backend/ebook/e-card.h deleted file mode 100644 index 3992067a55..0000000000 --- a/addressbook/backend/ebook/e-card.h +++ /dev/null @@ -1,141 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@helixcode.com> - * Arturo Espinosa - * Nat Friedman (nat@helixcode.com) - * - * Copyright (C) 2000 Helix Code, Inc. - * Copyright (C) 1999 The Free Software Foundation - */ - -#ifndef __E_CARD_H__ -#define __E_CARD_H__ - -#include <time.h> -#include <gtk/gtk.h> -#include <stdio.h> -#include <addressbook/backend/ebook/e-card-types.h> -#include <e-util/e-list.h> - -#define E_TYPE_CARD (e_card_get_type ()) -#define E_CARD(obj) (GTK_CHECK_CAST ((obj), E_TYPE_CARD, ECard)) -#define E_CARD_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_CARD, ECardClass)) -#define E_IS_CARD(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_CARD)) -#define E_IS_CARD_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_CARD)) - -typedef struct _ECard ECard; -typedef struct _ECardClass ECardClass; - -struct _ECard { - GtkObject object; - char *id; - - char *file_as; /* The File As field. */ - char *fname; /* The full name. */ - ECardName *name; /* The structured name. */ - EList *address; /* Delivery addresses (ECardDeliveryAddress *) */ - EList *address_label; /* Delivery address labels - * (ECardAddrLabel *) */ - - EList *phone; /* Phone numbers (ECardPhone *) */ - EList *email; /* Email addresses (char *) */ - char *url; /* The person's web page. */ - - ECardDate *bday; /* The person's birthday. */ - - char *note; - - - char *org; /* The person's organization. */ - char *org_unit; /* The person's organization unit. */ - char *office; /* The person's office. */ - char *role; /* The person's role w/in his org */ - char *title; /* The person's title w/in his org */ - - char *manager; - char *assistant; - - char *nickname; /* The person's nickname */ - - char *spouse; /* The person's spouse. */ - ECardDate *anniversary; /* The person's anniversary. */ - - char *mailer; /* Mailer */ - - char *fburl; /* Free Busy URL */ - - EList *categories; /* Categories. */ - - EList *arbitrary; /* Arbitrary fields. */ - - guint32 pilot_id; /* id of the corresponding pilot */ - guint32 pilot_status; /* status information */ -#if 0 - ECardPhoto *logo; /* This person's org's logo. */ - - ECardPhoto *photo; /* A photo of the person. */ - - ECard *agent; /* A person who sereves as this - guy's agent/secretary/etc. */ - - - char *categories; /* A list of the categories to which - this card belongs. */ - - ECardSound *sound; - - ECardKey *key; /* The person's public key. */ - ECardTimeZone *timezn; /* The person's time zone. */ - ECardGeoPos *geopos; /* The person's long/lat. */ - - ECardRev *rev; /* The time this card was last - modified. */ - - EList xtension; -#endif -}; - -struct _ECardClass { - GtkObjectClass parent_class; - GHashTable *attribute_jump_table; -}; - - -ECard *e_card_new ( char *vcard); -char *e_card_get_id ( ECard *card); -void e_card_set_id ( ECard *card, - const char *character); -char *e_card_get_vcard ( ECard *card); -ECard *e_card_duplicate ( ECard *card); - -ECardPhone *e_card_phone_new (void); -ECardPhone *e_card_phone_copy (const ECardPhone *phone); -void e_card_phone_free ( ECardPhone *phone); - -ECardDeliveryAddress *e_card_delivery_address_new (void); -ECardDeliveryAddress *e_card_delivery_address_copy (const ECardDeliveryAddress *addr); -void e_card_delivery_address_free ( ECardDeliveryAddress *addr); -char *e_card_delivery_address_to_string (const ECardDeliveryAddress *addr); -ECardDeliveryAddress *e_card_delivery_address_from_string (const char *full_addr); - -ECardAddrLabel *e_card_address_label_new (void); -ECardAddrLabel *e_card_address_label_copy (const ECardAddrLabel *addr); -void e_card_address_label_free ( ECardAddrLabel *addr); - -ECardName *e_card_name_new (void); -ECardName *e_card_name_copy (const ECardName *name); -void e_card_name_free ( ECardName *name); -char *e_card_name_to_string (const ECardName *name); -ECardName *e_card_name_from_string (const char *full_name); - -ECardArbitrary *e_card_arbitrary_new (void); -ECardArbitrary *e_card_arbitrary_copy (const ECardArbitrary *arbitrary); -void e_card_arbitrary_free ( ECardArbitrary *arbitrary); - -GList *e_card_load_cards_from_file(const char *filename); - -/* Standard Gtk function */ -GtkType e_card_get_type (void); - -#endif /* ! __E_CARD_H__ */ diff --git a/addressbook/backend/ebook/load-gnomecard-addressbook.c b/addressbook/backend/ebook/load-gnomecard-addressbook.c deleted file mode 100644 index f1f20bf50b..0000000000 --- a/addressbook/backend/ebook/load-gnomecard-addressbook.c +++ /dev/null @@ -1,110 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#include <config.h> -#include <bonobo.h> -#include <gnome.h> -#include <stdio.h> - -#include <e-book.h> - -static CORBA_Environment ev; - -#ifdef USING_OAF - -#include <liboaf/liboaf.h> - -static void -init_corba (int *argc, char **argv) -{ - gnome_init_with_popt_table("blah", "0.0", *argc, argv, NULL, 0, NULL); - - oaf_init (*argc, argv); -} - -#else - -#include <libgnorba/gnorba.h> - -static void -init_corba (int *argc, char **argv) -{ - gnome_CORBA_init_with_popt_table ( - "blah", "0.0", - argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); -} - -#endif - -static void -init_bonobo (int argc, char **argv) -{ - if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) - g_error (_("Could not initialize Bonobo")); -} - -static void -add_card_cb (EBook *book, EBookStatus status, const gchar *id, gpointer closure) -{ - ECard *card = E_CARD(closure); - char *vcard = e_card_get_vcard(card); - g_print ("Saved card: %s\n", vcard); - g_free(vcard); - gtk_object_unref(GTK_OBJECT(card)); -} - -static void -book_open_cb (EBook *book, EBookStatus status, gpointer closure) -{ - GList *list = e_card_load_cards_from_file("gnomecard.vcf"); - GList *iterator; - for (iterator = list; iterator; iterator = g_list_next(iterator)) { - ECard *card = iterator->data; - e_book_add_card(book, card, add_card_cb, card); - } - g_list_free(list); -} - -static guint -ebook_create (void) -{ - EBook *book; - gchar *path, *uri; - - book = e_book_new (); - - if (!book) { - printf ("%s: %s(): Couldn't create EBook, bailing.\n", - __FILE__, - __FUNCTION__); - return FALSE; - } - - - path = g_concat_dir_and_file (g_get_home_dir (), - "evolution/local/Contacts/addressbook.db"); - uri = g_strdup_printf ("file://%s", path); - g_free (path); - - if (! e_book_load_uri (book, uri, book_open_cb, NULL)) { - printf ("error calling load_uri!\n"); - } - g_free(uri); - - - return FALSE; -} - -int -main (int argc, char **argv) -{ - - CORBA_exception_init (&ev); - - init_corba (&argc, argv); - init_bonobo (argc, argv); - - gtk_idle_add ((GtkFunction) ebook_create, NULL); - - bonobo_main (); - - return 0; -} diff --git a/addressbook/backend/ebook/load-pine-addressbook.c b/addressbook/backend/ebook/load-pine-addressbook.c deleted file mode 100644 index 0cc1be693c..0000000000 --- a/addressbook/backend/ebook/load-pine-addressbook.c +++ /dev/null @@ -1,160 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#include <config.h> -#include <bonobo.h> -#include <gnome.h> -#include <stdio.h> - -#include <e-book.h> - -static CORBA_Environment ev; - -#ifdef USING_OAF - -#include <liboaf/liboaf.h> - -static void -init_corba (int *argc, char **argv) -{ - gnome_init_with_popt_table("blah", "0.0", *argc, argv, NULL, 0, NULL); - - oaf_init (*argc, argv); -} - -#else - -#include <libgnorba/gnorba.h> - -static void -init_corba (int *argc, char **argv) -{ - gnome_CORBA_init_with_popt_table ( - "blah", "0.0", - argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); -} - -#endif - -static void -init_bonobo (int argc, char **argv) -{ - if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) - g_error (_("Could not initialize Bonobo")); -} - -static void -add_card_cb (EBook *book, EBookStatus status, const gchar *id, gpointer closure) -{ - ECard *card = E_CARD(closure); - char *vcard = e_card_get_vcard(card); - g_print ("Saved card: %s\n", vcard); - g_free(vcard); - gtk_object_unref(GTK_OBJECT(card)); -} - -static void -book_open_cb (EBook *book, EBookStatus status, gpointer closure) -{ - FILE *fp = fopen (".addressbook", "r"); - char line[1024]; - - if (!fp) { - g_warning ("Can't find .addressbook"); - return; - } - - while(fgets(line, 1024, fp)) { - int length = strlen(line); - char **strings; - ECardName *name; - ECard *card; - EList *list; - if (line[length - 1] == '\n') - line[--length] = 0; - - card = e_card_new(""); - strings = g_strsplit(line, "\t", 3); - name = e_card_name_from_string(strings[1]); - gtk_object_set(GTK_OBJECT(card), - "nickname", strings[0], - "full_name", strings[1], - "name", name, - NULL); - gtk_object_get(GTK_OBJECT(card), - "email", &list, - NULL); - e_list_append(list, strings[2]); - g_strfreev(strings); - e_book_add_card(book, card, add_card_cb, card); - } -} - -static guint -ebook_create (void) -{ - EBook *book; - gchar *path, *uri; - - book = e_book_new (); - - if (!book) { - printf ("%s: %s(): Couldn't create EBook, bailing.\n", - __FILE__, - __FUNCTION__); - return FALSE; - } - - - path = g_concat_dir_and_file (g_get_home_dir (), - "evolution/local/Contacts/addressbook.db"); - uri = g_strdup_printf ("file://%s", path); - g_free (path); - - if (! e_book_load_uri (book, uri, book_open_cb, NULL)) { - printf ("error calling load_uri!\n"); - } - g_free(uri); - - - return FALSE; -} - -#if 0 -static char * -read_file (char *name) -{ - int len; - char buff[65536]; - char line[1024]; - FILE *f; - - f = fopen (name, "r"); - if (f == NULL) - g_error ("Unable to open %s!\n", name); - - len = 0; - while (fgets (line, sizeof (line), f) != NULL) { - strcpy (buff + len, line); - len += strlen (line); - } - - fclose (f); - - return g_strdup (buff); -} -#endif - -int -main (int argc, char **argv) -{ - - CORBA_exception_init (&ev); - - init_corba (&argc, argv); - init_bonobo (argc, argv); - - gtk_idle_add ((GtkFunction) ebook_create, NULL); - - bonobo_main (); - - return 0; -} diff --git a/addressbook/backend/ebook/test-card.c b/addressbook/backend/ebook/test-card.c deleted file mode 100644 index a727dae7a3..0000000000 --- a/addressbook/backend/ebook/test-card.c +++ /dev/null @@ -1,194 +0,0 @@ -#include <gnome.h> -#include "e-card.h" - -#define TEST_VCARD \ -"BEGIN:VCARD -" \ -"FN:Nat -" \ -"N:Friedman;Nat;D;Mr. -" \ -"ORG:Helix Code, Inc. -" \ -"TITLE:Head Geek -" \ -"ROLE:Programmer/Executive -" \ -"BDAY:1977-08-06 -" \ -"TEL;WORK:617 679 1984 -" \ -"TEL;CELL:123 456 7890 -" \ -"EMAIL;INTERNET:nat@nat.org -" \ -"EMAIL;INTERNET:nat@helixcode.com -" \ -"ADR;WORK;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234; -" \ -"ADR;HOME;POSTAL;INTL:P.O. Box 202;;;Any Town 2;MI;12344-4321;USA -" \ -"END:VCARD -" \ -" -" - -static char * -read_file (char *name) -{ - int len; - char buff[65536]; - char line[1024]; - FILE *f; - - f = fopen (name, "r"); - if (f == NULL) - g_error ("Unable to open %s!\n", name); - - len = 0; - while (fgets (line, sizeof (line), f) != NULL) { - strcpy (buff + len, line); - len += strlen (line); - } - - fclose (f); - - return g_strdup (buff); -} - - - -int -main (int argc, char **argv) -{ - char *cardstr; - ECard *card; - - /* Fields */ - char *fname; - char *org; - char *org_unit; - char *title; - char *role; - char *nickname; - char *fburl; - ECardName *name; - EList *address; - EList *phone; - EList *email; - EIterator *iterator; - ECardDate *bday; - - gnome_init ("TestCard", "0.0", argc, argv); - - cardstr = NULL; - if (argc == 2) - cardstr = read_file (argv [1]); - - if (cardstr == NULL) - cardstr = TEST_VCARD; -#if 0 - { - int i; - for ( i = 0; i < 100000; i++ ) { - card = e_card_new (cardstr); - - gtk_object_unref (GTK_OBJECT (card)); - } - } -#endif - card = e_card_new (cardstr); - gtk_object_get(GTK_OBJECT(card), - "full_name", &fname, - "name", &name, - "address", &address, - "phone", &phone, - "email", &email, - "org", &org, - "org_unit", &org_unit, - "title", &title, - "role", &role, - "nickname", &nickname, - "fburl", &fburl, - "birth_date", &bday, - NULL); - if ( fname ) { - printf("Name : %s\n", fname); - g_free(fname); - } - if ( name ) { - printf("Full Name:\n"); - if ( name->prefix ) - printf(" prefix : %s\n", name->prefix); - if ( name->given ) - printf(" given : %s\n", name->given); - if ( name->additional ) - printf(" additional : %s\n", name->additional); - if ( name->family ) - printf(" family : %s\n", name->family); - if ( name->suffix ) - printf(" suffix : %s\n", name->suffix); - } - if ( org ) { - printf("Company : %s\n", org); - } - if ( org_unit ) { - printf("Department : %s\n", org_unit); - } - if ( title ) { - printf("Title : %s\n", title); - } - if ( role ) { - printf("Profession : %s\n", role); - } - if ( nickname ) { - printf("Nickname : %s\n", nickname); - } - if ( fburl ) { - printf("Free Busy URL : %s\n", fburl); - } - if ( bday ) { - printf("BDay : %4d-%02d-%02d\n", bday->year, bday->month, bday->day); - } - if ( email ) { - iterator = e_list_get_iterator(address); - for (; e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - printf("Email : %s\n", (char *) e_iterator_get(iterator)); - } - gtk_object_unref(GTK_OBJECT(iterator)); - } - if ( phone ) { - iterator = e_list_get_iterator(address); - for (; e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - ECardPhone *e_card_phone = (ECardPhone *) e_iterator_get(iterator); - printf("Phone ; %d : %s\n", e_card_phone->flags, e_card_phone->number); - } - gtk_object_unref(GTK_OBJECT(iterator)); - } - if ( address ) { - iterator = e_list_get_iterator(address); - for (; e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - ECardDeliveryAddress *del_address = (ECardDeliveryAddress *) e_iterator_get(iterator); - printf("Address ; %d:\n", del_address->flags); - if ( del_address->po ) - printf(" Po : %s\n", del_address->po); - if ( del_address->ext ) - printf(" Ext : %s\n", del_address->ext); - if ( del_address->street ) - printf(" Street : %s\n", del_address->street); - if ( del_address->city ) - printf(" City : %s\n", del_address->city); - if ( del_address->region ) - printf(" Region : %s\n", del_address->region); - if ( del_address->code ) - printf(" Code : %s\n", del_address->code); - if ( del_address->country ) - printf(" Country : %s\n", del_address->country); - } - gtk_object_unref(GTK_OBJECT(iterator)); - } - printf("%s", e_card_get_vcard(card)); - gtk_object_unref (GTK_OBJECT (card)); - - return 0; -} diff --git a/addressbook/backend/ebook/test-client-list.c b/addressbook/backend/ebook/test-client-list.c deleted file mode 100644 index e492323310..0000000000 --- a/addressbook/backend/ebook/test-client-list.c +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#include <config.h> -#include <bonobo.h> -#include <gnome.h> - -#ifdef USING_OAF -#include <liboaf/liboaf.h> -#else -#include <libgnorba/gnorba.h> -#endif - -#include "e-book.h" - -CORBA_Environment ev; - -static void -init_bonobo (int argc, char **argv) -{ -#ifdef USING_OAF - gnome_init ("blah", "0.0", argc, argv); - oaf_init (argc, argv); -#else - gnome_CORBA_init_with_popt_table ( - "blah", "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")); -} - -static void -get_cursor_cb (EBook *book, EBookStatus status, ECardCursor *cursor, gpointer closure) -{ - long length = e_card_cursor_get_length(cursor); - long i; - - printf ("Length: %d\n", (int) length); - for ( i = 0; i < length; i++ ) { - ECard *card = e_card_cursor_get_nth(cursor, i); - char *vcard = e_card_get_vcard(card); - printf("[%s]\n", vcard); - g_free(vcard); - gtk_object_unref(GTK_OBJECT(card)); - } -} - -static void -book_open_cb (EBook *book, EBookStatus status, gpointer closure) -{ - printf ("Book opened.\n"); - e_book_get_cursor(book, "", get_cursor_cb, NULL); -} - -static guint -ebook_create (void) -{ - EBook *book; - - book = e_book_new (); - - if (! e_book_load_uri (book, "file:/tmp/test.db", book_open_cb, NULL)) { - printf ("error calling load_uri!\n"); - } - - - return FALSE; -} - -int -main (int argc, char **argv) -{ - - CORBA_exception_init (&ev); - init_bonobo (argc, argv); - - gtk_idle_add ((GtkFunction) ebook_create, NULL); - - bonobo_main (); - - return 0; -} diff --git a/addressbook/backend/ebook/test-client.c b/addressbook/backend/ebook/test-client.c deleted file mode 100644 index ef13c1ab96..0000000000 --- a/addressbook/backend/ebook/test-client.c +++ /dev/null @@ -1,190 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#include <config.h> -#include <bonobo.h> -#include <gnome.h> - -#include <e-book.h> - -#define TEST_VCARD \ -"BEGIN:VCARD -" \ -"FN:Nat -" \ -"N:Friedman;Nat;D;Mr. -" \ -"BDAY:1977-08-06 -" \ -"TEL;WORK:617 679 1984 -" \ -"TEL;CELL:123 456 7890 -" \ -"EMAIL;INTERNET:nat@nat.org -" \ -"EMAIL;INTERNET:nat@helixcode.com -" \ -"ADR;WORK;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234; -" \ -"END:VCARD -" \ -" -" - -static CORBA_Environment ev; -static char *cardstr; - -#ifdef USING_OAF - -#include <liboaf/liboaf.h> - -static void -init_corba (int *argc, char **argv) -{ - gnome_init_with_popt_table("blah", "0.0", *argc, argv, NULL, 0, NULL); - - oaf_init (*argc, argv); -} - -#else - -#include <libgnorba/gnorba.h> - -static void -init_corba (int *argc, char **argv) -{ - gnome_CORBA_init_with_popt_table ( - "blah", "0.0", - argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); -} - -#endif - -static void -init_bonobo (int argc, char **argv) -{ - if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) - g_error (_("Could not initialize Bonobo")); -} - -static void -get_cursor_cb (EBook *book, EBookStatus status, ECardCursor *cursor, gpointer closure) -{ - long length = e_card_cursor_get_length(cursor); - long i; - - /* we just added a card, so the length should be >1 */ - printf ("\n%s: %s(): Number of cards is %ld\n", - __FILE__, __FUNCTION__, length); - if (length < 1) - printf ("*** Why isn't this above zero?? ***\n\n"); - - for ( i = 0; i < length; i++ ) { - ECard *card = e_card_cursor_get_nth(cursor, i); - char *vcard = e_card_get_vcard(card); - printf("Get all cards callback: [%s]\n", vcard); - g_free(vcard); - gtk_object_unref(GTK_OBJECT(card)); - } -} - -static void -add_card_cb (EBook *book, EBookStatus status, const gchar *id, gpointer closure) -{ - char *vcard; - ECard *card; - GTimer *timer; - - printf ("Status: %d\n", status); - - printf ("Id: %s\n", id); - - timer = g_timer_new (); - g_timer_start (timer); - card = e_book_get_card (book, id); - g_timer_stop (timer); - - vcard = e_card_get_vcard(card); - printf ("%g\n", g_timer_elapsed (timer, NULL)); - printf ("Card added: [%s]\n", vcard); - g_free(vcard); - gtk_object_unref(GTK_OBJECT(card)); - - printf ("Getting cards..\n"); - e_book_get_cursor(book, "", get_cursor_cb, NULL); - printf ("Done getting all cards.\n"); -} - -static void -book_open_cb (EBook *book, EBookStatus status, gpointer closure) -{ - e_book_add_vcard(book, cardstr, add_card_cb, NULL); -} - -static guint -ebook_create (void) -{ - EBook *book; - - book = e_book_new (); - - if (!book) { - printf ("%s: %s(): Couldn't create EBook, bailing.\n", - __FILE__, - __FUNCTION__); - return FALSE; - } - - - if (! e_book_load_uri (book, "file:/tmp/test.db", book_open_cb, NULL)) { - printf ("error calling load_uri!\n"); - } - - - return FALSE; -} - -static char * -read_file (char *name) -{ - int len; - char buff[65536]; - char line[1024]; - FILE *f; - - f = fopen (name, "r"); - if (f == NULL) - g_error ("Unable to open %s!\n", name); - - len = 0; - while (fgets (line, sizeof (line), f) != NULL) { - strcpy (buff + len, line); - len += strlen (line); - } - - fclose (f); - - return g_strdup (buff); -} - - -int -main (int argc, char **argv) -{ - - CORBA_exception_init (&ev); - - init_corba (&argc, argv); - init_bonobo (argc, argv); - - cardstr = NULL; - if (argc == 2) - cardstr = read_file (argv [1]); - - if (cardstr == NULL) - cardstr = TEST_VCARD; - - gtk_idle_add ((GtkFunction) ebook_create, NULL); - - bonobo_main (); - - return 0; -} diff --git a/addressbook/backend/idl/.cvsignore b/addressbook/backend/idl/.cvsignore deleted file mode 100644 index 09980ae6ba..0000000000 --- a/addressbook/backend/idl/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la diff --git a/addressbook/backend/idl/Makefile.am b/addressbook/backend/idl/Makefile.am deleted file mode 100644 index db61d2c30c..0000000000 --- a/addressbook/backend/idl/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -idldir = $(datadir)/idl - -idl_DATA = \ - addressbook.idl - -EXTRA_DIST = $(idl_DATA) diff --git a/addressbook/backend/idl/addressbook.idl b/addressbook/backend/idl/addressbook.idl deleted file mode 100644 index b8cf15c4ff..0000000000 --- a/addressbook/backend/idl/addressbook.idl +++ /dev/null @@ -1,133 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#include <Bonobo.idl> - -module Evolution { - - typedef string CardId; - typedef string VCard; - typedef sequence<VCard> VCardList; - - interface CardCursor : Bonobo::Unknown { - long get_length (); - string get_nth (in long n); - }; - - /* - * A book view is a live view of a book. It's either a view - * of all the cards in the book or a view of a query. When - * created, it will get a series of signal_card_added calls - * for all objects in the initial set. After that, it will - * get added, removed, or changed signals whenever the book - * changes (if it affects the set of viewed cards.) - */ - interface BookViewListener : Bonobo::Unknown { - void signal_card_added (in VCardList cards); - void signal_card_removed (in CardId id); - void signal_card_changed (in VCardList cards); - void signal_sequence_complete (); - }; - - interface BookView : Bonobo::Unknown { - }; - - interface Book : Bonobo::Unknown { - /* - * Fetching cards in the addresbook. - */ - VCard get_vcard (in CardId id); - - /* - * Permissions. the first form is general write - * permission (whether or not the user can add or - * remove or modify any entry in the addressbook.) - * - * if can_write returns TRUE, can_write_card can still - * return FALSE if the user doesn't have permission to - * modify/remove that specific card. - */ - boolean can_write (); - boolean can_write_card (in CardId Id); - - /* - * Adding and deleting cards in the book. - */ - void create_card (in VCard vcard); - void remove_card (in CardId Id); - - /* - * Modifying cards in the addressbook. - */ - void modify_card (in VCard vcard); - - /* - * These two functions return a cursor to the book - * listener. This is for people who want a snapshot - * of the addressbook. The syntax for the query - * string is not yet defined. - */ - void get_cursor (in string query); - - /* - * These two functions return a book view to the book - * listener. This is for people who want a live view - * of the addressbook. - */ - void get_book_view(in BookViewListener listener, in string query); - - void check_connection (); - - string get_name (); - }; - - interface BookListener : Bonobo::Unknown { - - enum CallStatus { - Success, - RepositoryOffline, - PermissionDenied, - CardNotFound, - ProtocolNotSupported, - OtherError - }; - - void respond_create_card (in CallStatus status, in CardId Id); - - void respond_remove_card (in CallStatus status); - - void respond_modify_card (in CallStatus status); - - void report_open_book_progress (in string status_message, in short percent); - - void respond_open_book (in CallStatus status, in Book book); - - void respond_get_cursor (in CallStatus status, in CardCursor cursor); - - void respond_get_view (in CallStatus status, in BookView view); - - /** - * report_connection_status: - * - * Used to report changes in the connection to the - * contact repository. This is often a response to a - * call to check_connection() on the Book, but wombat - * is free to report the connection status without - * being asked. - */ - void report_connection_status (in boolean connected); - }; - - interface BookFactory : Bonobo::Unknown { - exception ProtocolNotSupported {}; - - void open_book (in string uri, in BookListener listener) - raises (ProtocolNotSupported); - }; -}; diff --git a/addressbook/backend/pas/.cvsignore b/addressbook/backend/pas/.cvsignore deleted file mode 100644 index 071cef99ae..0000000000 --- a/addressbook/backend/pas/.cvsignore +++ /dev/null @@ -1,11 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -addressbook-stubs.c -addressbook-skels.c -addressbook-common.c -addressbook.h -*.lo -*.la diff --git a/addressbook/backend/pas/Makefile.am b/addressbook/backend/pas/Makefile.am deleted file mode 100644 index 8f4f8a3731..0000000000 --- a/addressbook/backend/pas/Makefile.am +++ /dev/null @@ -1,52 +0,0 @@ -CORBA_SOURCE = \ - addressbook.h \ - addressbook-common.c \ - addressbook-stubs.c \ - addressbook-skels.c - -idls = \ - $(srcdir)/../idl/addressbook.idl - -idl_flags = `$(GNOME_CONFIG) --cflags idl` -I $(datadir)/idl - -$(CORBA_SOURCE): $(idls) - $(ORBIT_IDL) $(srcdir)/../idl/addressbook.idl $(idl_flags) - -INCLUDES = \ - -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ - -DG_LOG_DOMAIN=\"wombat-pas\" \ - -I$(top_srcdir) \ - -I$(top_srcdir)/addressbook/backend \ - -I$(top_builddir)/addressbook/backend \ - $(BONOBO_GNOME_CFLAGS) - -LDAP_BACKEND_SOURCES = pas-backend-ldap.c pas-backend-ldap.h - -if ENABLE_LDAP -LDAP_BACKEND = $(LDAP_BACKEND_SOURCES) -else -LDAP_BACKEND = -endif - -noinst_LIBRARIES = libpas.a - -libpas_a_SOURCES = \ - $(CORBA_SOURCE) \ - pas-book-factory.c \ - pas-book-factory.h \ - pas-book-view.c \ - pas-book-view.h \ - pas-book.c \ - pas-book.h \ - pas-backend-file.c \ - pas-backend-file.h \ - $(LDAP_BACKEND) \ - pas-backend.c \ - pas-backend.h \ - pas-card-cursor.c \ - pas-card-cursor.h - -BUILT_SOURCES = $(CORBA_SOURCE) -CLEANFILES += $(BUILT_SOURCES) - -EXTRA_DIST = $(LDAP_BACKEND_SOURCES)
\ No newline at end of file diff --git a/addressbook/backend/pas/TODO b/addressbook/backend/pas/TODO deleted file mode 100644 index 0c77c1b200..0000000000 --- a/addressbook/backend/pas/TODO +++ /dev/null @@ -1,2 +0,0 @@ -* Implement pas_book_factory_activate -* Authentication
\ No newline at end of file diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c deleted file mode 100644 index 3cf0586afe..0000000000 --- a/addressbook/backend/pas/pas-backend-file.c +++ /dev/null @@ -1,1233 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#include "config.h" -#include <gtk/gtksignal.h> -#include <unistd.h> -#include <fcntl.h> -#include <time.h> -#ifdef HAVE_DB_185_H -#include <db_185.h> -#else -#ifdef HAVE_DB1_DB_H -#include <db1/db.h> -#else -#include <db.h> -#endif -#endif - -#include "pas-backend-file.h" -#include "pas-book.h" -#include "pas-card-cursor.h" -#include <ebook/e-card-simple.h> -#include <e-util/e-sexp.h> -#include <e-util/e-util.h> - -#define PAS_BACKEND_FILE_VERSION_NAME "PAS-DB-VERSION" -#define PAS_BACKEND_FILE_VERSION "0.1" - -static PASBackendClass *pas_backend_file_parent_class; -typedef struct _PASBackendFileCursorPrivate PASBackendFileCursorPrivate; -typedef struct _PASBackendFileBookView PASBackendFileBookView; -typedef struct _PASBackendFileSearchContext PASBackendFileSearchContext; - -struct _PASBackendFilePrivate { - GList *clients; - gboolean loaded; - char *uri; - DB *file_db; - GList *book_views; -}; - -struct _PASBackendFileCursorPrivate { - PASBackend *backend; - PASBook *book; - - GList *elements; - guint32 num_elements; -}; - -struct _PASBackendFileBookView { - PASBookView *book_view; - gchar *search; - ESExp *search_sexp; - PASBackendFileSearchContext *search_context; -}; - -struct _PASBackendFileSearchContext { - ECardSimple *card; -}; - -static long -get_length(PASCardCursor *cursor, gpointer data) -{ - PASBackendFileCursorPrivate *cursor_data = (PASBackendFileCursorPrivate *) data; - - return cursor_data->num_elements; -} - -static char * -get_nth(PASCardCursor *cursor, long n, gpointer data) -{ - PASBackendFileCursorPrivate *cursor_data = (PASBackendFileCursorPrivate *) data; - GList *nth_item = g_list_nth(cursor_data->elements, n); - - return g_strdup((char*)nth_item->data); -} - -static void -cursor_destroy(GtkObject *object, gpointer data) -{ - CORBA_Environment ev; - Evolution_Book corba_book; - PASBackendFileCursorPrivate *cursor_data = (PASBackendFileCursorPrivate *) data; - - corba_book = bonobo_object_corba_objref(BONOBO_OBJECT(cursor_data->book)); - - CORBA_exception_init(&ev); - - Evolution_Book_unref(corba_book, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning("cursor_destroy: Exception unreffing " - "corba book.\n"); - } - - CORBA_exception_free(&ev); - - g_list_foreach(cursor_data->elements, (GFunc)g_free, NULL); - g_list_free (cursor_data->elements); - - g_free(cursor_data); -} - -static void -view_destroy(GtkObject *object, gpointer data) -{ - CORBA_Environment ev; - Evolution_Book corba_book; - PASBook *book = (PASBook *)data; - PASBackendFile *bf; - GList *list; - - bf = PAS_BACKEND_FILE(pas_book_get_backend(book)); - for (list = bf->priv->book_views; list; list = g_list_next(list)) { - PASBackendFileBookView *view = list->data; - if (view->book_view == PAS_BOOK_VIEW(object)) { - gtk_object_unref((GtkObject *)view->search_sexp); - g_free (view->search_context); - g_free (view->search); - g_free (view); - bf->priv->book_views = g_list_remove_link(bf->priv->book_views, list); - g_list_free_1(list); - break; - } - } - - corba_book = bonobo_object_corba_objref(BONOBO_OBJECT(book)); - - CORBA_exception_init(&ev); - - Evolution_Book_unref(corba_book, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning("view_destroy: Exception unreffing " - "corba book.\n"); - } - - CORBA_exception_free(&ev); -} - -static void -string_to_dbt(const char *str, DBT *dbt) -{ - dbt->data = (void*)str; - dbt->size = strlen (str) + 1; -} - -static char * -pas_backend_file_create_unique_id (char *vcard) -{ - /* use a 32 counter and the 32 bit timestamp to make an id. - it's doubtful 2^32 id's will be created in a second, so we - should be okay. */ - static guint c = 0; - return g_strdup_printf ("pas-id-%08lX%08X", time(NULL), c++); -} - -static gboolean -compare_email (ECardSimple *card, const char *str, - char *(*compare)(const char*, const char*)) -{ - int i; - - for (i = E_CARD_SIMPLE_EMAIL_ID_EMAIL; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i ++) { - const char *email = e_card_simple_get_email (card, i); - - if (email && compare(email, str)) - return TRUE; - } - - return FALSE; -} - -static gboolean -compare_phone (ECardSimple *card, const char *str, - char *(*compare)(const char*, const char*)) -{ - int i; - - for (i = E_CARD_SIMPLE_PHONE_ID_ASSISTANT; i < E_CARD_SIMPLE_PHONE_ID_LAST; i ++) { - const ECardPhone *phone = e_card_simple_get_phone (card, i); - - if (phone && compare(phone->number, str)) - return TRUE; - } - - return FALSE; -} - -static gboolean -compare_address (ECardSimple *card, const char *str, - char *(*compare)(const char*, const char*)) -{ - g_warning("address searching not implemented\n"); - return FALSE; -} - -static struct prop_info { - ECardSimpleField field_id; - const char *query_prop; - const char *ecard_prop; -#define PROP_TYPE_NORMAL 0x01 -#define PROP_TYPE_LIST 0x02 -#define PROP_TYPE_LISTITEM 0x03 - int prop_type; - gboolean (*list_compare)(ECardSimple *ecard, const char *str, - char *(*compare)(const char*, const char*)); - -} prop_info_table[] = { -#define NORMAL_PROP(f,q,e) {f, q, e, PROP_TYPE_NORMAL, NULL} -#define LIST_PROP(q,e,c) {0, q, e, PROP_TYPE_LIST, c} - - /* query prop, ecard prop, type, list compare function */ - NORMAL_PROP ( E_CARD_SIMPLE_FIELD_FILE_AS, "file_as", "file_as" ), - NORMAL_PROP ( E_CARD_SIMPLE_FIELD_FULL_NAME, "full_name", "full_name" ), - NORMAL_PROP ( E_CARD_SIMPLE_FIELD_URL, "url", "url" ), - NORMAL_PROP ( E_CARD_SIMPLE_FIELD_MAILER, "mailer", "mailer"), - NORMAL_PROP ( E_CARD_SIMPLE_FIELD_ORG, "org", "org"), - NORMAL_PROP ( E_CARD_SIMPLE_FIELD_ORG_UNIT, "org_unit", "org_unit"), - NORMAL_PROP ( E_CARD_SIMPLE_FIELD_OFFICE, "office", "office"), - NORMAL_PROP ( E_CARD_SIMPLE_FIELD_TITLE, "title", "title"), - NORMAL_PROP ( E_CARD_SIMPLE_FIELD_ROLE, "role", "role"), - NORMAL_PROP ( E_CARD_SIMPLE_FIELD_MANAGER, "manager", "manager"), - NORMAL_PROP ( E_CARD_SIMPLE_FIELD_ASSISTANT, "assistant", "assistant"), - NORMAL_PROP ( E_CARD_SIMPLE_FIELD_NICKNAME, "nickname", "nickname"), - NORMAL_PROP ( E_CARD_SIMPLE_FIELD_SPOUSE, "spouse", "spouse" ), - NORMAL_PROP ( E_CARD_SIMPLE_FIELD_NOTE, "note", "note"), - LIST_PROP ( "email", "email", compare_email ), - LIST_PROP ( "phone", "phone", compare_phone ), - LIST_PROP ( "address", "address", compare_address ), -}; -static int num_prop_infos = sizeof(prop_info_table) / sizeof(prop_info_table[0]); - -static ESExpResult * -entry_compare(PASBackendFileSearchContext *ctx, struct _ESExp *f, - int argc, struct _ESExpResult **argv, - char *(*compare)(const char*, const char*)) -{ - ESExpResult *r; - int truth = FALSE; - - if (argc == 2 - && argv[0]->type == ESEXP_RES_STRING - && argv[1]->type == ESEXP_RES_STRING) { - char *propname; - struct prop_info *info = NULL; - int i; - gboolean any_field; - - propname = argv[0]->value.string; - - any_field = !strcmp(propname, "x-evolution-any-field"); - for (i = 0; i < num_prop_infos; i ++) { - if (any_field - || !strcmp (prop_info_table[i].query_prop, propname)) { - info = &prop_info_table[i]; - - if (info->prop_type == PROP_TYPE_NORMAL) { - char *prop = NULL; - /* searches where the query's property - maps directly to an ecard property */ - - prop = e_card_simple_get (ctx->card, info->field_id); - - if (prop && compare(prop, argv[1]->value.string)) { - truth = TRUE; - } - if ((!prop) && compare("", argv[1]->value.string)) { - truth = TRUE; - } - } - else if (info->prop_type == PROP_TYPE_LIST) { - /* the special searches that match any of the list elements */ - truth = info->list_compare (ctx->card, argv[1]->value.string, compare); - } - - /* if we're looking at all fields and find a match, - or if we're just looking at this one field, - break. */ - if ((any_field && truth) - || !any_field) - break; - } - } - - } - r = e_sexp_result_new(ESEXP_RES_BOOL); - r->value.bool = truth; - - return r; -} - -static ESExpResult * -func_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data) -{ - PASBackendFileSearchContext *ctx = data; - - return entry_compare (ctx, f, argc, argv, (char *(*)(const char*, const char*)) e_strstrcase); -} - -static char * -is_helper (const char *s1, const char *s2) -{ - if (!strcmp(s1, s2)) - return (char*)s1; - else - return NULL; -} - -static ESExpResult * -func_is(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data) -{ - PASBackendFileSearchContext *ctx = data; - - return entry_compare (ctx, f, argc, argv, is_helper); -} - -static char * -endswith_helper (const char *s1, const char *s2) -{ - char *p; - if ((p = strstr(s1, s2)) - && (strlen(p) == strlen(s2))) - return p; - else - return NULL; -} - -static ESExpResult * -func_endswith(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data) -{ - PASBackendFileSearchContext *ctx = data; - - return entry_compare (ctx, f, argc, argv, endswith_helper); -} - -static char * -beginswith_helper (const char *s1, const char *s2) -{ - char *p; - if ((p = strstr(s1, s2)) - && (p == s1)) - return p; - else - return NULL; -} - -static ESExpResult * -func_beginswith(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data) -{ - PASBackendFileSearchContext *ctx = data; - - return entry_compare (ctx, f, argc, argv, beginswith_helper); -} - -/* '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[] = { - { "contains", func_contains, 0 }, - { "is", func_is, 0 }, - { "beginswith", func_beginswith, 0 }, - { "endswith", func_endswith, 0 }, -}; - -static gboolean -vcard_matches_search (PASBackendFileBookView *view, char *vcard_string) -{ - ESExpResult *r; - gboolean retval; - - view->search_context->card = e_card_simple_new (e_card_new (vcard_string)); - - /* if it's not a valid vcard why is it in our db? :) */ - if (!view->search_context->card) - return FALSE; - - r = e_sexp_eval(view->search_sexp); - - retval = (r && r->type == ESEXP_RES_BOOL && r->value.bool); - - gtk_object_unref(GTK_OBJECT(view->search_context->card)); - - e_sexp_result_free(r); - - return retval; -} - -static void -pas_backend_file_search (PASBackendFile *bf, - PASBook *book, - PASBackendFileBookView *view) -{ - int db_error = 0; - GList *cards = NULL; - DB *db = bf->priv->file_db; - DBT id_dbt, vcard_dbt; - int i; - - if (!bf->priv->loaded) - return; - - view->search_sexp = e_sexp_new(); - view->search_context = g_new0(PASBackendFileSearchContext, 1); - - for(i=0;i<sizeof(symbols)/sizeof(symbols[0]);i++) { - if (symbols[i].type == 1) { - e_sexp_add_ifunction(view->search_sexp, 0, symbols[i].name, - (ESExpIFunc *)symbols[i].func, view->search_context); - } else { - e_sexp_add_function(view->search_sexp, 0, symbols[i].name, - symbols[i].func, view->search_context); - } - } - - e_sexp_input_text(view->search_sexp, view->search, strlen(view->search)); - e_sexp_parse(view->search_sexp); - - db_error = db->seq(db, &id_dbt, &vcard_dbt, R_FIRST); - - while (db_error == 0) { - - /* don't include the version in the list of cards */ - if (id_dbt.size != strlen(PAS_BACKEND_FILE_VERSION_NAME) + 1 - || strcmp (id_dbt.data, PAS_BACKEND_FILE_VERSION_NAME)) { - char *vcard_string = vcard_dbt.data; - - /* check if the vcard matches the search sexp */ - if (vcard_matches_search (view, vcard_string)) { - cards = g_list_append (cards, strdup(vcard_string)); - } - } - - db_error = db->seq(db, &id_dbt, &vcard_dbt, R_NEXT); - } - - if (db_error == -1) { - g_warning ("pas_backend_file_search: error building list\n"); - } - else { - pas_book_view_notify_add (view->book_view, cards); - pas_book_view_notify_complete (view->book_view); - } - - /* - ** It's fine to do this now since the data has been handed off. - */ - g_list_foreach (cards, (GFunc)g_free, NULL); - g_list_free (cards); -} - -static char * -do_create(PASBackend *backend, - char *vcard_req, - char **vcard_ptr) -{ - PASBackendFile *bf = PAS_BACKEND_FILE (backend); - DB *db = bf->priv->file_db; - DBT id_dbt, vcard_dbt; - int db_error; - char *id; - ECard *card; - char *vcard; - char *ret_val; - - id = pas_backend_file_create_unique_id (vcard_req); - - string_to_dbt (id, &id_dbt); - - card = e_card_new(vcard_req); - e_card_set_id(card, id); - vcard = e_card_get_vcard(card); - - string_to_dbt (vcard, &vcard_dbt); - - db_error = db->put (db, &id_dbt, &vcard_dbt, 0); - - if (0 == db_error) { - db_error = db->sync (db, 0); - if (db_error != 0) - g_warning ("db->sync failed.\n"); - ret_val = id; - - } - else { - ret_val = NULL; - } - - gtk_object_unref(GTK_OBJECT(card)); - card = NULL; - - if (vcard_ptr && ret_val) - *vcard_ptr = vcard; - else - g_free (vcard); - - return ret_val; -} - -static void -pas_backend_file_process_create_card (PASBackend *backend, - PASBook *book, - PASRequest *req) -{ - char *id; - char *vcard; - GList *list; - PASBackendFile *bf = PAS_BACKEND_FILE (backend); - - id = do_create(backend, req->vcard, &vcard); - if (id) { - for (list = bf->priv->book_views; list; list = g_list_next(list)) { - PASBackendFileBookView *view = list->data; - if (vcard_matches_search (view, vcard)) { - pas_book_view_notify_add_1 (view->book_view, vcard); - pas_book_view_notify_complete (view->book_view); - } - } - - pas_book_respond_create ( - book, - Evolution_BookListener_Success, - id); - g_free(vcard); - g_free(id); - } - else { - /* XXX need a different call status for this case, i - think */ - pas_book_respond_create ( - book, - Evolution_BookListener_CardNotFound, - ""); - } - - g_free(req->vcard); -} - -static void -pas_backend_file_process_remove_card (PASBackend *backend, - PASBook *book, - PASRequest *req) -{ - PASBackendFile *bf = PAS_BACKEND_FILE (backend); - DB *db = bf->priv->file_db; - DBT id_dbt, vcard_dbt; - int db_error; - GList *list; - char *vcard_string; - - string_to_dbt (req->id, &id_dbt); - - db_error = db->get (db, &id_dbt, &vcard_dbt, 0); - if (0 != db_error) { - pas_book_respond_remove ( - book, - Evolution_BookListener_CardNotFound); - g_free (req->id); - return; - } - - db_error = db->del (db, &id_dbt, 0); - if (0 != db_error) { - pas_book_respond_remove ( - book, - Evolution_BookListener_CardNotFound); - g_free (req->id); - return; - } - - db_error = db->sync (db, 0); - if (db_error != 0) - g_warning ("db->sync failed.\n"); - - - vcard_string = vcard_dbt.data; - for (list = bf->priv->book_views; list; list = g_list_next(list)) { - PASBackendFileBookView *view = list->data; - if (vcard_matches_search (view, vcard_string)) { - pas_book_view_notify_remove (view->book_view, req->id); - pas_book_view_notify_complete (view->book_view); - } - } - - pas_book_respond_remove ( - book, - Evolution_BookListener_Success); - - g_free (req->id); -} - -static void -pas_backend_file_process_modify_card (PASBackend *backend, - PASBook *book, - PASRequest *req) -{ - PASBackendFile *bf = PAS_BACKEND_FILE (backend); - DB *db = bf->priv->file_db; - DBT id_dbt, vcard_dbt; - int db_error; - GList *list; - ECard *card; - char *id; - char *old_vcard_string; - - /* create a new ecard from the request data */ - card = e_card_new(req->vcard); - id = e_card_get_id(card); - - string_to_dbt (id, &id_dbt); - - /* get the old ecard - the one that's presently in the db */ - db_error = db->get (db, &id_dbt, &vcard_dbt, 0); - if (0 != db_error) { - pas_book_respond_modify ( - book, - Evolution_BookListener_CardNotFound); - g_free (req->id); - return; - } - old_vcard_string = g_strdup(vcard_dbt.data); - - string_to_dbt (req->vcard, &vcard_dbt); - - db_error = db->put (db, &id_dbt, &vcard_dbt, 0); - - if (0 == db_error) { - db_error = db->sync (db, 0); - if (db_error != 0) - g_warning ("db->sync failed.\n"); - - for (list = bf->priv->book_views; list; list = g_list_next(list)) { - PASBackendFileBookView *view = list->data; - gboolean old_match, new_match; - - old_match = vcard_matches_search (view, old_vcard_string); - new_match = vcard_matches_search (view, req->vcard); - if (old_match && new_match) - pas_book_view_notify_change_1 (view->book_view, req->vcard); - else if (new_match) - pas_book_view_notify_add_1 (view->book_view, req->vcard); - else /* if (old_match) */ - pas_book_view_notify_remove (view->book_view, id); - pas_book_view_notify_complete (view->book_view); - } - - pas_book_respond_modify ( - book, - Evolution_BookListener_Success); - } - else { - pas_book_respond_modify ( - book, - Evolution_BookListener_CardNotFound); - } - - g_free(old_vcard_string); - - gtk_object_unref(GTK_OBJECT(card)); - g_free (req->vcard); -} - -static void -pas_backend_file_build_all_cards_list(PASBackend *backend, - PASBackendFileCursorPrivate *cursor_data) -{ - PASBackendFile *bf = PAS_BACKEND_FILE (backend); - DB *db = bf->priv->file_db; - int db_error; - DBT id_dbt, vcard_dbt; - - cursor_data->elements = NULL; - - db_error = db->seq(db, &id_dbt, &vcard_dbt, R_FIRST); - - while (db_error == 0) { - - /* don't include the version in the list of cards */ - if (id_dbt.size != strlen(PAS_BACKEND_FILE_VERSION_NAME) + 1 - || strcmp (id_dbt.data, PAS_BACKEND_FILE_VERSION_NAME)) { - - cursor_data->elements = g_list_append(cursor_data->elements, - g_strdup(vcard_dbt.data)); - - } - - db_error = db->seq(db, &id_dbt, &vcard_dbt, R_NEXT); - - } - - if (db_error == -1) { - g_warning ("pas_backend_file_build_all_cards_list: error building list\n"); - } - else { - cursor_data->num_elements = g_list_length (cursor_data->elements); - } -} - -static void -pas_backend_file_process_get_cursor (PASBackend *backend, - PASBook *book, - PASRequest *req) -{ - /* - PASBackendFile *bf = PAS_BACKEND_FILE (backend); - DB *db = bf->priv->file_db; - DBT id_dbt, vcard_dbt; - */ - CORBA_Environment ev; - int db_error = 0; - PASBackendFileCursorPrivate *cursor_data; - PASCardCursor *cursor; - Evolution_Book corba_book; - - cursor_data = g_new(PASBackendFileCursorPrivate, 1); - cursor_data->backend = backend; - cursor_data->book = book; - - pas_backend_file_build_all_cards_list(backend, cursor_data); - - corba_book = bonobo_object_corba_objref(BONOBO_OBJECT(book)); - - CORBA_exception_init(&ev); - - Evolution_Book_ref(corba_book, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning("pas_backend_file_process_get_cursor: Exception reffing " - "corba book.\n"); - } - - CORBA_exception_free(&ev); - - cursor = pas_card_cursor_new(get_length, - get_nth, - cursor_data); - - gtk_signal_connect(GTK_OBJECT(cursor), "destroy", - GTK_SIGNAL_FUNC(cursor_destroy), cursor_data); - - pas_book_respond_get_cursor ( - book, - (db_error == 0 - ? Evolution_BookListener_Success - : Evolution_BookListener_CardNotFound), - cursor); -} - -static void -pas_backend_file_process_get_book_view (PASBackend *backend, - PASBook *book, - PASRequest *req) -{ - PASBackendFile *bf = PAS_BACKEND_FILE (backend); - CORBA_Environment ev; - PASBookView *book_view; - Evolution_Book corba_book; - PASBackendFileBookView *view; - - g_return_if_fail (req->listener != NULL); - - corba_book = bonobo_object_corba_objref(BONOBO_OBJECT(book)); - - CORBA_exception_init(&ev); - - Evolution_Book_ref(corba_book, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning("pas_backend_file_process_get_book_view: Exception reffing " - "corba book.\n"); - } - - CORBA_exception_free(&ev); - - book_view = pas_book_view_new (req->listener); - - gtk_signal_connect(GTK_OBJECT(book_view), "destroy", - GTK_SIGNAL_FUNC(view_destroy), book); - - pas_book_respond_get_book_view (book, - (book_view != NULL - ? Evolution_BookListener_Success - : Evolution_BookListener_CardNotFound /* XXX */), - book_view); - - view = g_new(PASBackendFileBookView, 1); - view->book_view = book_view; - view->search = g_strdup(req->search); - - bf->priv->book_views = g_list_prepend(bf->priv->book_views, view); - - pas_backend_file_search (bf, book, view); - - g_free(req->search); -} - -static void -pas_backend_file_process_check_connection (PASBackend *backend, - PASBook *book, - PASRequest *req) -{ - PASBackendFile *bf = PAS_BACKEND_FILE (backend); - - pas_book_report_connection (book, bf->priv->file_db != NULL); -} - -static char * -pas_backend_file_extract_path_from_uri (const char *uri) -{ - g_assert (strncasecmp (uri, "file:", 5) == 0); - - return g_strdup (uri + 5); -} - -static gboolean -can_write (PASBackend *backend) -{ - PASBackendFile *bf = PAS_BACKEND_FILE (backend); - char *path = pas_backend_file_extract_path_from_uri (bf->priv->uri); - gboolean retval; - - retval = (access (path, W_OK) != -1); - - g_free (path); - - return retval; -} - -static gboolean -pas_backend_file_can_write (PASBook *book) -{ - PASBackend* backend = pas_book_get_backend (book); - - return can_write(backend); -} - -static gboolean -pas_backend_file_can_write_card (PASBook *book, - const char *id) -{ - PASBackend* backend = pas_book_get_backend (book); - - return can_write(backend); -} - -static void -pas_backend_file_process_client_requests (PASBook *book) -{ - PASBackend *backend; - PASRequest *req; - - backend = pas_book_get_backend (book); - - req = pas_book_pop_request (book); - if (req == NULL) - return; - - switch (req->op) { - case CreateCard: - pas_backend_file_process_create_card (backend, book, req); - break; - - case RemoveCard: - pas_backend_file_process_remove_card (backend, book, req); - break; - - case ModifyCard: - pas_backend_file_process_modify_card (backend, book, req); - break; - - case CheckConnection: - pas_backend_file_process_check_connection (backend, book, req); - break; - - case GetCursor: - pas_backend_file_process_get_cursor (backend, book, req); - break; - - case GetBookView: - pas_backend_file_process_get_book_view (backend, book, req); - break; - } - - g_free (req); -} - -static void -pas_backend_file_book_destroy_cb (PASBook *book, gpointer data) -{ - PASBackendFile *backend; - - backend = PAS_BACKEND_FILE (data); - - pas_backend_remove_client (PAS_BACKEND (backend), book); -} - -static char * -pas_backend_file_get_vcard (PASBook *book, const char *id) -{ - PASBackendFile *bf; - DBT id_dbt, vcard_dbt; - DB *db; - int db_error; - - bf = PAS_BACKEND_FILE (pas_book_get_backend (book)); - db = bf->priv->file_db; - - string_to_dbt (id, &id_dbt); - - db_error = db->get (db, &id_dbt, &vcard_dbt, 0); - if (db_error == 0) { - /* success */ - return g_strdup (vcard_dbt.data); - } - else if (db_error == 1) { - /* key was not in file */ - return g_strdup (""); /* XXX */ - } - else /* if (db_error < 0)*/ { - /* error */ - return g_strdup (""); /* XXX */ - } -} - -static gboolean -pas_backend_file_upgrade_db (PASBackendFile *bf, char *old_version) -{ - if (!strcmp (old_version, "0.0")) { - /* 0.0 is the same as 0.1, we just need to add the version */ - DB *db = bf->priv->file_db; - DBT version_name_dbt, version_dbt; - int db_error; - - string_to_dbt (PAS_BACKEND_FILE_VERSION_NAME, &version_name_dbt); - string_to_dbt (PAS_BACKEND_FILE_VERSION, &version_dbt); - - db_error = db->put (db, &version_name_dbt, &version_dbt, 0); - if (db_error == 0) - return TRUE; - else - return FALSE; - } - else { - g_warning ("unsupported version '%s' found in PAS backend file\n", - old_version); - return FALSE; - } -} - -static gboolean -pas_backend_file_maybe_upgrade_db (PASBackendFile *bf) -{ - DB *db = bf->priv->file_db; - DBT version_name_dbt, version_dbt; - int db_error; - char *version; - gboolean ret_val = TRUE; - - string_to_dbt (PAS_BACKEND_FILE_VERSION_NAME, &version_name_dbt); - - db_error = db->get (db, &version_name_dbt, &version_dbt, 0); - if (db_error == 0) { - /* success */ - version = g_strdup (version_dbt.data); - } - else { - /* key was not in file */ - version = g_strdup ("0.0"); - } - - if (strcmp (version, PAS_BACKEND_FILE_VERSION)) - ret_val = pas_backend_file_upgrade_db (bf, version); - - g_free (version); - - return ret_val; -} - -#define INITIAL_VCARD "BEGIN:VCARD\n\ -X-EVOLUTION-FILE-AS:Helix Code, Inc.\n\ -LABEL;WORK;QUOTED-PRINTABLE:101 Rogers St. Ste. 214=0ACambridge, MA 02142=0AUSA\n\ -TEL;WORK;VOICE:(617) 679-1984\n\ -TEL;WORK;FAX:(617) 679-1949\n\ -EMAIL;INTERNET:hello@helixcode.com\n\ -URL:http://www.helixcode.com/\n\ -ORG:Helix Code, Inc.;\n\ -NOTE:Welcome to the Helix Code Addressbook.\n\ -END:VCARD" - -static gboolean -pas_backend_file_load_uri (PASBackend *backend, - const char *uri) -{ - PASBackendFile *bf = PAS_BACKEND_FILE (backend); - char *filename; - - g_assert (bf->priv->loaded == FALSE); - - filename = pas_backend_file_extract_path_from_uri (uri); - - bf->priv->file_db = dbopen (filename, O_RDWR, 0666, DB_HASH, NULL); - if (bf->priv->file_db == NULL) { - bf->priv->file_db = dbopen (filename, O_RDWR | O_CREAT, 0666, DB_HASH, NULL); - - if (bf->priv->file_db) { - char *id; - id = do_create(backend, INITIAL_VCARD, NULL); - g_free (id); - } - } - - g_free (filename); - - if (bf->priv->file_db != NULL) { - if (pas_backend_file_maybe_upgrade_db (bf)) - bf->priv->loaded = TRUE; - /* XXX what if we fail to upgrade it? */ - - g_free(bf->priv->uri); - bf->priv->uri = g_strdup (uri); - } else - return FALSE; - - return TRUE; -} - -/* Get_uri handler for the addressbook file backend */ -static const char * -pas_backend_file_get_uri (PASBackend *backend) -{ - PASBackendFile *bf; - - bf = PAS_BACKEND_FILE (backend); - - g_return_val_if_fail (bf->priv->loaded, NULL); - g_assert (bf->priv->uri != NULL); - - return bf->priv->uri; -} - -static gboolean -pas_backend_file_add_client (PASBackend *backend, - Evolution_BookListener listener) -{ - PASBackendFile *bf; - PASBook *book; - - g_assert (backend != NULL); - g_assert (PAS_IS_BACKEND_FILE (backend)); - - bf = PAS_BACKEND_FILE (backend); - - book = pas_book_new ( - backend, listener, - pas_backend_file_get_vcard, - pas_backend_file_can_write, - pas_backend_file_can_write_card); - - if (!book) { - if (!bf->priv->clients) - pas_backend_last_client_gone (backend); - - return FALSE; - } - - gtk_signal_connect (GTK_OBJECT (book), "destroy", - pas_backend_file_book_destroy_cb, backend); - - gtk_signal_connect (GTK_OBJECT (book), "requests_queued", - pas_backend_file_process_client_requests, NULL); - - bf->priv->clients = g_list_prepend ( - bf->priv->clients, book); - - if (bf->priv->loaded) { - pas_book_respond_open ( - book, Evolution_BookListener_Success); - } else { - /* Open the book. */ - pas_book_respond_open ( - book, Evolution_BookListener_Success); - } - - return TRUE; -} - -static void -pas_backend_file_remove_client (PASBackend *backend, - PASBook *book) -{ - PASBackendFile *bf; - GList *l; - PASBook *lbook; - - g_return_if_fail (backend != NULL); - g_return_if_fail (PAS_IS_BACKEND_FILE (backend)); - g_return_if_fail (book != NULL); - g_return_if_fail (PAS_IS_BOOK (book)); - - bf = PAS_BACKEND_FILE (backend); - - /* Find the book in the list of clients */ - - for (l = bf->priv->clients; l; l = l->next) { - lbook = PAS_BOOK (l->data); - - if (lbook == book) - break; - } - - g_assert (l != NULL); - - /* Disconnect */ - - bf->priv->clients = g_list_remove_link (bf->priv->clients, l); - g_list_free_1 (l); - - /* When all clients go away, notify the parent factory about it so that - * it may decide whether to kill the backend or not. - */ - if (!bf->priv->clients) - pas_backend_last_client_gone (backend); -} - -static gboolean -pas_backend_file_construct (PASBackendFile *backend) -{ - g_assert (backend != NULL); - g_assert (PAS_IS_BACKEND_FILE (backend)); - - if (! pas_backend_construct (PAS_BACKEND (backend))) - return FALSE; - - return TRUE; -} - -/** - * pas_backend_file_new: - */ -PASBackend * -pas_backend_file_new (void) -{ - PASBackendFile *backend; - - backend = gtk_type_new (pas_backend_file_get_type ()); - - if (! pas_backend_file_construct (backend)) { - gtk_object_unref (GTK_OBJECT (backend)); - - return NULL; - } - - return PAS_BACKEND (backend); -} - -static void -pas_backend_file_destroy (GtkObject *object) -{ - PASBackendFile *bf; - - bf = PAS_BACKEND_FILE (object); - - g_free (bf->priv->uri); - - GTK_OBJECT_CLASS (pas_backend_file_parent_class)->destroy (object); -} - -static void -pas_backend_file_class_init (PASBackendFileClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - PASBackendClass *parent_class; - - pas_backend_file_parent_class = gtk_type_class (pas_backend_get_type ()); - - parent_class = PAS_BACKEND_CLASS (klass); - - /* Set the virtual methods. */ - parent_class->load_uri = pas_backend_file_load_uri; - parent_class->get_uri = pas_backend_file_get_uri; - parent_class->add_client = pas_backend_file_add_client; - parent_class->remove_client = pas_backend_file_remove_client; - - object_class->destroy = pas_backend_file_destroy; -} - -static void -pas_backend_file_init (PASBackendFile *backend) -{ - PASBackendFilePrivate *priv; - - priv = g_new0 (PASBackendFilePrivate, 1); - priv->loaded = FALSE; - priv->clients = NULL; - priv->book_views = NULL; - priv->uri = NULL; - - backend->priv = priv; -} - -/** - * pas_backend_file_get_type: - */ -GtkType -pas_backend_file_get_type (void) -{ - static GtkType type = 0; - - if (! type) { - GtkTypeInfo info = { - "PASBackendFile", - sizeof (PASBackendFile), - sizeof (PASBackendFileClass), - (GtkClassInitFunc) pas_backend_file_class_init, - (GtkObjectInitFunc) pas_backend_file_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (pas_backend_get_type (), &info); - } - - return type; -} diff --git a/addressbook/backend/pas/pas-backend-file.h b/addressbook/backend/pas/pas-backend-file.h deleted file mode 100644 index 4da9a29cc5..0000000000 --- a/addressbook/backend/pas/pas-backend-file.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2000, Helix Code, Inc. - */ - -#ifndef __PAS_BACKEND_FILE_H__ -#define __PAS_BACKEND_FILE_H__ - -#include <libgnome/gnome-defs.h> -#include "pas-backend.h" - -typedef struct _PASBackendFilePrivate PASBackendFilePrivate; - -typedef struct { - PASBackend parent_object; - PASBackendFilePrivate *priv; -} PASBackendFile; - -typedef struct { - PASBackendClass parent_class; -} PASBackendFileClass; - -PASBackend *pas_backend_file_new (void); -GtkType pas_backend_file_get_type (void); - -#define PAS_BACKEND_FILE_TYPE (pas_backend_file_get_type ()) -#define PAS_BACKEND_FILE(o) (GTK_CHECK_CAST ((o), PAS_BACKEND_FILE_TYPE, PASBackendFile)) -#define PAS_BACKEND_FILE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), PAS_BACKEND_TYPE, PASBackendFileClass)) -#define PAS_IS_BACKEND_FILE(o) (GTK_CHECK_TYPE ((o), PAS_BACKEND_FILE_TYPE)) -#define PAS_IS_BACKEND_FILE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), PAS_BACKEND_FILE_TYPE)) - -#endif /* ! __PAS_BACKEND_FILE_H__ */ - diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c deleted file mode 100644 index 3968648972..0000000000 --- a/addressbook/backend/pas/pas-backend-ldap.c +++ /dev/null @@ -1,1151 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#include "config.h" -#include <gtk/gtksignal.h> -#include <fcntl.h> -#include <time.h> -#include <lber.h> -#include <ldap.h> - -#include "pas-backend-ldap.h" -#include "pas-book.h" -#include "pas-card-cursor.h" - -#include <e-util/e-sexp.h> -#include <ebook/e-card-simple.h> - -#define LDAP_MAX_SEARCH_RESPONSES 500 - -static gchar *query_prop_to_ldap(gchar *query_prop); - -static PASBackendClass *pas_backend_ldap_parent_class; -typedef struct _PASBackendLDAPCursorPrivate PASBackendLDAPCursorPrivate; -typedef struct _PASBackendLDAPBookView PASBackendLDAPBookView; - -struct _PASBackendLDAPPrivate { - char *uri; - gboolean connected; - GList *clients; - gchar *ldap_host; - gchar *ldap_rootdn; - int ldap_port; - int ldap_scope; - GList *book_views; -}; - -struct _PASBackendLDAPCursorPrivate { - PASBackend *backend; - PASBook *book; - - GList *elements; - long num_elements; -}; - -struct _PASBackendLDAPBookView { - PASBookView *book_view; - PASBackendLDAPPrivate *blpriv; - LDAP *ldap; - gchar *search; - int search_idle; - int search_msgid; -}; - -static long -get_length(PASCardCursor *cursor, gpointer data) -{ - PASBackendLDAPCursorPrivate *cursor_data = (PASBackendLDAPCursorPrivate *) data; - - return cursor_data->num_elements; -} - -static char * -get_nth(PASCardCursor *cursor, long n, gpointer data) -{ - return g_strdup(""); -} - -static void -cursor_destroy(GtkObject *object, gpointer data) -{ - CORBA_Environment ev; - Evolution_Book corba_book; - PASBackendLDAPCursorPrivate *cursor_data = (PASBackendLDAPCursorPrivate *) data; - - corba_book = bonobo_object_corba_objref(BONOBO_OBJECT(cursor_data->book)); - - CORBA_exception_init(&ev); - - Evolution_Book_unref(corba_book, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning("cursor_destroy: Exception unreffing " - "corba book.\n"); - } - - CORBA_exception_free(&ev); - - /* free the ldap specific cursor information */ - - - g_free(cursor_data); -} - -static void -view_destroy(GtkObject *object, gpointer data) -{ - CORBA_Environment ev; - Evolution_Book corba_book; - PASBook *book = (PASBook *)data; - PASBackendLDAP *bl; - GList *list; - - bl = PAS_BACKEND_LDAP(pas_book_get_backend(book)); - for (list = bl->priv->book_views; list; list = g_list_next(list)) { - PASBackendLDAPBookView *view = list->data; - if (view->book_view == PAS_BOOK_VIEW(object)) { - if (view->search_idle != 0) - g_source_remove(view->search_idle); - if (view->ldap) - ldap_unbind (view->ldap); - g_free (view->search); - g_free (view); - bl->priv->book_views = g_list_remove_link(bl->priv->book_views, list); - g_list_free_1(list); - break; - } - } - - corba_book = bonobo_object_corba_objref(BONOBO_OBJECT(book)); - - CORBA_exception_init(&ev); - - Evolution_Book_unref(corba_book, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning("view_destroy: Exception unreffing " - "corba book.\n"); - } - - CORBA_exception_free(&ev); -} - -static void -pas_backend_ldap_connect (PASBackendLDAPBookView *view) -{ - LDAP *ldap = view->ldap; - PASBackendLDAPPrivate *bl = view->blpriv; - - /* the connection has gone down, or wasn't ever opened */ - if (ldap == NULL || - (ldap_simple_bind_s(ldap, NULL /*binddn*/, NULL /*passwd*/) != LDAP_SUCCESS)) { - - /* close connection first if it's open first */ - if (ldap) - ldap_unbind (ldap); - - view->ldap = ldap_open (bl->ldap_host, bl->ldap_port); - if (NULL != view->ldap) { - ldap_simple_bind_s(view->ldap, - NULL /*binddn*/, NULL /*passwd*/); - bl->connected = TRUE; - } - else { - g_warning ("pas_backend_ldap_connect failed for " - "'ldap://%s:%d/%s'\n", - bl->ldap_host, - bl->ldap_port, - bl->ldap_rootdn ? bl->ldap_rootdn : ""); - bl->connected = FALSE; - } - } -} - -static void -pas_backend_ldap_process_create_card (PASBackend *backend, - PASBook *book, - PASRequest *req) -{ - g_warning ("pas_backend_ldap_process_create_card not implemented\n"); - - pas_book_respond_create ( - book, - Evolution_BookListener_CardNotFound, - ""); - - g_free (req->vcard); -} - -static void -pas_backend_ldap_process_remove_card (PASBackend *backend, - PASBook *book, - PASRequest *req) -{ - g_warning ("pas_backend_ldap_process_remove_card not implemented\n"); - - pas_book_respond_remove ( - book, - Evolution_BookListener_CardNotFound); - - g_free (req->id); -} - -static void -pas_backend_ldap_build_all_cards_list(PASBackend *backend, - PASBackendLDAPCursorPrivate *cursor_data) -{ - PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend); - LDAP *ldap; - int ldap_error; - LDAPMessage *res, *e; - - ldap = ldap_open (bl->priv->ldap_host, bl->priv->ldap_port); - if (NULL != ldap) { - ldap_simple_bind_s(ldap, NULL /*binddn*/, NULL /*passwd*/); - } - else { - g_warning ("pas_backend_ldap_build_all_cards_list: ldap_open failed for " - "'ldap://%s:%d/%s'\n", - bl->priv->ldap_host, - bl->priv->ldap_port, - bl->priv->ldap_rootdn ? bl->priv->ldap_rootdn : ""); - return; - } - - ldap->ld_sizelimit = LDAP_MAX_SEARCH_RESPONSES; - ldap->ld_deref = LDAP_DEREF_ALWAYS; - - if ((ldap_error = ldap_search_s (ldap, - bl->priv->ldap_rootdn, - bl->priv->ldap_scope, - "(objectclass=*)", - NULL, 0, &res)) == -1) { - g_warning ("ldap error '%s' in " - "pas_backend_ldap_build_all_cards_list\n", - ldap_err2string(ldap_error)); - } - - cursor_data->elements = NULL; - - cursor_data->num_elements = ldap_count_entries (ldap, res); - - e = ldap_first_entry(ldap, res); - - while (NULL != e) { - - /* for now just make a list of the dn's */ -#if 0 - for ( a = ldap_first_attribute( ldap, e, &ber ); a != NULL; - a = ldap_next_attribute( ldap, e, ber ) ) { - } -#else - cursor_data->elements = g_list_prepend(cursor_data->elements, - g_strdup(ldap_get_dn(ldap, e))); -#endif - - e = ldap_next_entry(ldap, e); - } - - ldap_msgfree(res); - - ldap_unbind (ldap); -} - -static void -pas_backend_ldap_process_modify_card (PASBackend *backend, - PASBook *book, - PASRequest *req) -{ - g_warning ("pas_backend_ldap_process_modify_card not implemented\n"); - - pas_book_respond_modify ( - book, - Evolution_BookListener_CardNotFound); - g_free (req->vcard); -} - -static void -pas_backend_ldap_process_get_cursor (PASBackend *backend, - PASBook *book, - PASRequest *req) -{ - CORBA_Environment ev; - PASBackendLDAPCursorPrivate *cursor_data; - int ldap_error = 0; - PASCardCursor *cursor; - Evolution_Book corba_book; - - cursor_data = g_new(PASBackendLDAPCursorPrivate, 1); - cursor_data->backend = backend; - cursor_data->book = book; - - pas_backend_ldap_build_all_cards_list(backend, cursor_data); - - corba_book = bonobo_object_corba_objref(BONOBO_OBJECT(book)); - - CORBA_exception_init(&ev); - - Evolution_Book_ref(corba_book, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning("pas_backend_file_process_get_cursor: Exception reffing " - "corba book.\n"); - } - - CORBA_exception_free(&ev); - - cursor = pas_card_cursor_new(get_length, - get_nth, - cursor_data); - - gtk_signal_connect(GTK_OBJECT(cursor), "destroy", - GTK_SIGNAL_FUNC(cursor_destroy), cursor_data); - - pas_book_respond_get_cursor ( - book, - (ldap_error == 0 - ? Evolution_BookListener_Success - : Evolution_BookListener_CardNotFound), - cursor); -} - -static void -construct_email_list(ECardSimple *card, const char *prop, char **values) -{ - int i; - - for (i = 0; values[i] && i < 3; i ++) { - e_card_simple_set_email (card, i, values[i]); - } -} - -struct prop_info { - ECardSimpleField field_id; - char *query_prop; - char *ldap_attr; -#define PROP_TYPE_NORMAL 0x01 -#define PROP_TYPE_LIST 0x02 -#define PROP_TYPE_LISTITEM 0x03 - int prop_type; - void (*construct_list_func)(ECardSimple *card, const char *prop, char **values); -} prop_info_table[] = { - /* field_id, query prop, ldap attr, type, list construct function */ - { E_CARD_SIMPLE_FIELD_FULL_NAME, "full_name", "cn", PROP_TYPE_NORMAL, NULL }, - { E_CARD_SIMPLE_FIELD_TITLE, "title", "title", PROP_TYPE_NORMAL, NULL }, - { E_CARD_SIMPLE_FIELD_ORG, "org", "o", PROP_TYPE_NORMAL, NULL }, - { E_CARD_SIMPLE_FIELD_PHONE_PRIMARY, "phone", "telephonenumber", PROP_TYPE_NORMAL, NULL }, - { 0 /* unused */, "email", "mail", PROP_TYPE_LIST, construct_email_list }, -}; - -static int num_prop_infos = sizeof(prop_info_table) / sizeof(prop_info_table[0]); - -static ESExpResult * -func_and(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data) -{ - GList **list = data; - ESExpResult *r; - char ** strings; - - if (argc > 0) { - int i; - - strings = g_new(char*, argc+3); - strings[0] = g_strdup ("(&"); - strings[argc+3 - 2] = g_strdup (")"); - strings[argc+3 - 1] = NULL; - - for (i = 0; i < argc; i ++) { - GList *list_head = *list; - strings[argc - i] = (*list)->data; - *list = g_list_remove_link(*list, *list); - g_list_free_1(list_head); - } - - *list = g_list_prepend(*list, g_strjoinv(" ", strings)); - - for (i = 0 ; i < argc + 2; i ++) - g_free (strings[i]); - - g_free (strings); - } - - r = e_sexp_result_new(ESEXP_RES_BOOL); - r->value.bool = FALSE; - - return r; -} - -static ESExpResult * -func_or(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data) -{ - GList **list = data; - ESExpResult *r; - char ** strings; - - if (argc > 0) { - int i; - - strings = g_new(char*, argc+3); - strings[0] = g_strdup ("(|"); - strings[argc+3 - 2] = g_strdup (")"); - strings[argc+3 - 1] = NULL; - for (i = 0; i < argc; i ++) { - GList *list_head = *list; - strings[argc - i] = (*list)->data; - *list = g_list_remove_link(*list, *list); - g_list_free_1(list_head); - } - - *list = g_list_prepend(*list, g_strjoinv(" ", strings)); - - for (i = 0 ; i < argc + 2; i ++) - g_free (strings[i]); - - g_free (strings); - } - - r = e_sexp_result_new(ESEXP_RES_BOOL); - r->value.bool = FALSE; - - return r; -} - -static ESExpResult * -func_not(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data) -{ - GList **list = data; - ESExpResult *r; - - /* just replace the head of the list with the NOT of it. */ - if (argc > 0) { - char *term = (*list)->data; - (*list)->data = g_strdup_printf("(!%s)", term); - g_free (term); - } - - r = e_sexp_result_new(ESEXP_RES_BOOL); - r->value.bool = FALSE; - - return r; -} - -static ESExpResult * -func_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data) -{ - GList **list = data; - ESExpResult *r; - - if (argc == 2 - && argv[0]->type == ESEXP_RES_STRING - && argv[1]->type == ESEXP_RES_STRING) { - char *propname = argv[0]->value.string; - char *str = argv[1]->value.string; - gboolean one_star = FALSE; - - if (strlen(str) == 0) - one_star = TRUE; - - if (!strcmp (propname, "x-evolution-any-field")) { - int i; - int query_length; - char *big_query; - char *header, *footer; - char *match_str; - - header = g_malloc0((num_prop_infos - 1) * 2 + 1); - footer = g_malloc0(num_prop_infos + 1); - for (i = 0; i < num_prop_infos - 1; i ++) { - strcat (header, "(|"); - strcat (footer, ")"); - } - - match_str = g_strdup_printf("=*%s%s)", - str, one_star ? "" : "*"); - - query_length = strlen (header); - - for (i = 0; i < num_prop_infos; i ++) { - query_length += 1 + strlen(prop_info_table[i].ldap_attr) + strlen (match_str); - } - - big_query = g_malloc0(query_length + 1); - strcat (big_query, header); - for (i = 0; i < num_prop_infos; i ++) { - strcat (big_query, "("); - strcat (big_query, prop_info_table[i].ldap_attr); - strcat (big_query, match_str); - } - strcat (big_query, footer); - - *list = g_list_prepend(*list, big_query); - - g_free (match_str); - g_free (header); - g_free (footer); - } - else { - char *ldap_attr = query_prop_to_ldap(propname); - - if (ldap_attr) - *list = g_list_prepend(*list, - g_strdup_printf("(%s=*%s%s)", - ldap_attr, - str, - one_star ? "" : "*")); - } - } - - r = e_sexp_result_new(ESEXP_RES_BOOL); - r->value.bool = FALSE; - - return r; -} - -static ESExpResult * -func_is(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data) -{ - GList **list = data; - ESExpResult *r; - - if (argc == 2 - && argv[0]->type == ESEXP_RES_STRING - && argv[1]->type == ESEXP_RES_STRING) { - char *propname = argv[0]->value.string; - char *str = argv[1]->value.string; - char *ldap_attr = query_prop_to_ldap(propname); - - if (ldap_attr) - *list = g_list_prepend(*list, - g_strdup_printf("(%s=%s)", - ldap_attr, str)); - } - - r = e_sexp_result_new(ESEXP_RES_BOOL); - r->value.bool = FALSE; - - return r; -} - -static ESExpResult * -func_beginswith(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data) -{ - GList **list = data; - ESExpResult *r; - - if (argc == 2 - && argv[0]->type == ESEXP_RES_STRING - && argv[1]->type == ESEXP_RES_STRING) { - char *propname = argv[0]->value.string; - char *str = argv[1]->value.string; - char *ldap_attr = query_prop_to_ldap(propname); - gboolean one_star = FALSE; - - if (strlen(str) == 0) - one_star = TRUE; - - if (ldap_attr) - *list = g_list_prepend(*list, - g_strdup_printf("(%s=%s*)", - ldap_attr, - str)); - } - - r = e_sexp_result_new(ESEXP_RES_BOOL); - r->value.bool = FALSE; - - return r; -} - -static ESExpResult * -func_endswith(struct _ESExp *f, int argc, struct _ESExpResult **argv, void *data) -{ - GList **list = data; - ESExpResult *r; - - if (argc == 2 - && argv[0]->type == ESEXP_RES_STRING - && argv[1]->type == ESEXP_RES_STRING) { - char *propname = argv[0]->value.string; - char *str = argv[1]->value.string; - char *ldap_attr = query_prop_to_ldap(propname); - gboolean one_star = FALSE; - - if (strlen(str) == 0) - one_star = TRUE; - - if (ldap_attr) - *list = g_list_prepend(*list, - g_strdup_printf("(%s=*%s)", - ldap_attr, - str)); - } - - r = e_sexp_result_new(ESEXP_RES_BOOL); - r->value.bool = FALSE; - - return r; -} - -/* '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[] = { - { "and", func_and, 0 }, - { "or", func_or, 0 }, - { "not", func_not, 0 }, - { "contains", func_contains, 0 }, - { "is", func_is, 0 }, - { "beginswith", func_beginswith, 0 }, - { "endswith", func_endswith, 0 }, -}; - -static gchar * -pas_backend_ldap_build_query (gchar *query) -{ - ESExp *sexp; - ESExpResult *r; - gchar *retval; - GList *list = NULL; - int i; - - 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, &list); - } else { - e_sexp_add_function(sexp, 0, symbols[i].name, - symbols[i].func, &list); - } - } - - e_sexp_input_text(sexp, query, strlen(query)); - e_sexp_parse(sexp); - - r = e_sexp_eval(sexp); - - gtk_object_unref(GTK_OBJECT(sexp)); - e_sexp_result_free(r); - - if (list->next) { - g_warning ("conversion to ldap query string failed"); - retval = NULL; - g_list_foreach (list, (GFunc)g_free, NULL); - } - else { - retval = list->data; - } - - g_list_free (list); - return retval; -} - -static gchar * -query_prop_to_ldap(gchar *query_prop) -{ - int i; - - for (i = 0; i < num_prop_infos; i ++) - if (!strcmp (query_prop, prop_info_table[i].query_prop)) - return prop_info_table[i].ldap_attr; - - return NULL; -} - -static gboolean -poll_ldap (PASBackendLDAPBookView *view) -{ - LDAP *ldap; - int rc; - LDAPMessage *res, *e; - GList *cards = NULL; - - ldap = view->ldap; - - if ((rc = ldap_result (ldap, view->search_msgid, 0, NULL, &res)) - != LDAP_RES_SEARCH_ENTRY) { - view->search_idle = 0; - pas_book_view_notify_complete (view->book_view); - ldap_unbind (ldap); - view->ldap = NULL; - return FALSE; - } - - e = ldap_first_entry(ldap, res); - - while (NULL != e) { - ECard *ecard = E_CARD(gtk_type_new(e_card_get_type())); - ECardSimple *card = e_card_simple_new (ecard); - char *dn = ldap_get_dn(ldap, e); - char *attr; - BerElement *ber = NULL; - - e_card_simple_set_id (card, dn); - - for (attr = ldap_first_attribute (ldap, e, &ber); attr; - attr = ldap_next_attribute (ldap, e, ber)) { - int i; - struct prop_info *info = NULL; - - for (i = 0; i < num_prop_infos; i ++) - if (!strcmp (attr, prop_info_table[i].ldap_attr)) - info = &prop_info_table[i]; - - if (info) { - char **values; - values = ldap_get_values (ldap, e, attr); - - if (info->prop_type == PROP_TYPE_NORMAL) { - /* if it's a normal property just set the string */ - e_card_simple_set (card, info->field_id, values[0]); - - } - else if (info->prop_type == PROP_TYPE_LIST) { - /* if it's a list call the construction function, - which calls gtk_object_set to set the property */ - info->construct_list_func(card, - info->query_prop, - values); - } - - ldap_value_free (values); - } - } - - /* if ldap->ld_errno == LDAP_DECODING_ERROR there was an - error decoding an attribute, and we shouldn't free ber, - since the ldap library already did it. */ - if (ldap->ld_errno != LDAP_DECODING_ERROR && ber) - ber_free (ber, 0); - - e_card_simple_sync_card (card); - cards = g_list_append (cards, e_card_simple_get_vcard (card)); - - gtk_object_unref (GTK_OBJECT(card)); - - e = ldap_next_entry(ldap, e); - } - - if (cards) { - pas_book_view_notify_add (view->book_view, cards); - - g_list_foreach (cards, (GFunc)g_free, NULL); - g_list_free (cards); - cards = NULL; - } - - ldap_msgfree(res); - - return TRUE; -} - -static void -pas_backend_ldap_search (PASBackendLDAP *bl, - PASBook *book, - PASBackendLDAPBookView *view) -{ - char *ldap_query; - - if (view->search_idle) - g_warning ("pas_backend_ldap_search called again with pending search on this view.\n"); - - ldap_query = pas_backend_ldap_build_query(view->search); - - if (ldap_query != NULL) { - LDAP *ldap; - - pas_backend_ldap_connect(view); - - ldap = view->ldap; - - if (ldap) { - ldap->ld_sizelimit = LDAP_MAX_SEARCH_RESPONSES; - ldap->ld_deref = LDAP_DEREF_ALWAYS; - - if ((view->search_msgid = ldap_search (ldap, - bl->priv->ldap_rootdn, - bl->priv->ldap_scope, - ldap_query, - NULL, 0)) == -1) { - g_warning ("ldap error '%s' in pas_backend_ldap_search\n", ldap_err2string(ldap->ld_errno)); - } - else { - view->search_idle = g_idle_add((GSourceFunc)poll_ldap, view); - } - } - } -} - -static void -pas_backend_ldap_process_get_book_view (PASBackend *backend, - PASBook *book, - PASRequest *req) -{ - PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend); - CORBA_Environment ev; - Evolution_Book corba_book; - PASBookView *book_view; - PASBackendLDAPBookView *view; - - g_return_if_fail (req->listener != NULL); - - corba_book = bonobo_object_corba_objref(BONOBO_OBJECT(book)); - - CORBA_exception_init(&ev); - - Evolution_Book_ref(corba_book, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning("pas_backend_file_process_get_book_view: Exception reffing " - "corba book.\n"); - } - - CORBA_exception_free(&ev); - - book_view = pas_book_view_new (req->listener); - - gtk_signal_connect(GTK_OBJECT(book_view), "destroy", - GTK_SIGNAL_FUNC(view_destroy), book); - - pas_book_respond_get_book_view (book, - (book_view != NULL - ? Evolution_BookListener_Success - : Evolution_BookListener_CardNotFound /* XXX */), - book_view); - - view = g_new0(PASBackendLDAPBookView, 1); - view->book_view = book_view; - view->search = g_strdup(req->search); - view->blpriv = bl->priv; - - bl->priv->book_views = g_list_prepend(bl->priv->book_views, view); - - pas_backend_ldap_search (bl, book, view); - -} - -static void -pas_backend_ldap_process_check_connection (PASBackend *backend, - PASBook *book, - PASRequest *req) -{ - PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend); - - pas_book_report_connection (book, bl->priv->connected); -} - -static gboolean -pas_backend_ldap_can_write (PASBook *book) -{ - return FALSE; /* XXX */ -} - -static gboolean -pas_backend_ldap_can_write_card (PASBook *book, - const char *id) -{ - return FALSE; /* XXX */ -} - -static void -pas_backend_ldap_process_client_requests (PASBook *book) -{ - PASBackend *backend; - PASRequest *req; - - backend = pas_book_get_backend (book); - - req = pas_book_pop_request (book); - if (req == NULL) - return; - - switch (req->op) { - case CreateCard: - pas_backend_ldap_process_create_card (backend, book, req); - break; - - case RemoveCard: - pas_backend_ldap_process_remove_card (backend, book, req); - break; - - case ModifyCard: - pas_backend_ldap_process_modify_card (backend, book, req); - break; - - case CheckConnection: - pas_backend_ldap_process_check_connection (backend, book, req); - break; - - case GetCursor: - pas_backend_ldap_process_get_cursor (backend, book, req); - break; - - case GetBookView: - pas_backend_ldap_process_get_book_view (backend, book, req); - break; - } - - g_free (req); -} - -static void -pas_backend_ldap_book_destroy_cb (PASBook *book, gpointer data) -{ - PASBackendLDAP *backend; - - backend = PAS_BACKEND_LDAP (data); - - pas_backend_remove_client (PAS_BACKEND (backend), book); -} - -static char * -pas_backend_ldap_get_vcard (PASBook *book, const char *id) -{ - PASBackendLDAP *bl; - int ldap_error = LDAP_SUCCESS; /* XXX */ - - bl = PAS_BACKEND_LDAP (pas_book_get_backend (book)); - - /* XXX use ldap_search */ - - if (ldap_error == LDAP_SUCCESS) { - /* success */ - return g_strdup (""); - } - else { - return g_strdup (""); - } -} - -static gboolean -pas_backend_ldap_load_uri (PASBackend *backend, - const char *uri) -{ - PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend); - LDAPURLDesc *lud; - int ldap_error; - - g_assert (bl->priv->connected == FALSE); - - ldap_error = ldap_url_parse ((char*)uri, &lud); - if (ldap_error == LDAP_SUCCESS) { - g_free(bl->priv->uri); - bl->priv->uri = g_strdup (uri); - bl->priv->ldap_host = g_strdup(lud->lud_host); - bl->priv->ldap_port = lud->lud_port; - /* if a port wasn't specified, default to 389 */ - if (bl->priv->ldap_port == 0) - bl->priv->ldap_port = 389; - bl->priv->ldap_rootdn = g_strdup(lud->lud_dn); - bl->priv->ldap_scope = lud->lud_scope; - - ldap_free_urldesc(lud); - - return TRUE; - } else - return FALSE; -} - -/* Get_uri handler for the addressbook LDAP backend */ -static const char * -pas_backend_ldap_get_uri (PASBackend *backend) -{ - PASBackendLDAP *bl; - - bl = PAS_BACKEND_LDAP (backend); - return bl->priv->uri; -} - -static gboolean -pas_backend_ldap_add_client (PASBackend *backend, - Evolution_BookListener listener) -{ - PASBackendLDAP *bl; - PASBook *book; - - g_assert (backend != NULL); - g_assert (PAS_IS_BACKEND_LDAP (backend)); - - bl = PAS_BACKEND_LDAP (backend); - - book = pas_book_new ( - backend, listener, - pas_backend_ldap_get_vcard, - pas_backend_ldap_can_write, - pas_backend_ldap_can_write_card); - - if (!book) { - if (!bl->priv->clients) - pas_backend_last_client_gone (backend); - - return FALSE; - } - - gtk_signal_connect (GTK_OBJECT (book), "destroy", - pas_backend_ldap_book_destroy_cb, backend); - - gtk_signal_connect (GTK_OBJECT (book), "requests_queued", - pas_backend_ldap_process_client_requests, NULL); - - bl->priv->clients = g_list_prepend ( - bl->priv->clients, book); - - if (bl->priv->connected) { - pas_book_respond_open ( - book, Evolution_BookListener_Success); - } else { - /* Open the book. */ - pas_book_respond_open ( - book, Evolution_BookListener_Success); - } - - return TRUE; -} - -static void -pas_backend_ldap_remove_client (PASBackend *backend, - PASBook *book) -{ - PASBackendLDAP *bl; - GList *l; - PASBook *lbook; - - g_return_if_fail (backend != NULL); - g_return_if_fail (PAS_IS_BACKEND_LDAP (backend)); - g_return_if_fail (book != NULL); - g_return_if_fail (PAS_IS_BOOK (book)); - - bl = PAS_BACKEND_LDAP (backend); - - /* Find the book in the list of clients */ - - for (l = bl->priv->clients; l; l = l->next) { - lbook = PAS_BOOK (l->data); - - if (lbook == book) - break; - } - - g_assert (l != NULL); - - /* Disconnect */ - - bl->priv->clients = g_list_remove_link (bl->priv->clients, l); - g_list_free_1 (l); - - /* When all clients go away, notify the parent factory about it so that - * it may decide whether to kill the backend or not. - */ - if (!bl->priv->clients) - pas_backend_last_client_gone (backend); -} - -static gboolean -pas_backend_ldap_construct (PASBackendLDAP *backend) -{ - g_assert (backend != NULL); - g_assert (PAS_IS_BACKEND_LDAP (backend)); - - if (! pas_backend_construct (PAS_BACKEND (backend))) - return FALSE; - - return TRUE; -} - -/** - * pas_backend_ldap_new: - */ -PASBackend * -pas_backend_ldap_new (void) -{ - PASBackendLDAP *backend; - - backend = gtk_type_new (pas_backend_ldap_get_type ()); - - if (! pas_backend_ldap_construct (backend)) { - gtk_object_unref (GTK_OBJECT (backend)); - - return NULL; - } - - return PAS_BACKEND (backend); -} - -static void -pas_backend_ldap_destroy (GtkObject *object) -{ - PASBackendLDAP *bl; - - bl = PAS_BACKEND_LDAP (object); - - g_free (bl->priv->uri); - - GTK_OBJECT_CLASS (pas_backend_ldap_parent_class)->destroy (object); -} - -static void -pas_backend_ldap_class_init (PASBackendLDAPClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - PASBackendClass *parent_class; - - pas_backend_ldap_parent_class = gtk_type_class (pas_backend_get_type ()); - - parent_class = PAS_BACKEND_CLASS (klass); - - /* Set the virtual methods. */ - parent_class->load_uri = pas_backend_ldap_load_uri; - parent_class->get_uri = pas_backend_ldap_get_uri; - parent_class->add_client = pas_backend_ldap_add_client; - parent_class->remove_client = pas_backend_ldap_remove_client; - - object_class->destroy = pas_backend_ldap_destroy; -} - -static void -pas_backend_ldap_init (PASBackendLDAP *backend) -{ - PASBackendLDAPPrivate *priv; - - priv = g_new0 (PASBackendLDAPPrivate, 1); - priv->connected = FALSE; - priv->clients = NULL; - priv->uri = NULL; - - backend->priv = priv; -} - -/** - * pas_backend_ldap_get_type: - */ -GtkType -pas_backend_ldap_get_type (void) -{ - static GtkType type = 0; - - if (! type) { - GtkTypeInfo info = { - "PASBackendLDAP", - sizeof (PASBackendLDAP), - sizeof (PASBackendLDAPClass), - (GtkClassInitFunc) pas_backend_ldap_class_init, - (GtkObjectInitFunc) pas_backend_ldap_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (pas_backend_get_type (), &info); - } - - return type; -} diff --git a/addressbook/backend/pas/pas-backend-ldap.h b/addressbook/backend/pas/pas-backend-ldap.h deleted file mode 100644 index a59cdf3857..0000000000 --- a/addressbook/backend/pas/pas-backend-ldap.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2000, Helix Code, Inc. - */ - -#ifndef __PAS_BACKEND_LDAP_H__ -#define __PAS_BACKEND_LDAP_H__ - -#include <libgnome/gnome-defs.h> -#include "pas-backend.h" - -typedef struct _PASBackendLDAPPrivate PASBackendLDAPPrivate; - -typedef struct { - PASBackend parent_object; - PASBackendLDAPPrivate *priv; -} PASBackendLDAP; - -typedef struct { - PASBackendClass parent_class; -} PASBackendLDAPClass; - -PASBackend *pas_backend_ldap_new (void); -GtkType pas_backend_ldap_get_type (void); - -#define PAS_BACKEND_LDAP_TYPE (pas_backend_ldap_get_type ()) -#define PAS_BACKEND_LDAP(o) (GTK_CHECK_CAST ((o), PAS_BACKEND_LDAP_TYPE, PASBackendLDAP)) -#define PAS_BACKEND_LDAP_CLASS(k) (GTK_CHECK_CLASS_CAST((k), PAS_BACKEND_TYPE, PASBackendLDAPClass)) -#define PAS_IS_BACKEND_LDAP(o) (GTK_CHECK_TYPE ((o), PAS_BACKEND_LDAP_TYPE)) -#define PAS_IS_BACKEND_LDAP_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), PAS_BACKEND_LDAP_TYPE)) - -#endif /* ! __PAS_BACKEND_LDAP_H__ */ - diff --git a/addressbook/backend/pas/pas-backend.c b/addressbook/backend/pas/pas-backend.c deleted file mode 100644 index 3d315c2faf..0000000000 --- a/addressbook/backend/pas/pas-backend.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#include <config.h> -#include <gtk/gtkobject.h> -#include <gtk/gtksignal.h> -#include "pas-backend.h" - -#define CLASS(o) PAS_BACKEND_CLASS (GTK_OBJECT (o)->klass) - -/* Signal IDs */ -enum { - LAST_CLIENT_GONE, - LAST_SIGNAL -}; - -static guint pas_backend_signals[LAST_SIGNAL]; - - -gboolean -pas_backend_construct (PASBackend *backend) -{ - return TRUE; -} - -gboolean -pas_backend_load_uri (PASBackend *backend, - const char *uri) -{ - g_return_val_if_fail (backend != NULL, FALSE); - g_return_val_if_fail (PAS_IS_BACKEND (backend), FALSE); - g_return_val_if_fail (uri != NULL, FALSE); - - g_assert (CLASS (backend)->load_uri != NULL); - - return (* CLASS (backend)->load_uri) (backend, uri); -} - -/** - * pas_backend_get_uri: - * @backend: An addressbook backend. - * - * Queries the URI that an addressbook backend is serving. - * - * Return value: URI for the backend. - **/ -const char * -pas_backend_get_uri (PASBackend *backend) -{ - g_return_val_if_fail (backend != NULL, NULL); - g_return_val_if_fail (PAS_IS_BACKEND (backend), NULL); - - g_assert (CLASS (backend)->get_uri != NULL); - - return (* CLASS (backend)->get_uri) (backend); -} - -/** - * pas_backend_add_client: - * @backend: An addressbook backend. - * @listener: Listener for notification to the client. - * - * Adds a client to an addressbook backend. - * - * Return value: TRUE on success, FALSE on failure to add the client. - */ -gboolean -pas_backend_add_client (PASBackend *backend, - Evolution_BookListener listener) -{ - g_return_val_if_fail (backend != NULL, FALSE); - g_return_val_if_fail (PAS_IS_BACKEND (backend), FALSE); - g_return_val_if_fail (listener != CORBA_OBJECT_NIL, FALSE); - - g_assert (CLASS (backend)->add_client != NULL); - - return CLASS (backend)->add_client (backend, listener); -} - -void -pas_backend_remove_client (PASBackend *backend, - PASBook *book) -{ - g_return_if_fail (backend != NULL); - g_return_if_fail (PAS_IS_BACKEND (backend)); - g_return_if_fail (book != NULL); - g_return_if_fail (PAS_IS_BOOK (book)); - - g_assert (CLASS (backend)->remove_client != NULL); - - CLASS (backend)->remove_client (backend, book); -} - -/** - * pas_backend_last_client_gone: - * @backend: An addressbook backend. - * - * Emits the "last_client_gone" signal for the specified backend. Should - * only be called from backend implementations if the backend really does - * not have any more clients. - **/ -void -pas_backend_last_client_gone (PASBackend *backend) -{ - g_return_if_fail (backend != NULL); - g_return_if_fail (PAS_IS_BACKEND (backend)); - - gtk_signal_emit (GTK_OBJECT (backend), pas_backend_signals[LAST_CLIENT_GONE]); -} - -static void -pas_backend_init (PASBackend *backend) -{ -} - -static void -pas_backend_class_init (PASBackendClass *klass) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass *) klass; - - pas_backend_signals[LAST_CLIENT_GONE] = - gtk_signal_new ("last_client_gone", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (PASBackendClass, last_client_gone), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, pas_backend_signals, LAST_SIGNAL); -} - -/** - * pas_backend_get_type: - */ -GtkType -pas_backend_get_type (void) -{ - static GtkType type = 0; - - if (! type) { - GtkTypeInfo info = { - "PASBackend", - sizeof (PASBackend), - sizeof (PASBackendClass), - (GtkClassInitFunc) pas_backend_class_init, - (GtkObjectInitFunc) pas_backend_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (gtk_object_get_type (), &info); - } - - return type; -} diff --git a/addressbook/backend/pas/pas-backend.h b/addressbook/backend/pas/pas-backend.h deleted file mode 100644 index a1d1a291fd..0000000000 --- a/addressbook/backend/pas/pas-backend.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * An abstract class which defines the API to a given backend. - * There will be one PASBackend object for every URI which is loaded. - * - * Two people will call into the PASBackend API: - * - * 1. The PASBookFactory, when it has been asked to load a book. - * It will create a new PASBackend if one is not already running - * for the requested URI. It will call pas_backend_add_client to - * add a new client to an existing PASBackend server. - * - * 2. A PASBook, when a client has requested an operation on the - * Evolution_Book interface. - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#ifndef __PAS_BACKEND_H__ -#define __PAS_BACKEND_H__ - -#include <libgnome/gnome-defs.h> -#include <gtk/gtkobject.h> -#include <pas/addressbook.h> - -typedef struct _PASBackend PASBackend; -typedef struct _PASBackendPrivate PASBackendPrivate; - -#include <pas/pas-book.h> - -struct _PASBackend { - GtkObject parent_object; - PASBackendPrivate *priv; -}; - -typedef struct { - GtkObjectClass parent_class; - - /* Virtual methods */ - gboolean (*load_uri) (PASBackend *backend, const char *uri); - const char *(* get_uri) (PASBackend *backend); - gboolean (*add_client) (PASBackend *backend, Evolution_BookListener listener); - void (*remove_client) (PASBackend *backend, PASBook *book); - - /* Notification signals */ - void (* last_client_gone) (PASBackend *backend); -} PASBackendClass; - -typedef PASBackend * (*PASBackendFactoryFn) (void); - -gboolean pas_backend_construct (PASBackend *backend); -gboolean pas_backend_load_uri (PASBackend *backend, - const char *uri); -const char *pas_backend_get_uri (PASBackend *backend); -gboolean pas_backend_add_client (PASBackend *backend, - Evolution_BookListener listener); -void pas_backend_remove_client (PASBackend *backend, - PASBook *book); - -void pas_backend_last_client_gone (PASBackend *backend); - -GtkType pas_backend_get_type (void); - -#define PAS_BACKEND_TYPE (pas_backend_get_type ()) -#define PAS_BACKEND(o) (GTK_CHECK_CAST ((o), PAS_BACKEND_TYPE, PASBackend)) -#define PAS_BACKEND_CLASS(k) (GTK_CHECK_CLASS_CAST((k), PAS_BACKEND_TYPE, PASBackendClass)) -#define PAS_IS_BACKEND(o) (GTK_CHECK_TYPE ((o), PAS_BACKEND_TYPE)) -#define PAS_IS_BACKEND_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), PAS_BACKEND_TYPE)) - -#endif /* ! __PAS_BACKEND_H__ */ - diff --git a/addressbook/backend/pas/pas-book-factory.c b/addressbook/backend/pas/pas-book-factory.c deleted file mode 100644 index 626c7420e2..0000000000 --- a/addressbook/backend/pas/pas-book-factory.c +++ /dev/null @@ -1,639 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#include <config.h> -#include <ctype.h> -#include <gnome.h> - -#include "addressbook.h" -#include "pas-book-factory.h" - -#ifdef USING_OAF -#include <liboaf/liboaf.h> -#define PAS_BOOK_FACTORY_OAF_ID "OAFIID:evolution:addressbook-server:0fbc844d-c721-4615-98d0-d67eacf42d80" -#else -#include <libgnorba/gnorba.h> -#define PAS_BOOK_FACTORY_GOAD_ID "evolution:addressbook-server" -#endif - -static BonoboObjectClass *pas_book_factory_parent_class; -POA_Evolution_BookFactory__vepv pas_book_factory_vepv; - -typedef struct { - char *uri; - Evolution_BookListener listener; -} PASBookFactoryQueuedRequest; - -struct _PASBookFactoryPrivate { - gint idle_id; - GHashTable *backends; - GHashTable *active_server_map; - GList *queued_requests; -}; - -/* Signal IDs */ -enum { - LAST_BOOK_GONE, - LAST_SIGNAL -}; - -static guint factory_signals[LAST_SIGNAL]; - -static char * -pas_book_factory_canonicalize_uri (const char *uri) -{ - /* FIXME: What do I do here? */ - - return g_strdup (uri); -} - -static char * -pas_book_factory_extract_proto_from_uri (const char *uri) -{ - char *proto; - char *p; - - p = strchr (uri, ':'); - - if (p == NULL) - return NULL; - - proto = g_malloc0 (p - uri + 1); - - strncpy (proto, uri, p - uri); - - return proto; -} - -/** - * pas_book_factory_register_backend: - * @factory: - * @proto: - * @backend: - */ -void -pas_book_factory_register_backend (PASBookFactory *factory, - const char *proto, - PASBackendFactoryFn backend) -{ - g_return_if_fail (factory != NULL); - g_return_if_fail (PAS_IS_BOOK_FACTORY (factory)); - g_return_if_fail (proto != NULL); - g_return_if_fail (backend != NULL); - - if (g_hash_table_lookup (factory->priv->backends, proto) != NULL) { - g_warning ("pas_book_factory_register_backend: " - "Proto \"%s\" already registered!\n", proto); - } - - g_hash_table_insert (factory->priv->backends, - g_strdup (proto), backend); -} - -/** - * pas_book_factory_get_n_backends: - * @factory: An addressbook factory. - * - * Queries the number of running addressbook backends in an addressbook factory. - * - * Return value: Number of running backends. - **/ -int -pas_book_factory_get_n_backends (PASBookFactory *factory) -{ - g_return_val_if_fail (factory != NULL, -1); - g_return_val_if_fail (PAS_IS_BOOK_FACTORY (factory), -1); - - return g_hash_table_size (factory->priv->active_server_map); -} - -/* Callback used when a backend loses its last connected client */ -static void -backend_last_client_gone_cb (PASBackend *backend, gpointer data) -{ - PASBookFactory *factory; - const char *uri; - gpointer orig_key; - gboolean result; - char *orig_uri; - - factory = PAS_BOOK_FACTORY (data); - - /* Remove the backend from the active server map */ - - uri = pas_backend_get_uri (backend); - g_assert (uri != NULL); - - result = g_hash_table_lookup_extended (factory->priv->active_server_map, uri, - &orig_key, NULL); - g_assert (result != FALSE); - - orig_uri = orig_key; - - g_hash_table_remove (factory->priv->active_server_map, orig_uri); - g_free (orig_uri); - - gtk_object_unref (GTK_OBJECT (backend)); - - /* Notify upstream if there are no more backends */ - - if (g_hash_table_size (factory->priv->active_server_map) == 0) - gtk_signal_emit (GTK_OBJECT (factory), factory_signals[LAST_BOOK_GONE]); -} - -static PASBackendFactoryFn -pas_book_factory_lookup_backend_factory (PASBookFactory *factory, - const char *uri) -{ - PASBackendFactoryFn backend_fn; - char *proto; - char *canonical_uri; - - g_assert (factory != NULL); - g_assert (PAS_IS_BOOK_FACTORY (factory)); - g_assert (uri != NULL); - - canonical_uri = pas_book_factory_canonicalize_uri (uri); - if (canonical_uri == NULL) - return NULL; - - proto = pas_book_factory_extract_proto_from_uri (canonical_uri); - if (proto == NULL) { - g_free (canonical_uri); - return NULL; - } - - backend_fn = g_hash_table_lookup (factory->priv->backends, proto); - - g_free (proto); - g_free (canonical_uri); - - return backend_fn; -} - -static PASBackend * -pas_book_factory_launch_backend (PASBookFactory *factory, - Evolution_BookListener listener, - const char *uri) -{ - PASBackendFactoryFn backend_factory; - PASBackend *backend; - - backend_factory = pas_book_factory_lookup_backend_factory ( - factory, uri); - - if (!backend_factory) { - CORBA_Environment ev; - - CORBA_exception_init (&ev); - Evolution_BookListener_respond_open_book ( - listener, - Evolution_BookListener_ProtocolNotSupported, - CORBA_OBJECT_NIL, - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("pas_book_factory_launch_backend(): could not notify " - "the listener"); - - CORBA_exception_free (&ev); - return NULL; - } - - backend = (* backend_factory) (); - if (!backend) { - CORBA_Environment ev; - - CORBA_exception_init (&ev); - Evolution_BookListener_respond_open_book ( - listener, - Evolution_BookListener_OtherError, - CORBA_OBJECT_NIL, - &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("pas_book_factory_launch_backend(): could not notify " - "the listener"); - - CORBA_exception_free (&ev); - return NULL; - } - - g_hash_table_insert (factory->priv->active_server_map, - g_strdup (uri), - backend); - - gtk_signal_connect (GTK_OBJECT (backend), "last_client_gone", - backend_last_client_gone_cb, - factory); - - return backend; -} - -static void -pas_book_factory_process_request (PASBookFactory *factory, - PASBookFactoryQueuedRequest *request) -{ - PASBackend *backend; - char *uri; - Evolution_BookListener listener; - CORBA_Environment ev; - - uri = request->uri; - listener = request->listener; - g_free (request); - - /* Look up the backend and create one if needed */ - - backend = g_hash_table_lookup (factory->priv->active_server_map, uri); - - if (!backend) { - backend = pas_book_factory_launch_backend (factory, listener, uri); - if (!backend) - goto out; - - if (!pas_backend_add_client (backend, listener)) - goto out; - - pas_backend_load_uri (backend, uri); - - goto out; - } - - pas_backend_add_client (backend, listener); - - out: - g_free (uri); - - CORBA_exception_init (&ev); - CORBA_Object_release (listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("pas_book_factory_process_request(): could not release the listener"); - - CORBA_exception_free (&ev); -} - -static gboolean -pas_book_factory_process_queue (PASBookFactory *factory) -{ - /* Process pending Book-creation requests. */ - if (factory->priv->queued_requests != NULL) { - PASBookFactoryQueuedRequest *request; - GList *l; - - l = factory->priv->queued_requests; - request = l->data; - - pas_book_factory_process_request (factory, request); - - factory->priv->queued_requests = g_list_remove_link ( - factory->priv->queued_requests, l); - g_list_free_1 (l); - } - - if (factory->priv->queued_requests == NULL) { - - factory->priv->idle_id = 0; - return FALSE; - } - - return TRUE; -} - -static void -pas_book_factory_queue_request (PASBookFactory *factory, - const char *uri, - const Evolution_BookListener listener) -{ - PASBookFactoryQueuedRequest *request; - Evolution_BookListener listener_copy; - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - listener_copy = CORBA_Object_duplicate (listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("PASBookFactory: Could not duplicate BookListener!\n"); - CORBA_exception_free (&ev); - return; - } - - CORBA_exception_free (&ev); - - request = g_new0 (PASBookFactoryQueuedRequest, 1); - request->listener = listener_copy; - request->uri = g_strdup (uri); - - factory->priv->queued_requests = - g_list_prepend (factory->priv->queued_requests, request); - - if (! factory->priv->idle_id) { - factory->priv->idle_id = - g_idle_add ((GSourceFunc) pas_book_factory_process_queue, factory); - } -} - - -static void -impl_Evolution_BookFactory_open_book (PortableServer_Servant servant, - const CORBA_char *uri, - const Evolution_BookListener listener, - CORBA_Environment *ev) -{ - PASBookFactory *factory = - PAS_BOOK_FACTORY (bonobo_object_from_servant (servant)); - PASBackendFactoryFn backend_factory; - - backend_factory = pas_book_factory_lookup_backend_factory (factory, uri); - - if (backend_factory == NULL) { - Evolution_BookListener_respond_open_book ( - listener, - Evolution_BookListener_ProtocolNotSupported, - CORBA_OBJECT_NIL, - ev); - - return; - } - - pas_book_factory_queue_request (factory, uri, listener); -} - -static gboolean -pas_book_factory_construct (PASBookFactory *factory) -{ - POA_Evolution_BookFactory *servant; - CORBA_Environment ev; - CORBA_Object obj; - - g_assert (factory != NULL); - g_assert (PAS_IS_BOOK_FACTORY (factory)); - - servant = (POA_Evolution_BookFactory *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &pas_book_factory_vepv; - - CORBA_exception_init (&ev); - - POA_Evolution_BookFactory__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - - return FALSE; - } - - CORBA_exception_free (&ev); - - obj = bonobo_object_activate_servant (BONOBO_OBJECT (factory), servant); - if (obj == CORBA_OBJECT_NIL) { - g_free (servant); - - return FALSE; - } - - bonobo_object_construct (BONOBO_OBJECT (factory), obj); - - return TRUE; -} - -/** - * pas_book_factory_new: - */ -PASBookFactory * -pas_book_factory_new (void) -{ - PASBookFactory *factory; - - factory = gtk_type_new (pas_book_factory_get_type ()); - - if (! pas_book_factory_construct (factory)) { - g_warning ("pas_book_factory_new: Could not construct PASBookFactory!\n"); - gtk_object_unref (GTK_OBJECT (factory)); - - return NULL; - } - - return factory; -} - -#ifdef USING_OAF - -static gboolean -register_factory (CORBA_Object obj) -{ - OAF_RegistrationResult result; - - puts ("about to register addressbook"); - - result = oaf_active_server_register (PAS_BOOK_FACTORY_OAF_ID, obj); - - switch (result) { - case OAF_REG_SUCCESS: - return TRUE; - case OAF_REG_NOT_LISTED: - g_message ("Error registering the PAS factory: not listed"); - return FALSE; - case OAF_REG_ALREADY_ACTIVE: - g_message ("Error registering the PAS factory: already active"); - return FALSE; - case OAF_REG_ERROR: - default: - g_message ("Error registering the PAS factory: generic error"); - return FALSE; - } -} - -#else - -static gboolean -register_factory (CORBA_Object obj) -{ - CORBA_Environment ev; - int ret; - - CORBA_exception_init (&ev); - ret = goad_server_register (NULL, obj, PAS_BOOK_FACTORY_GOAD_ID, "server", &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_message ("pas_book_factory_activate: Exception " - "registering PASBookFactory!\n"); - CORBA_exception_free (&ev); - return FALSE; - } - - CORBA_exception_free (&ev); - - switch (ret) { - case 0: - return TRUE; - case -2: - g_message ("pas_book_factory_activate: Another " - "PASBookFactory is already running.\n"); - return FALSE; - case -1: - default: - g_message ("pas_book_factory_activate: Error " - "registering PASBookFactory!\n"); - return FALSE; - } -} - -#endif - -/** - * pas_book_factory_activate: - */ -void -pas_book_factory_activate (PASBookFactory *factory) -{ - g_return_if_fail (factory != NULL); - g_return_if_fail (PAS_IS_BOOK_FACTORY (factory)); - - register_factory (bonobo_object_corba_objref (BONOBO_OBJECT (factory))); -} - -static void -pas_book_factory_init (PASBookFactory *factory) -{ - factory->priv = g_new0 (PASBookFactoryPrivate, 1); - - factory->priv->active_server_map = g_hash_table_new (g_str_hash, g_str_equal); - factory->priv->backends = g_hash_table_new (g_str_hash, g_str_equal); - factory->priv->queued_requests = NULL; -} - -static void -free_active_server_map_entry (gpointer key, gpointer value, gpointer data) -{ - char *uri; - PASBackend *backend; - - uri = key; - g_free (uri); - - backend = PAS_BACKEND (value); - gtk_object_unref (GTK_OBJECT (backend)); -} - -static void -remove_backends_entry (gpointer key, gpointer value, gpointer data) -{ - char *uri; - - uri = key; - g_free (uri); -} - -static void -pas_book_factory_destroy (GtkObject *object) -{ - PASBookFactory *factory = PAS_BOOK_FACTORY (object); - GList *l; - - for (l = factory->priv->queued_requests; l != NULL; l = l->next) { - PASBookFactoryQueuedRequest *request = l->data; - CORBA_Environment ev; - - g_free (request->uri); - - CORBA_exception_init (&ev); - CORBA_Object_release (request->listener, &ev); - CORBA_exception_free (&ev); - - g_free (request); - } - g_list_free (factory->priv->queued_requests); - factory->priv->queued_requests = NULL; - - g_hash_table_foreach (factory->priv->active_server_map, - free_active_server_map_entry, - NULL); - g_hash_table_destroy (factory->priv->active_server_map); - factory->priv->active_server_map = NULL; - - g_hash_table_foreach (factory->priv->backends, - remove_backends_entry, - NULL); - g_hash_table_destroy (factory->priv->backends); - factory->priv->backends = NULL; - - g_free (factory->priv); - - GTK_OBJECT_CLASS (pas_book_factory_parent_class)->destroy (object); -} - -static POA_Evolution_BookFactory__epv * -pas_book_factory_get_epv (void) -{ - POA_Evolution_BookFactory__epv *epv; - - epv = g_new0 (POA_Evolution_BookFactory__epv, 1); - - epv->open_book = impl_Evolution_BookFactory_open_book; - - return epv; - -} - -static void -pas_book_factory_corba_class_init (void) -{ - pas_book_factory_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - pas_book_factory_vepv.Evolution_BookFactory_epv = pas_book_factory_get_epv (); -} - -static void -pas_book_factory_class_init (PASBookFactoryClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - - pas_book_factory_parent_class = gtk_type_class (bonobo_object_get_type ()); - - factory_signals[LAST_BOOK_GONE] = - gtk_signal_new ("last_book_gone", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (PASBookFactoryClass, last_book_gone), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, factory_signals, LAST_SIGNAL); - - object_class->destroy = pas_book_factory_destroy; - - pas_book_factory_corba_class_init (); -} - -/** - * pas_book_factory_get_type: - */ -GtkType -pas_book_factory_get_type (void) -{ - static GtkType type = 0; - - if (! type) { - GtkTypeInfo info = { - "PASBookFactory", - sizeof (PASBookFactory), - sizeof (PASBookFactoryClass), - (GtkClassInitFunc) pas_book_factory_class_init, - (GtkObjectInitFunc) pas_book_factory_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (bonobo_object_get_type (), &info); - } - - return type; -} diff --git a/addressbook/backend/pas/pas-book-factory.h b/addressbook/backend/pas/pas-book-factory.h deleted file mode 100644 index 7e4690adf1..0000000000 --- a/addressbook/backend/pas/pas-book-factory.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2000, Helix Code, Inc. - */ - -#include <bonobo/bonobo-object.h> -#include <libgnome/gnome-defs.h> - -#include <pas/pas-backend.h> - -#ifndef __PAS_BOOK_FACTORY_H__ -#define __PAS_BOOK_FACTORY_H__ - -BEGIN_GNOME_DECLS - -typedef struct _PASBookFactoryPrivate PASBookFactoryPrivate; - -typedef struct { - BonoboObject parent_object; - PASBookFactoryPrivate *priv; -} PASBookFactory; - -typedef struct { - BonoboObjectClass parent_class; - - /* Notification signals */ - - void (* last_book_gone) (PASBookFactory *factory); -} PASBookFactoryClass; - -PASBookFactory *pas_book_factory_new (void); - -void pas_book_factory_register_backend (PASBookFactory *factory, - const char *proto, - PASBackendFactoryFn backend_factory); - -int pas_book_factory_get_n_backends (PASBookFactory *factory); - -void pas_book_factory_activate (PASBookFactory *factory); - -GtkType pas_book_factory_get_type (void); - -#define PAS_BOOK_FACTORY_TYPE (pas_book_factory_get_type ()) -#define PAS_BOOK_FACTORY(o) (GTK_CHECK_CAST ((o), PAS_BOOK_FACTORY_TYPE, PASBookFactory)) -#define PAS_BOOK_FACTORY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), PAS_BOOK_FACTORY_TYPE, PASBookFactoryClass)) -#define PAS_IS_BOOK_FACTORY(o) (GTK_CHECK_TYPE ((o), PAS_BOOK_FACTORY_TYPE)) -#define PAS_IS_BOOK_FACTORY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), PAS_BOOK_FACTORY_TYPE)) - -END_GNOME_DECLS - -#endif /* ! __PAS_BOOK_FACTORY_H__ */ diff --git a/addressbook/backend/pas/pas-book-view.c b/addressbook/backend/pas/pas-book-view.c deleted file mode 100644 index 3bf35f439f..0000000000 --- a/addressbook/backend/pas/pas-book-view.c +++ /dev/null @@ -1,316 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * pas-book-view.c - * - * Copyright 2000, Helix Code, Inc. - */ - -#include <config.h> -#include <glib.h> -#include "pas-book-view.h" - -static BonoboObjectClass *pas_book_view_parent_class; -POA_Evolution_BookView__vepv pas_book_view_vepv; - -struct _PASBookViewPrivate { - Evolution_BookViewListener listener; -}; - -/** - * pas_book_view_notify_change: - */ -void -pas_book_view_notify_change (PASBookView *book_view, - const GList *cards) -{ - CORBA_Environment ev; - gint i, length; - CORBA_sequence_Evolution_VCard card_sequence; - - length = g_list_length((GList *) cards); - - card_sequence._buffer = CORBA_sequence_Evolution_VCard_allocbuf(length); - card_sequence._maximum = length; - card_sequence._length = length; - - for ( i = 0; cards; cards = g_list_next(cards), i++ ) { - card_sequence._buffer[i] = CORBA_string_dup((char *) cards->data); - } - - CORBA_exception_init (&ev); - - Evolution_BookViewListener_signal_card_changed ( - book_view->priv->listener, &card_sequence, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("pas_book_view_notify_change: Exception signaling BookViewListener!\n"); - } - - CORBA_exception_free (&ev); - - CORBA_free(card_sequence._buffer); -} - -void -pas_book_view_notify_change_1 (PASBookView *book_view, - const char *card) -{ - GList *list = g_list_append(NULL, (char *) card); - pas_book_view_notify_change(book_view, list); - g_list_free(list); -} - -/** - * pas_book_view_notify_remove: - */ -void -pas_book_view_notify_remove (PASBookView *book_view, - const char *id) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - Evolution_BookViewListener_signal_card_removed ( - book_view->priv->listener, (Evolution_CardId) id, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("pas_book_view_notify_remove: Exception signaling BookViewListener!\n"); - } - - CORBA_exception_free (&ev); -} - -/** - * pas_book_view_notify_add: - */ -void -pas_book_view_notify_add (PASBookView *book_view, - const GList *cards) -{ - CORBA_Environment ev; - gint i, length; - CORBA_sequence_Evolution_VCard card_sequence; - - length = g_list_length((GList *)cards); - - card_sequence._buffer = CORBA_sequence_Evolution_VCard_allocbuf(length); - card_sequence._maximum = length; - card_sequence._length = length; - - for ( i = 0; cards; cards = g_list_next(cards), i++ ) { - card_sequence._buffer[i] = CORBA_string_dup((char *) cards->data); - } - - CORBA_exception_init (&ev); - - Evolution_BookViewListener_signal_card_added ( - book_view->priv->listener, &card_sequence, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("pas_book_view_notify_add: Exception signaling BookViewListener!\n"); - } - - CORBA_exception_free (&ev); - - CORBA_free(card_sequence._buffer); -} - -void -pas_book_view_notify_add_1 (PASBookView *book_view, - const char *card) -{ - GList *list = g_list_append(NULL, (char *) card); - pas_book_view_notify_add(book_view, list); - g_list_free(list); -} - -void -pas_book_view_notify_complete (PASBookView *book_view) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - Evolution_BookViewListener_signal_sequence_complete ( - book_view->priv->listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("pas_book_view_notify_complete: Exception signaling BookViewListener!\n"); - } - - CORBA_exception_free (&ev); -} - -static gboolean -pas_book_view_construct (PASBookView *book_view, - Evolution_BookViewListener listener) -{ - POA_Evolution_BookView *servant; - CORBA_Environment ev; - CORBA_Object obj; - - g_assert (book_view != NULL); - g_assert (PAS_IS_BOOK_VIEW (book_view)); - g_assert (listener != CORBA_OBJECT_NIL); - - servant = (POA_Evolution_BookView *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &pas_book_view_vepv; - - CORBA_exception_init (&ev); - - POA_Evolution_BookView__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - - return FALSE; - } - - CORBA_Object_duplicate (listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning("Unable to duplicate listener object in pas-book-view.c\n"); - CORBA_exception_free (&ev); - - return FALSE; - } - - Evolution_BookViewListener_ref (listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning("Unable to ref listener object in pas-book-view.c\n"); - CORBA_exception_free (&ev); - - return FALSE; - } - - CORBA_exception_free (&ev); - - obj = bonobo_object_activate_servant (BONOBO_OBJECT (book_view), servant); - if (obj == CORBA_OBJECT_NIL) { - g_free (servant); - - return FALSE; - } - - bonobo_object_construct (BONOBO_OBJECT (book_view), obj); - - book_view->priv->listener = listener; - - return TRUE; -} - -/** - * pas_book_view_new: - */ -PASBookView * -pas_book_view_new (Evolution_BookViewListener listener) -{ - PASBookView *book_view; - - g_return_val_if_fail (listener != CORBA_OBJECT_NIL, NULL); - - book_view = gtk_type_new (pas_book_view_get_type ()); - - if (! pas_book_view_construct (book_view, listener)) { - gtk_object_unref (GTK_OBJECT (book_view)); - - return NULL; - } - - return book_view; -} - -static void -pas_book_view_destroy (GtkObject *object) -{ - PASBookView *book_view = PAS_BOOK_VIEW (object); - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - Evolution_BookViewListener_unref (book_view->priv->listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning("Unable to unref listener object in pas-book-view.c\n"); - CORBA_exception_free (&ev); - - return; - } - - CORBA_Object_release (book_view->priv->listener, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning("Unable to release listener object in pas-book-view.c\n"); - CORBA_exception_free (&ev); - - return; - } - - CORBA_exception_free (&ev); - - g_free (book_view->priv); - - GTK_OBJECT_CLASS (pas_book_view_parent_class)->destroy (object); -} - -static POA_Evolution_BookView__epv * -pas_book_view_get_epv (void) -{ - POA_Evolution_BookView__epv *epv; - - epv = g_new0 (POA_Evolution_BookView__epv, 1); - - return epv; - -} - -static void -pas_book_view_corba_class_init (void) -{ - pas_book_view_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - pas_book_view_vepv.Evolution_BookView_epv = pas_book_view_get_epv (); -} - -static void -pas_book_view_class_init (PASBookViewClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - - pas_book_view_parent_class = gtk_type_class (bonobo_object_get_type ()); - - object_class->destroy = pas_book_view_destroy; - - pas_book_view_corba_class_init (); -} - -static void -pas_book_view_init (PASBookView *book_view) -{ - book_view->priv = g_new0 (PASBookViewPrivate, 1); - book_view->priv->listener = CORBA_OBJECT_NIL; -} - -/** - * pas_book_view_get_type: - */ -GtkType -pas_book_view_get_type (void) -{ - static GtkType type = 0; - - if (! type) { - GtkTypeInfo info = { - "PASBookView", - sizeof (PASBookView), - sizeof (PASBookViewClass), - (GtkClassInitFunc) pas_book_view_class_init, - (GtkObjectInitFunc) pas_book_view_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (bonobo_object_get_type (), &info); - } - - return type; -} - diff --git a/addressbook/backend/pas/pas-book-view.h b/addressbook/backend/pas/pas-book-view.h deleted file mode 100644 index b9cdbee876..0000000000 --- a/addressbook/backend/pas/pas-book-view.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * A wrapper object which exports the Evolution_Book CORBA interface - * and which maintains a request queue. - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#ifndef __PAS_BOOK_VIEW_H__ -#define __PAS_BOOK_VIEW_H__ - -#include <bonobo/bonobo-object.h> -#include <libgnome/gnome-defs.h> -#include <pas/addressbook.h> - -typedef struct _PASBookView PASBookView; -typedef struct _PASBookViewClass PASBookViewClass; -typedef struct _PASBookViewPrivate PASBookViewPrivate; - -struct _PASBookView { - BonoboObject parent_object; - PASBookViewPrivate *priv; -}; - -struct _PASBookViewClass { - BonoboObjectClass parent_class; -}; - -PASBookView *pas_book_view_new (Evolution_BookViewListener listener); - -void pas_book_view_notify_change (PASBookView *book_view, - const GList *cards); -void pas_book_view_notify_change_1 (PASBookView *book_view, - const char *card); -void pas_book_view_notify_remove (PASBookView *book_view, - const char *id); -void pas_book_view_notify_add (PASBookView *book_view, - const GList *cards); -void pas_book_view_notify_add_1 (PASBookView *book_view, - const char *card); -void pas_book_view_notify_complete (PASBookView *book_view); - -GtkType pas_book_view_get_type (void); - -#define PAS_BOOK_VIEW_TYPE (pas_book_view_get_type ()) -#define PAS_BOOK_VIEW(o) (GTK_CHECK_CAST ((o), PAS_BOOK_VIEW_TYPE, PASBookView)) -#define PAS_BOOK_VIEW_CLASS(k) (GTK_CHECK_CLASS_CAST((k), PAS_BOOK_VIEW_FACTORY_TYPE, PASBookViewClass)) -#define PAS_IS_BOOK_VIEW(o) (GTK_CHECK_TYPE ((o), PAS_BOOK_VIEW_TYPE)) -#define PAS_IS_BOOK_VIEW_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), PAS_BOOK_VIEW_TYPE)) - -#endif /* ! __PAS_BOOK_VIEW_H__ */ diff --git a/addressbook/backend/pas/pas-book.c b/addressbook/backend/pas/pas-book.c deleted file mode 100644 index 55caf1dce7..0000000000 --- a/addressbook/backend/pas/pas-book.c +++ /dev/null @@ -1,677 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * pas-book.c - * - * Copyright 2000, Helix Code, Inc. - */ - -#include <config.h> -#include <gtk/gtksignal.h> -#include "pas-book.h" - -static BonoboObjectClass *pas_book_parent_class; -POA_Evolution_Book__vepv pas_book_vepv; - -enum { - REQUESTS_QUEUED, - LAST_SIGNAL -}; - -static guint pas_book_signals [LAST_SIGNAL]; - -struct _PASBookPrivate { - PASBackend *backend; - Evolution_BookListener listener; - PASBookGetVCardFn get_vcard; - PASBookCanWriteFn can_write; - PASBookCanWriteCardFn can_write_card; - - GList *request_queue; - gint idle_id; -}; - -static gboolean -pas_book_check_queue (PASBook *book) -{ - if (book->priv->request_queue != NULL) { - gtk_signal_emit (GTK_OBJECT (book), - pas_book_signals [REQUESTS_QUEUED]); - } - - if (book->priv->request_queue == NULL) { - book->priv->idle_id = 0; - return FALSE; - } - - return TRUE; -} - -static void -pas_book_queue_request (PASBook *book, PASRequest *req) -{ - book->priv->request_queue = - g_list_append (book->priv->request_queue, req); - - if (book->priv->idle_id == 0) { - book->priv->idle_id = g_idle_add ((GSourceFunc) pas_book_check_queue, book); - } -} - -static void -pas_book_queue_create_card (PASBook *book, const char *vcard) -{ - PASRequest *req; - - req = g_new0 (PASRequest, 1); - req->op = CreateCard; - req->vcard = g_strdup (vcard); - - pas_book_queue_request (book, req); -} - -static void -pas_book_queue_remove_card (PASBook *book, const char *id) -{ - PASRequest *req; - - req = g_new0 (PASRequest, 1); - req->op = RemoveCard; - req->id = g_strdup (id); - - pas_book_queue_request (book, req); -} - -static void -pas_book_queue_modify_card (PASBook *book, const char *vcard) -{ - PASRequest *req; - - req = g_new0 (PASRequest, 1); - req->op = ModifyCard; - req->vcard = g_strdup (vcard); - - pas_book_queue_request (book, req); -} - -static void -pas_book_queue_get_cursor (PASBook *book, const char *search) -{ - PASRequest *req; - - req = g_new0 (PASRequest, 1); - req->op = GetCursor; - req->search = g_strdup(search); - - pas_book_queue_request (book, req); -} - -static void -pas_book_queue_get_book_view (PASBook *book, const Evolution_BookViewListener listener, const char *search) -{ - PASRequest *req; - CORBA_Environment ev; - - req = g_new0 (PASRequest, 1); - req->op = GetBookView; - req->search = g_strdup(search); - - CORBA_exception_init (&ev); - - req->listener = CORBA_Object_duplicate(listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("pas_book_queue_get_book_view: Exception " - "duplicating BookViewListener!\n"); - } - - CORBA_exception_free (&ev); - - pas_book_queue_request (book, req); -} - -static void -pas_book_queue_check_connection (PASBook *book) -{ - PASRequest *req; - - req = g_new0 (PASRequest, 1); - req->op = CheckConnection; - - pas_book_queue_request (book, req); -} - -static CORBA_char * -impl_Evolution_Book_get_vcard (PortableServer_Servant servant, - const Evolution_CardId id, - CORBA_Environment *ev) -{ - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); - char *vcard; - CORBA_char *retval; - - vcard = (book->priv->get_vcard) (book, (const char *) id); - retval = CORBA_string_dup (vcard); - g_free (vcard); - - return retval; -} - -static CORBA_boolean -impl_Evolution_Book_can_write (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); - CORBA_boolean retval; - - retval = (book->priv->can_write) (book); - - return retval; -} - -static CORBA_boolean -impl_Evolution_Book_can_write_card (PortableServer_Servant servant, - const Evolution_CardId id, - CORBA_Environment *ev) -{ - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); - CORBA_boolean retval; - - retval = (book->priv->can_write_card) (book, (const char *) id); - - return retval; -} - -static void -impl_Evolution_Book_create_card (PortableServer_Servant servant, - const Evolution_VCard vcard, - CORBA_Environment *ev) -{ - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); - - pas_book_queue_create_card (book, (const char *) vcard); -} - -static void -impl_Evolution_Book_remove_card (PortableServer_Servant servant, - const Evolution_CardId id, - CORBA_Environment *ev) -{ - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); - - pas_book_queue_remove_card (book, (const char *) id); -} - -static void -impl_Evolution_Book_modify_card (PortableServer_Servant servant, - const Evolution_VCard vcard, - CORBA_Environment *ev) -{ - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); - - pas_book_queue_modify_card (book, (const char *) vcard); -} - -static void -impl_Evolution_Book_get_cursor (PortableServer_Servant servant, - const CORBA_char *search, - CORBA_Environment *ev) -{ - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); - - pas_book_queue_get_cursor (book, search); -} - -static void -impl_Evolution_Book_get_book_view (PortableServer_Servant servant, - const Evolution_BookViewListener listener, - const CORBA_char *search, - CORBA_Environment *ev) -{ - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); - - pas_book_queue_get_book_view (book, listener, search); -} - -static void -impl_Evolution_Book_check_connection (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - PASBook *book = PAS_BOOK (bonobo_object_from_servant (servant)); - - pas_book_queue_check_connection (book); -} - -/** - * pas_book_get_backend: - */ -PASBackend * -pas_book_get_backend (PASBook *book) -{ - g_return_val_if_fail (book != NULL, NULL); - g_return_val_if_fail (PAS_IS_BOOK (book), NULL); - - return book->priv->backend; -} - -/** - * pas_book_get_listener: - */ -Evolution_BookListener -pas_book_get_listener (PASBook *book) -{ - g_return_val_if_fail (book != NULL, CORBA_OBJECT_NIL); - g_return_val_if_fail (PAS_IS_BOOK (book), CORBA_OBJECT_NIL); - - return book->priv->listener; -} - -/** - * pas_book_check_pending - */ -gint -pas_book_check_pending (PASBook *book) -{ - g_return_val_if_fail (book != NULL, -1); - g_return_val_if_fail (PAS_IS_BOOK (book), -1); - - return g_list_length (book->priv->request_queue); -} - -/** - * pas_book_pop_request: - */ -PASRequest * -pas_book_pop_request (PASBook *book) -{ - GList *popped; - PASRequest *req; - - g_return_val_if_fail (book != NULL, NULL); - g_return_val_if_fail (PAS_IS_BOOK (book), NULL); - - if (book->priv->request_queue == NULL) - return NULL; - - req = book->priv->request_queue->data; - - popped = book->priv->request_queue; - book->priv->request_queue = - g_list_remove_link (book->priv->request_queue, popped); - - g_list_free_1 (popped); - - return req; -} - -/** - * pas_book_respond_open: - */ -void -pas_book_respond_open (PASBook *book, - Evolution_BookListener_CallStatus status) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - if (status == Evolution_BookListener_Success) { - Evolution_BookListener_respond_open_book ( - book->priv->listener, status, - bonobo_object_corba_objref (BONOBO_OBJECT (book)), - &ev); - } else { - Evolution_BookListener_respond_open_book ( - book->priv->listener, status, - CORBA_OBJECT_NIL, &ev); - } - - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("pas_book_respond_open: Exception " - "responding to BookListener!\n"); - } - - CORBA_exception_free (&ev); -} - -/** - * pas_book_respond_create: - */ -void -pas_book_respond_create (PASBook *book, - Evolution_BookListener_CallStatus status, - const char *id) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - Evolution_BookListener_respond_create_card ( - book->priv->listener, status, (char *)id, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("pas_book_respond_create: Exception " - "responding to BookListener!\n"); - } - - CORBA_exception_free (&ev); -} - -/** - * pas_book_respond_remove: - */ -void -pas_book_respond_remove (PASBook *book, - Evolution_BookListener_CallStatus status) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - Evolution_BookListener_respond_remove_card ( - book->priv->listener, status, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("pas_book_respond_remove: Exception " - "responding to BookListener!\n"); - } - - CORBA_exception_free (&ev); -} - -/** - * pas_book_respond_modify: - */ -void -pas_book_respond_modify (PASBook *book, - Evolution_BookListener_CallStatus status) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - Evolution_BookListener_respond_modify_card ( - book->priv->listener, status, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("pas_book_respond_modify: Exception " - "responding to BookListener!\n"); - } - - CORBA_exception_free (&ev); -} - -/** - * pas_book_respond_get_cursor: - */ -void -pas_book_respond_get_cursor (PASBook *book, - Evolution_BookListener_CallStatus status, - PASCardCursor *cursor) -{ - CORBA_Environment ev; - CORBA_Object object; - - CORBA_exception_init (&ev); - - object = bonobo_object_corba_objref(BONOBO_OBJECT(cursor)); - - Evolution_BookListener_respond_get_cursor ( - book->priv->listener, status, object, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("pas_book_respond_get_cursor: Exception " - "responding to BookListener!\n"); - } - - CORBA_exception_free (&ev); -} - -/** - * pas_book_respond_get_cursor: - */ -void -pas_book_respond_get_book_view (PASBook *book, - Evolution_BookListener_CallStatus status, - PASBookView *book_view) -{ - CORBA_Environment ev; - CORBA_Object object; - - CORBA_exception_init (&ev); - - object = bonobo_object_corba_objref(BONOBO_OBJECT(book_view)); - - Evolution_BookListener_respond_get_view ( - book->priv->listener, status, object, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("pas_book_respond_get_book_view: Exception " - "responding to BookListener!\n"); - } - - CORBA_exception_free (&ev); -} - -/** - * pas_book_report_connection: - */ -void -pas_book_report_connection (PASBook *book, - gboolean connected) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - Evolution_BookListener_report_connection_status ( - book->priv->listener, (CORBA_boolean) connected, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - g_warning ("pas_book_report_connection: Exception " - "responding to BookListener!\n"); - } - - CORBA_exception_free (&ev); -} - -static gboolean -pas_book_construct (PASBook *book, - PASBackend *backend, - Evolution_BookListener listener, - PASBookGetVCardFn get_vcard, - PASBookCanWriteFn can_write, - PASBookCanWriteCardFn can_write_card) -{ - POA_Evolution_Book *servant; - CORBA_Environment ev; - CORBA_Object obj; - - g_assert (book != NULL); - g_assert (PAS_IS_BOOK (book)); - g_assert (listener != CORBA_OBJECT_NIL); - g_assert (get_vcard != NULL); - g_assert (can_write != NULL); - g_assert (can_write_card != NULL); - - servant = (POA_Evolution_Book *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &pas_book_vepv; - - CORBA_exception_init (&ev); - - POA_Evolution_Book__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - - return FALSE; - } - - CORBA_exception_free (&ev); - - obj = bonobo_object_activate_servant (BONOBO_OBJECT (book), servant); - if (obj == CORBA_OBJECT_NIL) { - g_free (servant); - - return FALSE; - } - - bonobo_object_construct (BONOBO_OBJECT (book), obj); - - CORBA_exception_init (&ev); - book->priv->listener = CORBA_Object_duplicate (listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("pas_book_construct(): could not duplicate the listener"); - - CORBA_exception_free (&ev); - - book->priv->listener = listener; - book->priv->get_vcard = get_vcard; - book->priv->can_write = can_write; - book->priv->can_write_card = can_write_card; - book->priv->backend = backend; - - return TRUE; -} - -/** - * pas_book_new: - */ -PASBook * -pas_book_new (PASBackend *backend, - Evolution_BookListener listener, - PASBookGetVCardFn get_vcard, - PASBookCanWriteFn can_write, - PASBookCanWriteCardFn can_write_card) -{ - PASBook *book; - - g_return_val_if_fail (listener != CORBA_OBJECT_NIL, NULL); - g_return_val_if_fail (get_vcard != NULL, NULL); - - book = gtk_type_new (pas_book_get_type ()); - - if (! pas_book_construct (book, backend, listener, - get_vcard, can_write, can_write_card)) { - gtk_object_unref (GTK_OBJECT (book)); - - return NULL; - } - - return book; -} - -static void -pas_book_destroy (GtkObject *object) -{ - PASBook *book = PAS_BOOK (object); - GList *l; - CORBA_Environment ev; - - for (l = book->priv->request_queue; l != NULL; l = l->next) { - PASRequest *req = l->data; - - g_free (req->id); - g_free (req->vcard); - g_free (req); - } - g_list_free (book->priv->request_queue); - - CORBA_exception_init (&ev); - CORBA_Object_release (book->priv->listener, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) - g_message ("pas_book_construct(): could not release the listener"); - - CORBA_exception_free (&ev); - - g_free (book->priv); - - GTK_OBJECT_CLASS (pas_book_parent_class)->destroy (object); -} - -static POA_Evolution_Book__epv * -pas_book_get_epv (void) -{ - POA_Evolution_Book__epv *epv; - - epv = g_new0 (POA_Evolution_Book__epv, 1); - - epv->get_vcard = impl_Evolution_Book_get_vcard; - epv->can_write = impl_Evolution_Book_can_write; - epv->can_write_card = impl_Evolution_Book_can_write_card; - epv->create_card = impl_Evolution_Book_create_card; - epv->remove_card = impl_Evolution_Book_remove_card; - epv->modify_card = impl_Evolution_Book_modify_card; - epv->check_connection = impl_Evolution_Book_check_connection; - epv->get_cursor = impl_Evolution_Book_get_cursor; - epv->get_book_view = impl_Evolution_Book_get_book_view; - - return epv; - -} - -static void -pas_book_corba_class_init (void) -{ - pas_book_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - pas_book_vepv.Evolution_Book_epv = pas_book_get_epv (); -} - -static void -pas_book_class_init (PASBookClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - - pas_book_parent_class = gtk_type_class (bonobo_object_get_type ()); - - pas_book_signals [REQUESTS_QUEUED] = - gtk_signal_new ("requests_queued", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (PASBookClass, requests_queued), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, pas_book_signals, LAST_SIGNAL); - - object_class->destroy = pas_book_destroy; - - pas_book_corba_class_init (); -} - -static void -pas_book_init (PASBook *book) -{ - book->priv = g_new0 (PASBookPrivate, 1); - book->priv->idle_id = 0; - book->priv->request_queue = NULL; -} - -/** - * pas_book_get_type: - */ -GtkType -pas_book_get_type (void) -{ - static GtkType type = 0; - - if (! type) { - GtkTypeInfo info = { - "PASBook", - sizeof (PASBook), - sizeof (PASBookClass), - (GtkClassInitFunc) pas_book_class_init, - (GtkObjectInitFunc) pas_book_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (bonobo_object_get_type (), &info); - } - - return type; -} - diff --git a/addressbook/backend/pas/pas-book.h b/addressbook/backend/pas/pas-book.h deleted file mode 100644 index 43a94b6600..0000000000 --- a/addressbook/backend/pas/pas-book.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * A wrapper object which exports the Evolution_Book CORBA interface - * and which maintains a request queue. - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#ifndef __PAS_BOOK_H__ -#define __PAS_BOOK_H__ - -#include <bonobo/bonobo-object.h> -#include <libgnome/gnome-defs.h> -#include <pas/addressbook.h> -#include <pas/pas-book-view.h> - -typedef struct _PASBook PASBook; -typedef struct _PASBookPrivate PASBookPrivate; - -#include <pas/pas-backend.h> -#include <pas/pas-card-cursor.h> - -typedef enum { - CreateCard, - RemoveCard, - ModifyCard, - GetCursor, - GetBookView, - CheckConnection -} PASOperation; - -typedef struct { - PASOperation op; - char *id; - char *vcard; - char *search; - Evolution_BookViewListener listener; -} PASRequest; - -struct _PASBook { - BonoboObject parent_object; - PASBookPrivate *priv; -}; - -typedef struct { - BonoboObjectClass parent_class; - - /* Signals */ - void (*requests_queued) (void); -} PASBookClass; - -typedef char * (*PASBookGetVCardFn) (PASBook *book, const char *id); -typedef gboolean (*PASBookCanWriteFn) (PASBook *book); -typedef gboolean (*PASBookCanWriteCardFn) (PASBook *book, const char *id); - -PASBook *pas_book_new (PASBackend *backend, - Evolution_BookListener listener, - PASBookGetVCardFn get_vcard, - PASBookCanWriteFn can_write, - PASBookCanWriteCardFn can_write_card); -PASBackend *pas_book_get_backend (PASBook *book); -Evolution_BookListener pas_book_get_listener (PASBook *book); -int pas_book_check_pending (PASBook *book); -PASRequest *pas_book_pop_request (PASBook *book); - -void pas_book_respond_open (PASBook *book, - Evolution_BookListener_CallStatus status); -void pas_book_respond_create (PASBook *book, - Evolution_BookListener_CallStatus status, - const char *id); -void pas_book_respond_remove (PASBook *book, - Evolution_BookListener_CallStatus status); -void pas_book_respond_modify (PASBook *book, - Evolution_BookListener_CallStatus status); -void pas_book_respond_get_cursor (PASBook *book, - Evolution_BookListener_CallStatus status, - PASCardCursor *cursor); -void pas_book_respond_get_book_view (PASBook *book, - Evolution_BookListener_CallStatus status, - PASBookView *book_view); -void pas_book_report_connection (PASBook *book, - gboolean connected); - -gboolean pas_book_can_write (PASBook *book); -gboolean pas_book_can_write_card (PASBook *book, - const char *id); -GtkType pas_book_get_type (void); - -#define PAS_BOOK_TYPE (pas_book_get_type ()) -#define PAS_BOOK(o) (GTK_CHECK_CAST ((o), PAS_BOOK_TYPE, PASBook)) -#define PAS_BOOK_CLASS(k) (GTK_CHECK_CLASS_CAST((k), PAS_BOOK_FACTORY_TYPE, PASBookClass)) -#define PAS_IS_BOOK(o) (GTK_CHECK_TYPE ((o), PAS_BOOK_TYPE)) -#define PAS_IS_BOOK_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), PAS_BOOK_TYPE)) - -#endif /* ! __PAS_BOOK_H__ */ diff --git a/addressbook/backend/pas/pas-card-cursor.c b/addressbook/backend/pas/pas-card-cursor.c deleted file mode 100644 index c2bbe1c9b0..0000000000 --- a/addressbook/backend/pas/pas-card-cursor.c +++ /dev/null @@ -1,227 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * pas-card-cursor.c: Implements card cursors. - * - * Author: - * Christopher James Lahey <clahey@helixcode.com. - */ - -#include <config.h> -#include <bonobo.h> -#include "addressbook.h" -#include "pas-card-cursor.h" - -struct _PASCardCursorPrivate { - long (*get_length) (PASCardCursor *cursor, gpointer data); - char * (*get_nth) (PASCardCursor *cursor, long n, gpointer data); - gpointer data; -}; - -/* - * A pointer to our parent object class - */ -static BonoboObjectClass *parent_class; - -/* - * The VEPV for the CardCursor object - */ -static POA_Evolution_CardCursor__vepv cursor_vepv; - -/* - * Implemented GtkObject::destroy - */ -static void -pas_card_cursor_destroy (GtkObject *object) -{ - PASCardCursor *cursor = PAS_CARD_CURSOR (object); - - if ( cursor->priv ) - g_free ( cursor->priv ); - - GTK_OBJECT_CLASS (parent_class)->destroy (object); -} - -/* - * CORBA Demo::Echo::echo method implementation - */ -static CORBA_long -impl_pas_card_cursor_get_length (PortableServer_Servant servant, - CORBA_Environment *ev) -{ - PASCardCursor *cursor = PAS_CARD_CURSOR (bonobo_object_from_servant (servant)); - if ( cursor->priv->get_length ) - return cursor->priv->get_length( cursor, cursor->priv->data ); - else - return 0; -} - -/* - * CORBA Demo::Echo::echo method implementation - */ -static char * -impl_pas_card_cursor_get_nth (PortableServer_Servant servant, - const CORBA_long n, - CORBA_Environment *ev) -{ - PASCardCursor *cursor = PAS_CARD_CURSOR (bonobo_object_from_servant (servant)); - if ( cursor->priv->get_nth ) { - char *vcard = cursor->priv->get_nth( cursor, n, cursor->priv->data ); - char *retval = CORBA_string_dup (vcard); - g_free (vcard); - return retval; - } else - return CORBA_string_dup (""); -} - -/* - * If you want users to derive classes from your implementation - * you need to support this method. - */ -POA_Evolution_CardCursor__epv * -pas_card_cursor_get_epv (void) -{ - POA_Evolution_CardCursor__epv *epv; - - epv = g_new0 (POA_Evolution_CardCursor__epv, 1); - - /* - * This is the method invoked by CORBA - */ - epv->get_length = impl_pas_card_cursor_get_length; - epv->get_nth = impl_pas_card_cursor_get_nth; - - return epv; -} - -static void -init_pas_card_cursor_corba_class (void) -{ - cursor_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - cursor_vepv.Evolution_CardCursor_epv = pas_card_cursor_get_epv (); -} - -static void -pas_card_cursor_class_init (PASCardCursorClass *klass) -{ - GtkObjectClass *object_class = (GtkObjectClass *) klass; - - parent_class = gtk_type_class (bonobo_object_get_type ()); - - object_class->destroy = pas_card_cursor_destroy; - - init_pas_card_cursor_corba_class (); -} - -static void -pas_card_cursor_init (PASCardCursor *cursor) -{ - cursor->priv = g_new(PASCardCursorPrivate, 1); - cursor->priv->get_length = NULL; - cursor->priv->get_nth = NULL; - cursor->priv->data = NULL; -} - -GtkType -pas_card_cursor_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "PASCardCursor", - sizeof (PASCardCursor), - sizeof (PASCardCursorClass), - (GtkClassInitFunc) pas_card_cursor_class_init, - (GtkObjectInitFunc) pas_card_cursor_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (bonobo_object_get_type (), &info); - } - - return type; -} - -PASCardCursor * -pas_card_cursor_construct (PASCardCursor *cursor, - Evolution_CardCursor corba_cursor, - PASCardCursorLengthFunc get_length, - PASCardCursorNthFunc get_nth, - gpointer data) -{ - g_return_val_if_fail (cursor != NULL, NULL); - g_return_val_if_fail (PAS_IS_CARD_CURSOR (cursor), NULL); - g_return_val_if_fail (corba_cursor != CORBA_OBJECT_NIL, NULL); - - /* - * Call parent constructor - */ - if (!bonobo_object_construct (BONOBO_OBJECT (cursor), (CORBA_Object) corba_cursor)) - return NULL; - - /* - * Initialize cursor - */ - cursor->priv->get_length = get_length; - cursor->priv->get_nth = get_nth; - cursor->priv->data = data; - - /* - * Success: return the GtkType we were given - */ - return cursor; -} - -/* - * This routine creates the ORBit CORBA server and initializes the - * CORBA side of things - */ -static Evolution_CardCursor -create_cursor (BonoboObject *cursor) -{ - POA_Evolution_CardCursor *servant; - CORBA_Environment ev; - - servant = (POA_Evolution_CardCursor *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &cursor_vepv; - - CORBA_exception_init (&ev); - POA_Evolution_CardCursor__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION){ - g_free (servant); - CORBA_exception_free (&ev); - return CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&ev); - - /* - * Activates the CORBA object. - */ - return (Evolution_CardCursor) bonobo_object_activate_servant (cursor, servant); -} - -PASCardCursor * -pas_card_cursor_new (PASCardCursorLengthFunc get_length, - PASCardCursorNthFunc get_nth, - gpointer data) -{ - PASCardCursor *cursor; - Evolution_CardCursor corba_cursor; - - cursor = gtk_type_new (pas_card_cursor_get_type ()); - corba_cursor = create_cursor (BONOBO_OBJECT (cursor)); - - if (corba_cursor == CORBA_OBJECT_NIL){ - gtk_object_unref (GTK_OBJECT (cursor)); - return NULL; - } - - return pas_card_cursor_construct (cursor, - corba_cursor, - get_length, - get_nth, - data); -} diff --git a/addressbook/backend/pas/pas-card-cursor.h b/addressbook/backend/pas/pas-card-cursor.h deleted file mode 100644 index 300e3e3ce1..0000000000 --- a/addressbook/backend/pas/pas-card-cursor.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 2000, Helix Code, Inc. - */ - -#ifndef __PAS_CARD_CURSOR_H__ -#define __PAS_CARD_CURSOR_H__ - -#include <libgnome/gnome-defs.h> -#include <bonobo/bonobo-object.h> -#include <pas/addressbook.h> - -BEGIN_GNOME_DECLS - -typedef struct _PASCardCursor PASCardCursor; -typedef struct _PASCardCursorPrivate PASCardCursorPrivate; -typedef struct _PASCardCursorClass PASCardCursorClass; - -typedef long (*PASCardCursorLengthFunc) (PASCardCursor *cursor, gpointer data); -typedef char * (*PASCardCursorNthFunc) (PASCardCursor *cursor, long n, gpointer data); - -struct _PASCardCursor { - BonoboObject parent; - PASCardCursorPrivate *priv; -}; - -struct _PASCardCursorClass { - BonoboObjectClass parent; -}; - -/* Creating a new addressbook. */ -PASCardCursor *pas_card_cursor_new (PASCardCursorLengthFunc get_length, - PASCardCursorNthFunc get_nth, - gpointer data); -PASCardCursor *pas_card_cursor_construct (PASCardCursor *cursor, - Evolution_CardCursor corba_cursor, - PASCardCursorLengthFunc get_length, - PASCardCursorNthFunc get_nth, - gpointer data); - -GtkType pas_card_cursor_get_type (void); -POA_Evolution_CardCursor__epv * - pas_card_cursor_get_epv (void); - -/* Fetching cards. */ -#define PAS_CARD_CURSOR_TYPE (pas_card_cursor_get_type ()) -#define PAS_CARD_CURSOR(o) (GTK_CHECK_CAST ((o), PAS_CARD_CURSOR_TYPE, PASCardCursor)) -#define PAS_CARD_CURSOR_CLASS(k) (GTK_CHECK_CLASS_CAST((k), PAS_CARD_CURSOR_TYPE, PASCardCursorClass)) -#define PAS_IS_CARD_CURSOR(o) (GTK_CHECK_TYPE ((o), PAS_CARD_CURSOR_TYPE)) -#define PAS_IS_CARD_CURSOR_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), PAS_CARD_CURSOR_TYPE)) - -END_GNOME_DECLS - -#endif /* ! __PAS_CARD_CURSOR_H__ */ diff --git a/addressbook/conduit/.cvsignore b/addressbook/conduit/.cvsignore deleted file mode 100644 index 6f302c2ac7..0000000000 --- a/addressbook/conduit/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -.deps -.libs -*.lo -Makefile.in -Makefile -libaddress_conduit.la -address-conduit-control-applet -address.conduit
\ No newline at end of file diff --git a/addressbook/conduit/Makefile.am b/addressbook/conduit/Makefile.am deleted file mode 100644 index c45e24714d..0000000000 --- a/addressbook/conduit/Makefile.am +++ /dev/null @@ -1,73 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir)/addressbook \ - -I$(top_srcdir)/addressbook/backend \ - $(GNOME_PILOT_CFLAGS) - -bin_PROGRAMS = address-conduit-control-applet - -address_conduit_control_applet_SOURCES = address-conduit-control-applet.c - -address_conduit_control_applet_LDADD = \ - $(CAPPLET_LIBS) \ - $(GNOME_LIBDIR) \ - -lgpilotdcm \ - -lgpilotd \ - -lgpilotdconduit \ - $(GNOME_CAPPLET_LIBS) \ - $(BONOBO_VFS_GNOME_LIBS) \ - $(GNOME_XML_LIB) \ - $(GNOMEUI_LIBS) \ - $(PISOCK_LIBDIR) $(PISOCK_LIBS) \ - $(INTLLIBS) - - -# address_conduit -address_conduitsdir=$(libdir)/gnome-pilot/conduits -address_conduits_LTLIBRARIES = libaddress_conduit.la - -libaddress_conduit_la_SOURCES = \ - address-conduit.c \ - address-conduit.h - -# address-conduit.c: my_gnomecal_idl - -address.conduit: address.conduit.in Makefile - sed -e 's^\@prefix\@^$(prefix)^g' < $(srcdir)/address.conduit.in > address.conduit.tmp \ - && mv address.conduit.tmp address.conduit - -# -# conduit -# - -libaddress_conduit_la_LDFLAGS = \ - -rpath $(libdir) - -libaddress_conduit_la_LIBADD = \ - $(top_builddir)/addressbook/backend/ebook/libebook-static.la \ - $(top_builddir)/e-util/libeutil-static.la \ - $(top_builddir)/addressbook/ename/libename-static.la \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/libical/src/libical/libical-static.la \ - $(BONOBO_VFS_GNOME_LIBS) \ - $(PISOCK_LIBDIR) $(PISOCK_LIBS) \ - $(GNOME_LIBDIR) \ - $(GNOME_LIBS) - -ccenterdir = $(datadir)/control-center -ccenterPalmPilotdir = $(ccenterdir)/Peripherals -ccenterConduitsdir = $(ccenterPalmPilotdir)/Conduits -ccenterConduits_DATA = address-conduit-control-applet.desktop - -panelConduitsdir = $(datadir)/gnome/apps/Settings/Peripherals/Conduits -panelConduits_DATA = $(ccenterConduits_DATA) - -Conduitdir = $(datadir)/gnome-pilot/conduits/ -Conduit_DATA = address.conduit - -EXTRA_DIST = \ - address.conduit.in \ - $(ccenterConduits_DATA) - -install-data-local: - $(mkinstalldirs) $(ccenterConduitsdir) - $(mkinstalldirs) $(Conduitdir) diff --git a/addressbook/conduit/address-conduit-control-applet.c b/addressbook/conduit/address-conduit-control-applet.c deleted file mode 100644 index 07a6e0042f..0000000000 --- a/addressbook/conduit/address-conduit-control-applet.c +++ /dev/null @@ -1,386 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* Control applet ("capplet") for the gnome-pilot address conduit, */ -/* based on */ -/* gpilotd control applet ('capplet') for use with the GNOME control center */ - -#include <pwd.h> -#include <sys/types.h> -#include <signal.h> -#include <gnome.h> - -#include <config.h> -#include <capplet-widget.h> - -#include <libgpilotdCM/gnome-pilot-conduit-management.h> -#include <libgpilotdCM/gnome-pilot-conduit-config.h> -#include <gpilotd/gnome-pilot-client.h> - -#include "address-conduit.h" - - -/* tell changes callbacks to ignore changes or not */ -static gboolean ignore_changes=FALSE; - -/* capplet widget */ -static GtkWidget *capplet=NULL; - -/* host/device/pilot configuration windows */ -GtkWidget *cfgOptionsWindow=NULL; -GtkWidget *cfgStateWindow=NULL; -GtkWidget *dialogWindow=NULL; - -gboolean activated,org_activation_state; -GnomePilotConduitManagement *conduit; -GnomePilotConduitConfig *conduit_config; -AddressbookConduitCfg *origState = NULL; -AddressbookConduitCfg *curState = NULL; - -static void doTrySettings(GtkWidget *widget, AddressbookConduitCfg *cfg); -static void doRevertSettings(GtkWidget *widget, AddressbookConduitCfg *cfg); -static void doSaveSettings(GtkWidget *widget, AddressbookConduitCfg *cfg); - -//static void readStateCfg (GtkWidget *w, AddressbookConduitCfg *c); -static void setStateCfg (GtkWidget *w, AddressbookConduitCfg *c); - -gint pilotId; -CORBA_Environment ev; -static GnomePilotClient *gpc; - - -/* This array must be in the same order as enumerations - in GnomePilotConduitSyncType as they are used as index. - Custom type implies Disabled state. -*/ -static gchar* sync_options[] ={ N_("Disabled"), - N_("Synchronize"), - N_("Copy From Pilot"), - N_("Copy To Pilot"), - N_("Merge From Pilot"), - N_("Merge To Pilot")}; -#define SYNC_OPTIONS_COUNT 6 - - - - -/* Saves the configuration data. */ -static void -addressbookconduit_save_configuration(AddressbookConduitCfg *c) -{ - gchar prefix[256]; - - g_snprintf(prefix,255,"/gnome-pilot.d/address-conduit/Pilot_%u/",c->pilotId); - - gnome_config_push_prefix(prefix); - gnome_config_set_bool ("open_secret", c->open_secret); - gnome_config_pop_prefix(); - - gnome_config_sync(); - gnome_config_drop_all(); -} - -/* Creates a duplicate of the configuration data */ -static AddressbookConduitCfg* -gcalconduit_dupe_configuration(AddressbookConduitCfg *c) { - AddressbookConduitCfg *retval; - g_return_val_if_fail(c!=NULL,NULL); - retval = g_new0(AddressbookConduitCfg,1); - retval->sync_type = c->sync_type; - retval->open_secret = c->open_secret; - retval->pilotId = c->pilotId; - return retval; -} - - -static void -doTrySettings(GtkWidget *widget, AddressbookConduitCfg *c) -{ - /* - readStateCfg (cfgStateWindow, curState); - if (activated) - gnome_pilot_conduit_config_enable (conduit_config, GnomePilotConduitSyncTypeCustom); - else - gnome_pilot_conduit_config_disable (conduit_config); - */ - - if (c->sync_type!=GnomePilotConduitSyncTypeCustom) - gnome_pilot_conduit_config_enable_with_first_sync (conduit_config, - c->sync_type, - c->sync_type, - TRUE); - else - gnome_pilot_conduit_config_disable (conduit_config); - - addressbookconduit_save_configuration (c); -} - - -static void -doSaveSettings(GtkWidget *widget, AddressbookConduitCfg *cfg) -{ - doTrySettings(widget, cfg); - addressbookconduit_save_configuration(cfg); -} - - -static void -doCancelSettings(GtkWidget *widget, AddressbookConduitCfg *c) -{ - doSaveSettings (widget, c); -} - - -static void -doRevertSettings(GtkWidget *widget, AddressbookConduitCfg *cfg) -{ - activated = org_activation_state; - setStateCfg (cfgStateWindow, curState); -} - -static void -about_cb (GtkWidget *widget, gpointer data) -{ - GtkWidget *about; - const gchar *authors[] = {_("Eskil Heyn Olsen <deity@eskil.dk>"),NULL}; - - about = gnome_about_new (_("Gpilotd address conduit"), VERSION, - _("(C) 1998 the Free Software Foundation"), - authors, - _("Configuration utility for the address conduit.\n"), - _("gnome-unknown.xpm")); - gtk_widget_show (about); - - return; -} - - -/* called by the sync_type GtkOptionMenu */ -static void -sync_action_selection(GtkMenuShell *widget, gpointer unused) -{ - if (!ignore_changes) { - capplet_widget_state_changed(CAPPLET_WIDGET (capplet), TRUE); - } -} - - -/* called by the sync_type GtkOptionMenu */ -static void -activate_sync_type(GtkMenuItem *widget, gpointer data) -{ - curState->sync_type = GPOINTER_TO_INT(data); - if(!ignore_changes) - capplet_widget_state_changed(CAPPLET_WIDGET(capplet), TRUE); -} - - -static GtkWidget -*createStateCfgWindow(void) -{ - GtkWidget *vbox, *table; - GtkWidget *label; - GtkWidget *optionMenu,*menuItem; - GtkMenu *menu; - gint i; - - vbox = gtk_vbox_new(FALSE, GNOME_PAD); - - table = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, GNOME_PAD); - - label = gtk_label_new(_("Synchronize Action")); - gtk_box_pack_start(GTK_BOX(table), label, FALSE, FALSE, GNOME_PAD); - - optionMenu=gtk_option_menu_new(); - gtk_object_set_data(GTK_OBJECT(vbox), "conduit_state", optionMenu); - menu = GTK_MENU(gtk_menu_new()); - - for (i=0; i<SYNC_OPTIONS_COUNT;i++) { - sync_options[i]=_(sync_options[i]); - menuItem = gtk_menu_item_new_with_label(sync_options[i]); - gtk_widget_show(menuItem); - gtk_signal_connect(GTK_OBJECT(menuItem),"activate", - GTK_SIGNAL_FUNC(activate_sync_type), - GINT_TO_POINTER(i)); - gtk_menu_append(menu,menuItem); - } - - gtk_option_menu_set_menu(GTK_OPTION_MENU(optionMenu),GTK_WIDGET(menu)); - gtk_signal_connect(GTK_OBJECT(menu), "selection-done", - GTK_SIGNAL_FUNC(sync_action_selection), - NULL); - - gtk_box_pack_start(GTK_BOX(table), optionMenu, FALSE, FALSE, 0); - - return vbox; -} - - -static void -setStateCfg (GtkWidget *w, AddressbookConduitCfg *c) -{ - GtkOptionMenu *optionMenu; - GtkMenu *menu; - - optionMenu = gtk_object_get_data (GTK_OBJECT(w), "conduit_state"); - g_assert (optionMenu != NULL); - menu = GTK_MENU (gtk_option_menu_get_menu (optionMenu)); - - ignore_changes = TRUE; - /* Here were are relying on the items in menu being the same - order as in GnomePilotConduitSyncType. */ - gtk_option_menu_set_history (optionMenu, (int) c->sync_type); - ignore_changes = FALSE; -} - - -#if 0 -static void -readStateCfg (GtkWidget *w, AddressbookConduitCfg *c) -{ - /* - GtkWidget *button; - button = gtk_object_get_data(GTK_OBJECT(cfg), "conduit_on_off"); - g_assert(button!=NULL); - activated = GTK_TOGGLE_BUTTON(button)->active; - */ -} -#endif /* 0 */ - - -static void -pilot_capplet_setup(void) -{ - GtkWidget *frame, *table; - - capplet = capplet_widget_new(); - - table = gtk_table_new(1, 2, FALSE); - gtk_container_border_width(GTK_CONTAINER(table), GNOME_PAD); - gtk_container_add(GTK_CONTAINER(capplet), table); - - frame = gtk_frame_new(_("Conduit state")); - gtk_container_border_width(GTK_CONTAINER(frame), GNOME_PAD_SMALL); - gtk_table_attach_defaults(GTK_TABLE(table), frame, 0, 1, 0, 1); - cfgStateWindow = createStateCfgWindow(); - gtk_container_add(GTK_CONTAINER(frame), cfgStateWindow); - - gtk_signal_connect(GTK_OBJECT(capplet), "try", - GTK_SIGNAL_FUNC(doTrySettings), curState); - gtk_signal_connect(GTK_OBJECT(capplet), "revert", - GTK_SIGNAL_FUNC(doRevertSettings), curState); - gtk_signal_connect(GTK_OBJECT(capplet), "ok", - GTK_SIGNAL_FUNC(doSaveSettings), curState); - gtk_signal_connect(GTK_OBJECT(capplet), "cancel", - GTK_SIGNAL_FUNC(doCancelSettings), curState); - gtk_signal_connect(GTK_OBJECT(capplet), "help", - GTK_SIGNAL_FUNC(about_cb), NULL); - - - setStateCfg (cfgStateWindow, curState); - - gtk_widget_show_all (capplet); -} - - -static void -run_error_dialog(gchar *mesg,...) -{ - char tmp[80]; - va_list ap; - - va_start(ap,mesg); - vsnprintf(tmp,79,mesg,ap); - dialogWindow = gnome_message_box_new(mesg,GNOME_MESSAGE_BOX_ERROR,GNOME_STOCK_BUTTON_OK,NULL); - gnome_dialog_run_and_close(GNOME_DIALOG(dialogWindow)); - va_end(ap); -} - - -static gint -get_pilot_id_from_gpilotd() -{ - GList *pilots=NULL; - gint pilot; - int i,err; - - i=0; - /* we don't worry about leaking here, so pilots isn't freed */ - switch(err = gnome_pilot_client_get_pilots(gpc,&pilots)) { - case GPILOTD_OK: { - if(pilots) { - for(i=0;i<g_list_length(pilots);i++) { - g_message("pilot %d = \"%s\"",i,(gchar*)g_list_nth(pilots,i)->data); - } - if(i==0) { - run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first.")); - return -1; - } else { - gnome_pilot_client_get_pilot_id_by_name(gpc, - pilots->data, /* this is the first pilot */ - &pilot); - if(i>1) { - g_message("too many pilots..."); - /* need a choose here */ - } - return pilot; - } - } else { - run_error_dialog(_("No pilot configured, please choose the\n'Pilot Link Properties' capplet first.")); - return -1; - } - break; - } - case GPILOTD_ERR_NOT_CONNECTED: - run_error_dialog(_("Not connected to the gnome-pilot daemon")); - return -1; - break; - default: - g_warning("gnome_pilot_client_get_pilot_ids(...) = %d",err); - run_error_dialog(_("An error occured when trying to fetch\npilot list from the gnome-pilot daemon")); - return -1; - break; - } -} - - -int -main (int argc, char *argv[]) -{ - g_log_set_always_fatal (G_LOG_LEVEL_ERROR | - G_LOG_LEVEL_CRITICAL | - G_LOG_LEVEL_WARNING); - - /* we're a capplet */ - gnome_capplet_init ("address conduit control applet", NULL, argc, argv, - NULL, 0, NULL); - - - gpc = gnome_pilot_client_new(); - gnome_pilot_client_connect_to_daemon(gpc); - pilotId = get_pilot_id_from_gpilotd(); - if(!pilotId) return -1; - - /* put all code to set things up in here */ - conduit_load_configuration (&origState, pilotId); - - conduit = gnome_pilot_conduit_management_new ("address_conduit", GNOME_PILOT_CONDUIT_MGMT_ID); - if (conduit == NULL) return -1; - conduit_config = gnome_pilot_conduit_config_new (conduit, pilotId); - org_activation_state = gnome_pilot_conduit_config_is_enabled (conduit_config, - &origState->sync_type); - activated = org_activation_state; - - //gpilotd_conduit_mgmt_get_sync_type (conduit, pilotId, &origState->sync_type); - - curState = gcalconduit_dupe_configuration(origState); - - pilot_capplet_setup (); - - - /* done setting up, now run main loop */ - capplet_gtk_main(); - - gnome_pilot_conduit_management_destroy(conduit); - - return 0; -} diff --git a/addressbook/conduit/address-conduit-control-applet.desktop b/addressbook/conduit/address-conduit-control-applet.desktop deleted file mode 100644 index a11a782844..0000000000 --- a/addressbook/conduit/address-conduit-control-applet.desktop +++ /dev/null @@ -1,12 +0,0 @@ -[Desktop Entry] -Name=Address conduit -Name[da]=Udstående -Name[no]=Oppgaver -Name[tr]=Adres parçasý -Comment=Configure the address conduit -Comment[da]=Konfigurér Udstående -Comment[no]=Konfigurér oppgavelisten -Comment[tr]=Adres parçasýnýn ayarlarý -Exec=address-conduit-control-applet --cap-id=1 -Terminal=0 -Type=Application diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c deleted file mode 100644 index d863d22af4..0000000000 --- a/addressbook/conduit/address-conduit.c +++ /dev/null @@ -1,1274 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -#include <config.h> -#include <sys/stat.h> -#include <utime.h> -#include <unistd.h> -#include <pwd.h> -#include <signal.h> -#include <errno.h> - -#include <pi-source.h> -#include <pi-socket.h> -#include <pi-file.h> -#include <pi-dlp.h> -#include <libgnorba/gnorba.h> -#include <libgnorba/gnome-factory.h> -#include <pi-version.h> -#include <gpilotd/gnome-pilot-conduit.h> -#include <gpilotd/gnome-pilot-conduit-standard-abs.h> -#include <address-conduit.h> -#include "ebook/e-book-types.h" - -#include <bonobo.h> - -GnomePilotConduit * conduit_get_gpilot_conduit (guint32); -void conduit_destroy_gpilot_conduit (GnomePilotConduit*); -void local_record_from_ecard (AddressbookLocalRecord *local, ECard *ecard); - -#define CONDUIT_VERSION "0.1" -#ifdef G_LOG_DOMAIN -#undef G_LOG_DOMAIN -#endif -#define G_LOG_DOMAIN "addressconduit" - -/* #define SUPPORT_ARCHIVING 1 */ -#define NEED_OAF_INIT_HACK 1 -#define DEBUG_ADDRESSBOOKCONDUIT 1 - -#ifdef DEBUG_ADDRESSBOOKCONDUIT -#define show_exception(e) g_warning ("Exception: %s\n", CORBA_exception_id (e)) -#define LOG(e...) g_log(G_LOG_DOMAIN,G_LOG_LEVEL_MESSAGE, e) -#else -#define show_exception(e) -#define LOG(e...) -#endif - -#define WARN(e...) g_log(G_LOG_DOMAIN,G_LOG_LEVEL_WARNING, e) -#define INFO(e...) g_log(G_LOG_DOMAIN,G_LOG_LEVEL_MESSAGE, e) - -#define catch_ret_val(_env,ret) \ - if (_env._major != CORBA_NO_EXCEPTION) { \ - g_log(G_LOG_DOMAIN,G_LOG_LEVEL_MESSAGE,"%s:%d: Caught exception",__FILE__,__LINE__); \ - g_warning ("Exception: %s\n", CORBA_exception_id (&(_env))); \ - CORBA_exception_free(&(_env)); \ - return ret; \ - } - - -static void -status_cb (EBook *ebook, EBookStatus status, gpointer closure) -{ - (*(EBookStatus*)closure) = status; - gtk_main_quit(); -} - - -/* Destroys any data allocated by gcalconduit_load_configuration - and deallocates the given configuration. */ -static void -conduit_destroy_configuration(AddressbookConduitCfg **c) -{ - g_return_if_fail(c!=NULL); - g_return_if_fail(*c!=NULL); - //g_free(*c); FIX ME - *c = NULL; -} - - -/* Given a AddressbookConduitContext**, allocates the structure */ -static void -conduit_new_context(AddressbookConduitContext **ctxt, - AddressbookConduitCfg *c) -{ - *ctxt = g_new0(AddressbookConduitContext,1); - g_assert(ctxt!=NULL); - (*ctxt)->cfg = c; - CORBA_exception_init (&((*ctxt)->ev)); -} - - -/* Destroys any data allocated by conduit_new_context - and deallocates its data. */ -static void -conduit_destroy_context(AddressbookConduitContext **ctxt) -{ - g_return_if_fail(ctxt!=NULL); - g_return_if_fail(*ctxt!=NULL); - - if ((*ctxt)->cfg!=NULL) - conduit_destroy_configuration(&((*ctxt)->cfg)); - - g_free(*ctxt); - *ctxt = NULL; -} - - -static void -cursor_cb (EBook *book, EBookStatus status, ECardCursor *cursor, gpointer closure) -{ - AddressbookConduitContext *ctxt = (AddressbookConduitContext*)closure; - - if (status == E_BOOK_STATUS_SUCCESS) { - long length; - int i; - - // ctxt->cursor = cursor; - ctxt->address_load_success = TRUE; - - length = e_card_cursor_get_length (cursor); - ctxt->cards = NULL; - for (i = 0; i < length; i ++) - ctxt->cards = g_list_append (ctxt->cards, e_card_cursor_get_nth (cursor, i)); - - gtk_main_quit(); /* end the sub event loop */ - } - else { - WARN (_("BLARG\n")); - gtk_main_quit(); /* end the sub event loop */ - } -} - -static void -book_open_cb (EBook *book, EBookStatus status, gpointer closure) -{ - AddressbookConduitContext *ctxt = (AddressbookConduitContext*)closure; - - if (status == E_BOOK_STATUS_SUCCESS) { - e_book_get_cursor (book, "(contains \"full_name\" \"\")", cursor_cb, ctxt); - } - else { - WARN (_("BLARG\n")); - gtk_main_quit(); /* end the sub event loop */ - } -} - -static int -start_address_server (GnomePilotConduitStandardAbs *conduit, - AddressbookConduitContext *ctxt) -{ - gchar *uri, *path; - - g_return_val_if_fail(conduit!=NULL,-2); - g_return_val_if_fail(ctxt!=NULL,-2); - - ctxt->ebook = e_book_new (); - - path = g_concat_dir_and_file (g_get_home_dir (), - "evolution/local/Contacts/addressbook.db"); - uri = g_strdup_printf ("file://%s", path); - g_free (path); - - e_book_load_uri (ctxt->ebook, uri, book_open_cb, ctxt); - - /* run a sub event loop to turn ebook's async loading into a - synchronous call */ - gtk_main (); - - g_free (uri); - - if (ctxt->address_load_success) - return 0; - - return -1; -} - -/* - * converts a ECard to a AddressbookLocalRecord - */ -void -local_record_from_ecard(AddressbookLocalRecord *local, - ECard *ecard) -{ - guint32 current_status; - - g_return_if_fail(local!=NULL); - g_return_if_fail(ecard!=NULL); - - local->ecard = ecard; - local->local.ID = local->ecard->pilot_id; - - gtk_object_get (GTK_OBJECT(ecard), - "pilot_status", ¤t_status, NULL); - - switch(current_status) { - case E_CARD_PILOT_STATUS_NONE: - local->local.attr = GnomePilotRecordNothing; - break; - case E_CARD_PILOT_STATUS_MOD: - local->local.attr = GnomePilotRecordModified; - break; - case E_CARD_PILOT_STATUS_DEL: - local->local.attr = GnomePilotRecordDeleted; - break; - } - - /* Records without a pilot_id are new */ - if(local->local.ID == 0) - local->local.attr = GnomePilotRecordNew; - - local->local.secret = 0; -#if 0 - if(obj->class!=NULL) - if(strcmp(obj->class,"PRIVATE")==0) - local->local.secret = 1; -#endif - - local->local.archived = 0; -} - -static ECard * -get_ecard_by_pilot_id (GList *card_list, recordid_t id) -{ - GList *l; - - for (l = card_list; l; l = l->next) { - guint32 pilot_id; - ECard *card = l->data; - - if (!card) - continue; - - gtk_object_get (GTK_OBJECT(card), - "pilot_id", &pilot_id, NULL); - - if (pilot_id == id) - return card; - } - - return NULL; -} - -/* - * Given a PilotRecord, find the matching record in - * the addressbook. If no match, return NULL - */ -static AddressbookLocalRecord * -find_record_in_ebook(GnomePilotConduitStandardAbs *conduit, - PilotRecord *remote, - AddressbookConduitContext *ctxt) -{ - AddressbookLocalRecord *loc; - ECard *ecard; - - g_return_val_if_fail(conduit!=NULL,NULL); - g_return_val_if_fail(remote!=NULL,NULL); - - LOG ("requesting %ld", remote->ID); - - ecard = get_ecard_by_pilot_id (ctxt->cards, remote->ID); - - if (NULL != ecard) { - LOG ("Found"); - loc = g_new0(AddressbookLocalRecord,1); - /* memory allocated in new_from_string is freed in free_match */ - local_record_from_ecard (loc, ecard); - return loc; - } - - INFO ("Object did not exist"); - return NULL; -} - -static ECard * -ecard_from_remote_record(AddressbookConduitContext *ctxt, - PilotRecord *remote) -{ - struct Address address; - ECard *ecard; - ECardSimple *simple; - int i; - char *string; - char *stringparts[4]; - char *commaparts[3]; - char *spaceparts[3]; - char *commastring, *spacestring; - - g_return_val_if_fail(remote!=NULL,NULL); - memset (&address, 0, sizeof (struct Address)); - unpack_Address (&address, remote->record, remote->length); - - - ecard = e_card_new(""); - simple = e_card_simple_new(ecard); - -#define get(pilotprop) \ - (address.entry [(pilotprop)]) -#define check(pilotprop) \ - (address.entry [(pilotprop)] && *address.entry [(pilotprop)]) - - i = 0; - if (check(entryFirstname)) - stringparts[i++] = get(entryFirstname); - if (check(entryLastname)) - stringparts[i++] = get(entryLastname); - stringparts[i] = NULL; - string = g_strjoinv(" ", stringparts); - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_FULL_NAME, string); - g_free(string); - - i = 0; - if (check (entryAddress)) - spaceparts[i++] = get (entryAddress); - if (check (entryZip)) - spaceparts[i++] = get (entryZip); - spaceparts[i] = 0; - spacestring = g_strjoinv(" ", spaceparts); - - i = 0; - if (check (entryCity)) - commaparts[i++] = get (entryCity); - if (spacestring && *spacestring) - commaparts[i++] = spacestring; - commaparts[i] = 0; - commastring = g_strjoinv(", ", commaparts); - - i = 0; - if (check (entryAddress)) - stringparts[i++] = get (entryAddress); - if (commastring && *commastring) - stringparts[i++] = commastring; - if (check (entryCountry)) - stringparts[i++] = get (entryCountry); - stringparts[i] = NULL; - string = g_strjoinv("\n", stringparts); - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_ADDRESS_HOME, string); - - g_free(spacestring); - g_free(commastring); - g_free(string); - - if (check (entryTitle)) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_TITLE, get (entryTitle)); - - if (check (entryCompany)) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_ORG, get (entryCompany)); - - for (i = entryPhone1; i <= entryPhone5; i ++) { - if (address.entry [i] && *(address.entry [i])) { - char *phonelabel = ctxt->ai.phoneLabels[address.phoneLabel[i - entryPhone1]]; - if (!strcmp (phonelabel, "E-mail")) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_EMAIL, address.entry[i]); - else if (!strcmp (phonelabel, "Home")) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_HOME, address.entry[i]); - else if (!strcmp (phonelabel, "Work")) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_BUSINESS, address.entry[i]); - else if (!strcmp (phonelabel, "Fax")) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_FAX, address.entry[i]); - else if (!strcmp (phonelabel, "Other")) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_OTHER, address.entry[i]); - else if (!strcmp (phonelabel, "Main")) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_PRIMARY, address.entry[i]); - else if (!strcmp (phonelabel, "Pager")) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_PAGER, address.entry[i]); - else if (!strcmp (phonelabel, "Mobile")) - e_card_simple_set(simple, E_CARD_SIMPLE_FIELD_PHONE_MOBILE, address.entry[i]); - } - } -#undef get -#undef set - - free_Address(&address); - - gtk_object_set (GTK_OBJECT(ecard), "pilot_id", remote->ID, NULL); - - gtk_object_unref(GTK_OBJECT(simple)); - - return ecard; -} - -static ECard* -merge_ecard_with_remote_record (AddressbookConduitContext *ctxt, - ECard *ecard, - PilotRecord *remote) -{ - return ecard; -} - -typedef struct { - EBookStatus status; - char *id; -} add_card_cons; - -static void -add_card_cb (EBook *ebook, EBookStatus status, const char *id, gpointer closure) -{ - add_card_cons *cons = (add_card_cons*)closure; - - cons->status = status; - cons->id = g_strdup (id); - - gtk_main_quit(); -} - -static gint -update_record (GnomePilotConduitStandardAbs *conduit, - PilotRecord *remote, - AddressbookConduitContext *ctxt) -{ - struct Address address; - ECard *ecard; - add_card_cons cons; - - g_return_val_if_fail(remote!=NULL,-1); - - memset (&address, 0, sizeof (struct Address)); - unpack_Address (&address, remote->record, remote->length); - - LOG ("requesting %ld [%s %s]", remote->ID, address.entry[entryFirstname], address.entry[entryLastname]); - printf ("requesting %ld [%s %s]\n", remote->ID, address.entry[entryFirstname], address.entry[entryLastname]); - - ecard = get_ecard_by_pilot_id (ctxt->cards, remote->ID); - - if (ecard == NULL) { - - LOG ("Object did not exist, creating a new one"); - printf ("Object did not exist, creating a new one\n"); - - ecard = ecard_from_remote_record (ctxt, remote); - - /* add the ecard to the server */ - e_book_add_card (ctxt->ebook, ecard, add_card_cb, &cons); - - gtk_main(); /* enter sub mainloop */ - - if (cons.status == E_BOOK_STATUS_SUCCESS) { - ctxt->cards = g_list_append (ctxt->cards, - e_book_get_card (ctxt->ebook, cons.id)); - g_free (cons.id); - } - else - WARN ("update_record: failed to add card to ebook\n"); - } else { - EBookStatus commit_status; - - ecard = merge_ecard_with_remote_record (ctxt, ecard, remote); - - e_book_commit_card (ctxt->ebook, ecard, status_cb, &commit_status); - - gtk_main (); /* enter sub mainloop */ - - if (commit_status != E_BOOK_STATUS_SUCCESS) - WARN ("update_record: failed to update card in ebook\n"); - } - - free_Address(&address); - - return 0; -} - -#if 0 -static void -check_for_slow_setting (GnomePilotConduit *c, AddressbookConduitContext *ctxt) -{ - GList *uids; - unsigned long int entry_number; - - uids = cal_client_get_uids (ctxt->client, CALOBJ_TYPE_ADDRESS); - - entry_number = g_list_length (uids); - - LOG (_("Address holds %ld address entries"), entry_number); - /* If the local base is empty, do a slow sync */ - if (entry_number == 0) { - GnomePilotConduitStandard *conduit; - conduit = GNOME_PILOT_CONDUIT_STANDARD (c); - gnome_pilot_conduit_standard_set_slow (conduit); - } -} -#endif /* 0 */ - -static gint -pre_sync (GnomePilotConduit *c, - GnomePilotDBInfo *dbi, - AddressbookConduitContext *ctxt) -{ - int l; - unsigned char *buf; - GnomePilotConduitStandardAbs *conduit; - - conduit = GNOME_PILOT_CONDUIT_STANDARD_ABS(c); - - g_message ("Evolution Addressbook Conduit v.%s",CONDUIT_VERSION); - - ctxt->ebook = NULL; - - if (start_address_server (GNOME_PILOT_CONDUIT_STANDARD_ABS(c), ctxt) != 0) { - WARN(_("Could not start addressbook server")); - gnome_pilot_conduit_error(GNOME_PILOT_CONDUIT(c), - _("Could not start addressbook server")); - return -1; - } - - - /* Set the counters for the progress bar crap */ - - gtk_object_set_data (GTK_OBJECT(c),"dbinfo",dbi); - - /* load_records(c); */ - - buf = (unsigned char*)g_malloc(0xffff); - if((l=dlp_ReadAppBlock(dbi->pilot_socket,dbi->db_handle,0,(unsigned char *)buf,0xffff)) < 0) { - WARN(_("Could not read pilot's Address application block")); - WARN("dlp_ReadAppBlock(...) = %d",l); - gnome_pilot_conduit_error(GNOME_PILOT_CONDUIT(c), - _("Could not read pilot's Address application block")); - return -1; - } - unpack_AddressAppInfo(&(ctxt->ai),buf,l); - g_free(buf); - -#if 0 - check_for_slow_setting(c,ctxt); -#else - /* for now just always use the slow sync method */ - gnome_pilot_conduit_standard_set_slow (GNOME_PILOT_CONDUIT_STANDARD (c)); -#endif - - return 0; -} - -/** - * Find (if possible) the local record which matches - * the given PilotRecord. - * if successfull, return non-zero and set *local to - * a non-null value (the located local record), - * otherwise return 0 and set *local = NULL; - */ - -static gint -match_record (GnomePilotConduitStandardAbs *conduit, - AddressbookLocalRecord **local, - PilotRecord *remote, - AddressbookConduitContext *ctxt) -{ - LOG ("in match_record"); - - g_return_val_if_fail(local!=NULL,-1); - g_return_val_if_fail(remote!=NULL,-1); - - *local = find_record_in_ebook(conduit,remote,ctxt); - - if (*local==NULL) return -1; - return 0; -} - -/** - * Free the data allocated by a previous match_record call. - * If successfull, return non-zero and ser *local=NULL, otherwise - * return 0. - */ -static gint -free_match (GnomePilotConduitStandardAbs *conduit, - AddressbookLocalRecord **local, - AddressbookConduitContext *ctxt) -{ - LOG ("entering free_match"); - - g_return_val_if_fail(local!=NULL,-1); - g_return_val_if_fail(*local!=NULL,-1); - - g_free(*local); - - *local = NULL; - return 0; -} - -#if SUPPORT_ARCHIVING -/* - Move to archive and set status to Nothing - */ -static gint -archive_local (GnomePilotConduitStandardAbs *conduit, - AddressbookLocalRecord *local, - AddressbookConduitContext *ctxt) -{ - LOG ("entering archive_local"); - - g_return_val_if_fail(local!=NULL,-1); - - return -1; -} - -/* -** used when copying information from the pilot to the desktop. if -** the archived flag is set to true in the PilotRecord, this method is -** called. -** -** Store in archive and set status to Nothing -*/ -static gint -archive_remote (GnomePilotConduitStandardAbs *conduit, - AddressbookLocalRecord *local, - PilotRecord *remote, - AddressbookConduitContext *ctxt) -{ - LOG ("entering archive_remote"); - - //g_return_val_if_fail(remote!=NULL,-1); - //g_return_val_if_fail(local!=NULL,-1); - - return -1; -} - -/* -** Called when copying records to the pilot. -** -** XXX more here. -*/ -static gint -clear_status_archive_local (GnomePilotConduitStandardAbs *conduit, - AddressbookLocalRecord *local, - AddressbookConduitContext *ctxt) -{ - LOG ("entering clear_status_archive_local"); - - g_return_val_if_fail(local!=NULL,-1); - - return -1; -} - -/* -** presumably used to set the archived flag on a local record. not -** actually used in the gnome-pilot source. -*/ -static gint -set_archived (GnomePilotConduitStandardAbs *conduit, - AddressbookLocalRecord *local, - gint archived, - AddressbookConduitContext *ctxt) -{ - LOG ("entering set_archived"); - - g_return_val_if_fail(local!=NULL,-1); - g_assert(local->ecard!=NULL); - - local->local.archived = archived; - update_address_entry_in_repository (conduit, local->ical, ctxt); - return 0; -} - -#endif - -/* -** used when copying information from the pilot to the desktop. if -** the archived flags and deleted flags are not set to true in the -** PilotRecord, this method is called. -** -** Store and set status to Nothing -*/ -static gint -store_remote (GnomePilotConduitStandardAbs *conduit, - PilotRecord *remote, - AddressbookConduitContext *ctxt) -{ - LOG ("entering store_remote"); - - g_return_val_if_fail(remote!=NULL,-1); - remote->attr = GnomePilotRecordNothing; - - return update_record(conduit,remote,ctxt); -} - -/* -** Used when looping over records on the local side of things. -** function should maintain state such that *local moves along the -** list of records. -** -** return value is 0 if we're done, 1 to continue iterating, and -1 on -** error. -*/ -static gint -iterate (GnomePilotConduitStandardAbs *conduit, - AddressbookLocalRecord **local, - AddressbookConduitContext *ctxt) -{ - static GList *iterator; - static int num; - - g_return_val_if_fail(local!=NULL,-1); - - if (*local==NULL) { - LOG ("beginning iteration"); - - iterator = ctxt->cards; - num = 0; - - LOG ("iterating over %d records", g_list_length (ctxt->cards)); - *local = g_new0(AddressbookLocalRecord, 1); - local_record_from_ecard (*local, (ECard*)iterator->data); - } else { - /* printf ("continuing iteration\n"); */ - num++; - if(g_list_next(iterator)==NULL) { - LOG ("ending"); - /** free stuff allocated for iteration */ - g_free((*local)); - - LOG ("iterated over %d records", num); - - /* ends iteration */ - (*local) = NULL; - return 0; - } else { - iterator = g_list_next (iterator); - local_record_from_ecard (*local,(ECard*)(iterator->data)); - } - } - return 1; -} - - -/* -** similar to iterate, except the list of records we iterate over have -** to have FLAG set and ARCHIVE should match the state of the local -** record. -** -** return value is 0 if we're done, 1 to continue iterating, and -1 on -** error. -*/ -static gint -iterate_specific (GnomePilotConduitStandardAbs *conduit, - AddressbookLocalRecord **local, - gint flag, - gint archived, - AddressbookConduitContext *ctxt) -{ -#ifdef DEBUG_ADDRESSBOOKCONDUIT - { - gchar *tmp; - switch (flag) { - case GnomePilotRecordNothing: tmp = g_strdup("RecordNothing"); break; - case GnomePilotRecordModified: tmp = g_strdup("RecordModified"); break; - case GnomePilotRecordDeleted: tmp = g_strdup("RecordDeleted"); break; - case GnomePilotRecordNew: tmp = g_strdup("RecordNew"); break; - default: tmp = g_strdup_printf("0x%x",flag); break; - } - printf ("entering iterate_specific(flag = %s)\n", tmp); - g_free(tmp); - } -#endif - g_return_val_if_fail(local!=NULL,-1); - - /* iterate until a record meets the criteria */ - while(gnome_pilot_conduit_standard_abs_iterate(conduit,(LocalRecord**)local)) { - if((*local)==NULL) break; -#if SUPPORT_ARCHIVING - if(archived && ((*local)->local.archived==archived)) break; -#endif - if(((*local)->local.attr == flag)) break; - } - - return (*local)==NULL?0:1; -} - -/* -** actually remove the records flagged as deleted from the local -** store. -** -** XXX return value isn't checked by gnome-pilot source. -*/ -static gint -purge (GnomePilotConduitStandardAbs *conduit, - AddressbookConduitContext *ctxt) -{ - GList *it; - gint retval = 0; - - for (it=ctxt->cards; it;) { - guint32 current_status; - - gtk_object_get (GTK_OBJECT (it->data), "pilot_status", - ¤t_status, NULL); - - if (current_status == E_CARD_PILOT_STATUS_DEL) { - EBookStatus remove_status; - - e_book_remove_card (ctxt->ebook, it->data, status_cb, &remove_status); - gtk_main(); /* enter sub loop */ - - if (remove_status == E_BOOK_STATUS_SUCCESS) { - GList *l = it; - it = g_list_next (it); - gtk_object_unref (GTK_OBJECT (it->data)); - ctxt->cards = g_list_remove_link(ctxt->cards, l); - g_list_free_1 (l); - } - else { - retval = -1; - it = g_list_next (it); - } - } - else - it = g_list_next (it); - } - - return retval; -} - - -/* -** sets the value of the status flag on the local record (deleted, -** nothing, modified, etc.) -** -** XXX return value not checked by gnome-pilot source. -*/ -static gint -set_status (GnomePilotConduitStandardAbs *conduit, - AddressbookLocalRecord *local, - gint status, - AddressbookConduitContext *ctxt) -{ - EBookStatus commit_status; - guint32 ecard_status; - - LOG ("entering set_status(status=%d)",status); - - g_return_val_if_fail(local!=NULL,-1); - g_assert(local->ecard!=NULL); - - local->local.attr = status; - switch(status) { - case GnomePilotRecordDeleted: - ecard_status = E_CARD_PILOT_STATUS_DEL; - break; - case GnomePilotRecordNew: - case GnomePilotRecordModified: - ecard_status = E_CARD_PILOT_STATUS_MOD; - break; - default: - ecard_status = E_CARD_PILOT_STATUS_NONE; - break; - } - - gtk_object_set (GTK_OBJECT (local->ecard), - "pilot_status", ecard_status, NULL); - - e_book_commit_card (ctxt->ebook, local->ecard, status_cb, - &commit_status); - - gtk_main (); /* enter sub loop */ - - if (commit_status != E_BOOK_STATUS_SUCCESS) { - WARN (_("Error while communicating with address server")); - } - - return 0; -} - -/* -** used when writing a record to the pilot. the id is the one -** assigned to the remote record. storing it in the local record -** makes it easier to match up local and remote records later on. -** -** this should not change the state of the local entry to modified. -** -** XXX return value not checked by gnome-pilot source. -*/ -static gint -set_pilot_id (GnomePilotConduitStandardAbs *conduit, - AddressbookLocalRecord *local, - guint32 ID, - AddressbookConduitContext *ctxt) -{ - EBookStatus commit_status; - - LOG ("entering set_pilot_id(id=%d)",ID); - - g_return_val_if_fail(local!=NULL,-1); - g_assert(local->ecard!=NULL); - - local->local.ID = ID; - - gtk_object_set (GTK_OBJECT(local->ecard), - "pilot_id", local->local.ID, NULL); - e_book_commit_card (ctxt->ebook, local->ecard, status_cb, &commit_status); - - gtk_main (); /* enter sub loop */ - - if (commit_status == E_BOOK_STATUS_SUCCESS) { - return 0; - } - else { - WARN ("set_pilot_id failed.\n"); - return -1; - } -} - -static int -get_phone_label_by_name (struct AddressAppInfo *ai, - const char *name) -{ - int i; - - for (i = 0; i < 8 /* the number of pilot address labels */; i ++) { - if (!strcmp(name, ai->phoneLabels[i])) - return i; - } - - WARN ("couldn't find pilot label '%s'.\n", name); - return 0; -} - -static int -get_phone_label_by_flag (struct AddressAppInfo *ai, - int flags) -{ - char *label_to_find; - - if (flags & E_CARD_PHONE_PREF) label_to_find = "Main"; - else if (flags & E_CARD_PHONE_WORK) label_to_find = "Work"; - else if (flags & E_CARD_PHONE_HOME) label_to_find = "Home"; - else if (flags & E_CARD_PHONE_FAX) label_to_find = "Fax"; - else if (flags & E_CARD_PHONE_PAGER) label_to_find = "Pager"; - else if (flags & E_CARD_PHONE_CELL) label_to_find = "Mobile"; - else label_to_find = "Other"; - - return get_phone_label_by_name (ai, label_to_find); -} - -/* -** used to convert between a local record and a remote record. memory -** allocated during this process should be freed in free_transmit -** below. -** -** XXX return value not checked by gnome-pilot source, but setting -** *remote to NULL triggers an error. -*/ -static gint -transmit (GnomePilotConduitStandardAbs *conduit, - AddressbookLocalRecord *local, - PilotRecord **remote, - AddressbookConduitContext *ctxt) -{ - PilotRecord *p; - ECardName *ecard_name; - EList *ecard_phones; - EList *ecard_emails; - char *ecard_org, *ecard_note, *ecard_title; - int phone_entry = entryPhone1; - - LOG ("entering transmit"); - - g_return_val_if_fail(local!=NULL,-1); - g_return_val_if_fail(remote!=NULL,-1); - g_assert(local->ecard!=NULL); - - p = g_new0(PilotRecord,1); - - p->ID = local->local.ID; - p->attr = local->local.attr; - p->archived = local->local.archived; - p->secret = local->local.secret; - - local->address = g_new0(struct Address,1); - - gtk_object_get (GTK_OBJECT (local->ecard), - "name", &ecard_name, - "org", &ecard_org, - "note", &ecard_note, - "title", &ecard_title, - "phone", &ecard_phones, - "email", &ecard_emails, - NULL); - - /* use strdup instead of g_strdup since free_transmit uses free, not g_free. */ - if (ecard_name) { - if (ecard_name->given) - local->address->entry [ entryFirstname ] = strdup (ecard_name->given); - if (ecard_name->family) - local->address->entry [ entryLastname ] = strdup (ecard_name->family); - // e_card_name_free (ecard_name); - } - - if (ecard_org) { - local->address->entry [ entryCompany ] = strdup (ecard_org); - } - if (ecard_title) { - local->address->entry [ entryTitle ] = strdup (ecard_title); - } - if (ecard_emails) { - EIterator *iterator = e_list_get_iterator (ecard_emails); - char *email; - - if ((email = (char *)e_iterator_get(iterator))) { - local->address->phoneLabel[phone_entry - entryPhone1] = - get_phone_label_by_name (&ctxt->ai, "E-mail"); - local->address->entry [ phone_entry ] = strdup (email); - - phone_entry++; - } - } - if (ecard_phones) { - int phone_entry = entryPhone1; - EIterator *iterator = e_list_get_iterator (ecard_phones); - ECardPhone *phone; - - while ((phone = (ECardPhone*)e_iterator_get(iterator))) { - - local->address->phoneLabel[phone_entry - entryPhone1] = - get_phone_label_by_flag (&ctxt->ai, phone->flags); - local->address->entry [ phone_entry ] = strdup (phone->number); - - /* only store a maximum of 5 numbers (4 if - there was an email address) */ - if (phone_entry == entryPhone5) - break; - - if (e_iterator_next (iterator) == FALSE) - break; - - phone_entry++; - } - } - - if (ecard_note) { - local->address->entry [ entryNote ] = strdup (ecard_note); - } -#if 0 - printf ("transmitting address to pilot [%s] complete=%d/%ld\n", - local->ical->summary==NULL?"NULL":local->ical->summary, - local->address->complete, local->ical->completed); -#endif - - /* Generate pilot record structure */ - p->record = g_new0(char,0xffff); - p->length = pack_Address(local->address,p->record,0xffff); - - *remote = p; - - return 0; -} - -/* -** free memory allocated in the transmit signal. -** -** XXX return value not checked. -*/ -static gint -free_transmit (GnomePilotConduitStandardAbs *conduit, - AddressbookLocalRecord *local, - PilotRecord **remote, - AddressbookConduitContext *ctxt) -{ - LOG ("entering free_transmit"); - - g_return_val_if_fail(local!=NULL,-1); - g_return_val_if_fail(remote!=NULL,-1); - - free_Address(local->address); - g_free((*remote)->record); - *remote = NULL; - return 0; -} - -/* -** used when synching. compare the local and remove record data and -** determine equality. -** -** retval is similar to strcmp: 0 for equality, anything else for -** inequality (no ordering is imposed). -*/ -static gint -compare (GnomePilotConduitStandardAbs *conduit, - AddressbookLocalRecord *local, - PilotRecord *remote, - AddressbookConduitContext *ctxt) -{ -#if 0 - /* used by the quick compare */ - PilotRecord *remoteOfLocal; - int err; - int retval; - - g_message ("entering compare"); - printf ("entering compare\n"); - - g_return_val_if_fail (local!=NULL,-1); - g_return_val_if_fail (remote!=NULL,-1); - - err = transmit(conduit,local,&remoteOfLocal,ctxt); - if (err != 0) return err; - - retval = 0; - if (remote->length == remoteOfLocal->length) { - if (memcmp(remoteOfLocal->record,remote->record,remote->length)!=0) { - g_message("compare failed on contents"); - printf ("compare failed on contents\n"); - retval = 1; - - /* debug spew */ - { - struct Address foolocal; - struct Address fooremote; - - unpack_Address (&foolocal, - remoteOfLocal->record, - remoteOfLocal->length); - unpack_Address (&fooremote, - remote->record, - remote->length); - - printf (" local:[%d %ld %d %d '%s' '%s']\n", - foolocal.indefinite, - mktime (& foolocal.due), - foolocal.priority, - foolocal.complete, - foolocal.description, - foolocal.note); - - printf ("remote:[%d %ld %d %d '%s' '%s']\n", - fooremote.indefinite, - mktime (& fooremote.due), - fooremote.priority, - fooremote.complete, - fooremote.description, - fooremote.note); - } - } - } else { - g_message("compare failed on length"); - printf("compare failed on length\n"); - retval = 1; - } - - free_transmit(conduit,local,&remoteOfLocal,ctxt); - return retval; -#endif /* 0 */ - return 0; -} - -/* -** XXX not actually called from the gnome-pilot source -*/ -static gint -compare_backup (GnomePilotConduitStandardAbs *conduit, - AddressbookLocalRecord *local, - PilotRecord *remote, - AddressbookConduitContext *ctxt) -{ - LOG ("entering compare_backup"); - - g_return_val_if_fail(local!=NULL,-1); - g_return_val_if_fail(remote!=NULL,-1); - - return -1; -} - -/* -** used when copying from the pilot. -** -** delete all records in the local database. this doesn't actually -** remove the records, merely sets their status to DELETED. -** -** return value is < 0 on error, >= 0 on success. -*/ -static gint -delete_all (GnomePilotConduitStandardAbs *conduit, - AddressbookConduitContext *ctxt) -{ - GList *it; - - for (it=ctxt->cards; it; it = g_list_next (it)) { - gtk_object_set (GTK_OBJECT (it->data), - "pilot_status", E_CARD_PILOT_STATUS_DEL, NULL); - } - - return 0; -} - -#ifdef NEED_OAF_INIT_HACK -static ORBit_MessageValidationResult -accept_all_cookies (CORBA_unsigned_long request_id, - CORBA_Principal *principal, - CORBA_char *operation) -{ - /* allow ALL cookies */ - return ORBIT_MESSAGE_ALLOW_ALL; -} -#endif - -GnomePilotConduit * -conduit_get_gpilot_conduit (guint32 pilotId) -{ - GtkObject *retval; - AddressbookConduitCfg *cfg; - AddressbookConduitContext *ctxt; - - printf ("in address's conduit_get_gpilot_conduit\n"); - -#ifdef NEED_OAF_INIT_HACK -#ifndef NO_WARNINGS -#warning "need a better way to do this" -#endif - /* we need to find wombat with oaf, so make sure oaf - is initialized here. once the desktop is converted - to oaf and gpilotd is built with oaf, this can go away */ - if (! oaf_is_initialized ()) - { - char *argv[ 1 ] = {"hi"}; - oaf_init (1, argv); - - if (bonobo_init (CORBA_OBJECT_NIL, - CORBA_OBJECT_NIL, - CORBA_OBJECT_NIL) == FALSE) - g_error (_("Could not initialize Bonobo")); - - ORBit_set_request_validation_handler (accept_all_cookies); - } -#endif - - retval = gnome_pilot_conduit_standard_abs_new ("AddressDB", - 0x61646472); - g_assert (retval != NULL); - gnome_pilot_conduit_construct(GNOME_PILOT_CONDUIT(retval),"AddressConduit"); - - conduit_load_configuration(&cfg,pilotId); - gtk_object_set_data (retval,"addressconduit_cfg",cfg); - - conduit_new_context(&ctxt,cfg); - gtk_object_set_data(GTK_OBJECT(retval),"addressconduit_context",ctxt); - - gtk_signal_connect (retval, "match_record", (GtkSignalFunc) match_record, ctxt); - gtk_signal_connect (retval, "free_match", (GtkSignalFunc) free_match, ctxt); -#ifdef SUPPORT_ARCHIVING - gtk_signal_connect (retval, "archive_local", (GtkSignalFunc) archive_local, ctxt); - gtk_signal_connect (retval, "archive_remote", (GtkSignalFunc) archive_remote, ctxt); - gtk_signal_connect (retval, "set_archived", (GtkSignalFunc) set_archived, ctxt); - gtk_signal_connect (retval, "clear_status_archive_local", (GtkSignalFunc) clear_status_archive_local, ctxt); -#endif - gtk_signal_connect (retval, "store_remote", (GtkSignalFunc) store_remote, ctxt); - gtk_signal_connect (retval, "iterate", (GtkSignalFunc) iterate, ctxt); - gtk_signal_connect (retval, "iterate_specific", (GtkSignalFunc) iterate_specific, ctxt); - gtk_signal_connect (retval, "purge", (GtkSignalFunc) purge, ctxt); - gtk_signal_connect (retval, "set_status", (GtkSignalFunc) set_status, ctxt); - gtk_signal_connect (retval, "set_pilot_id", (GtkSignalFunc) set_pilot_id, ctxt); - gtk_signal_connect (retval, "compare", (GtkSignalFunc) compare, ctxt); - gtk_signal_connect (retval, "compare_backup", (GtkSignalFunc) compare_backup, ctxt); - gtk_signal_connect (retval, "free_transmit", (GtkSignalFunc) free_transmit, ctxt); - gtk_signal_connect (retval, "delete_all", (GtkSignalFunc) delete_all, ctxt); - gtk_signal_connect (retval, "transmit", (GtkSignalFunc) transmit, ctxt); - gtk_signal_connect (retval, "pre_sync", (GtkSignalFunc) pre_sync, ctxt); - - return GNOME_PILOT_CONDUIT (retval); -} - -void -conduit_destroy_gpilot_conduit (GnomePilotConduit *conduit) -{ - AddressbookConduitCfg *cc; - AddressbookConduitContext *ctxt; - - cc = GET_CONDUITCFG(conduit); - ctxt = GET_CONDUITCONTEXT(conduit); - - if (ctxt->ebook != NULL) { - gtk_object_unref (GTK_OBJECT (ctxt->ebook)); - } - - conduit_destroy_configuration (&cc); - - conduit_destroy_context (&ctxt); - - gtk_object_destroy (GTK_OBJECT (conduit)); -} diff --git a/addressbook/conduit/address-conduit.h b/addressbook/conduit/address-conduit.h deleted file mode 100644 index 9858504fd7..0000000000 --- a/addressbook/conduit/address-conduit.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -#ifndef __ADDRESS_CONDUIT_H__ -#define __ADDRESS_CONDUIT_H__ - -#include <sys/types.h> -#include <fcntl.h> -#include <unistd.h> -#include <gnome.h> -#include <pi-address.h> -#include <gpilotd/gnome-pilot-conduit.h> -#include <gpilotd/gnome-pilot-conduit-standard-abs.h> -#include "ebook/e-card.h" -#include "ebook/e-card-simple.h" -#include "ebook/e-book.h" -#include "ebook/e-book-view.h" - -#ifdef USING_OAF -#include <liboaf/liboaf.h> -#else -#include <libgnorba/gnorba.h> -#endif - - -/* This is the local record structure for the GnomeCal conduit. */ -typedef struct _AddressbookLocalRecord AddressbookLocalRecord; -struct _AddressbookLocalRecord { - /* The stuff from gnome-pilot-conduit-standard-abs.h - Must be first in the structure, or instances of this - structure cannot be used by gnome-pilot-conduit-standard-abs. - */ - LocalRecord local; - /* The corresponding Evolution addressbook object. */ - ECard *ecard; - /* pilot-link address structure, used for implementing Transmit. */ - struct Address *address; -}; -#define ADDRESSBOOK_LOCALRECORD(s) ((AddressbookLocalRecord*)(s)) - -/* This is the configuration of the GnomeCal conduit. */ -typedef struct _AddressbookConduitCfg AddressbookConduitCfg; -struct _AddressbookConduitCfg { - gboolean open_secret; - guint32 pilotId; - GnomePilotConduitSyncType sync_type; /* only used by capplet */ -}; -#define GET_CONDUITCFG(c) ((AddressbookConduitCfg*)gtk_object_get_data(GTK_OBJECT(c),"addressconduit_cfg")) - -/* This is the context for all the Addressbook conduit methods. */ -typedef struct _AddressbookConduitContext AddressbookConduitContext; -struct _AddressbookConduitContext { - struct AddressAppInfo ai; - AddressbookConduitCfg *cfg; - EBook *ebook; - // ECardCursor *cursor; - GList *cards; - /* CalClient *client;*/ - CORBA_Environment ev; - CORBA_ORB orb; - gboolean address_load_tried; - gboolean address_load_success; - - char *address_file; -}; -#define GET_CONDUITCONTEXT(c) ((AddressbookConduitContext*)gtk_object_get_data(GTK_OBJECT(c),"addressconduit_context")) - - -/* Given a GCalConduitCfg*, allocates the structure and - loads the configuration data for the given pilot. - this is defined in the header file because it is used by - both address-conduit and address-conduit-control-applet, - and we don't want to export any symbols we don't have to. */ -static void -conduit_load_configuration(AddressbookConduitCfg **c, - guint32 pilotId) -{ - gchar prefix[256]; - g_snprintf(prefix,255,"/gnome-pilot.d/address-conduit/Pilot_%u/",pilotId); - - *c = g_new0(AddressbookConduitCfg,1); - g_assert(*c != NULL); - gnome_config_push_prefix(prefix); - (*c)->open_secret = gnome_config_get_bool("open_secret=FALSE"); - (*c)->sync_type = GnomePilotConduitSyncTypeCustom; /* set in capplets main */ - gnome_config_pop_prefix(); - - (*c)->pilotId = pilotId; -} - - -#endif __ADDRESS_CONDUIT_H__ diff --git a/addressbook/conduit/address.conduit.in b/addressbook/conduit/address.conduit.in deleted file mode 100644 index 3a0416fac8..0000000000 --- a/addressbook/conduit/address.conduit.in +++ /dev/null @@ -1,8 +0,0 @@ -<gnome-pilot-conduit version="1.0"> -<conduit id="address_conduit" type="shlib" location="@prefix@/lib/gnome-pilot/conduits/libaddress_conduit.so"/> -<name value="address"/> -<conduit-attribute name="description" value="Synchronizes with Evolution"/> -<conduit-attribute name="default-synctype" value="synchronize"/> -<conduit-attribute name="icon" value="@prefix@/share/pixmaps/gnome-calendar-conduit.png"/> -<conduit-attribute name="settings" value="TRUE"/> -</gnome-pilot-conduit> diff --git a/addressbook/contact-editor/.cvsignore b/addressbook/contact-editor/.cvsignore deleted file mode 100644 index 6fd0b5075c..0000000000 --- a/addressbook/contact-editor/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -*.lo -*.la -contact-editor-test diff --git a/addressbook/contact-editor/Makefile.am b/addressbook/contact-editor/Makefile.am deleted file mode 100644 index f51a0109ac..0000000000 --- a/addressbook/contact-editor/Makefile.am +++ /dev/null @@ -1,65 +0,0 @@ -CPPFLAGS = \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DDATADIR=\""$(datadir)"\" \ - -DEVOLUTIONDIR=\""$(evolutiondir)"\" - -INCLUDES = \ - $(BONOBO_GNOME_CFLAGS) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/addressbook/ \ - -I$(top_srcdir)/addressbook/backend \ - -I$(top_srcdir)/widgets/e-table \ - -DG_LOG_DOMAIN=\"contact-editor\" - -noinst_LIBRARIES = \ - libecontacteditor.a - -libecontacteditor_a_SOURCES = \ - e-contact-editor-categories.c \ - e-contact-editor-categories.h \ - e-contact-editor-fullname.c \ - e-contact-editor-fullname.h \ - e-contact-editor.c \ - e-contact-editor.h \ - e-contact-save-as.c \ - e-contact-save-as.h - -noinst_PROGRAMS = \ - contact-editor-test - -contact_editor_test_SOURCES = \ - test-editor.c - -contact_editor_test_LDADD = \ - libecontacteditor.a \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/addressbook/printing/libecontactprint.a \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/addressbook/ename/libename.la \ - $(top_builddir)/libversit/libversit.la \ - $(GNOMEGNORBA_LIBS) \ - $(BONOBO_GNOME_LIBS) \ - $(top_builddir)/widgets/e-table/libetable.a \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/widgets/e-text/libetext.a \ - $(EXTRA_GNOME_LIBS) - -evolutiondir = $(datadir)/evolution - -evolution_DATA = arrow.png - -gladedir = $(datadir)/evolution/glade - -glade_DATA = \ - contact-editor.glade \ - fullname.glade \ - categories.glade \ - e-contact-editor-confirm-delete.glade - -EXTRA_DIST = $(evolution_DATA) \ - $(glade_DATA) \ - e-contact-editor-strings.h \ - fullname-strings.h \ - categories-strings.h \ - e-contact-editor-confirm-delete.glade.h diff --git a/addressbook/contact-editor/arrow.png b/addressbook/contact-editor/arrow.png Binary files differdeleted file mode 100644 index b102356c78..0000000000 --- a/addressbook/contact-editor/arrow.png +++ /dev/null diff --git a/addressbook/contact-editor/briefcase.png b/addressbook/contact-editor/briefcase.png Binary files differdeleted file mode 100644 index dd59b8fd39..0000000000 --- a/addressbook/contact-editor/briefcase.png +++ /dev/null diff --git a/addressbook/contact-editor/categories-strings.h b/addressbook/contact-editor/categories-strings.h deleted file mode 100644 index 813018a00e..0000000000 --- a/addressbook/contact-editor/categories-strings.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_("categories"); -gchar *s = N_("Item(s) belong to these categories:"); -gchar *s = N_("Available Categories:"); diff --git a/addressbook/contact-editor/categories.glade b/addressbook/contact-editor/categories.glade deleted file mode 100644 index bf78008940..0000000000 --- a/addressbook/contact-editor/categories.glade +++ /dev/null @@ -1,190 +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> - <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>categories-strings.h</translatable_strings_file> -</project> - -<widget> - <class>GnomeDialog</class> - <name>categories</name> - <cxx_use_heap>True</cxx_use_heap> - <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> - <cxx_use_heap>True</cxx_use_heap> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>table-categories</name> - <cxx_use_heap>True</cxx_use_heap> - <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>GtkAccelLabel</class> - <name>accellabel1</name> - <cxx_use_heap>True</cxx_use_heap> - <label>Item(s) belong to these categories:</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>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel2</name> - <cxx_use_heap>True</cxx_use_heap> - <label>Available Categories:</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>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-categories</name> - <cxx_use_heap>True</cxx_use_heap> - <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> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>dialog-action_area1</name> - <cxx_use_heap>True</cxx_use_heap> - <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> - <cxx_use_heap>True</cxx_use_heap> - <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> - <cxx_use_heap>True</cxx_use_heap> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/addressbook/contact-editor/contact-editor.glade b/addressbook/contact-editor/contact-editor.glade deleted file mode 100644 index 7c328a72ce..0000000000 --- a/addressbook/contact-editor/contact-editor.glade +++ /dev/null @@ -1,2332 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>Contact-editor</name> - <program_name>contact-editor</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> - <backup_source_files>False</backup_source_files> - <output_translatable_strings>True</output_translatable_strings> - <translatable_strings_file>e-contact-editor-strings.h</translatable_strings_file> -</project> - -<widget> - <class>GnomeDialog</class> - <name>dialog2</name> - <border_width>2</border_width> - <visible>False</visible> - <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-vbox2</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>dialog-action_area2</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>8</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - <pack>GTK_PACK_END</pack> - </child> - - <widget> - <class>GtkButton</class> - <name>button28</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>button29</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>button30</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>table2</name> - <rows>2</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>0</row_spacing> - <column_spacing>2</column_spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkEntry</class> - <name>entry2</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>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>GtkVBox</class> - <name>vbox1</name> - <homogeneous>False</homogeneous> - <spacing>2</spacing> - <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>True</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkButton</class> - <name>button31</name> - <border_width>2</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>button32</name> - <border_width>2</border_width> - <can_focus>True</can_focus> - <label>_Delete</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow1</name> - <height>200</height> - <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> - <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>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>True</show_titles> - <shadow_type>GTK_SHADOW_NONE</shadow_type> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>label20</name> - <label>Phone Types</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> - -<widget> - <class>GnomeDialog</class> - <name>dialog-add-phone</name> - <visible>False</visible> - <title>New phone type</title> - <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>vbox2</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>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> - <has_default>True</has_default> - <can_focus>True</can_focus> - <label>Add</label> - <stock_pixmap>GNOME_STOCK_PIXMAP_ADD</stock_pixmap> - </widget> - - <widget> - <class>GtkButton</class> - <name>button44</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>frame-add-phone</name> - <border_width>4</border_width> - <label>New phone type</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>GtkAlignment</class> - <name>alignment9</name> - <border_width>9</border_width> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>1</yscale> - - <widget> - <class>GtkEntry</class> - <name>entry-add-phone</name> - <can_focus>True</can_focus> - <has_focus>True</has_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - </widget> - </widget> - </widget> - </widget> -</widget> - -<widget> - <class>GnomeApp</class> - <name>contact editor</name> - <title>Contact Editor</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> - <enable_layout_config>True</enable_layout_config> - - <widget> - <class>GnomeDock</class> - <child_name>GnomeApp:dock</child_name> - <name>dock1</name> - <allow_floating>True</allow_floating> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkNotebook</class> - <child_name>GnomeDock:contents</child_name> - <name>notebook-contact-editor</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> - - <widget> - <class>GtkTable</class> - <name>table-contact-editor-general</name> - <border_width>7</border_width> - <rows>14</rows> - <columns>8</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - - <widget> - <class>GtkEntry</class> - <name>entry-phone1</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>7</left_attach> - <right_attach>8</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>entry-phone2</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>7</left_attach> - <right_attach>8</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-phone3</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>7</left_attach> - <right_attach>8</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-phone4</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>7</left_attach> - <right_attach>8</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>GtkText</class> - <name>text-address</name> - <width>1</width> - <height>1</height> - <can_focus>True</can_focus> - <editable>True</editable> - <text></text> - <child> - <left_attach>7</left_attach> - <right_attach>8</right_attach> - <top_attach>5</top_attach> - <bottom_attach>9</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-fullname</name> - <can_focus>True</can_focus> - <label>_Full Name...</label> - <child> - <left_attach>1</left_attach> - <right_attach>3</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel-fileas</name> - <label>File As:</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>3</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel-web</name> - <label>Web page 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>3</right_attach> - <top_attach>8</top_attach> - <bottom_attach>9</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>1</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>1</yscale> - <child> - <left_attach>2</left_attach> - <right_attach>3</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>True</yfill> - </child> - - <widget> - <class>GtkButton</class> - <name>button-email1</name> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment5</name> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <left_attach>6</left_attach> - <right_attach>7</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>GtkButton</class> - <name>button-phone4</name> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment7</name> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <left_attach>6</left_attach> - <right_attach>7</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkButton</class> - <name>button-phone2</name> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment8</name> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <left_attach>6</left_attach> - <right_attach>7</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkButton</class> - <name>button-phone1</name> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GtkHSeparator</class> - <name>hseparator4</name> - <child> - <left_attach>4</left_attach> - <right_attach>8</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> - <xpad>0</xpad> - <ypad>2</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment6</name> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <left_attach>6</left_attach> - <right_attach>7</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-phone3</name> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-fullname</name> - <has_default>True</has_default> - <can_focus>True</can_focus> - <has_focus>True</has_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>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>GtkEntry</class> - <name>entry-jobtitle</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>4</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-company</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>4</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-email1</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>4</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> - - <widget> - <class>GtkEntry</class> - <name>entry-web</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>4</right_attach> - <top_attach>8</top_attach> - <bottom_attach>9</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>GtkHSeparator</class> - <name>hseparator5</name> - <child> - <left_attach>0</left_attach> - <right_attach>4</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> - <xpad>0</xpad> - <ypad>2</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkCombo</class> - <name>combo-file-as</name> - <value_in_list>False</value_in_list> - <ok_if_empty>True</ok_if_empty> - <case_sensitive>True</case_sensitive> - <use_arrows>True</use_arrows> - <use_arrows_always>False</use_arrows_always> - <items></items> - <child> - <left_attach>3</left_attach> - <right_attach>4</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - - <widget> - <class>GtkEntry</class> - <child_name>GtkCombo:entry</child_name> - <name>entry-file-as</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>GtkHSeparator</class> - <name>hseparator6</name> - <child> - <left_attach>0</left_attach> - <right_attach>4</right_attach> - <top_attach>7</top_attach> - <bottom_attach>8</bottom_attach> - <xpad>0</xpad> - <ypad>2</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment10</name> - <xalign>0.5</xalign> - <yalign>0</yalign> - <xscale>1</xscale> - <yscale>1</yscale> - <child> - <left_attach>3</left_attach> - <right_attach>4</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>True</xshrink> - <yshrink>True</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkCheckButton</class> - <name>checkbutton-htmlmail</name> - <visible>False</visible> - <label>Wants to receive _HTML mail</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment4</name> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <left_attach>6</left_attach> - <right_attach>7</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>True</yfill> - </child> - - <widget> - <class>GtkButton</class> - <name>button-address</name> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <name>address-label</name> - <label>Address:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>text-address</focus_target> - <child> - <left_attach>5</left_attach> - <right_attach>7</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>True</yfill> - </child> - </widget> - - <widget> - <class>GtkEventBox</class> - <name>eventbox1</name> - <child> - <left_attach>5</left_attach> - <right_attach>6</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label-phone1</name> - <label>_Business</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - - <widget> - <class>GtkEventBox</class> - <name>eventbox2</name> - <child> - <left_attach>5</left_attach> - <right_attach>6</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label-phone2</name> - <label>_Home</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-phone2</focus_target> - </widget> - </widget> - - <widget> - <class>GtkEventBox</class> - <name>eventbox3</name> - <child> - <left_attach>5</left_attach> - <right_attach>6</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>GtkLabel</class> - <name>label-phone3</name> - <label>Business _Fax</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-phone3</focus_target> - </widget> - </widget> - - <widget> - <class>GtkEventBox</class> - <name>eventbox4</name> - <child> - <left_attach>5</left_attach> - <right_attach>6</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>GtkLabel</class> - <name>label-phone4</name> - <label>_Mobile</label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>entry-phone4</focus_target> - </widget> - </widget> - - <widget> - <class>GtkEventBox</class> - <name>eventbox5</name> - <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>True</yfill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label-email1</name> - <label>Primary Email</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-email1</focus_target> - </widget> - </widget> - - <widget> - <class>GtkEventBox</class> - <name>eventbox-business</name> - <child> - <left_attach>5</left_attach> - <right_attach>6</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>True</yfill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label-address</name> - <label>B_usiness</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>text-address</focus_target> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment2</name> - <xalign>0</xalign> - <yalign>0</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <left_attach>7</left_attach> - <right_attach>8</right_attach> - <top_attach>9</top_attach> - <bottom_attach>10</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>GtkCheckButton</class> - <name>checkbutton-mailingaddress</name> - <visible>False</visible> - <label>_This is the mailing address</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - </widget> - </widget> - - <widget> - <class>GtkHSeparator</class> - <name>hseparator9</name> - <child> - <left_attach>0</left_attach> - <right_attach>4</right_attach> - <top_attach>11</top_attach> - <bottom_attach>12</bottom_attach> - <xpad>0</xpad> - <ypad>2</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkHSeparator</class> - <name>hseparator10</name> - <child> - <left_attach>4</left_attach> - <right_attach>8</right_attach> - <top_attach>11</top_attach> - <bottom_attach>12</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>GtkAlignment</class> - <name>alignment-contacts</name> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>0</yscale> - <child> - <left_attach>1</left_attach> - <right_attach>3</right_attach> - <top_attach>12</top_attach> - <bottom_attach>13</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-contacts</name> - <can_focus>True</can_focus> - <label>C_ontacts...</label> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment15</name> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>0</yscale> - <child> - <left_attach>7</left_attach> - <right_attach>8</right_attach> - <top_attach>12</top_attach> - <bottom_attach>13</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>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> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment14</name> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>0</yscale> - <child> - <left_attach>3</left_attach> - <right_attach>4</right_attach> - <top_attach>12</top_attach> - <bottom_attach>13</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>GtkEntry</class> - <name>entry-contacts</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>GtkAlignment</class> - <name>alignment16</name> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>0</yscale> - <child> - <left_attach>5</left_attach> - <right_attach>7</right_attach> - <top_attach>12</top_attach> - <bottom_attach>13</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-categories</name> - <can_focus>True</can_focus> - <label>Ca_tegories...</label> - </widget> - </widget> - - <widget> - <class>GtkEventBox</class> - <name>eventbox7</name> - <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>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label34</name> - <label>_Job title:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>entry-jobtitle</focus_target> - </widget> - </widget> - - <widget> - <class>Custom</class> - <name>custom1</name> - <creation_function>e_create_image_widget</creation_function> - <string1>malehead.png</string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 18 May 2000 12:19:47 GMT</last_modification_time> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>custom2</name> - <creation_function>e_create_image_widget</creation_function> - <string1>cellphone.png</string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 18 May 2000 12:20:02 GMT</last_modification_time> - <child> - <left_attach>4</left_attach> - <right_attach>5</right_attach> - <top_attach>0</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>custom3</name> - <creation_function>e_create_image_widget</creation_function> - <string1>envelope.png</string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 18 May 2000 12:19:51 GMT</last_modification_time> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>5</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>True</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>custom4</name> - <creation_function>e_create_image_widget</creation_function> - <string1>house.png</string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 18 May 2000 12:20:06 GMT</last_modification_time> - <child> - <left_attach>4</left_attach> - <right_attach>5</right_attach> - <top_attach>5</top_attach> - <bottom_attach>10</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>Custom</class> - <name>custom5</name> - <creation_function>e_create_image_widget</creation_function> - <string1>evolution-contacts.png</string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 18 May 2000 12:19:59 GMT</last_modification_time> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>12</top_attach> - <bottom_attach>14</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>Custom</class> - <name>custom6</name> - <creation_function>e_create_image_widget</creation_function> - <string1>briefcase.png</string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 18 May 2000 12:20:09 GMT</last_modification_time> - <child> - <left_attach>4</left_attach> - <right_attach>5</right_attach> - <top_attach>12</top_attach> - <bottom_attach>14</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>Custom</class> - <name>custom10</name> - <creation_function>e_create_image_widget</creation_function> - <string1>globe.png</string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 18 May 2000 12:19:56 GMT</last_modification_time> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>8</top_attach> - <bottom_attach>10</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label35</name> - <label>_Company:</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-company</focus_target> - <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>True</xfill> - <yfill>True</yfill> - </child> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>label15</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>GtkTable</class> - <name>table-contact-editor-details</name> - <border_width>7</border_width> - <rows>9</rows> - <columns>6</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - - <widget> - <class>GtkLabel</class> - <name>label21</name> - <label>_Department:</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-department</focus_target> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label22</name> - <label>_Office:</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-office</focus_target> - <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>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label23</name> - <label>_Profession:</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-profession</focus_target> - <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>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label24</name> - <label>_Nickname:</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-nickname</focus_target> - <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>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label25</name> - <label>_Spouse:</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-spouse</focus_target> - <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>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label31</name> - <label>_Birthday:</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>3</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>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label30</name> - <label>_Assistant's name:</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-assistant</focus_target> - <child> - <left_attach>3</left_attach> - <right_attach>4</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label29</name> - <label>_Manager's Name:</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-manager</focus_target> - <child> - <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>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label32</name> - <label>Anni_versary:</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>3</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>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-spouse</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>2</left_attach> - <right_attach>3</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> - - <widget> - <class>GtkEntry</class> - <name>entry-department</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>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>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-office</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>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>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-profession</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>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>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-nickname</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>2</left_attach> - <right_attach>3</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>GnomeDateEdit</class> - <name>dateedit-anniversary</name> - <show_time>False</show_time> - <use_24_format>False</use_24_format> - <week_start_monday>False</week_start_monday> - <lower_hour>7</lower_hour> - <upper_hour>19</upper_hour> - <child> - <left_attach>4</left_attach> - <right_attach>6</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> - - <widget> - <class>GnomeDateEdit</class> - <name>dateedit-birthday</name> - <show_time>False</show_time> - <use_24_format>False</use_24_format> - <week_start_monday>False</week_start_monday> - <lower_hour>7</lower_hour> - <upper_hour>19</upper_hour> - <child> - <left_attach>4</left_attach> - <right_attach>6</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>GtkEntry</class> - <name>entry-assistant</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>6</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-manager</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>6</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>GtkHSeparator</class> - <name>hseparator7</name> - <child> - <left_attach>0</left_attach> - <right_attach>6</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>2</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label33</name> - <label>No_tes:</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>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>True</yfill> - </child> - </widget> - - <widget> - <class>GtkHSeparator</class> - <name>hseparator8</name> - <child> - <left_attach>0</left_attach> - <right_attach>6</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>True</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>custom7</name> - <creation_function>e_create_image_widget</creation_function> - <string1>briefcase.png</string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 18 May 2000 12:20:13 GMT</last_modification_time> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>custom8</name> - <creation_function>e_create_image_widget</creation_function> - <string1>malehead.png</string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 18 May 2000 12:20:16 GMT</last_modification_time> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>4</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>True</yfill> - </child> - </widget> - - <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> - <left_attach>1</left_attach> - <right_attach>6</right_attach> - <top_attach>8</top_attach> - <bottom_attach>9</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>GtkText</class> - <name>text-comments</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text></text> - </widget> - </widget> - - <widget> - <class>Custom</class> - <name>custom9</name> - <creation_function>e_create_image_widget</creation_function> - <string1>globe.png</string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 18 May 2000 12:20:19 GMT</last_modification_time> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>7</top_attach> - <bottom_attach>9</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>label16</name> - <label>Details</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - </widget> - - <widget> - <class>GnomeAppBar</class> - <child_name>GnomeApp:appbar</child_name> - <name>appbar1</name> - <has_progress>True</has_progress> - <has_status>True</has_status> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> -</widget> - -</GTK-Interface> diff --git a/addressbook/contact-editor/e-contact-editor-categories.c b/addressbook/contact-editor/e-contact-editor-categories.c deleted file mode 100644 index 9251a86948..0000000000 --- a/addressbook/contact-editor/e-contact-editor-categories.c +++ /dev/null @@ -1,470 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-editor-categories.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 <e-contact-editor-categories.h> -#include <e-table-scrolled.h> -#include <e-table.h> -#include <e-table-simple.h> -#include <e-cell-text.h> -#include <e-cell-checkbox.h> - -static void e_contact_editor_categories_init (EContactEditorCategories *card); -static void e_contact_editor_categories_class_init (EContactEditorCategoriesClass *klass); -static void e_contact_editor_categories_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_contact_editor_categories_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_contact_editor_categories_destroy (GtkObject *object); -static int e_contact_editor_categories_col_count (ETableModel *etc, gpointer data); -static int e_contact_editor_categories_row_count (ETableModel *etc, gpointer data); -static void *e_contact_editor_categories_value_at (ETableModel *etc, int col, int row, gpointer data); -static void e_contact_editor_categories_set_value_at (ETableModel *etc, int col, int row, const void *val, gpointer data); -static gboolean e_contact_editor_categories_is_cell_editable (ETableModel *etc, int col, int row, gpointer data); -static void *e_contact_editor_categories_duplicate_value (ETableModel *etc, int col, const void *value, gpointer data); -static void e_contact_editor_categories_free_value (ETableModel *etc, int col, void *value, gpointer data); -static void *e_contact_editor_categories_initialize_value (ETableModel *etc, int col, gpointer data); -static gboolean e_contact_editor_categories_value_is_empty (ETableModel *etc, int col, const void *value, gpointer data); -static char * e_contact_editor_categories_value_to_string (ETableModel *etc, int col, const void *value, gpointer data); - -static GnomeDialogClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0, - ARG_CATEGORIES -}; - -GtkType -e_contact_editor_categories_get_type (void) -{ - static GtkType contact_editor_categories_type = 0; - - if (!contact_editor_categories_type) - { - static const GtkTypeInfo contact_editor_categories_info = - { - "EContactEditorCategories", - sizeof (EContactEditorCategories), - sizeof (EContactEditorCategoriesClass), - (GtkClassInitFunc) e_contact_editor_categories_class_init, - (GtkObjectInitFunc) e_contact_editor_categories_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - contact_editor_categories_type = gtk_type_unique (gnome_dialog_get_type (), &contact_editor_categories_info); - } - - return contact_editor_categories_type; -} - -static void -e_contact_editor_categories_class_init (EContactEditorCategoriesClass *klass) -{ - GtkObjectClass *object_class; - GnomeDialogClass *dialog_class; - - object_class = (GtkObjectClass*) klass; - dialog_class = (GnomeDialogClass *) klass; - - parent_class = gtk_type_class (gnome_dialog_get_type ()); - - gtk_object_add_arg_type ("EContactEditorCategories::categories", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_CATEGORIES); - - object_class->set_arg = e_contact_editor_categories_set_arg; - object_class->get_arg = e_contact_editor_categories_get_arg; - object_class->destroy = e_contact_editor_categories_destroy; -} - -gchar *builtin_categories[] = { - "Business", - "Competition", - "Favorites", - "Gifts", - "Goals/Objectives", - "Holiday", - "Holiday Cards", - "Hot Contacts", - "Ideas", - "International", - "Key Customer", - "Miscellaneous", - "Personal", - "Phone Calls", - "Status", - "Strategies", - "Suppliers", - "Time & Expenses", - "VIP", - "Waiting", -}; - -#define BUILTIN_CATEGORY_COUNT (sizeof(builtin_categories) / sizeof(builtin_categories[0])) - -static void -add_list_unique(EContactEditorCategories *categories, char *string) -{ - int k; - char *temp = e_strdup_strip(string); - char **list = categories->category_list; - - if (!*temp) { - g_free(temp); - return; - } - for (k = 0; k < categories->list_length; k++) { - if (!strcmp(list[k], temp)) { - categories->selected_list[k] = TRUE; - break; - } - } - if (k == categories->list_length) { - categories->selected_list[categories->list_length] = TRUE; - list[categories->list_length++] = temp; - } else { - g_free(temp); - } -} - -static void -do_parse_categories(EContactEditorCategories *categories) -{ - char *str = categories->categories; - int length = strlen(str); - char *copy = g_new(char, length + 1); - int i, j; - char **list; - int count = 1; - - e_table_model_pre_change(categories->model); - - for (i = 0; i < categories->list_length; i++) - g_free(categories->category_list[i]); - g_free(categories->category_list); - g_free(categories->selected_list); - - for (i = 0; str[i]; i++) { - switch (str[i]) { - case '\\': - i++; - if (!str[i]) - i--; - break; - case ',': - count ++; - break; - } - } - list = g_new(char *, count + 1 + BUILTIN_CATEGORY_COUNT); - categories->category_list = list; - - categories->selected_list = g_new(gboolean, count + 1 + BUILTIN_CATEGORY_COUNT); - - for (count = 0; count < BUILTIN_CATEGORY_COUNT; count++) { - list[count] = g_strdup(builtin_categories[count]); - categories->selected_list[count] = 0; - } - - categories->list_length = count; - - for (i = 0, j = 0; str[i]; i++, j++) { - switch (str[i]) { - case '\\': - i++; - if (str[i]) { - copy[j] = str[i]; - } else - i--; - break; - case ',': - copy[j] = 0; - add_list_unique(categories, copy); - j = -1; - break; - default: - copy[j] = str[i]; - break; - } - } - copy[j] = 0; - add_list_unique(categories, copy); - g_free(copy); - e_table_model_changed(categories->model); -} - -static void -e_contact_editor_categories_entry_change (GtkWidget *entry, - EContactEditorCategories *categories) -{ - g_free(categories->categories); - categories->categories = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry))); - do_parse_categories(categories); -} - - -#define INITIAL_SPEC "<ETableSpecification no-header=\"1\"> \ - <columns-shown> \ - <column> 0 </column> \ - <column> 1 </column> \ - </columns-shown> \ - <grouping> <leaf column=\"1\" ascending=\"1\"/> </grouping> \ -</ETableSpecification>" - -static void -e_contact_editor_categories_init (EContactEditorCategories *categories) -{ - GladeXML *gui; - GtkWidget *table; - ECell *cell_left_just; - ECell *cell_checkbox; - ETableHeader *header; - ETableCol *col; - GtkWidget *e_table; - - categories->list_length = 0; - categories->category_list = NULL; - categories->selected_list = NULL; - categories->categories = NULL; - - gnome_dialog_append_button ( GNOME_DIALOG(categories), - GNOME_STOCK_BUTTON_OK); - - gnome_dialog_append_button ( GNOME_DIALOG(categories), - GNOME_STOCK_BUTTON_CANCEL); - - gtk_window_set_policy(GTK_WINDOW(categories), FALSE, TRUE, FALSE); - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/categories.glade", NULL); - categories->gui = gui; - - table = glade_xml_get_widget(gui, "table-categories"); - gtk_widget_ref(table); - gtk_container_remove(GTK_CONTAINER(table->parent), table); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (categories)->vbox), table, TRUE, TRUE, 0); - gtk_widget_unref(table); - - categories->entry = glade_xml_get_widget(gui, "entry-categories"); - - gtk_signal_connect(GTK_OBJECT(categories->entry), "changed", - GTK_SIGNAL_FUNC(e_contact_editor_categories_entry_change), categories); - - categories->model = e_table_simple_new(e_contact_editor_categories_col_count, - e_contact_editor_categories_row_count, - e_contact_editor_categories_value_at, - e_contact_editor_categories_set_value_at, - e_contact_editor_categories_is_cell_editable, - e_contact_editor_categories_duplicate_value, - e_contact_editor_categories_free_value, - e_contact_editor_categories_initialize_value, - e_contact_editor_categories_value_is_empty, - e_contact_editor_categories_value_to_string, - categories); - - header = e_table_header_new(); - - cell_checkbox = e_cell_checkbox_new(); - col = e_table_col_new (0, "", - 0, 20, cell_checkbox, - g_int_compare, TRUE); - e_table_header_add_column (header, col, 0); - - cell_left_just = e_cell_text_new (categories->model, NULL, GTK_JUSTIFY_LEFT); - col = e_table_col_new (1, "Category", - 1.0, 20, cell_left_just, - g_str_compare, TRUE); - e_table_header_add_column (header, col, 1); - - e_table = e_table_scrolled_new (header, categories->model, INITIAL_SPEC); - - gtk_object_sink(GTK_OBJECT(categories->model)); - - gtk_widget_show(e_table); - - gtk_table_attach_defaults(GTK_TABLE(table), - e_table, - 0, 1, - 3, 4); -} - -void -e_contact_editor_categories_destroy (GtkObject *object) -{ - EContactEditorCategories *categories = E_CONTACT_EDITOR_CATEGORIES(object); - int i; - - if (categories->gui) - gtk_object_unref(GTK_OBJECT(categories->gui)); - - g_free(categories->categories); - for (i = 0; i < categories->list_length; i++) - g_free(categories->category_list[i]); - g_free(categories->category_list); - g_free(categories->selected_list); -} - -GtkWidget* -e_contact_editor_categories_new (char *categories) -{ - GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_categories_get_type ())); - gtk_object_set (GTK_OBJECT(widget), - "categories", categories, - NULL); - return widget; -} - -static void -e_contact_editor_categories_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - EContactEditorCategories *e_contact_editor_categories; - - e_contact_editor_categories = E_CONTACT_EDITOR_CATEGORIES (o); - - switch (arg_id){ - case ARG_CATEGORIES: - gtk_entry_set_text(GTK_ENTRY(e_contact_editor_categories->entry), GTK_VALUE_STRING (*arg)); - break; - } -} - -static void -e_contact_editor_categories_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EContactEditorCategories *e_contact_editor_categories; - - e_contact_editor_categories = E_CONTACT_EDITOR_CATEGORIES (object); - - switch (arg_id) { - case ARG_CATEGORIES: - GTK_VALUE_STRING (*arg) = g_strdup(e_contact_editor_categories->categories); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -/* This function returns the number of columns in our ETableModel. */ -static int -e_contact_editor_categories_col_count (ETableModel *etc, gpointer data) -{ - return 2; -} - -/* This function returns the number of rows in our ETableModel. */ -static int -e_contact_editor_categories_row_count (ETableModel *etc, gpointer data) -{ - EContactEditorCategories *categories = E_CONTACT_EDITOR_CATEGORIES(data); - return categories->list_length; -} - -/* This function returns the value at a particular point in our ETableModel. */ -static void * -e_contact_editor_categories_value_at (ETableModel *etc, int col, int row, gpointer data) -{ - EContactEditorCategories *categories = E_CONTACT_EDITOR_CATEGORIES(data); - if (col == 0) - return (void *) categories->selected_list[row]; - else - return categories->category_list[row]; -} - -/* This function sets the value at a particular point in our ETableModel. */ -static void -e_contact_editor_categories_set_value_at (ETableModel *etc, int col, int row, const void *val, gpointer data) -{ - EContactEditorCategories *categories = E_CONTACT_EDITOR_CATEGORIES(data); - if ( col == 0 ) { - char **strs; - int i, j; - char *string; - categories->selected_list[row] = (gboolean) val; - strs = g_new(char *, categories->list_length + 1); - for (i = 0, j = 0; i < categories->list_length; i++) { - if (categories->selected_list[i]) - strs[j++] = categories->category_list[i]; - } - strs[j] = 0; - string = g_strjoinv(", ", strs); - gtk_entry_set_text(GTK_ENTRY(categories->entry), string); - g_free(string); - g_free(strs); - } - if ( col == 1 ) - return; -} - -/* This function returns whether a particular cell is editable. */ -static gboolean -e_contact_editor_categories_is_cell_editable (ETableModel *etc, int col, int row, gpointer data) -{ - return col == 0; -} - -/* This function duplicates the value passed to it. */ -static void * -e_contact_editor_categories_duplicate_value (ETableModel *etc, int col, const void *value, gpointer data) -{ - if (col == 0) - return (void *)value; - else - return g_strdup(value); -} - -/* This function frees the value passed to it. */ -static void -e_contact_editor_categories_free_value (ETableModel *etc, int col, void *value, gpointer data) -{ - if (col == 0) - return; - else - g_free(value); -} - -static void * -e_contact_editor_categories_initialize_value (ETableModel *etc, int col, gpointer data) -{ - if (col == 0) - return NULL; - else - return g_strdup(""); -} - -static gboolean -e_contact_editor_categories_value_is_empty (ETableModel *etc, int col, const void *value, gpointer data) -{ - if (col == 0) - return value == NULL; - else - return !(value && *(char *)value); -} - -static char * -e_contact_editor_categories_value_to_string (ETableModel *etc, int col, const void *value, gpointer data) -{ - if (col == 0) - return g_strdup_printf("%d", (int) value); - else - return g_strdup(value); -} diff --git a/addressbook/contact-editor/e-contact-editor-categories.h b/addressbook/contact-editor/e-contact-editor-categories.h deleted file mode 100644 index 529ef71b68..0000000000 --- a/addressbook/contact-editor/e-contact-editor-categories.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-editor-categories.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_CONTACT_EDITOR_CATEGORIES_H__ -#define __E_CONTACT_EDITOR_CATEGORIES_H__ - -#include <gnome.h> -#include <glade/glade.h> -#include <ebook/e-card.h> -#include <widgets/e-table/e-table-model.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EContactEditorCategories - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * name ECardName * RW The card currently being edited. Returns a copy. - */ - -#define E_CONTACT_EDITOR_CATEGORIES_TYPE (e_contact_editor_categories_get_type ()) -#define E_CONTACT_EDITOR_CATEGORIES(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_CATEGORIES_TYPE, EContactEditorCategories)) -#define E_CONTACT_EDITOR_CATEGORIES_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_CATEGORIES_TYPE, EContactEditorCategoriesClass)) -#define E_IS_CONTACT_EDITOR_CATEGORIES(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_CATEGORIES_TYPE)) -#define E_IS_CONTACT_EDITOR_CATEGORIES_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_CATEGORIES_TYPE)) - - -typedef struct _EContactEditorCategories EContactEditorCategories; -typedef struct _EContactEditorCategoriesClass EContactEditorCategoriesClass; - -struct _EContactEditorCategories -{ - GnomeDialog parent; - - /* item specific fields */ - char *categories; - GtkWidget *entry; - ETableModel *model; - - int list_length; - char **category_list; - gboolean *selected_list; - - GladeXML *gui; -}; - -struct _EContactEditorCategoriesClass -{ - GnomeDialogClass parent_class; -}; - - -GtkWidget *e_contact_editor_categories_new(char *categories); -GtkType e_contact_editor_categories_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_CONTACT_EDITOR_CATEGORIES_H__ */ diff --git a/addressbook/contact-editor/e-contact-editor-confirm-delete.glade b/addressbook/contact-editor/e-contact-editor-confirm-delete.glade deleted file mode 100644 index 7f52321021..0000000000 --- a/addressbook/contact-editor/e-contact-editor-confirm-delete.glade +++ /dev/null @@ -1,85 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>e-contact-editor-confirm-delete</name> - <program_name>e-contact-editor-confirm-delete</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-contact-editor-confirm-delete.glade.h</translatable_strings_file> -</project> - -<widget> - <class>GnomeMessageBox</class> - <name>confirm-dialog</name> - <message_box_type>GNOME_MESSAGE_BOX_QUESTION</message_box_type> - <message>Are you sure you want -to delete this contact?</message> - <title>Delete Contact?</title> - <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>True</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>button2</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/addressbook/contact-editor/e-contact-editor-confirm-delete.glade.h b/addressbook/contact-editor/e-contact-editor-confirm-delete.glade.h deleted file mode 100644 index 7168db0a5c..0000000000 --- a/addressbook/contact-editor/e-contact-editor-confirm-delete.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_("Are you sure you want\n" - "to delete this contact?"); -gchar *s = N_("Delete Contact?"); diff --git a/addressbook/contact-editor/e-contact-editor-fullname.c b/addressbook/contact-editor/e-contact-editor-fullname.c deleted file mode 100644 index b2e598fdde..0000000000 --- a/addressbook/contact-editor/e-contact-editor-fullname.c +++ /dev/null @@ -1,214 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-editor-fullname.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 <e-contact-editor-fullname.h> - -static void e_contact_editor_fullname_init (EContactEditorFullname *card); -static void e_contact_editor_fullname_class_init (EContactEditorFullnameClass *klass); -static void e_contact_editor_fullname_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_contact_editor_fullname_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_contact_editor_fullname_destroy (GtkObject *object); - -static void fill_in_info(EContactEditorFullname *editor); -static void extract_info(EContactEditorFullname *editor); - -static GnomeDialogClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0, - ARG_NAME -}; - -GtkType -e_contact_editor_fullname_get_type (void) -{ - static GtkType contact_editor_fullname_type = 0; - - if (!contact_editor_fullname_type) - { - static const GtkTypeInfo contact_editor_fullname_info = - { - "EContactEditorFullname", - sizeof (EContactEditorFullname), - sizeof (EContactEditorFullnameClass), - (GtkClassInitFunc) e_contact_editor_fullname_class_init, - (GtkObjectInitFunc) e_contact_editor_fullname_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - contact_editor_fullname_type = gtk_type_unique (gnome_dialog_get_type (), &contact_editor_fullname_info); - } - - return contact_editor_fullname_type; -} - -static void -e_contact_editor_fullname_class_init (EContactEditorFullnameClass *klass) -{ - GtkObjectClass *object_class; - GnomeDialogClass *dialog_class; - - object_class = (GtkObjectClass*) klass; - dialog_class = (GnomeDialogClass *) klass; - - parent_class = gtk_type_class (gnome_dialog_get_type ()); - - gtk_object_add_arg_type ("EContactEditorFullname::name", GTK_TYPE_POINTER, - GTK_ARG_READWRITE, ARG_NAME); - - object_class->set_arg = e_contact_editor_fullname_set_arg; - object_class->get_arg = e_contact_editor_fullname_get_arg; - object_class->destroy = e_contact_editor_fullname_destroy; -} - -static void -e_contact_editor_fullname_init (EContactEditorFullname *e_contact_editor_fullname) -{ - GladeXML *gui; - GtkWidget *widget; - - gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_fullname), - GNOME_STOCK_BUTTON_OK); - - gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_fullname), - GNOME_STOCK_BUTTON_CANCEL); - - gtk_window_set_policy(GTK_WINDOW(e_contact_editor_fullname), TRUE, TRUE, FALSE); - - e_contact_editor_fullname->name = NULL; - gui = glade_xml_new (EVOLUTION_GLADEDIR "/fullname.glade", NULL); - e_contact_editor_fullname->gui = gui; - - widget = glade_xml_get_widget(gui, "table-checkfullname"); - gtk_widget_ref(widget); - gtk_container_remove(GTK_CONTAINER(widget->parent), widget); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (e_contact_editor_fullname)->vbox), widget, TRUE, TRUE, 0); - gtk_widget_unref(widget); -} - -void -e_contact_editor_fullname_destroy (GtkObject *object) -{ - EContactEditorFullname *e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME(object); - - if (e_contact_editor_fullname->gui) - gtk_object_unref(GTK_OBJECT(e_contact_editor_fullname->gui)); - e_card_name_free(e_contact_editor_fullname->name); -} - -GtkWidget* -e_contact_editor_fullname_new (ECardName *name) -{ - GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_fullname_get_type ())); - gtk_object_set (GTK_OBJECT(widget), - "name", name, - NULL); - return widget; -} - -static void -e_contact_editor_fullname_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - EContactEditorFullname *e_contact_editor_fullname; - - e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME (o); - - switch (arg_id){ - case ARG_NAME: - if (e_contact_editor_fullname->name) - e_card_name_free(e_contact_editor_fullname->name); - e_contact_editor_fullname->name = e_card_name_copy(GTK_VALUE_POINTER (*arg)); - fill_in_info(e_contact_editor_fullname); - break; - } -} - -static void -e_contact_editor_fullname_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EContactEditorFullname *e_contact_editor_fullname; - - e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME (object); - - switch (arg_id) { - case ARG_NAME: - extract_info(e_contact_editor_fullname); - GTK_VALUE_POINTER (*arg) = e_card_name_copy(e_contact_editor_fullname->name); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -fill_in_field(EContactEditorFullname *editor, char *field, char *string) -{ - GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, field)); - if (entry) { - if (string) - gtk_entry_set_text(entry, string); - else - gtk_entry_set_text(entry, ""); - } -} - -static void -fill_in_info(EContactEditorFullname *editor) -{ - ECardName *name = editor->name; - if (name) { - fill_in_field(editor, "entry-title", name->prefix); - fill_in_field(editor, "entry-first", name->given); - fill_in_field(editor, "entry-middle", name->additional); - fill_in_field(editor, "entry-last", name->family); - fill_in_field(editor, "entry-suffix", name->suffix); - } -} - -static char * -extract_field(EContactEditorFullname *editor, char *field) -{ - GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, field)); - if (entry) - return g_strdup(gtk_entry_get_text(entry)); - else - return NULL; -} - -static void -extract_info(EContactEditorFullname *editor) -{ - ECardName *name = editor->name; - if (!name) - name = e_card_name_new(); - name->prefix = extract_field(editor, "entry-title" ); - name->given = extract_field(editor, "entry-first" ); - name->additional = extract_field(editor, "entry-middle"); - name->family = extract_field(editor, "entry-last" ); - name->suffix = extract_field(editor, "entry-suffix"); -} diff --git a/addressbook/contact-editor/e-contact-editor-fullname.h b/addressbook/contact-editor/e-contact-editor-fullname.h deleted file mode 100644 index 409ffc72d0..0000000000 --- a/addressbook/contact-editor/e-contact-editor-fullname.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-editor-fullname.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_CONTACT_EDITOR_FULLNAME_H__ -#define __E_CONTACT_EDITOR_FULLNAME_H__ - -#include <gnome.h> -#include <glade/glade.h> -#include <ebook/e-card.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EContactEditorFullname - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * name ECardName * RW The card currently being edited. Returns a copy. - */ - -#define E_CONTACT_EDITOR_FULLNAME_TYPE (e_contact_editor_fullname_get_type ()) -#define E_CONTACT_EDITOR_FULLNAME(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_FULLNAME_TYPE, EContactEditorFullname)) -#define E_CONTACT_EDITOR_FULLNAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_FULLNAME_TYPE, EContactEditorFullnameClass)) -#define E_IS_CONTACT_EDITOR_FULLNAME(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_FULLNAME_TYPE)) -#define E_IS_CONTACT_EDITOR_FULLNAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_FULLNAME_TYPE)) - - -typedef struct _EContactEditorFullname EContactEditorFullname; -typedef struct _EContactEditorFullnameClass EContactEditorFullnameClass; - -struct _EContactEditorFullname -{ - GnomeDialog parent; - - /* item specific fields */ - ECardName *name; - GladeXML *gui; -}; - -struct _EContactEditorFullnameClass -{ - GnomeDialogClass parent_class; -}; - - -GtkWidget *e_contact_editor_fullname_new(ECardName *name); -GtkType e_contact_editor_fullname_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_CONTACT_EDITOR_FULLNAME_H__ */ diff --git a/addressbook/contact-editor/e-contact-editor-strings.h b/addressbook/contact-editor/e-contact-editor-strings.h deleted file mode 100644 index d5ac9daf24..0000000000 --- a/addressbook/contact-editor/e-contact-editor-strings.h +++ /dev/null @@ -1,41 +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_("_Add"); -gchar *s = N_("_Delete"); -gchar *s = N_("Phone Types"); -gchar *s = N_("New phone type"); -gchar *s = N_("Add"); -gchar *s = N_("New phone type"); -gchar *s = N_("Contact Editor"); -gchar *s = N_("_Full Name..."); -gchar *s = N_("File As:"); -gchar *s = N_("Web page address:"); -gchar *s = N_("Wants to receive _HTML mail"); -gchar *s = N_("Address:"); -gchar *s = N_("_Business"); -gchar *s = N_("_Home"); -gchar *s = N_("Business _Fax"); -gchar *s = N_("_Mobile"); -gchar *s = N_("Primary Email"); -gchar *s = N_("B_usiness"); -gchar *s = N_("_This is the mailing address"); -gchar *s = N_("C_ontacts..."); -gchar *s = N_("Ca_tegories..."); -gchar *s = N_("_Job title:"); -gchar *s = N_("_Company:"); -gchar *s = N_("General"); -gchar *s = N_("_Department:"); -gchar *s = N_("_Office:"); -gchar *s = N_("_Profession:"); -gchar *s = N_("_Nickname:"); -gchar *s = N_("_Spouse:"); -gchar *s = N_("_Birthday:"); -gchar *s = N_("_Assistant's name:"); -gchar *s = N_("_Manager's Name:"); -gchar *s = N_("Anni_versary:"); -gchar *s = N_("No_tes:"); -gchar *s = N_("Details"); diff --git a/addressbook/contact-editor/e-contact-editor.c b/addressbook/contact-editor/e-contact-editor.c deleted file mode 100644 index e8062d83b9..0000000000 --- a/addressbook/contact-editor/e-contact-editor.c +++ /dev/null @@ -1,1809 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-editor.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 "e-contact-editor.h" -#include <e-contact-editor-fullname.h> -#include <e-contact-editor-categories.h> -#include <gdk-pixbuf/gdk-pixbuf.h> -#include <gdk-pixbuf/gnome-canvas-pixbuf.h> -#include <e-util/e-gui-utils.h> -#include <e-contact-save-as.h> -#include "addressbook/printing/e-contact-print.h" - -/* Signal IDs */ -enum { - ADD_CARD, - COMMIT_CARD, - DELETE_CARD, - EDITOR_CLOSED, - LAST_SIGNAL -}; - -static void e_contact_editor_init (EContactEditor *card); -static void e_contact_editor_class_init (EContactEditorClass *klass); -static void e_contact_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_contact_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_contact_editor_destroy (GtkObject *object); - -#if 0 -static GtkWidget *e_contact_editor_build_dialog(EContactEditor *editor, gchar *entry_id, gchar *label_id, gchar *title, GList **list, GnomeUIInfo **info); -#endif -static void _email_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor); -static void _phone_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor); -static void _address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor); -static void fill_in_info(EContactEditor *editor); -static void extract_info(EContactEditor *editor); -static void set_fields(EContactEditor *editor); -static void set_address_field(EContactEditor *editor, int result); -static void add_field_callback(GtkWidget *widget, EContactEditor *editor); - -static GtkObjectClass *parent_class = NULL; - -static guint contact_editor_signals[LAST_SIGNAL]; - -/* The arguments we take */ -enum { - ARG_0, - ARG_CARD, - ARG_IS_NEW_CARD -}; - -enum { - DYNAMIC_LIST_EMAIL, - DYNAMIC_LIST_PHONE, - DYNAMIC_LIST_ADDRESS -}; - -GtkType -e_contact_editor_get_type (void) -{ - static GtkType contact_editor_type = 0; - - if (!contact_editor_type) - { - static const GtkTypeInfo contact_editor_info = - { - "EContactEditor", - sizeof (EContactEditor), - sizeof (EContactEditorClass), - (GtkClassInitFunc) e_contact_editor_class_init, - (GtkObjectInitFunc) e_contact_editor_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - contact_editor_type = gtk_type_unique (GTK_TYPE_OBJECT, &contact_editor_info); - } - - return contact_editor_type; -} - -static void -e_contact_editor_class_init (EContactEditorClass *klass) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) klass; - - parent_class = gtk_type_class (GTK_TYPE_OBJECT); - - gtk_object_add_arg_type ("EContactEditor::card", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_CARD); - gtk_object_add_arg_type ("EContactEditor::is_new_card", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_IS_NEW_CARD); - - contact_editor_signals[ADD_CARD] = - gtk_signal_new ("add_card", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EContactEditorClass, add_card), - gtk_marshal_NONE__OBJECT, - GTK_TYPE_NONE, 1, - GTK_TYPE_OBJECT); - - contact_editor_signals[COMMIT_CARD] = - gtk_signal_new ("commit_card", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EContactEditorClass, commit_card), - gtk_marshal_NONE__OBJECT, - GTK_TYPE_NONE, 1, - GTK_TYPE_OBJECT); - - contact_editor_signals[DELETE_CARD] = - gtk_signal_new ("delete_card", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EContactEditorClass, delete_card), - gtk_marshal_NONE__OBJECT, - GTK_TYPE_NONE, 1, - GTK_TYPE_OBJECT); - - contact_editor_signals[EDITOR_CLOSED] = - gtk_signal_new ("editor_closed", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EContactEditorClass, editor_closed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, contact_editor_signals, LAST_SIGNAL); - - object_class->set_arg = e_contact_editor_set_arg; - object_class->get_arg = e_contact_editor_get_arg; - object_class->destroy = e_contact_editor_destroy; -} - -static void -_replace_button(EContactEditor *editor, gchar *button_xml, gchar *image, GtkSignalFunc func) -{ - GladeXML *gui = editor->gui; - GtkWidget *button = glade_xml_get_widget(gui, button_xml); - GtkWidget *pixmap; - gchar *image_temp; - if (button && GTK_IS_BUTTON(button)) { - image_temp = g_strdup_printf("%s/%s", EVOLUTIONDIR, image); - pixmap = e_create_image_widget(NULL, image_temp, NULL, 0, 0); - gtk_container_add(GTK_CONTAINER(button), - pixmap); - g_free(image_temp); - gtk_widget_show(pixmap); - gtk_signal_connect(GTK_OBJECT(button), "button_press_event", func, editor); - } -} - -static void -_replace_buttons(EContactEditor *editor) -{ - _replace_button(editor, "button-phone1", "arrow.png", _phone_arrow_pressed); - _replace_button(editor, "button-phone2", "arrow.png", _phone_arrow_pressed); - _replace_button(editor, "button-phone3", "arrow.png", _phone_arrow_pressed); - _replace_button(editor, "button-phone4", "arrow.png", _phone_arrow_pressed); - _replace_button(editor, "button-address", "arrow.png", _address_arrow_pressed); - _replace_button(editor, "button-email1", "arrow.png", _email_arrow_pressed); -} - -static void -phone_entry_changed (GtkWidget *widget, EContactEditor *editor) -{ - int which; - gchar *string; - GtkEntry *entry = GTK_ENTRY(widget); - ECardPhone *phone; - - if ( widget == glade_xml_get_widget(editor->gui, "entry-phone1") ) { - which = 1; - } else if ( widget == glade_xml_get_widget(editor->gui, "entry-phone2") ) { - which = 2; - } else if ( widget == glade_xml_get_widget(editor->gui, "entry-phone3") ) { - which = 3; - } else if ( widget == glade_xml_get_widget(editor->gui, "entry-phone4") ) { - which = 4; - } else - return; - string = gtk_entry_get_text(entry); - phone = e_card_phone_new(); - phone->number = string; - e_card_simple_set_phone(editor->simple, editor->phone_choice[which - 1], phone); - phone->number = NULL; - e_card_phone_free(phone); - set_fields(editor); -} - -static void -email_entry_changed (GtkWidget *widget, EContactEditor *editor) -{ - gchar *string; - GtkEntry *entry = GTK_ENTRY(widget); - - string = gtk_entry_get_text(entry); - - e_card_simple_set_email(editor->simple, editor->email_choice, string); -} - -static void -address_text_changed (GtkWidget *widget, EContactEditor *editor) -{ - GtkEditable *editable = GTK_EDITABLE(widget); - ECardAddrLabel *address; - - if (editor->address_choice == -1) - return; - - address = e_card_address_label_new(); - address->data = gtk_editable_get_chars(editable, 0, -1); - e_card_simple_set_address(editor->simple, editor->address_choice, address); - e_card_address_label_free(address); -} - -/* This function tells you whether name_to_style will make sense. */ -static gboolean -style_makes_sense(const ECardName *name, char *company, int style) -{ - switch (style) { - case 0: /* Fall Through */ - case 1: - return TRUE; - case 2: - if (company && *company) - return TRUE; - else - return FALSE; - case 3: /* Fall Through */ - case 4: - if (company && *company && ((name->given && *name->given) || (name->family && *name->family))) - return TRUE; - else - return FALSE; - default: - return FALSE; - } -} - -static char * -name_to_style(const ECardName *name, char *company, int style) -{ - char *string; - char *strings[4], **stringptr; - char *substring; - switch (style) { - case 0: - stringptr = strings; - if (name->family && *name->family) - *(stringptr++) = name->family; - if (name->given && *name->given) - *(stringptr++) = name->given; - *stringptr = NULL; - string = g_strjoinv(", ", strings); - break; - case 1: - stringptr = strings; - if (name->given && *name->given) - *(stringptr++) = name->given; - if (name->family && *name->family) - *(stringptr++) = name->family; - *stringptr = NULL; - string = g_strjoinv(" ", strings); - break; - case 2: - string = g_strdup(company); - break; - case 3: /* Fall Through */ - case 4: - stringptr = strings; - if (name->family && *name->family) - *(stringptr++) = name->family; - if (name->given && *name->given) - *(stringptr++) = name->given; - *stringptr = NULL; - substring = g_strjoinv(", ", strings); - if (!(company && *company)) - company = ""; - if (style == 3) - string = g_strdup_printf("%s (%s)", substring, company); - else - string = g_strdup_printf("%s (%s)", company, substring); - g_free(substring); - break; - default: - string = g_strdup(""); - } - return string; -} - -static int -file_as_get_style (EContactEditor *editor) -{ - GtkEntry *file_as = GTK_ENTRY(glade_xml_get_widget(editor->gui, "entry-file-as")); - char *filestring = gtk_entry_get_text(file_as); - char *trystring; - ECardName *name = editor->name; - int i; - int style; - - if (!name) return 0; - - style = -1; - for (i = 0; i < 5; i++) { - trystring = name_to_style(name, editor->company, i); - if (!strcmp(trystring, filestring)) { - g_free(trystring); - return i; - } - g_free(trystring); - } - return -1; -} - -static void -file_as_set_style(EContactEditor *editor, int style) -{ - char *string; - int i; - GList *strings = NULL; - GtkEntry *file_as = GTK_ENTRY(glade_xml_get_widget(editor->gui, "entry-file-as")); - GtkWidget *widget; - - - if (style == -1) { - string = g_strdup(gtk_entry_get_text(file_as)); - strings = g_list_append(strings, string); - } - - for (i = 0; i < 5; i++) { - if (style_makes_sense(editor->name, editor->company, i)) { - string = name_to_style(editor->name, editor->company, i); - strings = g_list_append(strings, string); - } - } - - widget = glade_xml_get_widget(editor->gui, "combo-file-as"); - if (widget && GTK_IS_COMBO(widget)) { - GtkCombo *combo = GTK_COMBO(widget); - gtk_combo_set_popdown_strings(combo, strings); - g_list_foreach(strings, (GFunc) g_free, NULL); - g_list_free(strings); - } - - if (style != -1) { - string = name_to_style(editor->name, editor->company, style); - gtk_entry_set_text(file_as, string); - g_free(string); - } -} - -static void -name_entry_changed (GtkWidget *widget, EContactEditor *editor) -{ - GtkWidget *file_as; - int style = 0; - - file_as = glade_xml_get_widget(editor->gui, "entry-file-as"); - - if (file_as && GTK_IS_ENTRY(file_as)) { - style = file_as_get_style(editor); - } - - e_card_name_free(editor->name); - editor->name = e_card_name_from_string(gtk_entry_get_text(GTK_ENTRY(widget))); - - if (file_as && GTK_IS_ENTRY(file_as)) { - file_as_set_style(editor, style); - } -} - -static void -company_entry_changed (GtkWidget *widget, EContactEditor *editor) -{ - int style = 0; - GtkWidget *file_as; - - file_as = glade_xml_get_widget(editor->gui, "entry-file-as"); - - if (file_as && GTK_IS_ENTRY(file_as)) { - style = file_as_get_style(editor); - } - - g_free(editor->company); - - editor->company = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget))); - - if (file_as && GTK_IS_ENTRY(file_as)) { - file_as_set_style(editor, style); - } -} - -static void -set_entry_changed_signal_phone(EContactEditor *editor, char *id) -{ - GtkWidget *widget = glade_xml_get_widget(editor->gui, id); - if (widget && GTK_IS_ENTRY(widget)) - gtk_signal_connect(GTK_OBJECT(widget), "changed", - phone_entry_changed, editor); -} - -static void -set_entry_changed_signals(EContactEditor *editor) -{ - GtkWidget *widget; - set_entry_changed_signal_phone(editor, "entry-phone1"); - set_entry_changed_signal_phone(editor, "entry-phone2"); - set_entry_changed_signal_phone(editor, "entry-phone3"); - set_entry_changed_signal_phone(editor, "entry-phone4"); - widget = glade_xml_get_widget(editor->gui, "entry-email1"); - if (widget && GTK_IS_ENTRY(widget)) { - gtk_signal_connect(GTK_OBJECT(widget), "changed", - email_entry_changed, editor); - } - widget = glade_xml_get_widget(editor->gui, "text-address"); - if (widget && GTK_IS_TEXT(widget)) { - gtk_signal_connect(GTK_OBJECT(widget), "changed", - address_text_changed, editor); - } - widget = glade_xml_get_widget(editor->gui, "entry-fullname"); - if (widget && GTK_IS_ENTRY(widget)) { - gtk_signal_connect(GTK_OBJECT(widget), "changed", - name_entry_changed, editor); - } - widget = glade_xml_get_widget(editor->gui, "entry-company"); - if (widget && GTK_IS_ENTRY(widget)) { - gtk_signal_connect(GTK_OBJECT(widget), "changed", - company_entry_changed, editor); - } -} - -static void -full_name_clicked(GtkWidget *button, EContactEditor *editor) -{ - GnomeDialog *dialog = GNOME_DIALOG(e_contact_editor_fullname_new(editor->name)); - int result; - gtk_widget_show(GTK_WIDGET(dialog)); - result = gnome_dialog_run_and_close (dialog); - if (result == 0) { - ECardName *name; - GtkWidget *fname_widget; - - gtk_object_get(GTK_OBJECT(dialog), - "name", &name, - NULL); - e_card_name_free(editor->name); - editor->name = e_card_name_copy(name); - - fname_widget = glade_xml_get_widget(editor->gui, "entry-fullname"); - if (fname_widget && GTK_IS_ENTRY(fname_widget)) { - char *full_name = e_card_name_to_string(name); - gtk_entry_set_text(GTK_ENTRY(fname_widget), full_name); - g_free(full_name); - } - } - gtk_object_unref(GTK_OBJECT(dialog)); -} - -static void -categories_clicked(GtkWidget *button, EContactEditor *editor) -{ - char *categories; - GnomeDialog *dialog; - int result; - GtkWidget *entry = glade_xml_get_widget(editor->gui, "entry-categories"); - if (entry && GTK_IS_ENTRY(entry)) - categories = gtk_entry_get_text(GTK_ENTRY(entry)); - else if (editor->card) - gtk_object_get(GTK_OBJECT(editor->card), - "categories", &categories, - NULL); - dialog = GNOME_DIALOG(e_contact_editor_categories_new(categories)); - gtk_widget_show(GTK_WIDGET(dialog)); - result = gnome_dialog_run (dialog); - if (result == 0) { - gtk_object_get(GTK_OBJECT(dialog), - "categories", &categories, - NULL); - if (entry && GTK_IS_ENTRY(entry)) - gtk_entry_set_text(GTK_ENTRY(entry), categories); - else - gtk_object_set(GTK_OBJECT(editor->card), - "categories", categories, - NULL); - g_free(categories); - } - gtk_object_destroy(GTK_OBJECT(dialog)); - if (!entry) - g_free(categories); -} - -/* Emits the signal to request saving a card */ -static void -save_card (EContactEditor *ce) -{ - extract_info (ce); - e_card_simple_sync_card (ce->simple); - - if (ce->is_new_card) - gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[ADD_CARD], - ce->card); - else - gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[COMMIT_CARD], - ce->card); - - /* FIXME: should we set the ce->is_new_card here or have the client code - * set the "is_new_card" argument on the contact editor object? - */ - - ce->is_new_card = FALSE; -} - -/* Closes the dialog box and emits the appropriate signals */ -static void -close_dialog (EContactEditor *ce) -{ - g_assert (ce->app != NULL); - - gtk_widget_destroy (ce->app); - ce->app = NULL; - - gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[EDITOR_CLOSED]); -} - -/* Menu callbacks */ - -/* File/Save callback */ -static void -file_save_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - save_card (ce); -} - -/* File/Close callback */ -static void -file_close_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - close_dialog (ce); -} - -static void -file_save_as_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - ECard *card; - - ce = E_CONTACT_EDITOR (data); - - extract_info (ce); - e_card_simple_sync_card (ce->simple); - - card = ce->card; - e_contact_save_as("Save as VCard", card); -} - -gboolean -e_contact_editor_confirm_delete(void) -{ - GnomeDialog *dialog; - GladeXML *gui; - int result; - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/e-contact-editor-confirm-delete.glade", NULL); - - dialog = GNOME_DIALOG(glade_xml_get_widget(gui, "confirm-dialog")); - - result = gnome_dialog_run_and_close(dialog); - - gtk_object_unref(GTK_OBJECT(gui)); - - return !result; -} - -static void -delete_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - - if (e_contact_editor_confirm_delete()) { - - ce = E_CONTACT_EDITOR (data); - - extract_info (ce); - e_card_simple_sync_card (ce->simple); - - if (!ce->is_new_card) - gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[DELETE_CARD], - ce->card); - - file_close_cb(widget, data); - } -} - -/* Emits the signal to request printing a card */ -static void -print_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - - extract_info (ce); - e_card_simple_sync_card (ce->simple); - - gtk_widget_show(e_contact_print_card_dialog_new(ce->card)); -} - - -/* Menu bar */ - -static GnomeUIInfo file_new_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Appointment"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Meeting Re_quest"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Mail Message"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Contact"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Task"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Task _Request"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Journal Entry"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Note"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Ch_oose Form..."), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo file_page_setup_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Memo Style"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Define Print _Styles..."), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo file_menu[] = { - GNOMEUIINFO_MENU_NEW_SUBTREE (file_new_menu), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: S_end"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_SAVE_ITEM (file_save_cb, NULL), - GNOMEUIINFO_MENU_SAVE_AS_ITEM (file_save_as_cb, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Save Attac_hments..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("_Delete"), NULL, delete_cb), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Move to Folder..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Cop_y to Folder..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_SUBTREE (N_("Page Set_up"), file_page_setup_menu), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Print Pre_view"), NULL, NULL), - GNOMEUIINFO_MENU_PRINT_ITEM (print_cb, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_PROPERTIES_ITEM (NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_CLOSE_ITEM (file_close_cb, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo edit_object_menu[] = { - GNOMEUIINFO_ITEM_NONE ("FIXME: what goes here?", NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo edit_menu[] = { - GNOMEUIINFO_MENU_UNDO_ITEM (NULL, NULL), - GNOMEUIINFO_MENU_REDO_ITEM (NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_CUT_ITEM (NULL, NULL), - GNOMEUIINFO_MENU_COPY_ITEM (NULL, NULL), - GNOMEUIINFO_MENU_PASTE_ITEM (NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Paste _Special..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_CLEAR_ITEM (NULL, NULL), - GNOMEUIINFO_MENU_SELECT_ALL_ITEM (NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Mark as U_nread"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_FIND_ITEM (NULL, NULL), - GNOMEUIINFO_MENU_FIND_AGAIN_ITEM (NULL, NULL), - GNOMEUIINFO_SUBTREE (N_("_Object"), edit_object_menu), - GNOMEUIINFO_END -}; - -static GnomeUIInfo view_previous_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Item"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Unread Item"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Fi_rst Item in Folder"), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo view_next_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Item"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Unread Item"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Last Item in Folder"), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo view_toolbars_menu[] = { - { GNOME_APP_UI_TOGGLEITEM, N_("FIXME: _Standard"), NULL, NULL, NULL, NULL, - GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, - { GNOME_APP_UI_TOGGLEITEM, N_("FIXME: __Formatting"), NULL, NULL, NULL, NULL, - GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Customize..."), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo view_menu[] = { - GNOMEUIINFO_SUBTREE (N_("Pre_vious"), view_previous_menu), - GNOMEUIINFO_SUBTREE (N_("Ne_xt"), view_next_menu), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_SUBTREE (N_("_Toolbars"), view_toolbars_menu), - GNOMEUIINFO_END -}; - -static GnomeUIInfo insert_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _File..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: It_em..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Object..."), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo format_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Font..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Paragraph..."), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo tools_forms_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Ch_oose Form..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Desi_gn This Form"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: D_esign a Form..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Publish _Form..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Pu_blish Form As..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Script _Debugger"), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo tools_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Spelling..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_SUBTREE (N_("_Forms"), tools_forms_menu), - GNOMEUIINFO_END -}; - -static GnomeUIInfo actions_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _New Contact"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: New _Contact from Same Company"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: New _Letter to Contact"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: New _Message to Contact"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: New Meetin_g with Contact"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Plan a Meeting..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: New _Task for Contact"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: New _Journal Entry for Contact"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Flag for Follow Up..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Display Map of Address"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Open Web Page"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Forward as _vCard"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: For_ward"), NULL, NULL) -}; - -static GnomeUIInfo help_menu[] = { - GNOMEUIINFO_ITEM_NONE ("FIXME: fix Bonobo so it supports help items!", NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo main_menu[] = { - GNOMEUIINFO_MENU_FILE_TREE (file_menu), - GNOMEUIINFO_MENU_EDIT_TREE (edit_menu), - GNOMEUIINFO_MENU_VIEW_TREE (view_menu), - GNOMEUIINFO_SUBTREE (N_("_Insert"), insert_menu), - GNOMEUIINFO_SUBTREE (N_("F_ormat"), format_menu), - GNOMEUIINFO_SUBTREE (N_("_Tools"), tools_menu), - GNOMEUIINFO_SUBTREE (N_("Actio_ns"), actions_menu), - GNOMEUIINFO_MENU_HELP_TREE (help_menu), - GNOMEUIINFO_END -}; - -/* Creates the menu bar for the contact editor */ -static void -create_menu (EContactEditor *ce) -{ - BonoboUIHandlerMenuItem *list; - - bonobo_ui_handler_create_menubar (ce->uih); - - list = bonobo_ui_handler_menu_parse_uiinfo_list_with_data (main_menu, ce); - bonobo_ui_handler_menu_add_list (ce->uih, "/", list); -} - -/* Toolbar/Save and Close callback */ -static void -tb_save_and_close_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - save_card (ce); - close_dialog (ce); -} - -/* Toolbar */ - -static GnomeUIInfo toolbar[] = { - GNOMEUIINFO_ITEM_STOCK (N_("Save and Close"), - N_("Save the appointment and close the dialog box"), - tb_save_and_close_cb, - GNOME_STOCK_PIXMAP_SAVE), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_STOCK (N_("Print..."), - N_("Print this item"), print_cb, - GNOME_STOCK_PIXMAP_PRINT), -#if 0 - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Insert File..."), - N_("Insert a file as an attachment"), NULL), -#endif - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_STOCK (N_("Delete"), - N_("Delete this item"), delete_cb, - GNOME_STOCK_PIXMAP_TRASH), - GNOMEUIINFO_SEPARATOR, -#if 0 - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Previous"), - N_("Go to the previous item"), NULL, - GNOME_STOCK_PIXMAP_BACK), - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Next"), - N_("Go to the next item"), NULL, - GNOME_STOCK_PIXMAP_FORWARD), -#endif - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Help"), - N_("See online help"), NULL, GNOME_STOCK_PIXMAP_HELP), - GNOMEUIINFO_END -}; - -/* Creates the toolbar for the contact editor */ -static void -create_toolbar (EContactEditor *ce) -{ - BonoboUIHandlerToolbarItem *list; - GnomeDockItem *dock_item; - GtkWidget *toolbar_child; - - bonobo_ui_handler_create_toolbar (ce->uih, "Toolbar"); - - /* Fetch the toolbar. What a pain in the ass. */ - - dock_item = gnome_app_get_dock_item_by_name (GNOME_APP (ce->app), GNOME_APP_TOOLBAR_NAME); - g_assert (dock_item != NULL); - - toolbar_child = gnome_dock_item_get_child (dock_item); - g_assert (toolbar_child != NULL && GTK_IS_TOOLBAR (toolbar_child)); - - /* Turn off labels as GtkToolbar sucks */ - gtk_toolbar_set_style (GTK_TOOLBAR (toolbar_child), GTK_TOOLBAR_ICONS); - - list = bonobo_ui_handler_toolbar_parse_uiinfo_list_with_data (toolbar, ce); - bonobo_ui_handler_toolbar_add_list (ce->uih, "/Toolbar", list); -} - -/* Callback used when the dialog box is destroyed */ -static gint -app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - - close_dialog (ce); - return TRUE; -} - -static GList * -add_to_tab_order(GList *list, GladeXML *gui, char *name) -{ - GtkWidget *widget = glade_xml_get_widget(gui, name); - return g_list_prepend(list, widget); -} - -static void -setup_tab_order(GladeXML *gui) -{ - GtkWidget *container; - GList *list = NULL; - - container = glade_xml_get_widget(gui, "table-contact-editor-general"); - - if (container) { - list = add_to_tab_order(list, gui, "entry-fullname"); - list = add_to_tab_order(list, gui, "entry-jobtitle"); - list = add_to_tab_order(list, gui, "entry-company"); - list = add_to_tab_order(list, gui, "combo-file-as"); - list = add_to_tab_order(list, gui, "entry-phone1"); - list = add_to_tab_order(list, gui, "entry-phone2"); - list = add_to_tab_order(list, gui, "entry-phone3"); - list = add_to_tab_order(list, gui, "entry-phone4"); - list = g_list_reverse(list); - e_container_change_tab_order(GTK_CONTAINER(container), list); - g_list_free(list); - - list = NULL; - list = add_to_tab_order(list, gui, "entry-email1"); - list = add_to_tab_order(list, gui, "entry-web"); - list = add_to_tab_order(list, gui, "text-address"); - list = add_to_tab_order(list, gui, "alignment-contacts"); - list = g_list_reverse(list); - e_container_change_tab_order(GTK_CONTAINER(container), list); - g_list_free(list); - } -} - -static void -e_contact_editor_init (EContactEditor *e_contact_editor) -{ - GladeXML *gui; - GtkWidget *widget; - - e_contact_editor->email_info = NULL; - e_contact_editor->phone_info = NULL; - e_contact_editor->address_info = NULL; - e_contact_editor->email_popup = NULL; - e_contact_editor->phone_popup = NULL; - e_contact_editor->address_popup = NULL; - e_contact_editor->email_list = NULL; - e_contact_editor->phone_list = NULL; - e_contact_editor->address_list = NULL; - e_contact_editor->name = NULL; - e_contact_editor->company = g_strdup(""); - - e_contact_editor->email_choice = 0; - e_contact_editor->phone_choice[0] = E_CARD_SIMPLE_PHONE_ID_BUSINESS; - e_contact_editor->phone_choice[1] = E_CARD_SIMPLE_PHONE_ID_HOME; - e_contact_editor->phone_choice[2] = E_CARD_SIMPLE_PHONE_ID_BUSINESS_FAX; - e_contact_editor->phone_choice[3] = E_CARD_SIMPLE_PHONE_ID_MOBILE; - e_contact_editor->address_choice = 0; - - e_contact_editor->arbitrary_fields = NULL; - - e_contact_editor->simple = e_card_simple_new(NULL); - - e_contact_editor->card = NULL; - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/contact-editor.glade", NULL); - e_contact_editor->gui = gui; - - setup_tab_order(gui); - - e_contact_editor->app = glade_xml_get_widget (gui, "contact editor"); - - e_container_foreach_leaf (GTK_CONTAINER (e_contact_editor->app), - (GtkCallback) add_field_callback, - e_contact_editor); - - _replace_buttons(e_contact_editor); - set_entry_changed_signals(e_contact_editor); - - widget = glade_xml_get_widget(e_contact_editor->gui, "button-fullname"); - if (widget && GTK_IS_BUTTON(widget)) - gtk_signal_connect(GTK_OBJECT(widget), "clicked", - full_name_clicked, e_contact_editor); - - widget = glade_xml_get_widget(e_contact_editor->gui, "button-categories"); - if (widget && GTK_IS_BUTTON(widget)) - gtk_signal_connect(GTK_OBJECT(widget), "clicked", - categories_clicked, e_contact_editor); - - /* Build the menu and toolbar */ - - e_contact_editor->uih = bonobo_ui_handler_new (); - if (!e_contact_editor->uih) { - g_message ("e_contact_editor_init(): eeeeek, could not create the UI handler!"); - return; - } - - bonobo_ui_handler_set_app (e_contact_editor->uih, GNOME_APP (e_contact_editor->app)); - - create_menu (e_contact_editor); - create_toolbar (e_contact_editor); - - /* Connect to the deletion of the dialog */ - - gtk_signal_connect (GTK_OBJECT (e_contact_editor->app), "delete_event", - GTK_SIGNAL_FUNC (app_delete_event_cb), e_contact_editor); -} - -void -e_contact_editor_destroy (GtkObject *object) { - EContactEditor *e_contact_editor = E_CONTACT_EDITOR(object); - - if (e_contact_editor->email_list) { - g_list_foreach(e_contact_editor->email_list, (GFunc) g_free, NULL); - g_list_free(e_contact_editor->email_list); - } - if (e_contact_editor->email_info) { - g_free(e_contact_editor->email_info); - } - if (e_contact_editor->email_popup) { - gtk_widget_unref(e_contact_editor->email_popup); - } - - if (e_contact_editor->phone_list) { - g_list_foreach(e_contact_editor->phone_list, (GFunc) g_free, NULL); - g_list_free(e_contact_editor->phone_list); - } - if (e_contact_editor->phone_info) { - g_free(e_contact_editor->phone_info); - } - if (e_contact_editor->phone_popup) { - gtk_widget_unref(e_contact_editor->phone_popup); - } - - if (e_contact_editor->address_list) { - g_list_foreach(e_contact_editor->address_list, (GFunc) g_free, NULL); - g_list_free(e_contact_editor->address_list); - } - if (e_contact_editor->address_info) { - g_free(e_contact_editor->address_info); - } - if (e_contact_editor->address_popup) { - gtk_widget_unref(e_contact_editor->address_popup); - } - - if (e_contact_editor->simple) - gtk_object_unref(GTK_OBJECT(e_contact_editor->simple)); - - g_free (e_contact_editor->company); - - gtk_object_unref(GTK_OBJECT(e_contact_editor->gui)); -} - -EContactEditor * -e_contact_editor_new (ECard *card, gboolean is_new_card) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (gtk_type_new (E_CONTACT_EDITOR_TYPE)); - - gtk_object_set (GTK_OBJECT (ce), - "card", card, - "is_new_card", is_new_card, - NULL); - - gtk_widget_show (ce->app); - return ce; -} - -static void -e_contact_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - EContactEditor *editor; - - editor = E_CONTACT_EDITOR (o); - - switch (arg_id){ - case ARG_CARD: - if (editor->card) - gtk_object_unref(GTK_OBJECT(editor->card)); - editor->card = e_card_duplicate(E_CARD(GTK_VALUE_OBJECT (*arg))); - gtk_object_set(GTK_OBJECT(editor->simple), - "card", editor->card, - NULL); - fill_in_info(editor); - break; - - case ARG_IS_NEW_CARD: - editor->is_new_card = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE; - break; - } -} - -static void -e_contact_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EContactEditor *e_contact_editor; - - e_contact_editor = E_CONTACT_EDITOR (object); - - switch (arg_id) { - case ARG_CARD: - e_card_simple_sync_card(e_contact_editor->simple); - extract_info(e_contact_editor); - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_contact_editor->card); - break; - - case ARG_IS_NEW_CARD: - GTK_VALUE_BOOL (*arg) = e_contact_editor->is_new_card ? TRUE : FALSE; - break; - - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -_popup_position(GtkMenu *menu, - gint *x, - gint *y, - gpointer data) -{ - GtkWidget *button = GTK_WIDGET(data); - GtkRequisition request; - int mh, mw; - gdk_window_get_origin (button->window, x, y); - *x += button->allocation.width; - *y += button->allocation.height; - - gtk_widget_size_request(GTK_WIDGET(menu), &request); - - mh = request.height; - mw = request.width; - - *x -= mw; - if (*x < 0) - *x = 0; - - if (*y < 0) - *y = 0; - - if ((*x + mw) > gdk_screen_width ()) - *x = gdk_screen_width () - mw; - - if ((*y + mh) > gdk_screen_height ()) - *y = gdk_screen_height () - mh; -} - -static gint -_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor, GtkWidget *popup, GList **list, GnomeUIInfo **info, gchar *label, gchar *entry, gchar *dialog_title) -{ - gint menu_item; - gtk_signal_emit_stop_by_name(GTK_OBJECT(widget), "button_press_event"); - gtk_widget_realize(popup); - menu_item = gnome_popup_menu_do_popup_modal(popup, _popup_position, widget, button, editor); - if ( menu_item != -1 ) { -#if 0 - if (menu_item == g_list_length (*list)) { - e_contact_editor_build_dialog(editor, entry, label, dialog_title, list, info); - } else { -#endif - GtkWidget *label_widget = glade_xml_get_widget(editor->gui, label); - if (label_widget && GTK_IS_LABEL(label_widget)) { - gtk_object_set(GTK_OBJECT(label_widget), - "label", g_list_nth_data(*list, menu_item), - NULL); - } -#if 0 - } -#endif - } - return menu_item; -} - -static void -e_contact_editor_build_ui_info(GList *list, GnomeUIInfo **infop) -{ - GnomeUIInfo *info; - GnomeUIInfo singleton = { GNOME_APP_UI_TOGGLEITEM, NULL, NULL, NULL, NULL, NULL, GNOME_APP_PIXMAP_NONE, 0, 0, 0, NULL }; - GnomeUIInfo end = GNOMEUIINFO_END; - int length; - int i; - - info = *infop; - - if ( info ) - g_free(info); - length = g_list_length( list ); - info = g_new(GnomeUIInfo, length + 2); - for (i = 0; i < length; i++) { - info[i] = singleton; - info[i].label = _(list->data); - list = list->next; - } - info[i] = end; - - *infop = info; -} - -#if 0 -static void -_dialog_clicked(GtkWidget *dialog, gint button, EContactEditor *editor) -{ - GtkWidget *label = gtk_object_get_data(GTK_OBJECT(dialog), - "e_contact_editor_label"); - - GtkWidget *dialog_entry = gtk_object_get_data(GTK_OBJECT(dialog), - "e_contact_editor_dialog_entry"); - - GList **list = gtk_object_get_data(GTK_OBJECT(dialog), - "e_contact_editor_list"); - GList **info = gtk_object_get_data(GTK_OBJECT(dialog), - "e_contact_editor_info"); - switch (button) { - case 0: - if (label && GTK_IS_LABEL(label)) { - gtk_object_set(GTK_OBJECT(label), - "label", gtk_entry_get_text(GTK_ENTRY(dialog_entry)), - NULL); - *list = g_list_append(*list, g_strdup(gtk_entry_get_text(GTK_ENTRY(dialog_entry)))); - g_free(*info); - *info = NULL; - } - break; - } - gnome_dialog_close(GNOME_DIALOG(dialog)); -} - -static void -_dialog_destroy(EContactEditor *editor, GtkWidget *dialog) -{ - gnome_dialog_close(GNOME_DIALOG(dialog)); -} - -static GtkWidget * -e_contact_editor_build_dialog(EContactEditor *editor, gchar *entry_id, gchar *label_id, gchar *title, GList **list, GnomeUIInfo **info) -{ - GtkWidget *dialog_entry = gtk_entry_new(); - GtkWidget *entry = glade_xml_get_widget(editor->gui, entry_id); - GtkWidget *label = glade_xml_get_widget(editor->gui, label_id); - - GtkWidget *dialog = gnome_dialog_new(title, - NULL); - - gtk_container_add(GTK_CONTAINER(GNOME_DIALOG(dialog)->vbox), - gtk_widget_new (gtk_frame_get_type(), - "border_width", 4, - "label", title, - "child", gtk_widget_new(gtk_alignment_get_type(), - "child", dialog_entry, - "xalign", .5, - "yalign", .5, - "xscale", 1.0, - "yscale", 1.0, - "border_width", 9, - NULL), - NULL)); - - gnome_dialog_append_button_with_pixmap(GNOME_DIALOG(dialog), - "Add", - GNOME_STOCK_PIXMAP_ADD); - gnome_dialog_append_button(GNOME_DIALOG(dialog), GNOME_STOCK_BUTTON_CANCEL); - gnome_dialog_set_default(GNOME_DIALOG(dialog), 0); - - gtk_signal_connect(GTK_OBJECT(dialog), "clicked", - _dialog_clicked, editor); - gtk_signal_connect_while_alive(GTK_OBJECT(editor), "destroy", - _dialog_destroy, GTK_OBJECT(dialog), GTK_OBJECT(dialog)); - - gtk_object_set_data(GTK_OBJECT(dialog), - "e_contact_editor_entry", entry); - gtk_object_set_data(GTK_OBJECT(dialog), - "e_contact_editor_label", label); - gtk_object_set_data(GTK_OBJECT(dialog), - "e_contact_editor_dialog_entry", dialog_entry); - gtk_object_set_data(GTK_OBJECT(dialog), - "e_contact_editor_list", list); - gtk_object_set_data(GTK_OBJECT(dialog), - "e_contact_editor_info", info); - - gtk_widget_show_all(dialog); - return dialog; -} -#endif - -static void -_phone_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor) -{ - int which; - int i; - gchar *label; - gchar *entry; - int result; - if ( widget == glade_xml_get_widget(editor->gui, "button-phone1") ) { - which = 1; - } else if ( widget == glade_xml_get_widget(editor->gui, "button-phone2") ) { - which = 2; - } else if ( widget == glade_xml_get_widget(editor->gui, "button-phone3") ) { - which = 3; - } else if ( widget == glade_xml_get_widget(editor->gui, "button-phone4") ) { - which = 4; - } else - return; - - label = g_strdup_printf("label-phone%d", which); - entry = g_strdup_printf("entry-phone%d", which); - - if (editor->phone_list == NULL) { - static char *info[] = { - N_("Assistant"), - N_("Business"), - N_("Business 2"), - N_("Business Fax"), - N_("Callback"), - N_("Car"), - N_("Company"), - N_("Home"), - N_("Home 2"), - N_("Home Fax"), - N_("ISDN"), - N_("Mobile"), - N_("Other"), - N_("Other Fax"), - N_("Pager"), - N_("Primary"), - N_("Radio"), - N_("Telex"), - N_("TTY/TDD") - }; - - for (i = 0; i < sizeof(info) / sizeof(info[0]); i++) { - editor->phone_list = g_list_append(editor->phone_list, g_strdup(info[i])); - } - } - if (editor->phone_info == NULL) { - e_contact_editor_build_ui_info(editor->phone_list, &editor->phone_info); - - if ( editor->phone_popup ) - gtk_widget_unref(editor->phone_popup); - - editor->phone_popup = gnome_popup_menu_new(editor->phone_info); - } - - for(i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i++) { - const ECardPhone *phone = e_card_simple_get_phone(editor->simple, i); - gboolean checked; - checked = phone && phone->number && *phone->number; - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(editor->phone_info[i].widget), - checked); - gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(editor->phone_info[i].widget), - TRUE); - } - - result = _arrow_pressed (widget, button, editor, editor->phone_popup, &editor->phone_list, &editor->phone_info, label, entry, "Add new phone number type"); - - if (result != -1) { - editor->phone_choice[which - 1] = result; - set_fields(editor); - } - - g_free(label); - g_free(entry); -} - -static void -_email_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor) -{ - int i; - int result; - if (editor->email_list == NULL) { - static char *info[] = { - N_("Primary Email"), - N_("Email 2"), - N_("Email 3") - }; - - for (i = 0; i < sizeof(info) / sizeof(info[0]); i++) { - editor->email_list = g_list_append(editor->email_list, g_strdup(info[i])); - } - } - if (editor->email_info == NULL) { - e_contact_editor_build_ui_info(editor->email_list, &editor->email_info); - - if ( editor->email_popup ) - gtk_widget_unref(editor->email_popup); - - editor->email_popup = gnome_popup_menu_new(editor->email_info); - } - - for(i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i++) { - const char *string = e_card_simple_get_email(editor->simple, i); - gboolean checked; - checked = string && *string; - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(editor->email_info[i].widget), - checked); - gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(editor->email_info[i].widget), - TRUE); - } - - result = _arrow_pressed (widget, button, editor, editor->email_popup, &editor->email_list, &editor->email_info, "label-email1", "entry-email1", "Add new Email type"); - - if (result != -1) { - editor->email_choice = result; - set_fields(editor); - } -} - -static void -_address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor) -{ - int i; - int result; - if (editor->address_list == NULL) { - static char *info[] = { - N_("Business"), - N_("Home"), - N_("Other") - }; - - for (i = 0; i < sizeof(info) / sizeof(info[0]); i++) { - editor->address_list = g_list_append(editor->address_list, g_strdup(info[i])); - } - } - if (editor->address_info == NULL) { - e_contact_editor_build_ui_info(editor->address_list, &editor->address_info); - - if ( editor->address_popup ) - gtk_widget_unref(editor->address_popup); - - editor->address_popup = gnome_popup_menu_new(editor->address_info); - } - - for(i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) { - const ECardAddrLabel *address = e_card_simple_get_address(editor->simple, i); - gboolean checked; - checked = address && address->data && *address->data; - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(editor->address_info[i].widget), - checked); - gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(editor->address_info[i].widget), - TRUE); - } - - result = _arrow_pressed (widget, button, editor, editor->address_popup, &editor->address_list, &editor->address_info, "label-address", "text-address", "Add new Address type"); - - if (result != -1) { - set_address_field(editor, result); - } -} - -static void -set_field(GtkEntry *entry, const char *string) -{ - char *oldstring = gtk_entry_get_text(entry); - if (!string) - string = ""; - if (strcmp(string, oldstring)) - gtk_entry_set_text(entry, string); -} - -static void -set_phone_field(GtkWidget *entry, const ECardPhone *phone) -{ - set_field(GTK_ENTRY(entry), phone ? phone->number : ""); -} - -static void -set_fields(EContactEditor *editor) -{ - GtkWidget *entry; - - entry = glade_xml_get_widget(editor->gui, "entry-phone1"); - if (entry && GTK_IS_ENTRY(entry)) - set_phone_field(entry, e_card_simple_get_phone(editor->simple, editor->phone_choice[0])); - - entry = glade_xml_get_widget(editor->gui, "entry-phone2"); - if (entry && GTK_IS_ENTRY(entry)) - set_phone_field(entry, e_card_simple_get_phone(editor->simple, editor->phone_choice[1])); - - entry = glade_xml_get_widget(editor->gui, "entry-phone3"); - if (entry && GTK_IS_ENTRY(entry)) - set_phone_field(entry, e_card_simple_get_phone(editor->simple, editor->phone_choice[2])); - - entry = glade_xml_get_widget(editor->gui, "entry-phone4"); - if (entry && GTK_IS_ENTRY(entry)) - set_phone_field(entry, e_card_simple_get_phone(editor->simple, editor->phone_choice[3])); - - entry = glade_xml_get_widget(editor->gui, "entry-email1"); - if (entry && GTK_IS_ENTRY(entry)) - set_field(GTK_ENTRY(entry), e_card_simple_get_email(editor->simple, editor->email_choice)); - - set_address_field(editor, -1); -} - -static void -set_address_field(EContactEditor *editor, int result) -{ - GtkWidget *widget; - - widget = glade_xml_get_widget(editor->gui, "text-address"); - - if (widget && GTK_IS_TEXT(widget)) { - int position; - GtkEditable *editable; - const ECardAddrLabel *address; - - if (result == -1) - result = editor->address_choice; - editor->address_choice = -1; - - position = 0; - editable = GTK_EDITABLE(widget); - gtk_editable_delete_text(editable, 0, -1); - address = e_card_simple_get_address(editor->simple, result); - if (address && address->data) - gtk_editable_insert_text(editable, address->data, strlen(address->data), &position); - - editor->address_choice = result; - } -} - -static void -add_field_callback(GtkWidget *widget, EContactEditor *editor) -{ - const char *name; - int i; - static const char *builtins[] = { - "entry-fullname", - "entry-web", - "entry-company", - "entry-department", - "entry-office", - "entry-jobtitle", - "entry-profession", - "entry-manager", - "entry-assistant", - "entry-nickname", - "entry-spouse", - "text-comments", - "entry-categories", - "entry-contacts", - "entry-file-as", - "dateedit-anniversary", - "dateedit-birthday", - "entry-phone1", - "entry-phone2", - "entry-phone3", - "entry-phone4", - "entry-email1", - "text-address", - "checkbutton-mailingaddress", - "checkbutton-htmlmail", - NULL - }; - name = glade_get_widget_name(widget); - if (name) { - for (i = 0; builtins[i]; i++) { - if (!strcmp(name, builtins[i])) - return; - } - if (GTK_IS_ENTRY(widget) || GTK_IS_TEXT(widget)) { - editor->arbitrary_fields = g_list_prepend(editor->arbitrary_fields, g_strdup(name)); - } - } -} - -struct { - char *id; - char *key; -} field_mapping [] = { - { "entry-fullname", "full_name" }, - { "entry-web", "url" }, - { "entry-company", "org" }, - { "entry-department", "org_unit" }, - { "entry-office", "office" }, - { "entry-jobtitle", "title" }, - { "entry-profession", "role" }, - { "entry-manager", "manager" }, - { "entry-assistant", "assistant" }, - { "entry-nickname", "nickname" }, - { "entry-spouse", "spouse" }, - { "text-comments", "note" }, - { "entry-categories", "categories" }, -}; - -static void -fill_in_field(EContactEditor *editor, char *id, char *value) -{ - GtkWidget *widget = glade_xml_get_widget(editor->gui, id); - if (widget && GTK_IS_EDITABLE(widget)) { - int position = 0; - GtkEditable *editable = GTK_EDITABLE(widget); - gtk_editable_delete_text(editable, 0, -1); - if (value) - gtk_editable_insert_text(editable, value, strlen(value), &position); - } -} - -static void -fill_in_card_field(EContactEditor *editor, ECard *card, char *id, char *key) -{ - char *string; - gtk_object_get(GTK_OBJECT(card), - key, &string, - NULL); - fill_in_field(editor, id, string); -} - -static void -fill_in_single_field(EContactEditor *editor, char *name) -{ - ECardSimple *simple = editor->simple; - GtkWidget *widget = glade_xml_get_widget(editor->gui, name); - if (widget && GTK_IS_EDITABLE(widget)) { - int position = 0; - GtkEditable *editable = GTK_EDITABLE(widget); - const ECardArbitrary *arbitrary; - - gtk_editable_delete_text(editable, 0, -1); - arbitrary = e_card_simple_get_arbitrary(simple, - name); - if (arbitrary && arbitrary->value) - gtk_editable_insert_text(editable, arbitrary->value, strlen(arbitrary->value), &position); - } -} - -static void -fill_in_info(EContactEditor *editor) -{ - ECard *card = editor->card; - if (card) { - char *file_as; - ECardName *name; - const ECardDate *anniversary; - const ECardDate *bday; - int i; - GtkWidget *widget; - GList *list; - - gtk_object_get(GTK_OBJECT(card), - "file_as", &file_as, - "name", &name, - "anniversary", &anniversary, - "birth_date", &bday, - NULL); - - for (i = 0; i < sizeof(field_mapping) / sizeof(field_mapping[0]); i++) { - fill_in_card_field(editor, card, field_mapping[i].id, field_mapping[i].key); - } - - for (list = editor->arbitrary_fields; list; list = list->next) { - fill_in_single_field(editor, list->data); - } - - /* File as has to come after company and name or else it'll get messed up when setting them. */ - fill_in_field(editor, "entry-file-as", file_as); - - e_card_name_free(editor->name); - editor->name = e_card_name_copy(name); - - widget = glade_xml_get_widget(editor->gui, "dateedit-anniversary"); - if (anniversary && widget && GNOME_IS_DATE_EDIT(widget)) { - struct tm time_struct = {0,0,0,0,0,0,0,0,0}; - time_t time_val; - GnomeDateEdit *dateedit; - - time_struct.tm_mday = anniversary->day; - time_struct.tm_mon = anniversary->month - 1; - time_struct.tm_year = anniversary->year - 1900; - time_val = mktime(&time_struct); - dateedit = GNOME_DATE_EDIT(widget); - gnome_date_edit_set_time(dateedit, time_val); - } - - widget = glade_xml_get_widget(editor->gui, "dateedit-birthday"); - if (bday && widget && GNOME_IS_DATE_EDIT(widget)) { - struct tm time_struct = {0,0,0,0,0,0,0,0,0}; - time_t time_val; - GnomeDateEdit *dateedit; - time_struct.tm_mday = bday->day; - time_struct.tm_mon = bday->month - 1; - time_struct.tm_year = bday->year - 1900; - time_val = mktime(&time_struct); - dateedit = GNOME_DATE_EDIT(widget); - gnome_date_edit_set_time(dateedit, time_val); - } - - set_fields(editor); - } -} - -static void -extract_field(EContactEditor *editor, ECard *card, char *editable_id, char *key) -{ - GtkWidget *widget = glade_xml_get_widget(editor->gui, editable_id); - if (widget && GTK_IS_EDITABLE(widget)) { - GtkEditable *editable = GTK_EDITABLE(widget); - char *string = gtk_editable_get_chars(editable, 0, -1); - if (string && *string) - gtk_object_set(GTK_OBJECT(card), - key, string, - NULL); - else - gtk_object_set(GTK_OBJECT(card), - key, NULL, - NULL); - g_free(string); - } -} - -static void -extract_single_field(EContactEditor *editor, char *name) -{ - GtkWidget *widget = glade_xml_get_widget(editor->gui, name); - ECardSimple *simple = editor->simple; - if (widget && GTK_IS_EDITABLE(widget)) { - GtkEditable *editable = GTK_EDITABLE(widget); - char *string = gtk_editable_get_chars(editable, 0, -1); - - if (string && *string) - e_card_simple_set_arbitrary(simple, - name, - NULL, - string); - else - e_card_simple_set_arbitrary(simple, - name, - NULL, - NULL); - g_free(string); - } -} - -static void -extract_info(EContactEditor *editor) -{ - ECard *card = editor->card; - if (card) { - ECardDate *anniversary; - ECardDate *bday; - struct tm time_struct; - time_t time_val; - int i; - GtkWidget *widget; - GList *list; - - widget = glade_xml_get_widget(editor->gui, "entry-file-as"); - if (widget && GTK_IS_EDITABLE(widget)) { - GtkEditable *editable = GTK_EDITABLE(widget); - char *string = gtk_editable_get_chars(editable, 0, -1); - if (string && *string) - gtk_object_set(GTK_OBJECT(card), - "file_as", string, - NULL); - g_free(string); - } - - for (i = 0; i < sizeof(field_mapping) / sizeof(field_mapping[0]); i++) { - extract_field(editor, card, field_mapping[i].id, field_mapping[i].key); - } - - for (list = editor->arbitrary_fields; list; list = list->next) { - extract_single_field(editor, list->data); - } - - if (editor->name) - gtk_object_set(GTK_OBJECT(card), - "name", editor->name, - NULL); - - widget = glade_xml_get_widget(editor->gui, "dateedit-anniversary"); - if (widget && GNOME_IS_DATE_EDIT(widget)) { - time_val = gnome_date_edit_get_date(GNOME_DATE_EDIT(widget)); - gmtime_r(&time_val, - &time_struct); - anniversary = g_new(ECardDate, 1); - anniversary->day = time_struct.tm_mday; - anniversary->month = time_struct.tm_mon + 1; - anniversary->year = time_struct.tm_year + 1900; - gtk_object_set(GTK_OBJECT(card), - "anniversary", anniversary, - NULL); - } - - widget = glade_xml_get_widget(editor->gui, "dateedit-birthday"); - if (widget && GNOME_IS_DATE_EDIT(widget)) { - time_val = gnome_date_edit_get_date(GNOME_DATE_EDIT(widget)); - gmtime_r(&time_val, - &time_struct); - bday = g_new(ECardDate, 1); - bday->day = time_struct.tm_mday; - bday->month = time_struct.tm_mon + 1; - bday->year = time_struct.tm_year + 1900; - gtk_object_set(GTK_OBJECT(card), - "birth_date", bday, - NULL); - } - } -} diff --git a/addressbook/contact-editor/e-contact-editor.h b/addressbook/contact-editor/e-contact-editor.h deleted file mode 100644 index de14b84ca3..0000000000 --- a/addressbook/contact-editor/e-contact-editor.h +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-editor.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_CONTACT_EDITOR_H__ -#define __E_CONTACT_EDITOR_H__ - -#include <gnome.h> -#include <glade/glade.h> -#include <bonobo.h> -#include <ebook/e-card.h> -#include <ebook/e-card-simple.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EContactEditor - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * card ECard * RW The card currently being edited - */ - -#define E_CONTACT_EDITOR_TYPE (e_contact_editor_get_type ()) -#define E_CONTACT_EDITOR(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_TYPE, EContactEditor)) -#define E_CONTACT_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_TYPE, EContactEditorClass)) -#define E_IS_CONTACT_EDITOR(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_TYPE)) -#define E_IS_CONTACT_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_TYPE)) - - -typedef struct _EContactEditor EContactEditor; -typedef struct _EContactEditorClass EContactEditorClass; - -struct _EContactEditor -{ - GtkObject object; - - /* item specific fields */ - ECard *card; - ECardSimple *simple; - - /* UI handler */ - BonoboUIHandler *uih; - - GladeXML *gui; - GtkWidget *app; - GnomeUIInfo *email_info; - GnomeUIInfo *phone_info; - GnomeUIInfo *address_info; - GtkWidget *email_popup; - GtkWidget *phone_popup; - GtkWidget *address_popup; - GList *email_list; - GList *phone_list; - GList *address_list; - - ECardName *name; - char *company; - - ECardSimpleEmailId email_choice; - ECardSimplePhoneId phone_choice[4]; - ECardSimpleAddressId address_choice; - - GList *arbitrary_fields; - - /* Whether we are editing a new card or an existing one */ - guint is_new_card : 1; -}; - -struct _EContactEditorClass -{ - GtkObjectClass parent_class; - - /* Notification signals */ - - void (* add_card) (EContactEditor *ce, ECard *card); - void (* commit_card) (EContactEditor *ce, ECard *card); - void (* delete_card) (EContactEditor *ce, ECard *card); - void (* editor_closed) (EContactEditor *ce); -}; - - -EContactEditor *e_contact_editor_new (ECard *card, gboolean is_new_card); -GtkType e_contact_editor_get_type (void); - - -gboolean e_contact_editor_confirm_delete(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_CONTACT_EDITOR_H__ */ diff --git a/addressbook/contact-editor/e-contact-save-as.c b/addressbook/contact-editor/e-contact-save-as.c deleted file mode 100644 index 51cb2619e7..0000000000 --- a/addressbook/contact-editor/e-contact-save-as.c +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-editor.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. - */ - -#include <e-contact-save-as.h> -#include <e-util/e-util.h> -#include <unistd.h> -#include <fcntl.h> - -typedef struct { - GtkFileSelection *filesel; - ECard *card; -} SaveAsInfo; - -static void -save_it(GtkWidget *widget, SaveAsInfo *info) -{ - char *vcard = e_card_get_vcard(info->card); - const char *filename = gtk_file_selection_get_filename(info->filesel); - e_write_file(filename, vcard, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC); - g_free(vcard); - gtk_object_unref(GTK_OBJECT(info->card)); - gtk_widget_destroy(GTK_WIDGET(info->filesel)); - g_free(info); -} - -static void -close_it(GtkWidget *widget, SaveAsInfo *info) -{ - gtk_object_unref(GTK_OBJECT(info->card)); - gtk_widget_destroy(GTK_WIDGET(info->filesel)); - g_free(info); -} - -static void -delete_it(GtkWidget *widget, SaveAsInfo *info) -{ - gtk_object_unref(GTK_OBJECT(info->card)); - g_free(info); -} - -void -e_contact_save_as(char *title, ECard *card) -{ - GtkFileSelection *filesel; - SaveAsInfo *info = g_new(SaveAsInfo, 1); - - filesel = GTK_FILE_SELECTION(gtk_file_selection_new(title)); - - info->filesel = filesel; - info->card = e_card_duplicate(card); - - gtk_signal_connect(GTK_OBJECT(filesel->ok_button), "clicked", - save_it, info); - gtk_signal_connect(GTK_OBJECT(filesel->cancel_button), "clicked", - close_it, info); - gtk_signal_connect(GTK_OBJECT(filesel), "delete_event", - delete_it, info); - gtk_widget_show(GTK_WIDGET(filesel)); -} diff --git a/addressbook/contact-editor/e-contact-save-as.h b/addressbook/contact-editor/e-contact-save-as.h deleted file mode 100644 index e6af13e8fd..0000000000 --- a/addressbook/contact-editor/e-contact-save-as.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-save-as.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_CONTACT_SAVE_AS_H__ -#define __E_CONTACT_SAVE_AS_H__ - -#include <gnome.h> -#include <glade/glade.h> -#include <ebook/e-card.h> -#include <ebook/e-card-simple.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -void -e_contact_save_as(gchar *title, ECard *card); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_CONTACT_EDITOR_H__ */ diff --git a/addressbook/contact-editor/email.png b/addressbook/contact-editor/email.png Binary files differdeleted file mode 100644 index f3ff02e343..0000000000 --- a/addressbook/contact-editor/email.png +++ /dev/null diff --git a/addressbook/contact-editor/fullname-strings.h b/addressbook/contact-editor/fullname-strings.h deleted file mode 100644 index 0c84dfdc8f..0000000000 --- a/addressbook/contact-editor/fullname-strings.h +++ /dev/null @@ -1,25 +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_("Check Full Name"); -gchar *s = N_("_Title:"); -gchar *s = N_("_First:"); -gchar *s = N_("_Middle:"); -gchar *s = N_("_Last:"); -gchar *s = N_("_Suffix:"); -gchar *s = N_("\n" - "Mr.\n" - "Mrs.\n" - "Dr.\n" - ""); -gchar *s = N_("\n" - "Sr.\n" - "Jr.\n" - "I\n" - "II\n" - "III\n" - "Esq.\n" - ""); diff --git a/addressbook/contact-editor/fullname.glade b/addressbook/contact-editor/fullname.glade deleted file mode 100644 index 8f811c5616..0000000000 --- a/addressbook/contact-editor/fullname.glade +++ /dev/null @@ -1,391 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>fullname</name> - <program_name>fullname</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> - <use_widget_names>True</use_widget_names> - <output_main_file>False</output_main_file> - <output_support_files>False</output_support_files> - <output_build_files>False</output_build_files> - <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>fullname-strings.h</translatable_strings_file> -</project> - -<widget> - <class>GnomeDialog</class> - <name>dialog-checkfullname</name> - <visible>False</visible> - <title>Check Full Name</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>True</modal> - <allow_shrink>True</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - <auto_close>False</auto_close> - <hide_on_close>False</hide_on_close> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDialog:vbox</child_name> - <name>vbox-container</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>table-checkfullname</name> - <border_width>8</border_width> - <rows>5</rows> - <columns>3</columns> - <homogeneous>False</homogeneous> - <row_spacing>6</row_spacing> - <column_spacing>21</column_spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel1</name> - <label>_Title:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel2</name> - <label>_First:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel3</name> - <label>_Middle:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel4</name> - <label>_Last:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel5</name> - <label>_Suffix:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <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>GtkCombo</class> - <name>combo-title</name> - <value_in_list>False</value_in_list> - <ok_if_empty>True</ok_if_empty> - <case_sensitive>False</case_sensitive> - <use_arrows>True</use_arrows> - <use_arrows_always>False</use_arrows_always> - <items> -Mr. -Mrs. -Dr. -</items> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - - <widget> - <class>GtkEntry</class> - <child_name>GtkCombo:entry</child_name> - <name>entry-title</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - </widget> - </widget> - - <widget> - <class>GtkCombo</class> - <name>combo-suffix</name> - <value_in_list>False</value_in_list> - <ok_if_empty>True</ok_if_empty> - <case_sensitive>False</case_sensitive> - <use_arrows>True</use_arrows> - <use_arrows_always>False</use_arrows_always> - <items> -Sr. -Jr. -I -II -III -Esq. -</items> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - - <widget> - <class>GtkEntry</class> - <child_name>GtkCombo:entry</child_name> - <name>entry-suffix</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - </widget> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-first</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>3</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-middle</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>3</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-last</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>3</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - - <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>button1</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> - </widget> - - <widget> - <class>GtkButton</class> - <name>button2</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/addressbook/contact-editor/head.png b/addressbook/contact-editor/head.png Binary files differdeleted file mode 100644 index ca00b75f92..0000000000 --- a/addressbook/contact-editor/head.png +++ /dev/null diff --git a/addressbook/contact-editor/netfreebusy.png b/addressbook/contact-editor/netfreebusy.png Binary files differdeleted file mode 100644 index 09ec8a2a5c..0000000000 --- a/addressbook/contact-editor/netfreebusy.png +++ /dev/null diff --git a/addressbook/contact-editor/netmeeting.png b/addressbook/contact-editor/netmeeting.png Binary files differdeleted file mode 100644 index 4cb90c121e..0000000000 --- a/addressbook/contact-editor/netmeeting.png +++ /dev/null diff --git a/addressbook/contact-editor/phone.png b/addressbook/contact-editor/phone.png Binary files differdeleted file mode 100644 index ebec84ba0b..0000000000 --- a/addressbook/contact-editor/phone.png +++ /dev/null diff --git a/addressbook/contact-editor/snailmail.png b/addressbook/contact-editor/snailmail.png Binary files differdeleted file mode 100644 index 647ae8f68c..0000000000 --- a/addressbook/contact-editor/snailmail.png +++ /dev/null diff --git a/addressbook/contact-editor/test-editor.c b/addressbook/contact-editor/test-editor.c deleted file mode 100644 index 80db2fe848..0000000000 --- a/addressbook/contact-editor/test-editor.c +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * test-editor.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 <glade/glade.h> -#include "e-contact-editor.h" - -#define TEST_VCARD \ -"BEGIN:VCARD -" \ -"FN:Nat -" \ -"N:Friedman;Nat;D;Mr. -" \ -"BDAY:1977-08-06 -" \ -"TEL;WORK:617 679 1984 -" \ -"TEL;CELL:123 456 7890 -" \ -"EMAIL;INTERNET:nat@nat.org -" \ -"EMAIL;INTERNET:nat@helixcode.com -" \ -"ADR;WORK;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234; -" \ -"ADR;HOME;POSTAL;INTL:P.O. Box 202;;;Any Town 2;MI;12344-4321;USA -" \ -"END:VCARD -" \ -" -" - -static char * -read_file (char *name) -{ - int len; - char buff[65536]; - char line[1024]; - FILE *f; - - f = fopen (name, "r"); - if (f == NULL) - g_error ("Unable to open %s!\n", name); - - len = 0; - while (fgets (line, sizeof (line), f) != NULL) { - strcpy (buff + len, line); - len += strlen (line); - } - - fclose (f); - - return g_strdup (buff); -} - -/* Callback used when a contact editor is closed */ -static void -editor_closed_cb (EContactEditor *ce, gpointer data) -{ - static int count = 2; - - count--; - gtk_object_unref (GTK_OBJECT (ce)); - - if (count == 0) - 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 ( _( "Contact Editor Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the contact editor canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -int main( int argc, char *argv[] ) -{ - char *cardstr; - EContactEditor *ce; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Contact Editor Test", VERSION, argc, argv); - - glade_gnome_init (); - - cardstr = NULL; - if (argc == 2) - cardstr = read_file (argv [1]); - - if (cardstr == NULL) - cardstr = TEST_VCARD; - - ce = e_contact_editor_new (e_card_new (cardstr), TRUE); - gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", - GTK_SIGNAL_FUNC (editor_closed_cb), NULL); - - ce = e_contact_editor_new (e_card_new (cardstr), TRUE); - gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", - GTK_SIGNAL_FUNC (editor_closed_cb), NULL); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/contact-editor/web.png b/addressbook/contact-editor/web.png Binary files differdeleted file mode 100644 index 3211a11b19..0000000000 --- a/addressbook/contact-editor/web.png +++ /dev/null diff --git a/addressbook/demo/.cvsignore b/addressbook/demo/.cvsignore deleted file mode 100644 index a0427f184f..0000000000 --- a/addressbook/demo/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la -evolution-addressbook -test-addressbook
\ No newline at end of file diff --git a/addressbook/demo/Makefile.am b/addressbook/demo/Makefile.am deleted file mode 100644 index 1a7e4e6d01..0000000000 --- a/addressbook/demo/Makefile.am +++ /dev/null @@ -1,63 +0,0 @@ -INCLUDES = \ - $(EXTRA_GNOME_CFLAGS) \ - $(GNOME_INCLUDEDIR) \ - -I$(top_srcdir)/widgets/e-text \ - -I$(top_srcdir)/e-util \ - -I$(top_srcdir)/widgets/e-table \ - -I$(top_srcdir) \ - -I$(top_srcdir)/widgets/e-minicard \ - -I$(top_srcdir)/addressbook/backend/ebook \ - $(BONOBO_HTML_GNOME_CFLAGS) \ - -DEVOLUTION_VERSION=\""$(VERSION)"\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(datadir)/locale"\" \ - -DCAMEL_PROVIDERDIR=\""$(providerdir)"\" \ - -DG_LOG_DOMAIN=\"addressbook-demo\" - -noinst_PROGRAMS = \ - test-addressbook - -test_addressbook_SOURCES = \ - demo.c \ - e-test-model.c \ - e-test-model.h - -test_addressbook_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - $(BONOBO_HTML_GNOME_LIBS) \ - $(top_builddir)/widgets/e-minicard/libeminicard.a \ - $(top_builddir)/widgets/e-table/libetable.a \ - $(top_builddir)/widgets/e-text/libetext.a \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/libversit/libversit.la - -test_addressbook_LDFLAGS = `gnome-config --libs gdk_pixbuf` - -bin_PROGRAMS = \ - evolution-addressbook - -evolution_addressbook_SOURCES = \ - addressbook-factory.c \ - addressbook-widget.c \ - addressbook-widget.h \ - addressbook.c \ - addressbook.h \ - e-test-model.c \ - e-test-model.h - -evolution_addressbook_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - $(BONOBO_HTML_GNOME_LIBS) \ - $(top_builddir)/widgets/e-minicard/libeminicard.a \ - $(top_builddir)/widgets/e-table/libetable.a \ - $(top_builddir)/widgets/e-text/libetext.a \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/libversit/libversit.la - -evolution_addressbook_LDFLAGS = `gnome-config --libs gdk_pixbuf` - -gnorbadir = $(sysconfdir)/CORBA/servers -gnorba_DATA = addressbook.gnorba diff --git a/addressbook/demo/addressbook-factory.c b/addressbook/demo/addressbook-factory.c deleted file mode 100644 index cf59177f84..0000000000 --- a/addressbook/demo/addressbook-factory.c +++ /dev/null @@ -1,47 +0,0 @@ -/** - * sample-control-factory.c - * - * Copyright 1999, Helix Code, Inc. - * - * Author: - * Nat Friedman (nat@nat.org) - * - */ - -#include <config.h> -#include <gnome.h> -#include <libgnorba/gnorba.h> -#include <bonobo.h> - -#include "addressbook.h" - -CORBA_Environment ev; -CORBA_ORB orb; - -static void -init_bonobo (int argc, char **argv) -{ - - gnome_CORBA_init_with_popt_table ( - "evolution-addressbook", "0.0", - &argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); - - orb = gnome_CORBA_ORB (); - - if (bonobo_init (orb, NULL, NULL) == FALSE) - g_error (_("Could not initialize Bonobo")); -} - -int -main (int argc, char **argv) -{ - CORBA_exception_init (&ev); - - init_bonobo (argc, argv); - - addressbook_factory_init (); - - bonobo_main (); - - return 0; -} diff --git a/addressbook/demo/addressbook-widget.c b/addressbook/demo/addressbook-widget.c deleted file mode 100644 index a4e4fb95e7..0000000000 --- a/addressbook/demo/addressbook-widget.c +++ /dev/null @@ -1,533 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * demo.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 <stdio.h> -#include <string.h> -#include <gnome.h> -#include <gnome-xml/tree.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> -#include "e-util/e-cursors.h" -#include "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-cell-checkbox.h" -#include "e-table.h" -#include "e-reflow.h" -#include "e-minicard.h" -#include <gdk-pixbuf/gdk-pixbuf.h> - -#include "e-test-model.h" - -#include "addressbook-widget.h" - -#define COLS 4 - -/* 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> 1 </column> \ - <column> 2 </column> \ - <column> 3 </column> \ - </columns-shown> \ - <grouping> <leaf column=\"1\" ascending=\"1\"/> </grouping> \ -</ETableSpecification>" - -char *headers[COLS] = { - "Email", - "Full Name", - "Address", - "Phone" -}; - -static int window_count = 0; -static GHashTable *models = NULL; - -static void -remove_model(ETableModel *model, gchar *filename) -{ - g_hash_table_remove(models, filename); - g_free(filename); -} - -static ETestModel * -get_model(char *filename) -{ - ETestModel *model; - gboolean free_filename = FALSE; - - if ( filename == NULL ) { - filename = gnome_util_prepend_user_home("addressbook.xml"); - free_filename = TRUE; - } - - if ( models == NULL ) { - models = g_hash_table_new(g_str_hash, g_str_equal); - } - - model = g_hash_table_lookup(models, filename); - if ( model ) { - if (free_filename) - g_free(filename); - return model; - } - - if ( !free_filename ) - filename = g_strdup(filename); - - model = E_TEST_MODEL(e_test_model_new(filename)); - g_hash_table_insert(models, - filename, model); - gtk_signal_connect(GTK_OBJECT(model), "destroy", - GTK_SIGNAL_FUNC(remove_model), filename); - - return model; -} - -static void -add_address_cb(GtkWidget *button, gpointer data) -{ - View *view = (View *) data; - Address *newadd = g_new(Address, 1); - newadd->email = g_strdup(""); - newadd->phone = g_strdup(""); - newadd->full_name = g_strdup(""); - newadd->street = g_strdup(""); - e_test_model_add_column (view->model, newadd); -} - -static void -rebuild_reflow(ETableModel *model, gpointer data) -{ - int i; - View *view = (View *) data; - Reflow *reflow = view->reflow; - if (!reflow) - return; - gtk_object_destroy(GTK_OBJECT(reflow->reflow)); - reflow->reflow = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( reflow->canvas ) ), - e_reflow_get_type(), - "height", (double) reflow->last_alloc.height, - "minimum_width", (double) reflow->last_alloc.width, - NULL ); - - for ( i = 0; i < view->model->data_count; i++ ) - { - GnomeCanvasItem *item; - item = gnome_canvas_item_new( GNOME_CANVAS_GROUP(reflow->reflow), - e_minicard_get_type(), - "model", view->model, - "row", i, - NULL); - e_reflow_add_item(E_REFLOW(reflow->reflow), item); - } - e_canvas_item_request_reflow(reflow->reflow); -} - -static void -destroy_reflow(View *view) -{ - Reflow *reflow = view->reflow; - if ( !reflow ) - return; - - gtk_signal_disconnect(GTK_OBJECT(view->model), - reflow->model_changed_id); - g_free(reflow); - gtk_object_unref(GTK_OBJECT(view->model)); - view->reflow = NULL; -} - -static void -destroy_callback(GtkWidget *app, gpointer data) -{ - View *view = (View *)data; - if ( view->reflow ) { - destroy_reflow(view); - } - gtk_object_unref(GTK_OBJECT(view->model)); - g_free(view); - window_count --; - if ( window_count <= 0 ) - gtk_main_quit(); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - double width; - View *view = (View *)data; - Reflow *reflow = view->reflow; - if ( !reflow ) - return; - reflow->last_alloc = *allocation; - gnome_canvas_item_set( reflow->reflow, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( reflow->reflow, - "minimum_width", (double) allocation->width, - NULL ); - gtk_object_get(GTK_OBJECT(reflow->reflow), - "width", &width, - NULL); - width = MAX(width, allocation->width); - gnome_canvas_set_scroll_region(GNOME_CANVAS( reflow->canvas ), 0, 0, width, allocation->height ); - gnome_canvas_item_set( reflow->rect, - "x2", (double) width, - "y2", (double) allocation->height, - NULL ); -} - -static void resize(ECanvas *canvas, gpointer data) -{ - double width; - View *view = (View *)data; - Reflow *reflow = view->reflow; - if ( !reflow ) - return; - gtk_object_get(GTK_OBJECT(reflow->reflow), - "width", &width, - NULL); - width = MAX(width, reflow->last_alloc.width); - gnome_canvas_set_scroll_region(GNOME_CANVAS(reflow->canvas), 0, 0, width, reflow->last_alloc.height ); - gnome_canvas_item_set( reflow->rect, - "x2", (double) width, - "y2", (double) reflow->last_alloc.height, - NULL ); -} - -static void -canvas_realized(GtkLayout *layout, View *view) -{ - gdk_window_set_back_pixmap( layout->bin_window, NULL, FALSE); -} - -static GtkWidget * -create_reflow(View *view) -{ - GtkWidget *inner_vbox; - GtkWidget *scrollbar; - int i; - Reflow *reflow = g_new(Reflow, 1); - view->reflow = reflow; - - view->type = VIEW_TYPE_REFLOW; - - /* Next we create our model. This uses the functions we defined - earlier. */ - - inner_vbox = gtk_vbox_new(FALSE, 0); - reflow->canvas = e_canvas_new(); - reflow->rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( reflow->canvas ) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - reflow->reflow = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( reflow->canvas ) ), - e_reflow_get_type(), - "height", (double) 100, - "minimum_width", (double) 100, - NULL ); - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( reflow->canvas ), "reflow", - GTK_SIGNAL_FUNC( resize ), - ( gpointer ) view); - - for ( i = 0; i < view->model->data_count; i++ ) - { - GnomeCanvasItem *item; - item = gnome_canvas_item_new( GNOME_CANVAS_GROUP(reflow->reflow), - e_minicard_get_type(), - "model", view->model, - "row", i, - NULL); - e_reflow_add_item(E_REFLOW(reflow->reflow), item); - } - gnome_canvas_set_scroll_region ( GNOME_CANVAS( reflow->canvas ), - 0, 0, - 100, 100 ); - - scrollbar = gtk_hscrollbar_new(gtk_layout_get_hadjustment(GTK_LAYOUT(reflow->canvas))); - - gtk_signal_connect( GTK_OBJECT( reflow->canvas ), "size_allocate", - GTK_SIGNAL_FUNC( allocate_callback ), - ( gpointer ) view ); - - gtk_signal_connect( GTK_OBJECT(reflow->canvas), "realize", - GTK_SIGNAL_FUNC(canvas_realized), view); - - reflow->model_changed_id = gtk_signal_connect(GTK_OBJECT( view->model ), "model_changed", - GTK_SIGNAL_FUNC(rebuild_reflow), view); - - gtk_object_ref(GTK_OBJECT(view->model)); - - /* Build the gtk widget hierarchy. */ - gtk_box_pack_start(GTK_BOX(inner_vbox), reflow->canvas, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(inner_vbox), scrollbar, FALSE, FALSE, 0); - - return inner_vbox; -} - -/* We create a window containing our new table. */ -static GtkWidget * -create_table(View *view) -{ - ECell *cell_left_just; - ETableHeader *e_table_header; - GtkWidget *e_table; - int i; - - view->type = VIEW_TYPE_TABLE; - - /* - 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(view->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 < LAST_COL; i++){ - /* Create the column. */ - ETableCol *ecol = e_table_col_new ( - i, headers [i], - 80, 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 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_from_spec_file (e_table_header, E_TABLE_MODEL(view->model), "spec"); - -#if 0 - gtk_signal_connect(GTK_OBJECT(E_TABLE(e_table)->sort_info), "sort_info_changed", - GTK_SIGNAL_FUNC(queue_header_save), e_table->sort_info); - - gtk_signal_connect(GTK_OBJECT(E_TABLE(e_table)->header), "structure_change", - GTK_SIGNAL_FUNC(queue_header_save), e_table->sort_info); - gtk_signal_connect(GTK_OBJECT(E_TABLE(e_table)->header), "dimension_change", - GTK_SIGNAL_FUNC(queue_header_save), e_table->sort_info); -#endif - - return e_table; -} - -void -change_type(View *view, ViewType type) -{ - gtk_object_ref(GTK_OBJECT(view->model)); - if (view->reflow) - destroy_reflow(view); - gtk_widget_destroy(view->child); - switch(type) { - case VIEW_TYPE_REFLOW: - view->child = create_reflow(view); - break; - case VIEW_TYPE_TABLE: - view->child = create_table(view); - break; - } - gtk_container_add(GTK_CONTAINER(view->frame), view->child); - gtk_widget_show_all(view->child); - gtk_object_unref(GTK_OBJECT(view->model)); -} - -View * -create_view(void) -{ - View *view = g_new(View, 1); - ViewType type = VIEW_TYPE_REFLOW; - GtkWidget *button; - - view->reflow = NULL; - - view->model = get_model(NULL); - - /* This frame is simply to get a bevel around our table. */ - view->frame = gtk_frame_new (NULL); - - switch(type) { - case VIEW_TYPE_REFLOW: - view->child = create_reflow(view); - break; - case VIEW_TYPE_TABLE: - view->child = create_table(view); - break; - } - - - gtk_signal_connect( GTK_OBJECT( view->child ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - view ); - - /* - vbox = gtk_vbox_new(FALSE, 0); - button = gtk_button_new_with_label("Add address"); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(add_address_cb), view); - - change_button = gtk_button_new_with_label("Change View"); - gtk_signal_connect(GTK_OBJECT(change_button), "clicked", - GTK_SIGNAL_FUNC(change_callback), view); - */ - /* Build the gtk widget hierarchy. */ - - view->widget = gtk_vbox_new(FALSE, 0); - - button = gtk_button_new_with_label("Add address"); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(add_address_cb), view); - - gtk_container_add (GTK_CONTAINER (view->frame), view->child); - gtk_box_pack_start (GTK_BOX (view->widget), view->frame, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (view->widget), button, FALSE, FALSE, 0); - /* - gtk_box_pack_start (GTK_BOX (vbox), change_button, FALSE, FALSE, 0); - */ - /* Show it all. */ - gtk_widget_show_all (view->widget); - gtk_object_ref(GTK_OBJECT(view->model)); - gtk_object_sink(GTK_OBJECT(view->model)); - window_count ++; - return view; - -} - -#if 0 -static void -change_callback(GtkWidget *button, View *view) -{ - if (view->type == VIEW_TYPE_REFLOW) - change_type(view, VIEW_TYPE_TABLE); - else - change_type(view, VIEW_TYPE_REFLOW); -} - -static GtkWidget * -create_window(char *filename, ViewType type) -{ - GtkWidget *button; - GtkWidget *change_button; - GtkWidget *vbox; - View *view = g_new(View, 1); - - view->reflow = NULL; - - view->model = get_model(filename); - - /* Here we create a window for our new table. This window - will get shown and the person will be able to test their - item. */ - view->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - - gtk_signal_connect( GTK_OBJECT( view->window ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - view ); - - /* This frame is simply to get a bevel around our table. */ - view->frame = gtk_frame_new (NULL); - - switch(type) { - case VIEW_TYPE_REFLOW: - view->child = create_reflow(view); - break; - case VIEW_TYPE_TABLE: - view->child = create_table(view); - break; - } - - - vbox = gtk_vbox_new(FALSE, 0); - - button = gtk_button_new_with_label("Add address"); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(add_address_cb), view); - - change_button = gtk_button_new_with_label("Change View"); - gtk_signal_connect(GTK_OBJECT(change_button), "clicked", - GTK_SIGNAL_FUNC(change_callback), view); - - /* Build the gtk widget hierarchy. */ - - gtk_container_add (GTK_CONTAINER (view->frame), view->child); - gtk_box_pack_start (GTK_BOX (vbox), view->frame, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (vbox), change_button, FALSE, FALSE, 0); - gtk_container_add (GTK_CONTAINER (view->window), vbox); - - /* Size the initial window. */ - gtk_widget_set_usize (view->window, 200, 200); - /* Show it all. */ - gtk_widget_show_all (view->window); - gtk_object_sink(GTK_OBJECT(view->model)); - window_count ++; - return view->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_window("addressbook.xml", VIEW_TYPE_TABLE); - create_window("addressbook.xml", VIEW_TYPE_TABLE); - create_window("addressbook.xml", VIEW_TYPE_TABLE); - create_window("addressbook.xml", VIEW_TYPE_REFLOW); - create_window("addressbook2.xml", VIEW_TYPE_TABLE); - create_window("addressbook2.xml", VIEW_TYPE_REFLOW); - - gtk_main (); - - e_cursors_shutdown (); - return 0; -} -#endif diff --git a/addressbook/demo/addressbook-widget.h b/addressbook/demo/addressbook-widget.h deleted file mode 100644 index 9111713da5..0000000000 --- a/addressbook/demo/addressbook-widget.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * demo.h - * 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. - */ - -#ifndef __DEMO_H__ -#define __DEMO_H__ - -#include "e-test-model.h" - -typedef struct _View View; - -typedef enum { - VIEW_TYPE_REFLOW, - VIEW_TYPE_TABLE -} ViewType; - -typedef struct { - GtkAllocation last_alloc; - GnomeCanvasItem *reflow; - GtkWidget *canvas; - GnomeCanvasItem *rect; - int model_changed_id; -} Reflow; - -struct _View { - ViewType type; - ETestModel *model; - GtkWidget *child; - GtkWidget *frame; - Reflow *reflow; - - GtkWidget *widget; -}; - -void change_type(View *view, ViewType type); -View *create_view(void); - -#endif /* __DEMO_H__ */ diff --git a/addressbook/demo/addressbook.c b/addressbook/demo/addressbook.c deleted file mode 100644 index b273788118..0000000000 --- a/addressbook/demo/addressbook.c +++ /dev/null @@ -1,200 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * folder-browser-factory.c: A Bonobo Control factory for Folder Browsers - * - * Author: - * Miguel de Icaza (miguel@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ -/* - * bonobo-clock-control.c - * - * Copyright 1999, Helix Code, Inc. - * - * Author: - * Nat Friedman (nat@nat.org) - */ - -#include <config.h> -#include <gnome.h> -#include <libgnorba/gnorba.h> -#include <bonobo.h> - -#include <libgnomeui/gtk-clock.h> - -#include "addressbook-widget.h" -#include "addressbook.h" - - - -#if 0 -static void -bonobo_clock_control_prop_value_changed_cb (BonoboPropertyBag *pb, char *name, char *type, - gpointer old_value, gpointer new_value, - gpointer user_data) -{ - GtkClock *clock = user_data; - - if (! strcmp (name, "running")) { - gboolean *b = new_value; - - if (*b) - gtk_clock_start (clock); - else - gtk_clock_stop (clock); - } -} - -/* - * Callback routine used to release any values we associated with the control - * dynamically. - */ -static void -release_data (GtkObject *object, void *data) -{ - g_free (data); -} -#endif - - -static void -control_deactivate (BonoboControl *control, BonoboUIHandler *uih) -{ - /* how to remove a menu item */ - bonobo_ui_handler_menu_remove (uih, "/Actions/New Contact"); - - /* remove our toolbar */ - bonobo_ui_handler_dock_remove (uih, "/Toolbar"); -} - -static void -do_nothing_cb (BonoboUIHandler *uih, void *user_data, const char *path) -{ - printf ("Yow! I am called back!\n"); -} - -static GnomeUIInfo gnome_toolbar [] = { - GNOMEUIINFO_ITEM_STOCK (N_("New"), N_("Create a new contact"), do_nothing_cb, GNOME_STOCK_PIXMAP_NEW), - - GNOMEUIINFO_SEPARATOR, - - GNOMEUIINFO_ITEM_STOCK (N_("Find"), N_("Find a contact"), do_nothing_cb, GNOME_STOCK_PIXMAP_SEARCH), - GNOMEUIINFO_ITEM_STOCK (N_("Print"), N_("Print contacts"), do_nothing_cb, GNOME_STOCK_PIXMAP_PRINT), - GNOMEUIINFO_ITEM_STOCK (N_("Delete"), N_("Delete a contact"), do_nothing_cb, GNOME_STOCK_PIXMAP_TRASH), - - GNOMEUIINFO_END -}; - - - - -static void -control_activate (BonoboControl *control, BonoboUIHandler *uih) -{ - Bonobo_UIHandler remote_uih; - GtkWidget *toolbar; - BonoboControl *toolbar_control; - - remote_uih = bonobo_control_get_remote_ui_handler (control); - bonobo_ui_handler_set_container (uih, remote_uih); - bonobo_object_release_unref (remote_uih, NULL); - - bonobo_ui_handler_menu_new_item (uih, "/Actions/New Contact", N_("_New Contact"), - NULL, -1, - BONOBO_UI_HANDLER_PIXMAP_NONE, NULL, - 0, 0, do_nothing_cb, NULL); - - toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, - GTK_TOOLBAR_BOTH); - - gnome_app_fill_toolbar (GTK_TOOLBAR (toolbar), - gnome_toolbar, - NULL); - - gtk_widget_show_all (toolbar); - - toolbar_control = bonobo_control_new (toolbar); - bonobo_ui_handler_dock_add ( - uih, "/Toolbar", - bonobo_object_corba_objref (BONOBO_OBJECT (toolbar_control)), - GNOME_DOCK_ITEM_BEH_LOCKED | - GNOME_DOCK_ITEM_BEH_EXCLUSIVE, - GNOME_DOCK_TOP, - 1, 1, 0); -} - -static void -control_activate_cb (BonoboControl *control, - gboolean activate, - gpointer user_data) -{ - BonoboUIHandler *uih; - - uih = bonobo_control_get_ui_handler (control); - g_assert (uih); - - if (activate) - control_activate (control, uih); - else - control_deactivate (control, uih); -} - - -static BonoboObject * -addressbook_factory (BonoboGenericFactory *Factory, void *closure) -{ -#if 0 - BonoboPropertyBag *pb; - CORBA_boolean *running; -#endif - BonoboControl *control; - View *view; - - /* Create the control. */ - view = create_view(); - control = bonobo_control_new (view->widget); - - gtk_signal_connect (GTK_OBJECT (control), "activate", - control_activate_cb, NULL); -#if 0 - /* Create the properties. */ - pb = bonobo_property_bag_new (); - bonobo_control_set_property_bag (control, pb); - - gtk_signal_connect (GTK_OBJECT (pb), "value_changed", - bonobo_clock_control_prop_value_changed_cb, - clock); - - running = g_new0 (CORBA_boolean, 1); - *running = TRUE; - bonobo_property_bag_add (pb, "running", "boolean", - (gpointer) running, - NULL, "Whether or not the clock is running", 0); - - /* - * Release "running" when the object is destroyed - */ - gtk_signal_connect (GTK_OBJECT (pb), "destroy", GTK_SIGNAL_FUNC (release_data), running); -#endif - - return BONOBO_OBJECT (control); -} - -void -addressbook_factory_init (void) -{ - static BonoboGenericFactory *addressbook_control_factory = NULL; - - if (addressbook_control_factory != NULL) - return; - - addressbook_control_factory = - bonobo_generic_factory_new ( - "control-factory:addressbook", - addressbook_factory, NULL); - - if (addressbook_control_factory == NULL) { - g_error ("I could not register a Addressbook factory."); - } -} diff --git a/addressbook/demo/addressbook.gnorba b/addressbook/demo/addressbook.gnorba deleted file mode 100644 index 7114b1c332..0000000000 --- a/addressbook/demo/addressbook.gnorba +++ /dev/null @@ -1,11 +0,0 @@ -[control-factory:addressbook] -type=exe -repo_id=IDL:GNOME/GenericFactory:1.0 -description=Factory for the sample Addressbook control -location_info=evolution-addressbook - -[control:addressbook] -type=factory -repo_id=IDL:BonoboControl/addressbook-control:1.0 IDL:GNOME/Control:1.0 -description=A sample Bonobo control which displays an addressbook. -location_info=control-factory:addressbook diff --git a/addressbook/demo/addressbook.h b/addressbook/demo/addressbook.h deleted file mode 100644 index e9289128a6..0000000000 --- a/addressbook/demo/addressbook.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __ADDRESSBOOK_H__ -#define __ADDRESSBOOK_H__ - -#include <bonobo/bonobo-control.h> - -void addressbook_factory_init (void); - -#endif /* __ADDRESSBOOK_H__ */ diff --git a/addressbook/demo/demo.c b/addressbook/demo/demo.c deleted file mode 100644 index 1e2c256d3a..0000000000 --- a/addressbook/demo/demo.c +++ /dev/null @@ -1,462 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#include <stdio.h> -#include <string.h> -#include <gnome.h> -#include <gnome-xml/tree.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> -#include "e-util/e-cursors.h" -#include "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-cell-checkbox.h" -#include "e-table.h" -#include "e-reflow.h" -#include "e-minicard.h" - -#include <gdk-pixbuf/gdk-pixbuf.h> - -#include "table-test.h" - -#include "e-test-model.h" - -#define COLS 4 - -/* 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> 1 </column> \ - <column> 2 </column> \ - <column> 3 </column> \ - </columns-shown> \ - <grouping> <leaf column=\"1\" ascending=\"1\"/> </grouping> \ -</ETableSpecification>" - -char *headers[COLS] = { - "Email", - "Full Name", - "Address", - "Phone" -}; - -typedef struct _View View; - -typedef enum { - VIEW_TYPE_REFLOW, - VIEW_TYPE_TABLE -} ViewType; - -typedef struct { - GtkAllocation last_alloc; - GnomeCanvasItem *reflow; - GtkWidget *canvas; - GnomeCanvasItem *rect; - int model_changed_id; -} Reflow; - -struct _View { - ETestModel *model; - GtkWidget *window; - GtkWidget *frame; - GtkWidget *child; - - ViewType type; - - Reflow *reflow; -}; - -static int window_count = 0; -static GHashTable *models = NULL; - -static void -remove_model(ETableModel *model, gchar *filename) -{ - g_hash_table_remove(models, filename); - g_free(filename); -} - -static ETestModel * -get_model(char *filename) -{ - ETestModel *model; - if ( models == NULL ) { - models = g_hash_table_new(g_str_hash, g_str_equal); - } - - model = g_hash_table_lookup(models, filename); - if ( model ) - return model; - - filename = g_strdup(filename); - - model = E_TEST_MODEL(e_test_model_new(filename)); - g_hash_table_insert(models, - filename, model); - gtk_signal_connect(GTK_OBJECT(model), "destroy", - GTK_SIGNAL_FUNC(remove_model), filename); - return model; -} - -static void -add_address_cb(GtkWidget *button, gpointer data) -{ - View *view = (View *) data; - Address *newadd = g_new(Address, 1); - newadd->email = g_strdup(""); - newadd->phone = g_strdup(""); - newadd->full_name = g_strdup(""); - newadd->street = g_strdup(""); - e_test_model_add_column (view->model, newadd); -} - -static void -rebuild_reflow(ETableModel *model, gpointer data) -{ - int i; - View *view = (View *) data; - Reflow *reflow = view->reflow; - if (!reflow) - return; - gtk_object_destroy(GTK_OBJECT(reflow->reflow)); - reflow->reflow = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( reflow->canvas ) ), - e_reflow_get_type(), - "height", (double) reflow->last_alloc.height, - "minimum_width", (double) reflow->last_alloc.width, - NULL ); - - for ( i = 0; i < view->model->data_count; i++ ) - { - GnomeCanvasItem *item; - item = gnome_canvas_item_new( GNOME_CANVAS_GROUP(reflow->reflow), - e_minicard_get_type(), - "model", view->model, - "row", i, - NULL); - e_reflow_add_item(E_REFLOW(reflow->reflow), item); - } - e_canvas_item_request_reflow(reflow->reflow); -} - -static void -destroy_reflow(View *view) -{ - Reflow *reflow = view->reflow; - if ( !reflow ) - return; - - gtk_signal_disconnect(GTK_OBJECT(view->model), - reflow->model_changed_id); - g_free(reflow); - gtk_object_unref(GTK_OBJECT(view->model)); - view->reflow = NULL; -} - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - View *view = (View *)data; - if ( view->reflow ) { - destroy_reflow(view); - } - gtk_object_unref(GTK_OBJECT(view->model)); - g_free(view); - window_count --; - if ( window_count <= 0 ) - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - double width; - View *view = (View *)data; - Reflow *reflow = view->reflow; - if ( !reflow ) - return; - reflow->last_alloc = *allocation; - gnome_canvas_item_set( reflow->reflow, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( reflow->reflow, - "minimum_width", (double) allocation->width, - NULL ); - gtk_object_get(GTK_OBJECT(reflow->reflow), - "width", &width, - NULL); - width = MAX(width, allocation->width); - gnome_canvas_set_scroll_region(GNOME_CANVAS( reflow->canvas ), 0, 0, width, allocation->height ); - gnome_canvas_item_set( reflow->rect, - "x2", (double) width, - "y2", (double) allocation->height, - NULL ); -} - -static void resize(ECanvas *canvas, gpointer data) -{ - double width; - View *view = (View *)data; - Reflow *reflow = view->reflow; - if ( !reflow ) - return; - gtk_object_get(GTK_OBJECT(reflow->reflow), - "width", &width, - NULL); - width = MAX(width, reflow->last_alloc.width); - gnome_canvas_set_scroll_region(GNOME_CANVAS(reflow->canvas), 0, 0, width, reflow->last_alloc.height ); - gnome_canvas_item_set( reflow->rect, - "x2", (double) width, - "y2", (double) reflow->last_alloc.height, - NULL ); -} - -static GtkWidget * -create_reflow(View *view) -{ - GtkWidget *inner_vbox; - GtkWidget *scrollbar; - int i; - Reflow *reflow = g_new(Reflow, 1); - view->reflow = reflow; - - view->type = VIEW_TYPE_REFLOW; - - /* Next we create our model. This uses the functions we defined - earlier. */ - - inner_vbox = gtk_vbox_new(FALSE, 0); - reflow->canvas = e_canvas_new(); - reflow->rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( reflow->canvas ) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - reflow->reflow = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( reflow->canvas ) ), - e_reflow_get_type(), - "height", (double) 100, - "minimum_width", (double) 100, - NULL ); - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( reflow->canvas ), "reflow", - GTK_SIGNAL_FUNC( resize ), - ( gpointer ) view); - - for ( i = 0; i < view->model->data_count; i++ ) - { - GnomeCanvasItem *item; - item = gnome_canvas_item_new( GNOME_CANVAS_GROUP(reflow->reflow), - e_minicard_get_type(), - "model", view->model, - "row", i, - NULL); - e_reflow_add_item(E_REFLOW(reflow->reflow), item); - } - gnome_canvas_set_scroll_region ( GNOME_CANVAS( reflow->canvas ), - 0, 0, - 100, 100 ); - - scrollbar = gtk_hscrollbar_new(gtk_layout_get_hadjustment(GTK_LAYOUT(reflow->canvas))); - - gtk_signal_connect( GTK_OBJECT( reflow->canvas ), "size_allocate", - GTK_SIGNAL_FUNC( allocate_callback ), - ( gpointer ) view ); - - gdk_window_set_back_pixmap( GTK_LAYOUT(reflow->canvas)->bin_window, NULL, FALSE); - - reflow->model_changed_id = gtk_signal_connect(GTK_OBJECT( view->model ), "model_changed", - GTK_SIGNAL_FUNC(rebuild_reflow), view); - - gtk_object_ref(GTK_OBJECT(view->model)); - - /* Build the gtk widget hierarchy. */ - gtk_box_pack_start(GTK_BOX(inner_vbox), reflow->canvas, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(inner_vbox), scrollbar, FALSE, FALSE, 0); - - return inner_vbox; -} - -/* We create a window containing our new table. */ -static GtkWidget * -create_table(View *view) -{ - ECell *cell_left_just; - ETableHeader *e_table_header; - GtkWidget *e_table; - int i; - - view->type = VIEW_TYPE_TABLE; - - /* - 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(view->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 < LAST_COL; i++){ - /* Create the column. */ - ETableCol *ecol = e_table_col_new ( - i, headers [i], - 80, 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 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_from_spec_file (e_table_header, E_TABLE_MODEL(view->model), "spec"); - -#if 0 - gtk_signal_connect(GTK_OBJECT(E_TABLE(e_table)->sort_info), "sort_info_changed", - GTK_SIGNAL_FUNC(queue_header_save), e_table->sort_info); - - gtk_signal_connect(GTK_OBJECT(E_TABLE(e_table)->header), "structure_change", - GTK_SIGNAL_FUNC(queue_header_save), e_table->sort_info); - gtk_signal_connect(GTK_OBJECT(E_TABLE(e_table)->header), "dimension_change", - GTK_SIGNAL_FUNC(queue_header_save), e_table->sort_info); -#endif - - return e_table; -} - -static void -change_type(View *view, ViewType type) -{ - gtk_object_ref(GTK_OBJECT(view->model)); - if (view->reflow) - destroy_reflow(view); - gtk_widget_destroy(view->child); - switch(type) { - case VIEW_TYPE_REFLOW: - view->child = create_reflow(view); - break; - case VIEW_TYPE_TABLE: - view->child = create_table(view); - break; - } - gtk_container_add(GTK_CONTAINER(view->frame), view->child); - gtk_widget_show_all(view->child); - gtk_object_unref(GTK_OBJECT(view->model)); -} - -static void -change_callback(GtkWidget *button, View *view) -{ - if (view->type == VIEW_TYPE_REFLOW) - change_type(view, VIEW_TYPE_TABLE); - else - change_type(view, VIEW_TYPE_REFLOW); -} - -static GtkWidget * -create_window(char *filename, ViewType type) -{ - GtkWidget *button; - GtkWidget *change_button; - GtkWidget *vbox; - View *view = g_new(View, 1); - - view->reflow = NULL; - - view->model = get_model(filename); - - /* Here we create a window for our new table. This window - will get shown and the person will be able to test their - item. */ - view->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - - gtk_signal_connect( GTK_OBJECT( view->window ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - view ); - - /* This frame is simply to get a bevel around our table. */ - view->frame = gtk_frame_new (NULL); - - switch(type) { - case VIEW_TYPE_REFLOW: - view->child = create_reflow(view); - break; - case VIEW_TYPE_TABLE: - view->child = create_table(view); - break; - } - - - vbox = gtk_vbox_new(FALSE, 0); - - button = gtk_button_new_with_label("Add address"); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(add_address_cb), view); - - change_button = gtk_button_new_with_label("Change View"); - gtk_signal_connect(GTK_OBJECT(change_button), "clicked", - GTK_SIGNAL_FUNC(change_callback), view); - - /* Build the gtk widget hierarchy. */ - - gtk_container_add (GTK_CONTAINER (view->frame), view->child); - gtk_box_pack_start (GTK_BOX (vbox), view->frame, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (vbox), change_button, FALSE, FALSE, 0); - gtk_container_add (GTK_CONTAINER (view->window), vbox); - - /* Size the initial window. */ - gtk_widget_set_usize (view->window, 200, 200); - /* Show it all. */ - gtk_widget_show_all (view->window); - gtk_object_ref(GTK_OBJECT(view->model)); - gtk_object_sink(GTK_OBJECT(view->model)); - window_count ++; - return view->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_window("addressbook.xml", VIEW_TYPE_TABLE); - create_window("addressbook.xml", VIEW_TYPE_TABLE); - create_window("addressbook.xml", VIEW_TYPE_TABLE); - create_window("addressbook.xml", VIEW_TYPE_REFLOW); - create_window("addressbook.xml", VIEW_TYPE_REFLOW); - create_window("addressbook2.xml", VIEW_TYPE_TABLE); - create_window("addressbook2.xml", VIEW_TYPE_REFLOW); - - gtk_main (); - - e_cursors_shutdown (); - return 0; -} diff --git a/addressbook/demo/e-test-model.c b/addressbook/demo/e-test-model.c deleted file mode 100644 index 941e1c006f..0000000000 --- a/addressbook/demo/e-test-model.c +++ /dev/null @@ -1,385 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * - * Author: - * Miguel de Icaza (miguel@gnu.org) - * - * (C) 1999 Helix Code, Inc. - */ - -#include <config.h> -#include "e-test-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() -/* - * ETestModel callbacks -n * These are the callbacks that define the behavior of our custom model. - */ - -static void -test_destroy(GtkObject *object) -{ - ETestModel *model = E_TEST_MODEL(object); - int i; - if (model->book) - gtk_object_unref(GTK_OBJECT(model->book)); - if (model->book_view) - gtk_object_unref(GTK_OBJECT(model->book_view)); - for ( i = 0; i < model->data_count; i++ ) { - gtk_object_unref(GTK_OBJECT(model->data[i])); - } - g_free(model->data); - g_free(model->uri); -} - -/* This function returns the number of columns in our ETableModel. */ -static int -test_col_count (ETableModel *etc) -{ - return LAST_COL; -} - -/* This function returns the number of rows in our ETableModel. */ -static int -test_row_count (ETableModel *etc) -{ - ETestModel *test = E_TEST_MODEL(etc); - return test->data_count; -} - -/* This function returns the value at a particular point in our ETableModel. */ -static void * -test_value_at (ETableModel *etc, int col, int row) -{ - ETestModel *test = E_TEST_MODEL(etc); - ECardList *list; - ECardIterator *iterator; - gchar *string; - if ( col >= LAST_COL || row >= test->data_count ) - return NULL; - switch (col) { - case EMAIL: - gtk_object_get(GTK_OBJECT(test->data[row]), - "email", &list, - NULL); - iterator = e_card_list_get_iterator(list); - if (e_card_iterator_get(iterator)) - return (void *) e_card_iterator_get(iterator); - else - return ""; - gtk_object_unref(GTK_OBJECT(iterator)); - break; - case FULL_NAME: - gtk_object_get(GTK_OBJECT(test->data[row]), - "full_name", &string, - NULL); - if (string) - return string; - else - return ""; - break; - case STREET: - gtk_object_get(GTK_OBJECT(test->data[row]), - "street", &list, - NULL); - iterator = e_card_list_get_iterator(list); - if (e_card_iterator_get(iterator)) - return ((ECardDeliveryAddress *)e_card_iterator_get(iterator))->street; - else - return ""; - gtk_object_unref(GTK_OBJECT(iterator)); - break; - case PHONE: - gtk_object_get(GTK_OBJECT(test->data[row]), - "phone", &list, - NULL); - iterator = e_card_list_get_iterator(list); - if (e_card_iterator_get(iterator)) - return ((ECardPhone *)e_card_iterator_get(iterator))->number; - else - return ""; - gtk_object_unref(GTK_OBJECT(iterator)); - break; - default: - return NULL; - } -} - -/* This function sets the value at a particular point in our ETableModel. */ -static void -test_set_value_at (ETableModel *etc, int col, int row, const void *val) -{ - ETestModel *test = E_TEST_MODEL(etc); - ECardList *list; - ECardIterator *iterator; - if ( col >= LAST_COL || row >= test->data_count ) - return; - switch (col) { - case EMAIL: - gtk_object_get(GTK_OBJECT(test->data[row]), - "email", &list, - NULL); - iterator = e_card_list_get_iterator(list); - if (e_card_iterator_is_valid(iterator)) { - e_card_iterator_set(iterator, val); - } else { - e_card_list_append(list, val); - } - gtk_object_unref(GTK_OBJECT(iterator)); - break; - case FULL_NAME: - gtk_object_set(GTK_OBJECT(test->data[row]), - "full_name", val, - NULL); - break; - case STREET: - gtk_object_get(GTK_OBJECT(test->data[row]), - "address", &list, - NULL); - iterator = e_card_list_get_iterator(list); - if (e_card_iterator_is_valid(iterator)) { - const ECardDeliveryAddress *address = e_card_iterator_get(iterator); - ECardDeliveryAddress *address_copy = e_card_delivery_address_copy(address); - g_free(address_copy->street); - address_copy->street = g_strdup(val); - e_card_iterator_set(iterator, address_copy); - e_card_delivery_address_free(address_copy); - } else { - ECardDeliveryAddress *address = g_new(ECardDeliveryAddress, 1); - address->po = NULL; - address->ext = NULL; - address->street = g_strdup(val); - address->city = NULL; - address->region = NULL; - address->code = NULL; - address->country = NULL; - address->flags = 0; - e_card_list_append(list, address); - e_card_delivery_address_free(address); - } - gtk_object_unref(GTK_OBJECT(iterator)); - break; - case PHONE: - gtk_object_get(GTK_OBJECT(test->data[row]), - "phone", &list, - NULL); - iterator = e_card_list_get_iterator(list); - if (e_card_iterator_is_valid(iterator)) { - const ECardPhone *phone = e_card_iterator_get(iterator); - ECardPhone *phone_copy = e_card_phone_copy(phone); - g_free(phone_copy->number); - phone_copy->number = g_strdup(val); - e_card_iterator_set(iterator, phone_copy); - e_card_phone_free(phone_copy); - } else { - ECardPhone *phone = g_new(ECardPhone, 1); - phone->number = g_strdup(val); - phone->flags = 0; - e_card_list_append(list, phone); - e_card_phone_free(phone); - } - gtk_object_unref(GTK_OBJECT(iterator)); - break; - default: - return; - } - e_book_commit_card(test->book, test->data[row], NULL, NULL); - if ( !etc->frozen ) - e_table_model_cell_changed(etc, col, row); -} - -/* This function returns whether a particular cell is editable. */ -static gboolean -test_is_cell_editable (ETableModel *etc, int col, int row) -{ - return TRUE; -} - -/* This function duplicates the value passed to it. */ -static void * -test_duplicate_value (ETableModel *etc, int col, const void *value) -{ - return g_strdup(value); -} - -/* This function frees the value passed to it. */ -static void -test_free_value (ETableModel *etc, int col, void *value) -{ - g_free(value); -} - -/* This function is for when the model is unfrozen. This can mostly - be ignored for simple models. */ -static void -test_thaw (ETableModel *etc) -{ - e_table_model_changed(etc); -} - -static void -e_test_model_class_init (GtkObjectClass *object_class) -{ - ETableModelClass *model_class = (ETableModelClass *) object_class; - - object_class->destroy = test_destroy; - - model_class->column_count = test_col_count; - model_class->row_count = test_row_count; - model_class->value_at = test_value_at; - model_class->set_value_at = test_set_value_at; - model_class->is_cell_editable = test_is_cell_editable; - model_class->duplicate_value = test_duplicate_value; - model_class->free_value = test_free_value; - model_class->thaw = test_thaw; -} - -static void -e_test_model_init (GtkObject *object) -{ - ETestModel *model = E_TEST_MODEL(object); - model->data = NULL; - model->data_count = 0; - model->book = NULL; - model->book_view = NULL; -} - -GtkType -e_test_model_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "ETestModel", - sizeof (ETestModel), - sizeof (ETestModelClass), - (GtkClassInitFunc) e_test_model_class_init, - (GtkObjectInitFunc) e_test_model_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -void -e_test_model_add_column (ETestModel *model, Address *newadd) -{ -#if 0 - model->data = g_realloc(model->data, (++model->data_count) * sizeof(Address *)); - model->data[model->data_count - 1] = newadd; - e_test_model_queue_save(model); - if ( model && !E_TABLE_MODEL(model)->frozen ) - e_table_model_changed(E_TABLE_MODEL(model)); -#endif -} - -static void -e_test_model_card_added(EBookView *book_view, - const GList *cards, - ETestModel *model) -{ - model->data = g_realloc(model->data, (model->data_count + g_list_length((GList *)cards)) * sizeof(ECard *)); - for ( ; cards; cards = cards->next) { - gtk_object_ref(GTK_OBJECT(cards->data)); - model->data[model->data_count++] = E_CARD (cards->data); - } - e_table_model_changed(E_TABLE_MODEL(model)); -} - -static void -e_test_model_card_removed(EBookView *book_view, - const char *id, - ETestModel *model) -{ - int i; - for ( i = 0; i < model->data_count; i++) { - if ( !strcmp(e_card_get_id(model->data[i]), id) ) { - gtk_object_unref(GTK_OBJECT(model->data[i])); - memmove(model->data + i, model->data + i + 1, (model->data_count - i - 1) * sizeof (ECard *)); - } - } - e_table_model_changed(E_TABLE_MODEL(model)); -} - -static void -e_test_model_card_changed(EBookView *book_view, - const GList *cards, - ETestModel *model) -{ - for ( ; cards; cards = cards->next) { - int i; - for ( i = 0; i < model->data_count; i++) { - if ( !strcmp(e_card_get_id(model->data[i]), e_card_get_id(E_CARD(cards->data))) ) { - gtk_object_unref(GTK_OBJECT(model->data[i])); - model->data[i] = E_CARD(cards->data); - gtk_object_ref(GTK_OBJECT(model->data[i])); - e_table_model_row_changed(E_TABLE_MODEL(model), i); - break; - } - } - } -} - -static void -e_test_model_book_respond_get_view(EBook *book, - EBookStatus status, - EBookView *book_view, - ETestModel *model) -{ - if (status == E_BOOK_STATUS_SUCCESS) { - model->book_view = book_view; - gtk_object_ref(GTK_OBJECT(book_view)); - gtk_signal_connect(GTK_OBJECT(book_view), - "card_changed", - GTK_SIGNAL_FUNC(e_test_model_card_changed), - model); - gtk_signal_connect(GTK_OBJECT(book_view), - "card_removed", - GTK_SIGNAL_FUNC(e_test_model_card_removed), - model); - gtk_signal_connect(GTK_OBJECT(book_view), - "card_added", - GTK_SIGNAL_FUNC(e_test_model_card_added), - model); - } -} - -static void -e_test_model_uri_loaded(EBook *book, - EBookStatus status, - ETestModel *model) -{ - if (status == E_BOOK_STATUS_SUCCESS) { - e_book_get_book_view (book, - "", - (EBookBookViewCallback) e_test_model_book_respond_get_view, - model); - } -} - -ETableModel * -e_test_model_new (gchar *uri) -{ - ETestModel *et; - - et = gtk_type_new (e_test_model_get_type ()); - - et->uri = g_strdup(uri); - et->book = e_book_new(); - e_book_load_uri(et->book, - et->uri, - (EBookCallback) e_test_model_uri_loaded, - et); - - return E_TABLE_MODEL(et); -} diff --git a/addressbook/demo/e-test-model.h b/addressbook/demo/e-test-model.h deleted file mode 100644 index 871ea11de8..0000000000 --- a/addressbook/demo/e-test-model.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_TEST_MODEL_H_ -#define _E_TEST_MODEL_H_ - -#include "e-table-model.h" -#include <e-book.h> -#include <e-book-view.h> -#include <e-card.h> - -#define E_TEST_MODEL_TYPE (e_test_model_get_type ()) -#define E_TEST_MODEL(o) (GTK_CHECK_CAST ((o), E_TEST_MODEL_TYPE, ETestModel)) -#define E_TEST_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TEST_MODEL_TYPE, ETestModelClass)) -#define E_IS_TEST_MODEL(o) (GTK_CHECK_TYPE ((o), E_TEST_MODEL_TYPE)) -#define E_IS_TEST_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TEST_MODEL_TYPE)) - -/* Virtual Column list: - 0 Email - 1 Full Name - 2 Street - 3 Phone -*/ -typedef struct _Address Address; -typedef enum _Rows Rows; - -struct _Address { - gchar *email; - gchar *full_name; - gchar *street; - gchar *phone; -}; - -enum _Rows { - EMAIL, - FULL_NAME, - STREET, - PHONE, - LAST_COL -}; - -typedef struct { - ETableModel parent; - - EBook *book; - - EBookView *book_view; - - ECard **data; - int data_count; - - char *uri; -} ETestModel; - - -typedef struct { - ETableModelClass parent_class; -} ETestModelClass; - - -GtkType e_test_model_get_type (void); -ETableModel *e_test_model_new (char *uri); - -void e_test_model_add_column (ETestModel *model, Address *newadd); - -#endif /* _E_TEST_MODEL_H_ */ diff --git a/addressbook/demo/spec b/addressbook/demo/spec deleted file mode 100644 index 2d366ed75f..0000000000 --- a/addressbook/demo/spec +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0"?> -<ETableSpecification> - <columns-shown> - <column>1</column> - <column>0</column> - <column>2</column> - <column>3</column> - </columns-shown> - <grouping> - <leaf column="2" ascending="1"/> - </grouping> -</ETableSpecification> diff --git a/addressbook/ename/.cvsignore b/addressbook/ename/.cvsignore deleted file mode 100644 index 4f8c173841..0000000000 --- a/addressbook/ename/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la -test-ename-western -test-ename-western-gtk diff --git a/addressbook/ename/Makefile.am b/addressbook/ename/Makefile.am deleted file mode 100644 index 25a67a929c..0000000000 --- a/addressbook/ename/Makefile.am +++ /dev/null @@ -1,50 +0,0 @@ -INCLUDES = \ - -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ - -DG_LOG_DOMAIN=\"EName\" \ - -I$(srcdir) \ - -I$(srcdir)/.. \ - -I$(top_srcdir) \ - -I. \ - -I.. \ - -I$(top_builddir) \ - -I$(includedir) \ - $(GNOME_INCLUDEDIR) - -gnome_libs = \ - $(BONOBO_GNOME_LIBS) \ - $(INTLLIBS) - -ename_libs = \ - libename.la \ - $(gnome_libs) - -lib_LTLIBRARIES = libename.la - -libename_la_SOURCES = \ - e-name-western.c - -libenameincludedir = $(includedir)/ename - -libenameinclude_HEADERS = \ - e-name-western-tables.h \ - e-name-western.h - - -noinst_LTLIBRARIES = libename-static.la -libename_static_la_SOURCES = $(libename_la_SOURCES) -libename_static_la_LDFLAGS = --all-static - - -noinst_PROGRAMS = \ - test-ename-western \ - test-ename-western-gtk - -test_ename_western_SOURCES = \ - test-ename-western.c - -test_ename_western_LDADD = $(ename_libs) - -test_ename_western_gtk_SOURCES = \ - test-ename-western-gtk.c - -test_ename_western_gtk_LDADD = $(ename_libs) $(gnome_libs) diff --git a/addressbook/ename/TODO b/addressbook/ename/TODO deleted file mode 100644 index 669661eea7..0000000000 --- a/addressbook/ename/TODO +++ /dev/null @@ -1,2 +0,0 @@ -* Support other naming systems. -* Handle misspelled suffixes better. diff --git a/addressbook/ename/e-name-western-tables.h b/addressbook/ename/e-name-western-tables.h deleted file mode 100644 index bb29cc5292..0000000000 --- a/addressbook/ename/e-name-western-tables.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef __E_NAME_WESTERN_TABLES_H__ -#define __E_NAME_WESTERN_TABLES_H__ - -char *e_name_western_pfx_table[] = { - - /* - * English. - */ - "mister", "miss.", "mr.", "mrs.", "ms.", - "miss", "mr", "mrs", "ms", "sir", - "professor", "prof.", "dr", "dr.", "doctor", - "reverend", "president", "judge", "senator", - "congressman", "congresswoman", "commander", - "lieutenant", "colonel", "major", "general", - - "the honorable", "the reverend", "his holiness", - "his eminence", - - - /* - * French. - */ - "monsieur", "mr.", "mademoiselle", "melle.", - "madame", "mme.", "professeur", - - /* - * Spanish. - */ - "senor", "senora", "senorita", - - NULL}; - -char *e_name_western_sfx_table[] = { - - /* - * English. - */ - "junior", "senior", "jr", "sr", "I", "II", "III", "IV", "V", - "phd", "ms", "md", "esq", "esq.", "esquire", - - NULL}; - -char *e_name_western_twopart_sfx_table[] = { - - /* - * English. - */ - "the first", "the second", "the third", - - NULL}; - -char *e_name_western_complex_last_table[] = {"van", "von", "de", NULL}; - -#endif /* ! __E_NAME_WESTERN_TABLES_H__ */ diff --git a/addressbook/ename/e-name-western.c b/addressbook/ename/e-name-western.c deleted file mode 100644 index 698cceec0b..0000000000 --- a/addressbook/ename/e-name-western.c +++ /dev/null @@ -1,868 +0,0 @@ -/* - * A simple Western name parser. - * - * <Nat> Jamie, do you know anything about name parsing? - * <jwz> Are you going down that rat hole? Bring a flashlight. - * - * Author: - * Nat Friedman (nat@helixcode.com) - * - * Copyright 1999, Helix Code, Inc. - */ - -#include <ctype.h> -#include <string.h> -#include <glib.h> - -#include <ename/e-name-western.h> -#include <ename/e-name-western-tables.h> - -typedef struct { - int prefix_idx; - int first_idx; - int middle_idx; - int nick_idx; - int last_idx; - int suffix_idx; -} ENameWesternIdxs; - -static int -e_name_western_str_count_words (char *str) -{ - int word_count; - char *p; - - word_count = 0; - - for (p = str; p != NULL; p = strchr (p, ' ')) { - word_count ++; - p ++; - } - - return word_count; -} - -static void -e_name_western_cleanup_string (char **str) -{ - char *newstr; - char *p; - - if (*str == NULL) - return; - - /* skip any spaces and commas at the start of the string */ - p = *str; - while (isspace (*p) || *p == ',') - p ++; - - /* make the copy we're going to return */ - newstr = g_strdup (p); - - if ( strlen(newstr) > 0) { - /* now search from the back, skipping over any spaces and commas */ - p = newstr + strlen (newstr) - 1; - while (isspace (*p) || *p == ',') - p --; - /* advance p to after the character that caused us to exit the - previous loop, and end the string. */ - if ((! isspace (*p)) && *p != ',') - p ++; - *p = '\0'; - } - - g_free (*str); - *str = newstr; -} - -static char * -e_name_western_get_words_at_idx (char *str, int idx, int num_words) -{ - char *words; - char *p; - int word_count; - int words_len; - - /* - * Walk to the end of the words. - */ - word_count = 0; - p = str + idx; - while (word_count < num_words && *p != '\0') { - while (! isspace (*p) && *p != '\0') - p ++; - - while (isspace (*p) && *p != '\0') - p ++; - - word_count ++; - } - - words_len = p - str - idx - 1; - - if (*p == '\0') - words_len ++; - - words = g_malloc0 (1 + words_len); - strncpy (words, str + idx, words_len); - - return words; -} - -/* - * What the fuck is wrong with glib's MAX macro. - */ -static int -e_name_western_max (const int a, const int b) -{ - if (a > b) - return a; - - return b; -} - -static gboolean -e_name_western_word_is_suffix (char *word) -{ - int i; - - for (i = 0; e_name_western_sfx_table [i] != NULL; i ++) { - if (g_strcasecmp (word, e_name_western_sfx_table [i])) - continue; - - return TRUE; - } - - return FALSE; -} - -static char * -e_name_western_get_one_prefix_at_str (char *str) -{ - char *word; - int i; - - /* - * Check for prefixes from our table. - */ - for (i = 0; e_name_western_pfx_table [i] != NULL; i ++) { - int pfx_words; - char *words; - - pfx_words = e_name_western_str_count_words (e_name_western_pfx_table [i]); - words = e_name_western_get_words_at_idx (str, 0, pfx_words); - - if (! g_strcasecmp (words, e_name_western_pfx_table [i])) - return words; - - g_free (words); - } - - /* - * Check for prefixes we don't know about. These are always a - * sequence of more than one letters followed by a period. - */ - word = e_name_western_get_words_at_idx (str, 0, 1); - - if (strlen (word) > 2 && isalpha (word [0]) && isalpha (word [1]) && - word [strlen (word) - 1] == '.') - return word; - - g_free (word); - - return NULL; -} - -static char * -e_name_western_get_prefix_at_str (char *str) -{ - char *pfx; - char *pfx1; - char *pfx2; - char *p; - - /* Get the first prefix. */ - pfx1 = e_name_western_get_one_prefix_at_str (str); - - if (pfx1 == NULL) - return NULL; - - /* Check for a second prefix. */ - p = str + strlen (pfx1); - while (isspace (*p) && *p != '\0') - p ++; - - pfx2 = e_name_western_get_one_prefix_at_str (p); - - if (pfx2 != NULL) { - int pfx_len; - - pfx_len = (p + strlen (pfx2)) - str; - pfx = g_malloc0 (pfx_len + 1); - strncpy (pfx, str, pfx_len); - } else { - pfx = g_strdup (pfx1); - } - - g_free (pfx1); - g_free (pfx2); - - return pfx; -} - -static void -e_name_western_extract_prefix (ENameWestern *name, ENameWesternIdxs *idxs) -{ - char *pfx; - - pfx = e_name_western_get_prefix_at_str (name->full); - - if (pfx == NULL) - return; - - idxs->prefix_idx = 0; - name->prefix = pfx; -} - -static gboolean -e_name_western_is_complex_last_beginning (char *word) -{ - int i; - - for (i = 0; e_name_western_complex_last_table [i] != NULL; i ++) { - - if (! g_strcasecmp ( - word, e_name_western_complex_last_table [i])) - return TRUE; - } - - return FALSE; -} - -static void -e_name_western_extract_first (ENameWestern *name, ENameWesternIdxs *idxs) -{ - /* - * If there's a prefix, then the first name is right after it. - */ - if (idxs->prefix_idx != -1) { - int first_idx; - char *p; - - first_idx = idxs->prefix_idx + strlen (name->prefix); - - /* Skip past white space. */ - p = name->full + first_idx; - while (isspace (*p) && *p != '\0') - p++; - - if (*p == '\0') - return; - - idxs->first_idx = p - name->full; - name->first = e_name_western_get_words_at_idx ( - name->full, idxs->first_idx, 1); - - } else { - - /* - * Otherwise, the first name is probably the first string. - */ - idxs->first_idx = 0; - name->first = e_name_western_get_words_at_idx ( - name->full, idxs->first_idx, 1); - } - - /* - * Check that we didn't just assign the beginning of a - * compound last name to the first name. - */ - if (name->first != NULL) { - if (e_name_western_is_complex_last_beginning (name->first)) { - g_free (name->first); - name->first = NULL; - idxs->first_idx = -1; - } - } -} - -static void -e_name_western_extract_middle (ENameWestern *name, ENameWesternIdxs *idxs) -{ - char *word; - int middle_idx; - - /* - * Middle names can only exist if you have a first name. - */ - if (idxs->first_idx == -1) - return; - - middle_idx = idxs->first_idx + strlen (name->first) + 1; - - if (middle_idx > strlen (name->full)) - return; - - /* - * Search for the first space (or the terminating \0) - */ - while (isspace (name->full [middle_idx]) && - name->full [middle_idx] != '\0') - middle_idx ++; - - if (name->full [middle_idx] == '\0') - return; - - /* - * Skip past the nickname, if it's there. - */ - if (name->full [middle_idx] == '\"') { - if (idxs->nick_idx == -1) - return; - - middle_idx = idxs->nick_idx + strlen (name->nick) + 1; - - while (isspace (name->full [middle_idx]) && - name->full [middle_idx] != '\0') - middle_idx ++; - - if (name->full [middle_idx] == '\0') - return; - } - - /* - * Make sure this isn't the beginning of a complex last name. - */ - word = e_name_western_get_words_at_idx (name->full, middle_idx, 1); - if (e_name_western_is_complex_last_beginning (word)) { - g_free (word); - return; - } - - /* - * Make sure this isn't a suffix. - */ - e_name_western_cleanup_string (& word); - if (e_name_western_word_is_suffix (word)) { - g_free (word); - return; - } - - /* - * Make sure we didn't just grab a cute nickname. - */ - if (word [0] == '\"') { - g_free (word); - return; - } - - idxs->middle_idx = middle_idx; - name->middle = word; -} - -static void -e_name_western_extract_nickname (ENameWestern *name, ENameWesternIdxs *idxs) -{ - int idx; - int start_idx; - char *str; - - if (idxs->first_idx == -1) - return; - - if (idxs->middle_idx > idxs->first_idx) - idx = idxs->middle_idx + strlen (name->middle); - else - idx = idxs->first_idx + strlen (name->first); - - while (name->full [idx] != '\"' && name->full [idx] != '\0') - idx ++; - - if (name->full [idx] != '\"') - return; - - start_idx = idx; - - /* - * Advance to the next double quote. - */ - idx ++; - - while (name->full [idx] != '\"' && name->full [idx] != '\0') - idx ++; - - if (name->full [idx] == '\0') - return; - - str = g_malloc0 (idx - start_idx + 2); - strncpy (str, name->full + start_idx, idx - start_idx + 1); - - name->nick = str; - idxs->nick_idx = start_idx; -} - -static int -e_name_western_last_get_max_idx (ENameWestern *name, ENameWesternIdxs *idxs) -{ - int max_idx = -1; - - if (name->prefix != NULL) - max_idx = e_name_western_max ( - max_idx, idxs->prefix_idx + strlen (name->prefix)); - - if (name->first != NULL) - max_idx = e_name_western_max ( - max_idx, idxs->first_idx + strlen (name->first)); - - if (name->middle != NULL) - max_idx = e_name_western_max ( - max_idx, idxs->middle_idx + strlen (name->middle)); - - if (name->nick != NULL) - max_idx = e_name_western_max ( - max_idx, idxs->nick_idx + strlen (name->nick)); - - return max_idx; -} - -static void -e_name_western_extract_last (ENameWestern *name, ENameWesternIdxs *idxs) -{ - char *word; - int idx = -1; - - idx = e_name_western_last_get_max_idx (name, idxs); - - /* - * In the case where there is no preceding name element, the - * name is either just a first name ("Nat", "John"), is a - * single-element name ("Cher", which we treat as a first - * name), or is just a last name. The only time we can - * differentiate a last name alone from a single-element name - * or a first name alone is if it's a complex last name ("de - * Icaza", "van Josephsen"). So if there is no preceding name - * element, we check to see whether or not the first part of - * the name is the beginning of a complex name. If it is, - * we subsume the entire string. If we accidentally subsume - * the suffix, this will get fixed in the fixup routine. - */ - if (idx == -1) { - word = e_name_western_get_words_at_idx (name->full, 0, 1); - if (! e_name_western_is_complex_last_beginning (word)) { - g_free (word); - return; - } - - name->last = g_strdup (name->full); - idxs->last_idx = 0; - return; - } - - /* Skip past the white space. */ - while (isspace (name->full [idx]) && name->full [idx] != '\0') - idx ++; - - if (name->full [idx] == '\0') - return; - - word = e_name_western_get_words_at_idx (name->full, idx, 1); - e_name_western_cleanup_string (& word); - if (e_name_western_word_is_suffix (word)) { - g_free (word); - return; - } - g_free (word); - - /* - * Subsume the rest of the string into the last name. If we - * accidentally include the prefix, it will get fixed later. - * This is the only way to handle things like "Miguel de Icaza - * Amozorrutia" without dropping data and forcing the user - * to retype it. - */ - name->last = g_strdup (name->full + idx); - idxs->last_idx = idx; -} - -static char * -e_name_western_get_preceding_word (char *str, int idx) -{ - int word_len; - char *word; - char *p; - - p = str + idx; - - while (isspace (*p) && p > str) - p --; - - while (! isspace (*p) && p > str) - p --; - - if (isspace (*p)) - p ++; - - word_len = (str + idx) - p; - word = g_malloc0 (word_len + 1); - if (word_len > 0) - strncpy (word, p, word_len); - - return word; -} - -static char * -e_name_western_get_suffix_at_str_end (char *str) -{ - char *suffix; - char *p; - - /* - * Walk backwards till we reach the beginning of the - * (potentially-comma-separated) list of suffixes. - */ - p = str + strlen (str); - while (1) { - char *nextp; - char *word; - - word = e_name_western_get_preceding_word (str, p - str); - nextp = p - strlen (word) - 1; - - e_name_western_cleanup_string (& word); - - if (e_name_western_word_is_suffix (word)) { - p = nextp; - g_free (word); - } else { - g_free (word); - break; - } - } - - if (p == (str + strlen (str))) - return NULL; - - suffix = g_strdup (p); - e_name_western_cleanup_string (& suffix); - - if (strlen (suffix) == 0) { - g_free (suffix); - return NULL; - } - - return suffix; -} - -static void -e_name_western_extract_suffix (ENameWestern *name, ENameWesternIdxs *idxs) -{ - - name->suffix = e_name_western_get_suffix_at_str_end (name->full); - - if (name->suffix == NULL) - return; - - idxs->suffix_idx = strlen (name->full) - strlen (name->suffix); -} - -static gboolean -e_name_western_detect_backwards (ENameWestern *name, ENameWesternIdxs *idxs) -{ - char *comma; - char *word; - - comma = strchr (name->full, ','); - - if (comma == NULL) - return FALSE; - - /* - * If there's a comma, we need to detect whether it's - * separating the last name from the first or just separating - * suffixes. So we grab the word which comes before the - * comma and check if it's a suffix. - */ - word = e_name_western_get_preceding_word (name->full, comma - name->full); - - if (e_name_western_word_is_suffix (word)) { - g_free (word); - return FALSE; - } - - g_free (word); - return TRUE; -} - -static void -e_name_western_reorder_asshole (ENameWestern *name, ENameWesternIdxs *idxs) -{ - char *prefix; - char *last; - char *suffix; - char *firstmidnick; - char *newfull; - - char *comma; - char *p; - - if (! e_name_western_detect_backwards (name, idxs)) - return; - - /* - * Convert - * <Prefix> <Last name>, <First name> <Middle[+nick] name> <Suffix> - * to - * <Prefix> <First name> <Middle[+nick] name> <Last name> <Suffix> - */ - - /* - * Grab the prefix from the beginning. - */ - prefix = e_name_western_get_prefix_at_str (name->full); - - /* - * Everything from the end of the prefix to the comma is the - * last name. - */ - comma = strchr (name->full, ','); - if (comma == NULL) - return; - - p = name->full + (prefix == NULL ? 0 : strlen (prefix)); - - while (isspace (*p) && *p != '\0') - p ++; - - last = g_malloc0 (comma - p + 1); - strncpy (last, p, comma - p); - - /* - * Get the suffix off the end. - */ - suffix = e_name_western_get_suffix_at_str_end (name->full); - - /* - * Firstmidnick is everything from the comma to the beginning - * of the suffix. - */ - p = comma + 1; - - while (isspace (*p) && *p != '\0') - p ++; - - if (suffix != NULL) { - char *q; - - /* - * Point q at the beginning of the suffix. - */ - q = name->full + strlen (name->full) - strlen (suffix) - 1; - - /* - * Walk backwards until we hit the space which - * separates the suffix from firstmidnick. - */ - while (! isspace (*q) && q > comma) - q --; - - if ((q - p + 1) > 0) { - firstmidnick = g_malloc0 (q - p + 1); - strncpy (firstmidnick, p, q - p); - } else - firstmidnick = NULL; - } else { - firstmidnick = g_strdup (p); - } - - /* - * Create our new reordered version of the name. - */ -#define NULLSTR(a) ((a) == NULL ? "" : (a)) - newfull = g_strdup_printf ("%s %s %s %s", NULLSTR (prefix), NULLSTR (firstmidnick), - NULLSTR (last), NULLSTR (suffix)); - g_strstrip (newfull); - g_free (name->full); - name->full = newfull; - - - g_free (prefix); - g_free (firstmidnick); - g_free (last); - g_free (suffix); -} - -static void -e_name_western_zap_nil (char **str, int *idx) -{ - if (*str == NULL) - return; - - if (strlen (*str) != 0) - return; - - *idx = -1; - g_free (*str); - *str = NULL; -} - -static void -e_name_western_fixup (ENameWestern *name, ENameWesternIdxs *idxs) -{ - /* - * The middle and last names cannot be the same. - */ - if (idxs->middle_idx != -1 && idxs->middle_idx == idxs->last_idx) { - idxs->middle_idx = -1; - g_free (name->middle); - name->middle = NULL; - } - - /* - * If we have a middle name and no last name, then we mistook - * the last name for the middle name. - */ - if (idxs->last_idx == -1 && idxs->middle_idx != -1) { - idxs->last_idx = idxs->middle_idx; - name->last = name->middle; - name->middle = NULL; - idxs->middle_idx = -1; - } - - /* - * Check to see if we accidentally included the suffix in the - * last name. - */ - if (idxs->suffix_idx != -1 && idxs->last_idx != -1 && - idxs->suffix_idx < (idxs->last_idx + strlen (name->last))) { - char *sfx; - - sfx = name->last + (idxs->suffix_idx - idxs->last_idx); - if (sfx != NULL) { - char *newlast; - char *p; - - p = sfx - 1; - while (isspace (*p) && p > name->last) - p --; - p ++; - - newlast = g_malloc0 (p - name->last + 1); - strncpy (newlast, name->last, p - name->last); - g_free (name->last); - name->last = newlast; - } - } - - /* - * If we have a prefix and a first name, but no last name, - * then we need to assign the first name to the last name. - * This way we get things like "Mr Friedman" correctly. - */ - if (idxs->first_idx != -1 && idxs->prefix_idx != -1 && - idxs->last_idx == -1) { - name->last = name->first; - idxs->last_idx = idxs->first_idx; - idxs->first_idx = -1; - name->first = NULL; - } - - /* - * Remove stray spaces and commas (although there don't seem - * to be any in the test cases, they might show up later). - */ - e_name_western_cleanup_string (& name->prefix); - e_name_western_cleanup_string (& name->first); - e_name_western_cleanup_string (& name->middle); - e_name_western_cleanup_string (& name->nick); - e_name_western_cleanup_string (& name->last); - e_name_western_cleanup_string (& name->suffix); - - /* - * Make zero-length strings just NULL. - */ - e_name_western_zap_nil (& name->prefix, & idxs->prefix_idx); - e_name_western_zap_nil (& name->first, & idxs->first_idx); - e_name_western_zap_nil (& name->middle, & idxs->middle_idx); - e_name_western_zap_nil (& name->nick, & idxs->nick_idx); - e_name_western_zap_nil (& name->last, & idxs->last_idx); - e_name_western_zap_nil (& name->suffix, & idxs->suffix_idx); -} - -/** - * e_name_western_western_parse_fullname: - * @full_name: A string containing a Western name. - * - * Parses @full_name and returns an #ENameWestern object filled with - * the component parts of the name. - */ -ENameWestern * -e_name_western_parse (const char *full_name) -{ - ENameWesternIdxs *idxs; - ENameWestern *wname; - - wname = g_new0 (ENameWestern, 1); - - wname->full = g_strdup (full_name); - - idxs = g_new0 (ENameWesternIdxs, 1); - - idxs->prefix_idx = -1; - idxs->first_idx = -1; - idxs->middle_idx = -1; - idxs->nick_idx = -1; - idxs->last_idx = -1; - idxs->suffix_idx = -1; - - /* - * An extremely simple algorithm. - * - * The goal here is to get it right 95% of the time for - * Western names. - * - * First we check to see if this is an ass-backwards name - * ("Prefix Last, First Middle Suffix"). These names really - * suck (imagine "Dr von Johnson, Albert Roderick Jr"), so - * we reorder them first and then parse them. - * - * Next, we grab the most obvious assignments for the various - * parts of the name. Once this is done, we check for stupid - * errors and fix them up. - */ - e_name_western_reorder_asshole (wname, idxs); - - e_name_western_extract_prefix (wname, idxs); - e_name_western_extract_first (wname, idxs); - e_name_western_extract_nickname (wname, idxs); - e_name_western_extract_middle (wname, idxs); - e_name_western_extract_last (wname, idxs); - e_name_western_extract_suffix (wname, idxs); - - e_name_western_fixup (wname, idxs); - - g_free (idxs); - - return wname; -} - -/** - * e_name_western_free: - * @name: An ENameWestern object which needs to be freed. - * - * Deep-frees @name - */ -void -e_name_western_free (ENameWestern *w) -{ - - g_free (w->prefix); - g_free (w->first); - g_free (w->middle); - g_free (w->nick); - g_free (w->last); - g_free (w->suffix); - - g_free (w->full); - - g_free (w); -} diff --git a/addressbook/ename/e-name-western.h b/addressbook/ename/e-name-western.h deleted file mode 100644 index fa5bac494c..0000000000 --- a/addressbook/ename/e-name-western.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __E_NAME_WESTERN_H__ -#define __E_NAME_WESTERN_H__ - -typedef struct { - - /* Public */ - char *prefix; - char *first; - char *middle; - char *nick; - char *last; - char *suffix; - - /* Private */ - char *full; -} ENameWestern; - -ENameWestern *e_name_western_parse (const char *full_name); -void e_name_western_free (ENameWestern *w); - -#endif /* ! __E_NAME_WESTERN_H__ */ diff --git a/addressbook/ename/test-ename-western-gtk.c b/addressbook/ename/test-ename-western-gtk.c deleted file mode 100644 index 17daf42b30..0000000000 --- a/addressbook/ename/test-ename-western-gtk.c +++ /dev/null @@ -1,148 +0,0 @@ -#include <gnome.h> -#include <ename/e-name-western.h> - -ENameWestern *name; -GtkWidget *full; -GtkWidget *prefix; -GtkWidget *first; -GtkWidget *middle; -GtkWidget *nick; -GtkWidget *last; -GtkWidget *suffix; - -static void -fill_entries (void) -{ - -#define SET(a,b) (gtk_entry_set_text (GTK_ENTRY (a), (b) == NULL ? "" : (b))) - SET(prefix, name->prefix); - SET(first, name->first); - SET(middle, name->middle); - SET(nick, name->nick); - SET(last, name->last); - SET(suffix, name->suffix); -} - -static void -full_changed_cb (GtkEntry *fulle) -{ - e_name_western_free (name); - name = e_name_western_parse (gtk_entry_get_text (fulle)); - fill_entries (); -} - -static void -create_window (void) -{ - GtkWidget *app; - GtkTable *table; - - GtkWidget *prefix_label; - GtkWidget *first_label; - GtkWidget *middle_label; - GtkWidget *nick_label; - GtkWidget *last_label; - GtkWidget *suffix_label; - - app = gnome_app_new ("test", "Evolution Western Name Parser"); - - table = GTK_TABLE (gtk_table_new (3, 6, FALSE)); - - full = gtk_entry_new (); - prefix = gtk_entry_new (); - first = gtk_entry_new (); - middle = gtk_entry_new (); - nick = gtk_entry_new (); - last = gtk_entry_new (); - suffix = gtk_entry_new (); - - gtk_widget_set_usize (prefix, 100, 0); - gtk_widget_set_usize (first, 100, 0); - gtk_widget_set_usize (middle, 100, 0); - gtk_widget_set_usize (nick, 100, 0); - gtk_widget_set_usize (last, 100, 0); - gtk_widget_set_usize (suffix, 100, 0); - - gtk_table_attach (table, full, 0, 6, 0, 1, - GTK_EXPAND | GTK_FILL, 0, - 0, 0); - - gtk_table_attach (table, prefix, 0, 1, 1, 2, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, - 0, 0); - - gtk_table_attach (table, first, 1, 2, 1, 2, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, - 0, 0); - - gtk_table_attach (table, middle, 2, 3, 1, 2, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, - 0, 0); - - gtk_table_attach (table, nick, 3, 4, 1, 2, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, - 0, 0); - - gtk_table_attach (table, last, 4, 5, 1, 2, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, - 0, 0); - - gtk_table_attach (table, suffix, 5, 6, 1, 2, - GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, - 0, 0); - - prefix_label = gtk_label_new ("Prefix"); - first_label = gtk_label_new ("First"); - middle_label = gtk_label_new ("Middle"); - nick_label = gtk_label_new ("Nick"); - last_label = gtk_label_new ("Last"); - suffix_label = gtk_label_new ("Suffix"); - - gtk_table_attach (table, prefix_label, 0, 1, 2, 3, - GTK_SHRINK, 0, - 0, 0); - - gtk_table_attach (table, first_label, 1, 2, 2, 3, - GTK_SHRINK, 0, - 0, 0); - - gtk_table_attach (table, middle_label, 2, 3, 2, 3, - GTK_SHRINK, 0, - 0, 0); - - gtk_table_attach (table, nick_label, 3, 4, 2, 3, - GTK_SHRINK, 0, - 0, 0); - - gtk_table_attach (table, last_label, 4, 5, 2, 3, - GTK_SHRINK, 0, - 0, 0); - - gtk_table_attach (table, suffix_label, 5, 6, 2, 3, - GTK_SHRINK, 0, - 0, 0); - - gnome_app_set_contents (GNOME_APP (app), GTK_WIDGET (table)); - - gtk_widget_show_all (app); - - gtk_entry_set_text (GTK_ENTRY (full), - "The Honorable Doctor van Jacobsen, Albert Roderick \"The Clenched Fist\" Jr, MD, PhD, Esquire"); - - name = e_name_western_parse ("The Honorable Doctor van Jacobsen, Albert Roderick \"The Clenched Fist\" Jr, MD, PhD, Esquire"); - fill_entries (); - - gtk_signal_connect (GTK_OBJECT (full), "changed", full_changed_cb, NULL); -} - -int -main (int argc, char **argv) -{ - gnome_init ("Test EName", "Test EName", argc, argv); - - create_window (); - - gtk_main (); - - return 0; -} diff --git a/addressbook/ename/test-ename-western.c b/addressbook/ename/test-ename-western.c deleted file mode 100644 index 6d3beaf16f..0000000000 --- a/addressbook/ename/test-ename-western.c +++ /dev/null @@ -1,70 +0,0 @@ -#include <gnome.h> -#include <ctype.h> - -#include <ename/e-name-western.h> - -static void -do_name (char *n) -{ - ENameWestern *wname; - - wname = e_name_western_parse (n); - - printf ("Full Name: [%s]\n", n); - - printf ("Prefix: [%s]\n", wname->prefix); - printf ("First: [%s]\n", wname->first); - printf ("Middle: [%s]\n", wname->middle); - printf ("Nick: [%s]\n", wname->nick); - printf ("Last: [%s]\n", wname->last); - printf ("Suffix: [%s]\n", wname->suffix); - - printf ("\n"); - - e_name_western_free (wname); -} - -int -main (int argc, char **argv) -{ - if (argc == 2) { - while (! feof (stdin)) { - char s[256]; - - if (fgets (s, sizeof (s), stdin) == NULL) - return 0; - - g_strstrip (s); - - do_name (s); - } - - return 0; - } - - do_name ("Nat"); - do_name ("Karl Anders Carlsson"); - do_name ("Miguel de Icaza Amozorrutia"); - do_name ("The Honorable Doctor de Icaza, Miguel \"Sparky\" Junior, PhD, MD"); - do_name ("Nat Friedman MD, Phd"); - do_name ("Nat Friedman PhD"); - do_name ("Friedman, Nat"); - do_name ("Miguel de Icaza Esquire"); - do_name ("Dr Miguel \"Sparky\" de Icaza"); - do_name ("Robert H.B. Netzer"); - do_name ("W. Richard Stevens"); - do_name ("Nat Friedman"); - do_name ("N. Friedman"); - do_name ("Miguel de Icaza"); - do_name ("Drew Johnson"); - do_name ("President Bill \"Slick Willy\" Clinton"); - do_name ("The Honorable Mark J. Einstein Jr"); - do_name ("Friedman, Nat"); - do_name ("de Icaza, Miguel"); - do_name ("Mr de Icaza, Miguel"); - do_name ("Smith, John Jr"); - do_name ("Nick Glennie-Smith"); - do_name ("Dr von Johnson, Albert Roderick Jr"); - - return 0; -} diff --git a/addressbook/gui/.cvsignore b/addressbook/gui/.cvsignore deleted file mode 100644 index 09980ae6ba..0000000000 --- a/addressbook/gui/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.lo -*.la diff --git a/addressbook/gui/Makefile.am b/addressbook/gui/Makefile.am deleted file mode 100644 index a9fdef3273..0000000000 --- a/addressbook/gui/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = minicard search component
\ No newline at end of file diff --git a/addressbook/gui/component/.cvsignore b/addressbook/gui/component/.cvsignore deleted file mode 100644 index a8ecb5d170..0000000000 --- a/addressbook/gui/component/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -*.lo -*.la -evolution-addressbook -evolution-addressbook.pure -test-addressbook diff --git a/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in b/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in deleted file mode 100644 index 4f319fb947..0000000000 --- a/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in +++ /dev/null @@ -1,88 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:control-factory:e_minicard:16bb7c25-c7d2-46dc-a5f0-a0975d0e0595" - type="exe" - location="evolution-addressbook"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/GenericFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Factory for the Addressbook Minicard control"/> - -</oaf_server> - -<oaf_server iid="OAFIID:control:e_minicard:f9542709-fb31-4c6a-bc00-d462ba41e4b9" - type="factory" - location="OAFIID:control-factory:e_minicard:16bb7c25-c7d2-46dc-a5f0-a0975d0e0595"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:Bonobo/Control:1.0"/> - <item value="IDL:Bonobo/PersistStream:1.0"/> - </oaf_attribute> - - <oaf_attribute name="bonobo:supported_mime_types" type="stringv"> - <item value="text/vcard"/> - <item value="text/x-vcard"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Factory for the Evolution addressbook minicard control."/> - -</oaf_server> - -<oaf_server iid="OAFIID:control-factory:addressbook:3e10597b-0591-4d45-b082-d781b7aa6e17" - type="exe" - location="evolution-addressbook"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/GenericFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Factory for the sample Addressbook control"/> - -</oaf_server> - -<oaf_server iid="OAFIID:control:addressbook:851f883b-2fe7-4c94-a1e3-a1f2a7a03c49" - type="factory" - location="OAFIID:control-factory:addressbook:3e10597b-0591-4d45-b082-d781b7aa6e17"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:BonoboControl/addressbook-control:1.0"/> - <item value="IDL:GNOME/Control:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="A sample Bonobo control which displays an addressbook."/> - -</oaf_server> - -<oaf_server iid="OAFIID:evolution-shell-component-factory:addressbook:dbf3bba0-4b0a-4f07-899b-1ec56fdf38a0" - type="exe" - location="evolution-addressbook"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/GenericFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Factory for the Evolution addressbook component."/> - -</oaf_server> - -<oaf_server iid="OAFIID:evolution-shell-component:addressbook:b7a26547-7014-4bb5-98ab-2bcac2bb55ca" - type="factory" - location="OAFIID:evolution-shell-component-factory:addressbook:dbf3bba0-4b0a-4f07-899b-1ec56fdf38a0"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:Evolution/ShellComponent:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Evolution component for handling contacts."/> - -</oaf_server> - -</oaf_info> diff --git a/addressbook/gui/component/GNOME_Evolution_Addressbook.oafinfo b/addressbook/gui/component/GNOME_Evolution_Addressbook.oafinfo deleted file mode 100644 index 4f319fb947..0000000000 --- a/addressbook/gui/component/GNOME_Evolution_Addressbook.oafinfo +++ /dev/null @@ -1,88 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:control-factory:e_minicard:16bb7c25-c7d2-46dc-a5f0-a0975d0e0595" - type="exe" - location="evolution-addressbook"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/GenericFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Factory for the Addressbook Minicard control"/> - -</oaf_server> - -<oaf_server iid="OAFIID:control:e_minicard:f9542709-fb31-4c6a-bc00-d462ba41e4b9" - type="factory" - location="OAFIID:control-factory:e_minicard:16bb7c25-c7d2-46dc-a5f0-a0975d0e0595"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:Bonobo/Control:1.0"/> - <item value="IDL:Bonobo/PersistStream:1.0"/> - </oaf_attribute> - - <oaf_attribute name="bonobo:supported_mime_types" type="stringv"> - <item value="text/vcard"/> - <item value="text/x-vcard"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Factory for the Evolution addressbook minicard control."/> - -</oaf_server> - -<oaf_server iid="OAFIID:control-factory:addressbook:3e10597b-0591-4d45-b082-d781b7aa6e17" - type="exe" - location="evolution-addressbook"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/GenericFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Factory for the sample Addressbook control"/> - -</oaf_server> - -<oaf_server iid="OAFIID:control:addressbook:851f883b-2fe7-4c94-a1e3-a1f2a7a03c49" - type="factory" - location="OAFIID:control-factory:addressbook:3e10597b-0591-4d45-b082-d781b7aa6e17"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:BonoboControl/addressbook-control:1.0"/> - <item value="IDL:GNOME/Control:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="A sample Bonobo control which displays an addressbook."/> - -</oaf_server> - -<oaf_server iid="OAFIID:evolution-shell-component-factory:addressbook:dbf3bba0-4b0a-4f07-899b-1ec56fdf38a0" - type="exe" - location="evolution-addressbook"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/GenericFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Factory for the Evolution addressbook component."/> - -</oaf_server> - -<oaf_server iid="OAFIID:evolution-shell-component:addressbook:b7a26547-7014-4bb5-98ab-2bcac2bb55ca" - type="factory" - location="OAFIID:evolution-shell-component-factory:addressbook:dbf3bba0-4b0a-4f07-899b-1ec56fdf38a0"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:Evolution/ShellComponent:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Evolution component for handling contacts."/> - -</oaf_server> - -</oaf_info> diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am deleted file mode 100644 index 9dc6f10e3a..0000000000 --- a/addressbook/gui/component/Makefile.am +++ /dev/null @@ -1,91 +0,0 @@ -SUBDIRS = select-names - -CPPFLAGS = \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" - -INCLUDES = \ - -DG_LOG_DOMAIN=\"evolution-addressbook\" \ - $(EXTRA_GNOME_CFLAGS) \ - $(GNOME_INCLUDEDIR) \ - -I$(top_srcdir) \ - -I$(top_builddir) \ - -I$(top_srcdir)/shell \ - -I$(top_builddir)/shell \ - -I$(top_srcdir)/widgets/e-text \ - -I$(top_srcdir)/widgets/e-table \ - -I$(top_srcdir)/widgets/misc \ - -I$(top_srcdir)/addressbook/gui/minicard \ - -I$(top_srcdir)/addressbook/contact-editor \ - -I$(top_srcdir)/addressbook/backend \ - -I$(top_builddir)/addressbook/backend \ - $(BONOBO_HTML_GNOME_CFLAGS) \ - -DEVOLUTION_VERSION=\""$(VERSION)"\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(datadir)/locale"\" \ - -DCAMEL_PROVIDERDIR=\""$(providerdir)"\" - -bin_PROGRAMS = \ - evolution-addressbook - -evolution_addressbook_SOURCES = \ - addressbook-component.c \ - addressbook-component.h \ - addressbook-factory.c \ - addressbook.c \ - addressbook.h \ - e-addressbook-model.c \ - e-addressbook-model.h \ - e-cardlist-model.c \ - e-cardlist-model.h \ - e-ldap-server-dialog.c \ - e-ldap-server-dialog.h \ - e-ldap-storage.c \ - e-ldap-storage.h - -evolution_addressbook_LDADD = \ - select-names/libeselectnames.la \ - $(top_builddir)/shell/libeshell.a \ - $(EXTRA_GNOME_LIBS) \ - $(BONOBO_HTML_GNOME_LIBS) \ - $(top_builddir)/addressbook/gui/minicard/libeminicard.a \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/addressbook/ename/libename.la \ - $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/widgets/e-text/libetext.a \ - $(top_builddir)/widgets/e-table/libetable.a \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/addressbook/printing/libecontactprint.a \ - $(top_builddir)/addressbook/gui/search/libeaddressbooksearch.a - -evolution_addressbook_LDFLAGS = `gnome-config --libs gdk_pixbuf` - -if USING_OAF -oafdir = $(datadir)/oaf -oaf_DATA = addressbook.oafinfo -else -gnorbadir = $(sysconfdir)/CORBA/servers -gnorba_DATA = addressbook.gnorba -endif - -gladedir = $(datadir)/evolution/glade -glade_DATA = ldap-server-dialog.glade ldap-server-dialog.glade.h alphabet.glade - -EXTRA_DIST = \ - $(glade_DATA) \ - addressbook.gnorba \ - addressbook.oafinfo \ - alphabet.glade.h - -if ENABLE_PURIFY -PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ - -all-local: evolution-addressbook.pure - -evolution-addressbook.pure: evolution-addressbook - @rm -f evolution-addressbook.pure - $(PLINK) $(evolution_addressbook_LDFLAGS) $(evolution_addressbook_OBJECTS) $(evolution_addressbook_LDADD) $(LIBS) - -endif diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c deleted file mode 100644 index b066330a49..0000000000 --- a/addressbook/gui/component/addressbook-component.c +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* addressbook-component.c - * - * Copyright (C) 2000 Helix Code, 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. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo.h> - -#include "evolution-shell-component.h" -#include "evolution-storage.h" - -#include "addressbook-component.h" -#include "addressbook.h" -#include "e-ldap-storage.h" - - -#ifdef USING_OAF -#define COMPONENT_FACTORY_ID "OAFIID:evolution-shell-component-factory:addressbook:dbf3bba0-4b0a-4f07-899b-1ec56fdf38a0" -#else -#define COMPONENT_FACTORY_ID "evolution-shell-component-factory:addressbook" -#endif - -static BonoboGenericFactory *factory = NULL; - -static const EvolutionShellComponentFolderType folder_types[] = { - { "contacts", "evolution-contacts.png" }, - { NULL, NULL } -}; - - -/* EvolutionShellComponent methods and signals. */ - -static EvolutionShellComponentResult -create_view (EvolutionShellComponent *shell_component, - const char *physical_uri, - const char *type, - BonoboControl **control_return, - void *closure) -{ - BonoboControl *control; - - if (g_strcasecmp (type, "contacts") != 0) - return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE; - - control = addressbook_factory_new_control (); - bonobo_control_set_property (control, "folder_uri", physical_uri, NULL); - - *control_return = control; - - return EVOLUTION_SHELL_COMPONENT_OK; -} - -static int owner_count = 0; - -static void -owner_set_cb (EvolutionShellComponent *shell_component, - EvolutionShellClient *shell_client, - const char *evolution_homedir, - gpointer user_data) -{ - owner_count ++; - - setup_ldap_storage (shell_component, evolution_homedir); -} - -static void -owner_unset_cb (EvolutionShellComponent *shell_component, - Evolution_Shell shell_interface, - gpointer user_data) -{ - owner_count --; - if (owner_count == 0) - gtk_main_quit(); -} - - -/* The factory function. */ - -static BonoboObject * -factory_fn (BonoboGenericFactory *factory, - void *closure) -{ - EvolutionShellComponent *shell_component; - - shell_component = evolution_shell_component_new (folder_types, create_view, NULL, NULL, NULL, NULL); - - gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set", - GTK_SIGNAL_FUNC (owner_set_cb), NULL); - - gtk_signal_connect (GTK_OBJECT (shell_component), "owner_unset", - GTK_SIGNAL_FUNC (owner_unset_cb), NULL); - - return BONOBO_OBJECT (shell_component); -} - - -void -addressbook_component_factory_init (void) -{ - if (factory != NULL) - return; - - factory = bonobo_generic_factory_new (COMPONENT_FACTORY_ID, factory_fn, NULL); - - if (factory == NULL) - g_error ("Cannot initialize the Evolution addressbook factory."); -} - diff --git a/addressbook/gui/component/addressbook-component.h b/addressbook/gui/component/addressbook-component.h deleted file mode 100644 index ec37da694a..0000000000 --- a/addressbook/gui/component/addressbook-component.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* addressbook-component.h - * - * Copyright (C) 2000 Helix Code, 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. - * - * Author: Ettore Perazzoli - */ - -#ifndef _ADDRESSBOOK_COMPONENT_H -#define _ADDRESSBOOK_COMPONENT_H - -void addressbook_component_factory_init (void); - -#endif /* _ADDRESSBOOK_COMPONENT_H */ diff --git a/addressbook/gui/component/addressbook-factory.c b/addressbook/gui/component/addressbook-factory.c deleted file mode 100644 index 7b939318fb..0000000000 --- a/addressbook/gui/component/addressbook-factory.c +++ /dev/null @@ -1,88 +0,0 @@ -/** - * sample-control-factory.c - * - * Copyright 1999, Helix Code, Inc. - * - * Author: - * Nat Friedman (nat@nat.org) - * - */ - -#include <config.h> -#include <gnome.h> -#include <bonobo.h> -#include <glade/glade.h> -#include <e-util/e-cursors.h> - -#include "addressbook.h" -#include "addressbook-component.h" -#include "addressbook/gui/minicard/e-minicard-control.h" -#include "select-names/e-select-names-factory.h" - -#ifdef USING_OAF - -#include <liboaf/liboaf.h> - -static void -init_corba (int *argc, char **argv) -{ - gnome_init_with_popt_table ("evolution-addressbook", "0.0", - *argc, argv, oaf_popt_options, 0, NULL); - - oaf_init (*argc, argv); -} - -#else - -#include <libgnorba/gnorba.h> - -static void -init_corba (int *argc, char **argv) -{ - CORBA_Environment ev; - - CORBA_exception_init (&ev); - - gnome_CORBA_init_with_popt_table ( - "evolution-addressbook", "0.0", - argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); - - CORBA_exception_free (&ev); -} - -#endif - -static void -init_bonobo (int argc, char **argv) -{ - if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) - g_error (_("Could not initialize Bonobo")); - - glade_gnome_init (); -} - -int -main (int argc, char **argv) -{ - init_corba (&argc, argv); - - init_bonobo (argc, argv); - - /* FIXME: Messy names here. This file should be `main.c'. `addressbook.c' should - be `addressbook-control-factory.c' and the functions should be called - `addressbook_control_factory_something()'. And `addressbook-component.c' - should be `addressbook-component-factory.c'. */ - - addressbook_factory_init (); - addressbook_component_factory_init (); - - e_select_names_factory_init (); - - e_minicard_control_factory_init (); - - e_cursors_init(); - - bonobo_main (); - - return 0; -} diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c deleted file mode 100644 index 9c0213edd8..0000000000 --- a/addressbook/gui/component/addressbook.c +++ /dev/null @@ -1,1144 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * addressbook.c: - * - * Author: - * Chris Lahey (clahey@helixcode.com) - * - * (C) 2000 Helix Code, Inc. - */ - -#include <config.h> - -#include <gnome.h> -#include <libgnorba/gnorba.h> -#include <bonobo.h> - -#include "addressbook.h" - -#include <ebook/e-book.h> -#include <e-util/e-util.h> -#include <e-util/e-popup-menu.h> -#include "e-minicard-view-widget.h" -#include "addressbook/gui/search/e-addressbook-search-dialog.h" - -#include <e-table.h> -#include <e-cell-text.h> - -#include <e-scroll-frame.h> - -#include <e-addressbook-model.h> -#include <select-names/e-select-names.h> -#include <select-names/e-select-names-manager.h> -#include "e-contact-editor.h" -#include "e-contact-save-as.h" -#include "e-ldap-server-dialog.h" -#include <libgnomeprint/gnome-print.h> -#include <libgnomeprint/gnome-print-dialog.h> -#include <libgnomeprint/gnome-print-master.h> -#include <libgnomeprint/gnome-print-master-preview.h> - -#include <addressbook/printing/e-contact-print.h> - -#ifdef USING_OAF -#define CONTROL_FACTORY_ID "OAFIID:control-factory:addressbook:3e10597b-0591-4d45-b082-d781b7aa6e17" -#else -#define CONTROL_FACTORY_ID "control-factory:addressbook" -#endif - -#define PROPERTY_FOLDER_URI "folder_uri" - -#define PROPERTY_FOLDER_URI_IDX 1 - -typedef enum { - ADDRESSBOOK_VIEW_NONE, /* initialized to this */ - ADDRESSBOOK_VIEW_TABLE, - ADDRESSBOOK_VIEW_MINICARD -} AddressbookViewType; - -typedef struct { - AddressbookViewType view_type; - EBook *book; - GtkWidget *vbox; - GtkWidget *minicard_hbox; - GtkWidget *minicard_view; - GtkWidget *table; - ETableModel *model; - ECardSimple *simple; - GtkAllocation last_alloc; - BonoboControl *control; - BonoboPropertyBag *properties; - char *uri; -} AddressbookView; - -static void change_view_type (AddressbookView *view, AddressbookViewType view_type); - -static void -control_deactivate (BonoboControl *control, BonoboUIHandler *uih) -{ - /* how to remove a menu item */ - bonobo_ui_handler_menu_remove (uih, "/File/<Print Placeholder>/Print contacts..."); - bonobo_ui_handler_menu_remove (uih, "/File/<Print Placeholder>/separator1"); - bonobo_ui_handler_menu_remove (uih, "/File/TestSelectNames"); - bonobo_ui_handler_menu_remove (uih, "/View/<sep>"); - bonobo_ui_handler_menu_remove (uih, "/View/Toggle View"); - bonobo_ui_handler_menu_remove (uih, "/Actions/New Contact"); -#ifdef HAVE_LDAP - bonobo_ui_handler_menu_remove (uih, "/Actions/New Directory Server"); -#endif - bonobo_ui_handler_menu_remove (uih, "/<Component Placeholder>/Tools"); - bonobo_ui_handler_menu_remove (uih, "/<Component Placeholder>/Tools/Search"); - /* remove our toolbar */ - bonobo_ui_handler_dock_remove (uih, "/Toolbar"); -} - -static void -card_added_cb (EBook* book, EBookStatus status, const char *id, - gpointer user_data) -{ - g_print ("%s: %s(): a card was added\n", __FILE__, __FUNCTION__); -} - -static void -card_modified_cb (EBook* book, EBookStatus status, - gpointer user_data) -{ - g_print ("%s: %s(): a card was modified\n", __FILE__, __FUNCTION__); -} - -/* Callback for the add_card signal from the contact editor */ -static void -add_card_cb (EContactEditor *ce, ECard *card, gpointer data) -{ - EBook *book; - - book = E_BOOK (data); - e_book_add_card (book, card, card_added_cb, NULL); -} - -/* Callback for the commit_card signal from the contact editor */ -static void -commit_card_cb (EContactEditor *ce, ECard *card, gpointer data) -{ - EBook *book; - - book = E_BOOK (data); - e_book_commit_card (book, card, card_modified_cb, NULL); -} - -/* Callback for the delete_card signal from the contact editor */ -static void -delete_card_cb (EContactEditor *ce, ECard *card, gpointer data) -{ - EBook *book; - - book = E_BOOK (data); - e_book_remove_card (book, card, card_modified_cb, NULL); -} - -/* Callback used when the contact editor is closed */ -static void -editor_closed_cb (EContactEditor *ce, gpointer data) -{ - gtk_object_unref (GTK_OBJECT (ce)); -} - -static void -new_contact_cb (BonoboUIHandler *uih, void *user_data, const char *path) -{ - ECard *card; - EBook *book; - EContactEditor *ce; - AddressbookView *view = (AddressbookView *) user_data; - GtkObject *object; - - card = e_card_new(""); - - if (view->minicard_view) - object = GTK_OBJECT(view->minicard_view); - else - object = GTK_OBJECT(view->model); - - gtk_object_get(object, "book", &book, NULL); - g_assert (E_IS_BOOK (book)); - - ce = e_contact_editor_new (card, TRUE); - - gtk_signal_connect (GTK_OBJECT (ce), "add_card", - GTK_SIGNAL_FUNC (add_card_cb), book); - gtk_signal_connect (GTK_OBJECT (ce), "commit_card", - GTK_SIGNAL_FUNC (commit_card_cb), book); - gtk_signal_connect (GTK_OBJECT (ce), "delete_card", - GTK_SIGNAL_FUNC (delete_card_cb), book); - gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", - GTK_SIGNAL_FUNC (editor_closed_cb), NULL); - - gtk_object_sink(GTK_OBJECT(card)); -} - -static void -toggle_view_as_cb (BonoboUIHandler *uih, void *user_data, const char *path) -{ - AddressbookView *view = user_data; - - if (view->view_type == ADDRESSBOOK_VIEW_TABLE) - change_view_type (view, ADDRESSBOOK_VIEW_MINICARD); - else - change_view_type (view, ADDRESSBOOK_VIEW_TABLE); -} - -#ifdef HAVE_LDAP -static void -null_cb (EBook *book, EBookStatus status, gpointer closure) -{ -} - -static void -new_server_cb (BonoboUIHandler *uih, void *user_data, const char *path) -{ - ELDAPServer *server = g_new (ELDAPServer, 1); - EBook *book; - AddressbookView *view = (AddressbookView *) user_data; - GtkObject *object; - - /* fill in the defaults */ - server->name = g_strdup(""); - server->host = g_strdup(""); - server->port = g_strdup_printf("%d", 389); - server->description = g_strdup(""); - server->rootdn = g_strdup(""); - server->uri = g_strdup_printf ("ldap://%s:%s/%s", server->host, server->port, server->rootdn); - e_ldap_server_editor_show (server); - - if (view->minicard_view) - object = GTK_OBJECT(view->minicard_view); - else - object = GTK_OBJECT(view->model); - gtk_object_get(object, "book", &book, NULL); - g_assert (E_IS_BOOK (book)); - - /* write out the new server info */ - e_ldap_storage_add_server (server); - - /* now update the view */ - e_book_unload_uri (book); - if (! e_book_load_uri (book, server->uri, null_cb, NULL)) { - g_warning ("error calling load_uri!\n"); - } -} -#endif - -static void -search_cb (BonoboUIHandler *uih, void *user_data, const char *path) -{ - EBook *book; - AddressbookView *view = (AddressbookView *) user_data; - GtkObject *object; - - if (view->minicard_view) - object = GTK_OBJECT(view->minicard_view); - else - object = GTK_OBJECT(view->model); - gtk_object_get(object, "book", &book, NULL); - g_assert (E_IS_BOOK (book)); - - gtk_widget_show(e_addressbook_search_dialog_new(book)); -} - -static char * -get_query (AddressbookView *view) -{ - GtkObject *object; - char *query = NULL; - - if (view->minicard_view) - object = GTK_OBJECT(view->minicard_view); - else - object = GTK_OBJECT(view->model); - - if (object) - gtk_object_get (object, "query", &query, NULL); - - return query; -} - -static void -set_query (AddressbookView *view, char *query) -{ - GtkObject *object; - - if (view->minicard_view) - object = GTK_OBJECT(view->minicard_view); - else - object = GTK_OBJECT(view->model); - - gtk_object_set (object, - "query", query, - NULL); -} - -static void -set_book(AddressbookView *view) -{ - if (view->book) - gtk_object_set(view->minicard_view ? GTK_OBJECT(view->minicard_view) : GTK_OBJECT(view->model), - "book", view->book, - NULL); -} - -static void -find_contact_cb (BonoboUIHandler *uih, void *user_data, const char *path) -{ - gint result; - GtkWidget* search_entry = gtk_entry_new(); - gchar* search_text; - AddressbookView *view = (AddressbookView *) user_data; - - GtkWidget* dlg = gnome_dialog_new ("Search Contacts", "Find", - GNOME_STOCK_BUTTON_CANCEL, NULL); - - search_text = get_query (view); - gtk_entry_set_text(GTK_ENTRY(search_entry), search_text); - g_free (search_text); - - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox), - search_entry, TRUE, TRUE, 0); - - gtk_widget_show_all (dlg); - - gnome_dialog_close_hides (GNOME_DIALOG (dlg), TRUE); - result = gnome_dialog_run_and_close (GNOME_DIALOG (dlg)); - - /* If the user clicks "okay"...*/ - if (result == 0) { - search_text = gtk_entry_get_text(GTK_ENTRY(search_entry)); - set_query (view, search_text); - } - -} - -static void -card_deleted_cb (EBook* book, EBookStatus status, gpointer user_data) -{ - g_print ("%s: %s(): a card was deleted\n", __FILE__, __FUNCTION__); -} - -static void -delete_contact_cb (BonoboUIHandler *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - if (view->minicard_view) - e_minicard_view_widget_remove_selection (E_MINICARD_VIEW_WIDGET(view->minicard_view), card_deleted_cb, NULL); -} - -static void -e_contact_print_destroy(GnomeDialog *dialog, gpointer data) -{ - ETableScrolled *table = gtk_object_get_data(GTK_OBJECT(dialog), "table"); - EPrintable *printable = gtk_object_get_data(GTK_OBJECT(dialog), "printable"); - gtk_object_unref(GTK_OBJECT(printable)); - gtk_object_unref(GTK_OBJECT(table)); -} - -static void -e_contact_print_button(GnomeDialog *dialog, gint button, gpointer data) -{ - GnomePrintMaster *master; - GnomePrintContext *pc; - EPrintable *printable = gtk_object_get_data(GTK_OBJECT(dialog), "printable"); - GtkWidget *preview; - switch( button ) { - case GNOME_PRINT_PRINT: - master = gnome_print_master_new_from_dialog( GNOME_PRINT_DIALOG(dialog) ); - pc = gnome_print_master_get_context( master ); - e_printable_reset(printable); - while (e_printable_data_left(printable)) { - if (gnome_print_gsave(pc) == -1) - /* FIXME */; - if (gnome_print_translate(pc, .5 * 72, .5 * 72) == -1) - /* FIXME */; - e_printable_print_page(printable, - pc, - 7.5 * 72, - 10.5 * 72, - TRUE); - if (gnome_print_grestore(pc) == -1) - /* FIXME */; - if (gnome_print_showpage(pc) == -1) - /* FIXME */; - } - gnome_print_master_close(master); - gnome_print_master_print(master); - gtk_object_unref(GTK_OBJECT(master)); - gnome_dialog_close(dialog); - break; - case GNOME_PRINT_PREVIEW: - master = gnome_print_master_new_from_dialog( GNOME_PRINT_DIALOG(dialog) ); - pc = gnome_print_master_get_context( master ); - e_printable_reset(printable); - while (e_printable_data_left(printable)) { - if (gnome_print_gsave(pc) == -1) - /* FIXME */; - if (gnome_print_translate(pc, .5 * 72, .5 * 72) == -1) - /* FIXME */; - e_printable_print_page(printable, - pc, - 7.5 * 72, - 10.5 * 72, - TRUE); - if (gnome_print_grestore(pc) == -1) - /* FIXME */; - if (gnome_print_showpage(pc) == -1) - /* FIXME */; - } - gnome_print_master_close(master); - preview = GTK_WIDGET(gnome_print_master_preview_new(master, "Print Preview")); - gtk_widget_show_all(preview); - gtk_object_unref(GTK_OBJECT(master)); - break; - case GNOME_PRINT_CANCEL: - gnome_dialog_close(dialog); - break; - } -} - -static void -print_cb (BonoboUIHandler *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - if (view->minicard_view) { - char *query = get_query(view); - GtkWidget *print = e_contact_print_dialog_new(view->book, query); - g_free(query); - gtk_widget_show_all(print); - } else { - GtkWidget *dialog; - EPrintable *printable; - - dialog = gnome_print_dialog_new("Print cards", GNOME_PRINT_DIALOG_RANGE | GNOME_PRINT_DIALOG_COPIES); - gnome_print_dialog_construct_range_any(GNOME_PRINT_DIALOG(dialog), GNOME_PRINT_RANGE_ALL | GNOME_PRINT_RANGE_SELECTION, - NULL, NULL, NULL); - - printable = e_table_scrolled_get_printable(E_TABLE_SCROLLED(view->table)); - - gtk_object_ref(GTK_OBJECT(view->table)); - - gtk_object_set_data(GTK_OBJECT(dialog), "table", view->table); - gtk_object_set_data(GTK_OBJECT(dialog), "printable", printable); - - gtk_signal_connect(GTK_OBJECT(dialog), - "clicked", GTK_SIGNAL_FUNC(e_contact_print_button), NULL); - gtk_signal_connect(GTK_OBJECT(dialog), - "destroy", GTK_SIGNAL_FUNC(e_contact_print_destroy), NULL); - gtk_widget_show(dialog); - } -} - -static GnomeUIInfo gnome_toolbar [] = { - GNOMEUIINFO_ITEM_STOCK (N_("New"), N_("Create a new contact"), new_contact_cb, GNOME_STOCK_PIXMAP_NEW), - - GNOMEUIINFO_SEPARATOR, - - GNOMEUIINFO_ITEM_STOCK (N_("Find"), N_("Find a contact"), find_contact_cb, GNOME_STOCK_PIXMAP_SEARCH), - GNOMEUIINFO_ITEM_STOCK (N_("Print"), N_("Print contacts"), print_cb, GNOME_STOCK_PIXMAP_PRINT), - GNOMEUIINFO_ITEM_STOCK (N_("Delete"), N_("Delete a contact"), delete_contact_cb, GNOME_STOCK_PIXMAP_TRASH), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_END -}; - - -static void -search_entry_activated (GtkWidget* widget, gpointer user_data) -{ - char* search_word = gtk_entry_get_text(GTK_ENTRY(widget)); - char* search_query; - AddressbookView *view = (AddressbookView *) user_data; - - if (search_word && strlen (search_word)) - search_query = g_strdup_printf ( - "(contains \"x-evolution-any-field\" \"%s\")", - search_word); - else - search_query = g_strdup ( - "(contains \"full_name\" \"\")"); - - set_query(view, search_query); - - g_free (search_query); -} - -static GtkWidget* -make_quick_search_widget (GtkSignalFunc start_search_func, - gpointer user_data_for_search) -{ - GtkWidget *search_vbox = gtk_vbox_new (FALSE, 0); - GtkWidget *search_entry = gtk_entry_new (); - - if (start_search_func) - { - gtk_signal_connect (GTK_OBJECT (search_entry), "activate", - (GtkSignalFunc) search_entry_activated, - user_data_for_search); - } - - /* add the search entry to the our search_vbox */ - gtk_box_pack_start (GTK_BOX (search_vbox), search_entry, - FALSE, TRUE, 3); - gtk_box_pack_start (GTK_BOX (search_vbox), - gtk_label_new("Quick Search"), - FALSE, TRUE, 0); - - return search_vbox; -} - -static void -control_activate (BonoboControl *control, BonoboUIHandler *uih, - AddressbookView *view) -{ - Bonobo_UIHandler remote_uih; - GtkWidget *toolbar, *toolbar_frame; - BonoboControl *toolbar_control; - GnomeDockItemBehavior behavior; - GtkWidget *hbox = gtk_hbox_new (FALSE, 0); - GtkWidget *quick_search_widget; - - remote_uih = bonobo_control_get_remote_ui_handler (control); - bonobo_ui_handler_set_container (uih, remote_uih); - bonobo_object_release_unref (remote_uih, NULL); - - bonobo_ui_handler_menu_new_separator (uih, "/View/<sep>", -1); - - bonobo_ui_handler_menu_new_item (uih, "/File/<Print Placeholder>/Print contacts...", - N_("_Print Contacts..."), - NULL, -1, - BONOBO_UI_HANDLER_PIXMAP_STOCK, - GNOME_STOCK_MENU_PRINT, - 0, 0, print_cb, - (gpointer) view); - - bonobo_ui_handler_menu_new_separator (uih, "/File/<Print Placeholder>/separator1", -1); - - bonobo_ui_handler_menu_new_item (uih, "/View/Toggle View", - N_("As _Table"), - NULL, -1, - BONOBO_UI_HANDLER_PIXMAP_NONE, NULL, - 0, 0, toggle_view_as_cb, - (gpointer)view); - - bonobo_ui_handler_menu_new_item (uih, "/Actions/New Contact", - N_("_New Contact"), - NULL, -1, - BONOBO_UI_HANDLER_PIXMAP_NONE, NULL, - 0, 0, new_contact_cb, - (gpointer)view); - -#ifdef HAVE_LDAP - bonobo_ui_handler_menu_new_item (uih, "/Actions/New Directory Server", - N_("N_ew Directory Server"), - NULL, -1, - BONOBO_UI_HANDLER_PIXMAP_NONE, NULL, - 0, 0, new_server_cb, - (gpointer)view); -#endif - - bonobo_ui_handler_menu_new_subtree (uih, "/<Component Placeholder>/Tools", - _("_Tools"), - NULL, -1, - BONOBO_UI_HANDLER_PIXMAP_NONE, NULL, - 0, 0); - - bonobo_ui_handler_menu_new_item (uih, "/<Component Placeholder>/Tools/Search", - N_("_Search for contacts"), - NULL, -1, - BONOBO_UI_HANDLER_PIXMAP_STOCK, GNOME_STOCK_MENU_SEARCH, - 0, 0, search_cb, - (gpointer)view); - - toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, - GTK_TOOLBAR_BOTH); - - gnome_app_fill_toolbar_with_data (GTK_TOOLBAR (toolbar), - gnome_toolbar, - NULL, view); - - gtk_box_pack_start (GTK_BOX (hbox), toolbar, FALSE, TRUE, 0); - - - /* add the search_vbox to the hbox which will be our toolbar */ - quick_search_widget = make_quick_search_widget ( - search_entry_activated, view); - - gtk_box_pack_start (GTK_BOX (hbox), - quick_search_widget, - FALSE, TRUE, 0); - - gtk_widget_show_all (hbox); - - toolbar_frame = gtk_frame_new (NULL); - gtk_frame_set_shadow_type (GTK_FRAME (toolbar_frame), GTK_SHADOW_OUT); - gtk_container_add (GTK_CONTAINER (toolbar_frame), hbox); - gtk_widget_show (toolbar_frame); - - gtk_widget_show_all (toolbar_frame); - - behavior = GNOME_DOCK_ITEM_BEH_EXCLUSIVE; - if (!gnome_preferences_get_toolbar_detachable ()) - behavior |= GNOME_DOCK_ITEM_BEH_LOCKED; - - toolbar_control = bonobo_control_new (toolbar_frame); - bonobo_ui_handler_dock_add ( - uih, "/Toolbar", - bonobo_object_corba_objref (BONOBO_OBJECT (toolbar_control)), - behavior, - GNOME_DOCK_TOP, - 1, 1, 0); -} - -static void -control_activate_cb (BonoboControl *control, - gboolean activate, - AddressbookView *view) -{ - BonoboUIHandler *uih; - - uih = bonobo_control_get_ui_handler (control); - g_assert (uih); - - if (activate) - control_activate (control, uih, view); - else - control_deactivate (control, uih); -} - -static void -addressbook_view_free(AddressbookView *view) -{ - if (view->properties) - bonobo_object_unref(BONOBO_OBJECT(view->properties)); - if (view->book) - gtk_object_unref(GTK_OBJECT(view->book)); - g_free(view->uri); - g_free(view); -} - -static void -book_open_cb (EBook *book, EBookStatus status, gpointer closure) -{ - AddressbookView *view = closure; - if (status == E_BOOK_STATUS_SUCCESS) { - set_book (view); - } else { - GtkWidget *warning_dialog, *label, *href; - warning_dialog = gnome_dialog_new ( - _("Unable to open addressbook"), - GNOME_STOCK_BUTTON_CLOSE, - NULL); - - label = gtk_label_new ( - _("We were unable to open this addressbook. This either\n" - "means you have entered an incorrect URI, or have tried\n" - "to access an LDAP server and don't have LDAP support\n" - "compiled in. If you've entered a URI, check the URI for\n" - "correctness and reenter. If not, you probably have\n" - "attempted to access an LDAP server. If you wish to be\n" - "able to use LDAP, you'll need to download and install\n" - "OpenLDAP and recompile and install evolution.\n")); - gtk_misc_set_alignment(GTK_MISC(label), - 0, .5); - gtk_label_set_justify(GTK_LABEL(label), - GTK_JUSTIFY_LEFT); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (warning_dialog)->vbox), - label, TRUE, TRUE, 0); - gtk_widget_show (label); - - href = gnome_href_new ("http://www.openldap.org/", "OpenLDAP at http://www.openldap.org/"); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (warning_dialog)->vbox), - href, FALSE, FALSE, 0); - gtk_widget_show (href); - - gnome_dialog_run (GNOME_DIALOG (warning_dialog)); - - gtk_object_destroy (GTK_OBJECT (warning_dialog)); - } -} - -static void destroy_callback(GtkWidget *widget, gpointer data) -{ - AddressbookView *view = data; - addressbook_view_free(view); -} - -static void -get_prop (BonoboPropertyBag *bag, - BonoboArg *arg, - guint arg_id, - gpointer user_data) -{ - AddressbookView *view = user_data; - - switch (arg_id) { - - case PROPERTY_FOLDER_URI_IDX: - if (view && view->uri) - BONOBO_ARG_SET_STRING (arg, view->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) -{ - AddressbookView *view = user_data; - - char *uri_data; - - switch (arg_id) { - - case PROPERTY_FOLDER_URI_IDX: - if (view->uri) { - /* we've already had a uri set on this view, so unload it */ - e_book_unload_uri (view->book); - g_free (view->uri); - } - - view->uri = g_strdup(BONOBO_ARG_GET_STRING (arg)); - - if (!strncmp (view->uri, "file:", 5)) { - char *file_name = g_concat_dir_and_file(view->uri + 7, "addressbook.db"); - uri_data = g_strdup_printf("file://%s", file_name); - g_free(file_name); - } - else { - uri_data = g_strdup (view->uri); - } - - if (! e_book_load_uri (view->book, uri_data, book_open_cb, view)) - printf ("error calling load_uri!\n"); - - g_free(uri_data); - - break; - - default: - g_warning ("Unhandled arg %d\n", arg_id); - break; - } -} - -#define SPEC "<?xml version=\"1.0\"?> \ -<ETableSpecification click-to-add=\"1\"> \ - <columns-shown> \ - <column>0</column> \ - <column>1</column> \ - <column>5</column> \ - <column>3</column> \ - <column>4</column> \ - </columns-shown> \ - <grouping> \ - <leaf column=\"0\" ascending=\"1\"/> \ - </grouping> \ -</ETableSpecification>" - -static void -teardown_minicard_view (AddressbookView *view) -{ - if (view->minicard_view) { - view->minicard_view = NULL; - } - if (view->minicard_hbox) { - gtk_widget_destroy(view->minicard_hbox); - view->minicard_hbox = NULL; - } -} - -typedef struct { - AddressbookView *view; - char letter; -} LetterClosure; - -static void -jump_to_letter(GtkWidget *button, LetterClosure *closure) -{ - if (closure->view->minicard_view) - e_minicard_view_widget_jump_to_letter(E_MINICARD_VIEW_WIDGET(closure->view->minicard_view), closure->letter); -} - -static void -free_closure(GtkWidget *button, LetterClosure *closure) -{ - g_free(closure); -} - -static void -connect_button (AddressbookView *view, GladeXML *gui, char letter) -{ - char *name; - GtkWidget *button; - LetterClosure *closure; - name = g_strdup_printf("button-%c", letter); - button = glade_xml_get_widget(gui, name); - g_free(name); - if (!button) - return; - closure = g_new(LetterClosure, 1); - closure->view = view; - closure->letter = letter; - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(jump_to_letter), closure); - gtk_signal_connect(GTK_OBJECT(button), "destroy", - GTK_SIGNAL_FUNC(free_closure), closure); -} - -static GtkWidget * -create_alphabet (AddressbookView *view) -{ - GtkWidget *widget; - char letter; - GladeXML *gui = glade_xml_new (EVOLUTION_GLADEDIR "/alphabet.glade", NULL); - - widget = glade_xml_get_widget(gui, "scrolledwindow-top"); - if (!widget) { - return NULL; - } - - connect_button(view, gui, '1'); - for (letter = 'a'; letter <= 'z'; letter ++) { - connect_button(view, gui, letter); - } - - gtk_object_unref(GTK_OBJECT(gui)); - return widget; -} - -static void -create_minicard_view (AddressbookView *view, char *initial_query) -{ - GtkWidget *scrollframe; - GtkWidget *alphabet; - - gtk_widget_push_visual (gdk_rgb_get_visual ()); - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - - view->minicard_hbox = gtk_hbox_new(FALSE, 0); - - view->minicard_view = e_minicard_view_widget_new(); - - scrollframe = e_scroll_frame_new (NULL, NULL); - e_scroll_frame_set_policy (E_SCROLL_FRAME (scrollframe), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_NEVER); - - gtk_container_add (GTK_CONTAINER (scrollframe), view->minicard_view); - - gtk_box_pack_start(GTK_BOX(view->minicard_hbox), scrollframe, TRUE, TRUE, 0); - - alphabet = create_alphabet(view); - if (alphabet) { - gtk_object_ref(GTK_OBJECT(alphabet)); - gtk_widget_unparent(alphabet); - gtk_box_pack_start(GTK_BOX(view->minicard_hbox), alphabet, FALSE, FALSE, 0); - gtk_object_unref(GTK_OBJECT(alphabet)); - } - - gtk_box_pack_start(GTK_BOX(view->vbox), view->minicard_hbox, TRUE, TRUE, 0); - - gtk_widget_show_all( GTK_WIDGET(view->minicard_hbox) ); - -#if 0 - gdk_window_set_back_pixmap( - GTK_LAYOUT(view->canvas)->bin_window, NULL, FALSE); -#endif - - gtk_widget_pop_visual (); - gtk_widget_pop_colormap (); -} - -static void -teardown_table_view (AddressbookView *view) -{ - if (view->table) { - gtk_widget_destroy (GTK_WIDGET (view->table)); - view->table = NULL; - } - if (view->model) { - gtk_object_unref (GTK_OBJECT (view->model)); - view->model = NULL; - } - if (view->simple) { - gtk_object_destroy (GTK_OBJECT (view->simple)); - view->simple = NULL; - } -} - -static void -table_double_click(ETableScrolled *table, gint row, AddressbookView *view) -{ - ECard *card = e_addressbook_model_get_card(E_ADDRESSBOOK_MODEL(view->model), row); - EBook *book; - EContactEditor *ce; - - gtk_object_get(GTK_OBJECT(view->model), - "book", &book, - NULL); - - g_assert (E_IS_BOOK (book)); - - ce = e_contact_editor_new (card, FALSE); - - gtk_signal_connect (GTK_OBJECT (ce), "add_card", - GTK_SIGNAL_FUNC (add_card_cb), book); - gtk_signal_connect (GTK_OBJECT (ce), "commit_card", - GTK_SIGNAL_FUNC (commit_card_cb), book); - gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", - GTK_SIGNAL_FUNC (editor_closed_cb), NULL); - - gtk_object_unref(GTK_OBJECT(card)); -} - -typedef struct { - EBook *book; - ECard *card; -} CardAndBook; - -static void -card_and_book_free (CardAndBook *card_and_book) -{ - gtk_object_unref(GTK_OBJECT(card_and_book->card)); - gtk_object_unref(GTK_OBJECT(card_and_book->book)); -} - -static void -save_as (GtkWidget *widget, CardAndBook *card_and_book) -{ - e_contact_save_as(_("Save as VCard"), card_and_book->card); - card_and_book_free(card_and_book); -} - -static void -print (GtkWidget *widget, CardAndBook *card_and_book) -{ - gtk_widget_show(e_contact_print_card_dialog_new(card_and_book->card)); - card_and_book_free(card_and_book); -} - -static void -delete (GtkWidget *widget, CardAndBook *card_and_book) -{ - if (e_contact_editor_confirm_delete()) { - /* Add the card in the contact editor to our ebook */ - e_book_remove_card (card_and_book->book, - card_and_book->card, - NULL, - NULL); - } - card_and_book_free(card_and_book); -} - -static gint -table_right_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, AddressbookView *view) -{ - CardAndBook *card_and_book; - - EPopupMenu menu[] = { - {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), 0}, - {"Print", NULL, GTK_SIGNAL_FUNC(print), 0}, - {"Delete", NULL, GTK_SIGNAL_FUNC(delete), 0}, - {NULL, NULL, NULL, 0} - }; - - card_and_book = g_new(CardAndBook, 1); - card_and_book->card = e_addressbook_model_get_card(E_ADDRESSBOOK_MODEL(view->model), row); - gtk_object_get(GTK_OBJECT(view->model), - "book", &(card_and_book->book), - NULL); - - gtk_object_ref(GTK_OBJECT(card_and_book->book)); - - e_popup_menu_run (menu, (GdkEventButton *)event, 0, 0, card_and_book); - - return TRUE; -} - -static void -create_table_view (AddressbookView *view, char *initial_query) -{ - ECell *cell_left_just; - ETableHeader *e_table_header; - int i; - - view->simple = e_card_simple_new(NULL); - - view->model = e_addressbook_model_new(); - - /* - 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 (view->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 < E_CARD_SIMPLE_FIELD_LAST - 1; i++){ - /* Create the column. */ - ETableCol *ecol = e_table_col_new ( - i, e_card_simple_get_name(view->simple, i+1), - 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 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. */ - view->table = e_table_scrolled_new (e_table_header, E_TABLE_MODEL(view->model), SPEC); - - gtk_signal_connect(GTK_OBJECT(view->table), "double_click", - GTK_SIGNAL_FUNC(table_double_click), view); - gtk_signal_connect(GTK_OBJECT(view->table), "right_click", - GTK_SIGNAL_FUNC(table_right_click), view); - - gtk_object_set (GTK_OBJECT(view->table), - "click_to_add_message", _("* Click here to add a contact *"), - NULL); - - gtk_box_pack_start(GTK_BOX(view->vbox), view->table, TRUE, TRUE, 0); - - gtk_widget_show( GTK_WIDGET(view->table) ); -} - -static void -change_view_type (AddressbookView *view, AddressbookViewType view_type) -{ - char *query = NULL; - BonoboUIHandler *uih = bonobo_control_get_ui_handler (view->control); - - if (view_type == view->view_type) - return; - - if (view->view_type != ADDRESSBOOK_VIEW_NONE) - query = get_query(view); - else - query = g_strdup("(contains \"x-evolution-any-field\" \"\")"); - - - switch (view_type) { - case ADDRESSBOOK_VIEW_MINICARD: - teardown_table_view (view); - create_minicard_view (view, query); - if (uih) - bonobo_ui_handler_menu_set_label (uih, "/View/Toggle View", - N_("As _Table")); - break; - case ADDRESSBOOK_VIEW_TABLE: - teardown_minicard_view (view); - create_table_view (view, query); - if (uih) - bonobo_ui_handler_menu_set_label (uih, "/View/Toggle View", - N_("As _Minicards")); - break; - default: - g_warning ("view_type must be either TABLE or MINICARD\n"); - g_free (query); - return; - } - - view->view_type = view_type; - - /* set the book */ - set_book (view); - - /* and reset the query */ - if (query) - set_query (view, query); - g_free (query); -} - - -BonoboControl * -addressbook_factory_new_control (void) -{ - AddressbookView *view; - - view = g_new0 (AddressbookView, 1); - - view->vbox = gtk_vbox_new(FALSE, 0); - - gtk_signal_connect( GTK_OBJECT( view->vbox ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) view ); - - /* Create the control. */ - view->control = bonobo_control_new(view->vbox); - - view->model = NULL; - view->minicard_view = NULL; - - /* create the initial view */ - change_view_type (view, ADDRESSBOOK_VIEW_MINICARD); - - gtk_widget_show_all( view->vbox ); - - /* create the view's ebook */ - view->book = e_book_new (); - - view->properties = bonobo_property_bag_new (get_prop, set_prop, view); - - bonobo_property_bag_add ( - view->properties, PROPERTY_FOLDER_URI, PROPERTY_FOLDER_URI_IDX, - BONOBO_ARG_STRING, NULL, _("The URI that the Folder Browser will display"), 0); - - bonobo_control_set_property_bag (view->control, - view->properties); - - view->uri = NULL; - - gtk_signal_connect (GTK_OBJECT (view->control), "activate", - control_activate_cb, view); - - return view->control; -} - -static BonoboObject * -addressbook_factory (BonoboGenericFactory *Factory, void *closure) -{ - return BONOBO_OBJECT (addressbook_factory_new_control ()); -} - -void -addressbook_factory_init (void) -{ - static BonoboGenericFactory *addressbook_control_factory = NULL; - - if (addressbook_control_factory != NULL) - return; - - addressbook_control_factory = bonobo_generic_factory_new (CONTROL_FACTORY_ID, - addressbook_factory, - NULL); - - if (addressbook_control_factory == NULL) { - g_error ("I could not register a Addressbook factory."); - } -} diff --git a/addressbook/gui/component/addressbook.gnorba b/addressbook/gui/component/addressbook.gnorba deleted file mode 100644 index bc3830686d..0000000000 --- a/addressbook/gui/component/addressbook.gnorba +++ /dev/null @@ -1,23 +0,0 @@ -[control-factory:addressbook] -type=exe -repo_id=IDL:GNOME/GenericFactory:1.0 -description=Factory for the sample Addressbook control -location_info=evolution-addressbook - -[control:addressbook] -type=factory -repo_id=IDL:BonoboControl/addressbook-control:1.0 IDL:GNOME/Control:1.0 -description=A sample Bonobo control which displays an addressbook. -location_info=control-factory:addressbook - -[evolution-shell-component-factory:addressbook] -type=exe -repo_id=IDL:GNOME/GenericFactory:1.0 -description=Factory for the Evolution addressbook component. -location_info=evolution-addressbook - -[evolution-shell-component:addressbook] -type=factory -repo_id=IDL:Evolution/ShellComponent:1.0 -description=Evolution component for handling contacts. -location_info=evolution-shell-component-factory:addressbook diff --git a/addressbook/gui/component/addressbook.h b/addressbook/gui/component/addressbook.h deleted file mode 100644 index 66c5a7e4e6..0000000000 --- a/addressbook/gui/component/addressbook.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __ADDRESSBOOK_H__ -#define __ADDRESSBOOK_H__ - -#include <bonobo/bonobo-control.h> - -BonoboControl *addressbook_factory_new_control (void); -void addressbook_factory_init (void); - -#endif /* __ADDRESSBOOK_H__ */ diff --git a/addressbook/gui/component/addressbook.oafinfo b/addressbook/gui/component/addressbook.oafinfo deleted file mode 100644 index 4f319fb947..0000000000 --- a/addressbook/gui/component/addressbook.oafinfo +++ /dev/null @@ -1,88 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:control-factory:e_minicard:16bb7c25-c7d2-46dc-a5f0-a0975d0e0595" - type="exe" - location="evolution-addressbook"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/GenericFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Factory for the Addressbook Minicard control"/> - -</oaf_server> - -<oaf_server iid="OAFIID:control:e_minicard:f9542709-fb31-4c6a-bc00-d462ba41e4b9" - type="factory" - location="OAFIID:control-factory:e_minicard:16bb7c25-c7d2-46dc-a5f0-a0975d0e0595"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:Bonobo/Control:1.0"/> - <item value="IDL:Bonobo/PersistStream:1.0"/> - </oaf_attribute> - - <oaf_attribute name="bonobo:supported_mime_types" type="stringv"> - <item value="text/vcard"/> - <item value="text/x-vcard"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Factory for the Evolution addressbook minicard control."/> - -</oaf_server> - -<oaf_server iid="OAFIID:control-factory:addressbook:3e10597b-0591-4d45-b082-d781b7aa6e17" - type="exe" - location="evolution-addressbook"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/GenericFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Factory for the sample Addressbook control"/> - -</oaf_server> - -<oaf_server iid="OAFIID:control:addressbook:851f883b-2fe7-4c94-a1e3-a1f2a7a03c49" - type="factory" - location="OAFIID:control-factory:addressbook:3e10597b-0591-4d45-b082-d781b7aa6e17"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:BonoboControl/addressbook-control:1.0"/> - <item value="IDL:GNOME/Control:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="A sample Bonobo control which displays an addressbook."/> - -</oaf_server> - -<oaf_server iid="OAFIID:evolution-shell-component-factory:addressbook:dbf3bba0-4b0a-4f07-899b-1ec56fdf38a0" - type="exe" - location="evolution-addressbook"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/GenericFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Factory for the Evolution addressbook component."/> - -</oaf_server> - -<oaf_server iid="OAFIID:evolution-shell-component:addressbook:b7a26547-7014-4bb5-98ab-2bcac2bb55ca" - type="factory" - location="OAFIID:evolution-shell-component-factory:addressbook:dbf3bba0-4b0a-4f07-899b-1ec56fdf38a0"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:Evolution/ShellComponent:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Evolution component for handling contacts."/> - -</oaf_server> - -</oaf_info> diff --git a/addressbook/gui/component/alphabet.glade b/addressbook/gui/component/alphabet.glade deleted file mode 100644 index bc6e5f3798..0000000000 --- a/addressbook/gui/component/alphabet.glade +++ /dev/null @@ -1,357 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>alphabet</name> - <program_name>alphabet</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>alphabet.glade.h</translatable_strings_file> -</project> - -<widget> - <class>GtkWindow</class> - <name>window2</name> - <visible>False</visible> - <title>window2</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>GtkScrolledWindow</class> - <name>scrolledwindow-top</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> - - <widget> - <class>GtkViewport</class> - <name>viewport1</name> - <border_width>4</border_width> - <shadow_type>GTK_SHADOW_NONE</shadow_type> - - <widget> - <class>GtkVBox</class> - <name>vbox2</name> - <width>27</width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkButton</class> - <name>button-1</name> - <label>123</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-a</name> - <label>a</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-b</name> - <label>b</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-c</name> - <label>c</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-d</name> - <label>d</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-e</name> - <label>e</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-f</name> - <label>f</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-g</name> - <label>g</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-h</name> - <label>h</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-i</name> - <label>i</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-j</name> - <label>j</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-k</name> - <label>k</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-l</name> - <label>l</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-m</name> - <label>m</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-n</name> - <label>n</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-o</name> - <label>o</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-p</name> - <label>p</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-q</name> - <label>q</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-r</name> - <label>r</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-s</name> - <label>s</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-t</name> - <label>t</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-u</name> - <label>u</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-v</name> - <label>v</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-w</name> - <can_focus>True</can_focus> - <label>w</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-x</name> - <label>x</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-y</name> - <label>y</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-z</name> - <label>z</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/addressbook/gui/component/alphabet.glade.h b/addressbook/gui/component/alphabet.glade.h deleted file mode 100644 index 2448eeb4fc..0000000000 --- a/addressbook/gui/component/alphabet.glade.h +++ /dev/null @@ -1,34 +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_("window2"); -gchar *s = N_("123"); -gchar *s = N_("a"); -gchar *s = N_("b"); -gchar *s = N_("c"); -gchar *s = N_("d"); -gchar *s = N_("e"); -gchar *s = N_("f"); -gchar *s = N_("g"); -gchar *s = N_("h"); -gchar *s = N_("i"); -gchar *s = N_("j"); -gchar *s = N_("k"); -gchar *s = N_("l"); -gchar *s = N_("m"); -gchar *s = N_("n"); -gchar *s = N_("o"); -gchar *s = N_("p"); -gchar *s = N_("q"); -gchar *s = N_("r"); -gchar *s = N_("s"); -gchar *s = N_("t"); -gchar *s = N_("u"); -gchar *s = N_("v"); -gchar *s = N_("w"); -gchar *s = N_("x"); -gchar *s = N_("y"); -gchar *s = N_("z"); diff --git a/addressbook/gui/component/e-addressbook-model.c b/addressbook/gui/component/e-addressbook-model.c deleted file mode 100644 index d46b42fe00..0000000000 --- a/addressbook/gui/component/e-addressbook-model.c +++ /dev/null @@ -1,421 +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 "e-addressbook-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; - -/* - * EAddressbookModel callbacks - * These are the callbacks that define the behavior of our custom model. - */ -static void e_addressbook_model_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_addressbook_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - - -enum { - ARG_0, - ARG_BOOK, - ARG_QUERY, - ARG_EDITABLE, -}; - -static void -addressbook_destroy(GtkObject *object) -{ - EAddressbookModel *model = E_ADDRESSBOOK_MODEL(object); - int i; - - if (model->get_view_idle) - g_source_remove(model->get_view_idle); - if (model->book_view && model->create_card_id) - gtk_signal_disconnect(GTK_OBJECT (model->book_view), - model->create_card_id); - if (model->book_view && model->remove_card_id) - gtk_signal_disconnect(GTK_OBJECT (model->book_view), - model->remove_card_id); - if (model->book_view && model->modify_card_id) - gtk_signal_disconnect(GTK_OBJECT (model->book_view), - model->modify_card_id); - if (model->book) - gtk_object_unref(GTK_OBJECT(model->book)); - if (model->book_view) - gtk_object_unref(GTK_OBJECT(model->book_view)); - - for ( i = 0; i < model->data_count; i++ ) { - gtk_object_unref(GTK_OBJECT(model->data[i])); - } - g_free(model->data); -} - -/* This function returns the number of columns in our ETableModel. */ -static int -addressbook_col_count (ETableModel *etc) -{ - return E_CARD_SIMPLE_FIELD_LAST; -} - -/* This function returns the number of rows in our ETableModel. */ -static int -addressbook_row_count (ETableModel *etc) -{ - EAddressbookModel *addressbook = E_ADDRESSBOOK_MODEL(etc); - return addressbook->data_count; -} - -/* This function returns the value at a particular point in our ETableModel. */ -static void * -addressbook_value_at (ETableModel *etc, int col, int row) -{ - EAddressbookModel *addressbook = E_ADDRESSBOOK_MODEL(etc); - const char *value; - if ( col >= E_CARD_SIMPLE_FIELD_LAST - 1 || row >= addressbook->data_count ) - return NULL; - - value = e_card_simple_get_const(addressbook->data[row], - col + 1); - return (void *)(value ? value : ""); -} - -/* This function sets the value at a particular point in our ETableModel. */ -static void -addressbook_set_value_at (ETableModel *etc, int col, int row, const void *val) -{ - EAddressbookModel *addressbook = E_ADDRESSBOOK_MODEL(etc); - ECard *card; - if (addressbook->editable) { - if ( col >= E_CARD_SIMPLE_FIELD_LAST - 1|| row >= addressbook->data_count ) - return; - e_card_simple_set(addressbook->data[row], - col + 1, - val); - gtk_object_get(GTK_OBJECT(addressbook->data[row]), - "card", &card, - NULL); - e_book_commit_card(addressbook->book, card, NULL, NULL); - - e_table_model_cell_changed(etc, col, row); - } -} - -/* This function returns whether a particular cell is editable. */ -static gboolean -addressbook_is_cell_editable (ETableModel *etc, int col, int row) -{ - return E_ADDRESSBOOK_MODEL(etc)->editable; -} - -static void -addressbook_append_row (ETableModel *etm, ETableModel *source, gint row) -{ - ECard *card; - ECardSimple *simple; - EAddressbookModel *addressbook = E_ADDRESSBOOK_MODEL(etm); - int col; - - card = e_card_new(""); - simple = e_card_simple_new(card); - - for (col = 0; col < E_CARD_SIMPLE_FIELD_LAST - 1; col++) { - const void *val = e_table_model_value_at(source, col, row); - e_card_simple_set(simple, - col + 1, - val); - } - e_card_simple_sync_card(simple); - e_book_add_card(addressbook->book, card, NULL, NULL); - gtk_object_unref(GTK_OBJECT(simple)); - gtk_object_unref(GTK_OBJECT(card)); -} - -/* This function duplicates the value passed to it. */ -static void * -addressbook_duplicate_value (ETableModel *etc, int col, const void *value) -{ - return g_strdup(value); -} - -/* This function frees the value passed to it. */ -static void -addressbook_free_value (ETableModel *etc, int col, void *value) -{ - g_free(value); -} - -static void * -addressbook_initialize_value (ETableModel *etc, int col) -{ - return g_strdup(""); -} - -static gboolean -addressbook_value_is_empty (ETableModel *etc, int col, const void *value) -{ - return !(value && *(char *)value); -} - -static char * -addressbook_value_to_string (ETableModel *etc, int col, const void *value) -{ - return g_strdup(value); -} - -static void -create_card(EBookView *book_view, - const GList *cards, - EAddressbookModel *model) -{ - model->data = g_realloc(model->data, (model->data_count + g_list_length((GList *)cards)) * sizeof(ECard *)); - for ( ; cards; cards = cards->next) { - model->data[model->data_count++] = e_card_simple_new (E_CARD(cards->data)); - e_table_model_row_inserted(E_TABLE_MODEL(model), model->data_count - 1); - } -} - -static void -remove_card(EBookView *book_view, - const char *id, - EAddressbookModel *model) -{ - int i; - for ( i = 0; i < model->data_count; i++) { - if ( !strcmp(e_card_simple_get_id(model->data[i]), id) ) { - gtk_object_unref(GTK_OBJECT(model->data[i])); - memmove(model->data + i, model->data + i + 1, (model->data_count - i - 1) * sizeof (ECard *)); - e_table_model_row_deleted(E_TABLE_MODEL(model), i); - } - } -} - -static void -modify_card(EBookView *book_view, - const GList *cards, - EAddressbookModel *model) -{ - for ( ; cards; cards = cards->next) { - int i; - for ( i = 0; i < model->data_count; i++) { - if ( !strcmp(e_card_simple_get_id(model->data[i]), e_card_get_id(E_CARD(cards->data))) ) { - gtk_object_unref(GTK_OBJECT(model->data[i])); - model->data[i] = e_card_simple_new(E_CARD(cards->data)); - gtk_object_ref(GTK_OBJECT(model->data[i])); - e_table_model_row_changed(E_TABLE_MODEL(model), i); - break; - } - } - } -} - -static void -e_addressbook_model_class_init (GtkObjectClass *object_class) -{ - ETableModelClass *model_class = (ETableModelClass *) object_class; - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = addressbook_destroy; - object_class->set_arg = e_addressbook_model_set_arg; - object_class->get_arg = e_addressbook_model_get_arg; - - gtk_object_add_arg_type ("EAddressbookModel::book", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_BOOK); - gtk_object_add_arg_type ("EAddressbookModel::query", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_QUERY); - gtk_object_add_arg_type ("EAddressbookModel::editable", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_EDITABLE); - - model_class->column_count = addressbook_col_count; - model_class->row_count = addressbook_row_count; - model_class->value_at = addressbook_value_at; - model_class->set_value_at = addressbook_set_value_at; - model_class->is_cell_editable = addressbook_is_cell_editable; - model_class->append_row = addressbook_append_row; - model_class->duplicate_value = addressbook_duplicate_value; - model_class->free_value = addressbook_free_value; - model_class->initialize_value = addressbook_initialize_value; - model_class->value_is_empty = addressbook_value_is_empty; - model_class->value_to_string = addressbook_value_to_string; -} - -static void -e_addressbook_model_init (GtkObject *object) -{ - EAddressbookModel *model = E_ADDRESSBOOK_MODEL(object); - model->book = NULL; - model->query = g_strdup("(contains \"x-evolution-any-field\" \"\")"); - model->book_view = NULL; - model->get_view_idle = 0; - model->create_card_id = 0; - model->remove_card_id = 0; - model->modify_card_id = 0; - model->data = NULL; - model->data_count = 0; - model->editable = TRUE; -} - -static void -book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointer closure) -{ - EAddressbookModel *model = closure; - int i; - if (model->book_view && model->create_card_id) - gtk_signal_disconnect(GTK_OBJECT (model->book_view), - model->create_card_id); - if (model->book_view && model->remove_card_id) - gtk_signal_disconnect(GTK_OBJECT (model->book_view), - model->remove_card_id); - if (model->book_view && model->modify_card_id) - gtk_signal_disconnect(GTK_OBJECT (model->book_view), - model->modify_card_id); - if (model->book_view) - gtk_object_unref(GTK_OBJECT(model->book_view)); - model->book_view = book_view; - if (model->book_view) - gtk_object_ref(GTK_OBJECT(model->book_view)); - model->create_card_id = gtk_signal_connect(GTK_OBJECT(model->book_view), - "card_added", - GTK_SIGNAL_FUNC(create_card), - model); - model->remove_card_id = gtk_signal_connect(GTK_OBJECT(model->book_view), - "card_removed", - GTK_SIGNAL_FUNC(remove_card), - model); - model->modify_card_id = gtk_signal_connect(GTK_OBJECT(model->book_view), - "card_changed", - GTK_SIGNAL_FUNC(modify_card), - model); - - for ( i = 0; i < model->data_count; i++ ) { - gtk_object_unref(GTK_OBJECT(model->data[i])); - } - - e_table_model_pre_change(E_TABLE_MODEL(model)); - g_free(model->data); - model->data = NULL; - model->data_count = 0; - e_table_model_changed(E_TABLE_MODEL(model)); -} - -static gboolean -get_view(EAddressbookModel *model) -{ - if (model->book && model->query) - e_book_get_book_view(model->book, model->query, book_view_loaded, model); - - model->get_view_idle = 0; - return FALSE; -} - -ECard * -e_addressbook_model_get_card(EAddressbookModel *model, - int row) -{ - if (model->data && row < model->data_count) { - ECard *card; - gtk_object_get(GTK_OBJECT(model->data[row]), - "card", &card, - NULL); - gtk_object_ref(GTK_OBJECT(card)); - return card; - } - return NULL; -} - -static void -e_addressbook_model_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - EAddressbookModel *model; - - model = E_ADDRESSBOOK_MODEL (o); - - switch (arg_id){ - case ARG_BOOK: - if (model->book) - gtk_object_unref(GTK_OBJECT(model->book)); - model->book = E_BOOK(GTK_VALUE_OBJECT (*arg)); - if (model->book) { - gtk_object_ref(GTK_OBJECT(model->book)); - if (model->get_view_idle == 0) - model->get_view_idle = g_idle_add((GSourceFunc)get_view, model); - } - break; - case ARG_QUERY: - if (model->query) - g_free(model->query); - model->query = g_strdup(GTK_VALUE_STRING (*arg)); - if (model->get_view_idle == 0) - model->get_view_idle = g_idle_add((GSourceFunc)get_view, model); - break; - case ARG_EDITABLE: - model->editable = GTK_VALUE_BOOL (*arg); - break; - } -} - -static void -e_addressbook_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EAddressbookModel *e_addressbook_model; - - e_addressbook_model = E_ADDRESSBOOK_MODEL (object); - - switch (arg_id) { - case ARG_BOOK: - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_addressbook_model->book); - break; - case ARG_QUERY: - GTK_VALUE_STRING (*arg) = g_strdup(e_addressbook_model->query); - break; - case ARG_EDITABLE: - GTK_VALUE_BOOL (*arg) = e_addressbook_model->editable; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -GtkType -e_addressbook_model_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "EAddressbookModel", - sizeof (EAddressbookModel), - sizeof (EAddressbookModelClass), - (GtkClassInitFunc) e_addressbook_model_class_init, - (GtkObjectInitFunc) e_addressbook_model_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -ETableModel * -e_addressbook_model_new (void) -{ - EAddressbookModel *et; - - et = gtk_type_new (e_addressbook_model_get_type ()); - - return E_TABLE_MODEL(et); -} diff --git a/addressbook/gui/component/e-addressbook-model.h b/addressbook/gui/component/e-addressbook-model.h deleted file mode 100644 index 8f5f6485cf..0000000000 --- a/addressbook/gui/component/e-addressbook-model.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_ADDRESSBOOK_MODEL_H_ -#define _E_ADDRESSBOOK_MODEL_H_ - -#include "e-table-model.h" -#include <ebook/e-book.h> -#include <ebook/e-book-view.h> -#include <ebook/e-card-simple.h> - -#define E_ADDRESSBOOK_MODEL_TYPE (e_addressbook_model_get_type ()) -#define E_ADDRESSBOOK_MODEL(o) (GTK_CHECK_CAST ((o), E_ADDRESSBOOK_MODEL_TYPE, EAddressbookModel)) -#define E_ADDRESSBOOK_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_ADDRESSBOOK_MODEL_TYPE, EAddressbookModelClass)) -#define E_IS_ADDRESSBOOK_MODEL(o) (GTK_CHECK_TYPE ((o), E_ADDRESSBOOK_MODEL_TYPE)) -#define E_IS_ADDRESSBOOK_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_ADDRESSBOOK_MODEL_TYPE)) - -/* Virtual Column list: - 0 Email - 1 Full Name - 2 Street - 3 Phone -*/ - -typedef struct { - ETableModel parent; - - /* item specific fields */ - EBook *book; - char *query; - EBookView *book_view; - - int get_view_idle; - - ECardSimple **data; - int data_count; - - int create_card_id, remove_card_id, modify_card_id; - - guint editable : 1; -} EAddressbookModel; - - -typedef struct { - ETableModelClass parent_class; -} EAddressbookModelClass; - - -GtkType e_addressbook_model_get_type (void); -ETableModel *e_addressbook_model_new (void); - -/* Returns object with ref count of 1. */ -ECard *e_addressbook_model_get_card(EAddressbookModel *model, - int row); - -#endif /* _E_ADDRESSBOOK_MODEL_H_ */ diff --git a/addressbook/gui/component/e-cardlist-model.c b/addressbook/gui/component/e-cardlist-model.c deleted file mode 100644 index 23b61d58be..0000000000 --- a/addressbook/gui/component/e-cardlist-model.c +++ /dev/null @@ -1,226 +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 "e-cardlist-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() - -static void -e_cardlist_model_destroy(GtkObject *object) -{ - ECardlistModel *model = E_CARDLIST_MODEL(object); - int i; - - for ( i = 0; i < model->data_count; i++ ) { - gtk_object_unref(GTK_OBJECT(model->data[i])); - } - g_free(model->data); -} - -/* This function returns the number of columns in our ETableModel. */ -static int -e_cardlist_model_col_count (ETableModel *etc) -{ - return E_CARD_SIMPLE_FIELD_LAST; -} - -/* This function returns the number of rows in our ETableModel. */ -static int -e_cardlist_model_row_count (ETableModel *etc) -{ - ECardlistModel *e_cardlist_model = E_CARDLIST_MODEL(etc); - return e_cardlist_model->data_count; -} - -/* This function returns the value at a particular point in our ETableModel. */ -static void * -e_cardlist_model_value_at (ETableModel *etc, int col, int row) -{ - ECardlistModel *e_cardlist_model = E_CARDLIST_MODEL(etc); - const char *value; - if ( col >= E_CARD_SIMPLE_FIELD_LAST - 1|| row >= e_cardlist_model->data_count ) - return NULL; - value = e_card_simple_get_const(e_cardlist_model->data[row], - col + 1); - return (void *)(value ? value : ""); -} - -/* This function sets the value at a particular point in our ETableModel. */ -static void -e_cardlist_model_set_value_at (ETableModel *etc, int col, int row, const void *val) -{ - ECardlistModel *e_cardlist_model = E_CARDLIST_MODEL(etc); - ECard *card; - if ( col >= E_CARD_SIMPLE_FIELD_LAST - 1|| row >= e_cardlist_model->data_count ) - return; - e_card_simple_set(e_cardlist_model->data[row], - col + 1, - val); - gtk_object_get(GTK_OBJECT(e_cardlist_model->data[row]), - "card", &card, - NULL); - - e_table_model_cell_changed(etc, col, row); -} - -/* This function returns whether a particular cell is editable. */ -static gboolean -e_cardlist_model_is_cell_editable (ETableModel *etc, int col, int row) -{ - return TRUE; -} - -/* This function duplicates the value passed to it. */ -static void * -e_cardlist_model_duplicate_value (ETableModel *etc, int col, const void *value) -{ - return g_strdup(value); -} - -/* This function frees the value passed to it. */ -static void -e_cardlist_model_free_value (ETableModel *etc, int col, void *value) -{ - g_free(value); -} - -static void * -e_cardlist_model_initialize_value (ETableModel *etc, int col) -{ - return g_strdup(""); -} - -static gboolean -e_cardlist_model_value_is_empty (ETableModel *etc, int col, const void *value) -{ - return !(value && *(char *)value); -} - -static char * -e_cardlist_model_value_to_string (ETableModel *etc, int col, const void *value) -{ - return g_strdup(value); -} - -void -e_cardlist_model_add(ECardlistModel *model, - ECard **cards, - int count) -{ - int i; - model->data = g_realloc(model->data, model->data_count + count * sizeof(ECard *)); - for (i = 0; i < count; i++) { - gboolean found = FALSE; - gchar *id = e_card_get_id(cards[i]); - for ( i = 0; i < model->data_count; i++) { - if ( !strcmp(e_card_simple_get_id(model->data[i]), id) ) { - found = TRUE; - } - } - if (!found) { - gtk_object_ref(GTK_OBJECT(cards[i])); - model->data[model->data_count++] = e_card_simple_new (cards[i]); - e_table_model_row_inserted(E_TABLE_MODEL(model), model->data_count - 1); - } - } -} - -void -e_cardlist_model_remove(ECardlistModel *model, - const char *id) -{ - int i; - for ( i = 0; i < model->data_count; i++) { - if ( !strcmp(e_card_simple_get_id(model->data[i]), id) ) { - gtk_object_unref(GTK_OBJECT(model->data[i])); - memmove(model->data + i, model->data + i + 1, (model->data_count - i - 1) * sizeof (ECard *)); - e_table_model_row_deleted(E_TABLE_MODEL(model), i); - } - } -} - -static void -e_cardlist_model_class_init (GtkObjectClass *object_class) -{ - ETableModelClass *model_class = (ETableModelClass *) object_class; - - object_class->destroy = e_cardlist_model_destroy; - - model_class->column_count = e_cardlist_model_col_count; - model_class->row_count = e_cardlist_model_row_count; - model_class->value_at = e_cardlist_model_value_at; - model_class->set_value_at = e_cardlist_model_set_value_at; - model_class->is_cell_editable = e_cardlist_model_is_cell_editable; - model_class->duplicate_value = e_cardlist_model_duplicate_value; - model_class->free_value = e_cardlist_model_free_value; - model_class->initialize_value = e_cardlist_model_initialize_value; - model_class->value_is_empty = e_cardlist_model_value_is_empty; - model_class->value_to_string = e_cardlist_model_value_to_string; -} - -static void -e_cardlist_model_init (GtkObject *object) -{ - ECardlistModel *model = E_CARDLIST_MODEL(object); - model->data = NULL; - model->data_count = 0; -} - -ECard * -e_cardlist_model_get(ECardlistModel *model, - int row) -{ - if (model->data && row < model->data_count) { - ECard *card; - gtk_object_get(GTK_OBJECT(model->data[row]), - "card", &card, - NULL); - gtk_object_ref(GTK_OBJECT(card)); - return card; - } - return NULL; -} - -GtkType -e_cardlist_model_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "ECardlistModel", - sizeof (ECardlistModel), - sizeof (ECardlistModelClass), - (GtkClassInitFunc) e_cardlist_model_class_init, - (GtkObjectInitFunc) e_cardlist_model_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -ETableModel * -e_cardlist_model_new (void) -{ - ECardlistModel *et; - - et = gtk_type_new (e_cardlist_model_get_type ()); - - return E_TABLE_MODEL(et); -} diff --git a/addressbook/gui/component/e-cardlist-model.h b/addressbook/gui/component/e-cardlist-model.h deleted file mode 100644 index b7df356342..0000000000 --- a/addressbook/gui/component/e-cardlist-model.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_CARDLIST_MODEL_H_ -#define _E_CARDLIST_MODEL_H_ - -#include "e-table-model.h" -#include <ebook/e-book.h> -#include <ebook/e-book-view.h> -#include <ebook/e-card-simple.h> - -#define E_CARDLIST_MODEL_TYPE (e_cardlist_model_get_type ()) -#define E_CARDLIST_MODEL(o) (GTK_CHECK_CAST ((o), E_CARDLIST_MODEL_TYPE, ECardlistModel)) -#define E_CARDLIST_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CARDLIST_MODEL_TYPE, ECardlistModelClass)) -#define E_IS_CARDLIST_MODEL(o) (GTK_CHECK_TYPE ((o), E_CARDLIST_MODEL_TYPE)) -#define E_IS_CARDLIST_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CARDLIST_MODEL_TYPE)) - -typedef struct { - ETableModel parent; - - /* item specific fields */ - ECardSimple **data; - int data_count; -} ECardlistModel; - - -typedef struct { - ETableModelClass parent_class; -} ECardlistModelClass; - - -GtkType e_cardlist_model_get_type (void); -ETableModel *e_cardlist_model_new (void); - -/* Returns object with an extra ref count. */ -ECard *e_cardlist_model_get (ECardlistModel *model, - int row); -void e_cardlist_model_add (ECardlistModel *model, - ECard **card, - int count); -void e_cardlist_model_remove (ECardlistModel *model, - const char *id); - -#endif /* _E_CARDLIST_MODEL_H_ */ diff --git a/addressbook/gui/component/e-ldap-server-dialog.c b/addressbook/gui/component/e-ldap-server-dialog.c deleted file mode 100644 index 172f43280b..0000000000 --- a/addressbook/gui/component/e-ldap-server-dialog.c +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-ldap-server-dialog.c - * Copyright (C) 2000 Helix Code, Inc. - * Author: Chris Toshok <toshok@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 <glade/glade.h> -#include "e-ldap-server-dialog.h" - -typedef struct { - GladeXML *gui; - GtkWidget *dialog; - ELDAPServer *server; -} ELDAPServerDialog; - -static void -fill_in_server_info (ELDAPServerDialog *dialog) -{ - ELDAPServer *ldap_server = dialog->server; - GtkEditable *editable; - int position; - - /* the name */ - position = 0; - editable = GTK_EDITABLE(glade_xml_get_widget(dialog->gui, "name-entry")); - gtk_editable_delete_text (editable, 0, -1); - gtk_editable_insert_text (editable, ldap_server->name, strlen (ldap_server->name), &position); - - /* the server description */ - position = 0; - editable = GTK_EDITABLE(glade_xml_get_widget(dialog->gui, "description-entry")); - gtk_editable_delete_text (editable, 0, -1); - gtk_editable_insert_text (editable, ldap_server->description, strlen (ldap_server->description), &position); - - /* the server hostname */ - position = 0; - editable = GTK_EDITABLE(glade_xml_get_widget(dialog->gui, "server-entry")); - gtk_editable_delete_text (editable, 0, -1); - gtk_editable_insert_text (editable, ldap_server->host, strlen (ldap_server->host), &position); - - /* the server port */ - position = 0; - editable = GTK_EDITABLE(glade_xml_get_widget(dialog->gui, "port-entry")); - gtk_editable_delete_text (editable, 0, -1); - gtk_editable_insert_text (editable, ldap_server->port, strlen (ldap_server->port), &position); - - /* the root dn */ - position = 0; - editable = GTK_EDITABLE(glade_xml_get_widget(dialog->gui, "root-dn-entry")); - gtk_editable_delete_text (editable, 0, -1); - gtk_editable_insert_text (editable, ldap_server->rootdn, strlen (ldap_server->rootdn), &position); -} - -static void -extract_server_info (ELDAPServerDialog *dialog) -{ - ELDAPServer *ldap_server = dialog->server; - GtkEditable *editable; - char *description, *server, *port, *rootdn, *name; - - /* the server name */ - editable = GTK_EDITABLE(glade_xml_get_widget(dialog->gui, "name-entry")); - name = gtk_editable_get_chars(editable, 0, -1); - if (name && *name) { - if (ldap_server->name) - g_free(ldap_server->name); - ldap_server->name = name; - } - - /* the server description */ - editable = GTK_EDITABLE(glade_xml_get_widget(dialog->gui, "description-entry")); - description = gtk_editable_get_chars(editable, 0, -1); - if (description && *description) { - if (ldap_server->description) - g_free(ldap_server->description); - ldap_server->description = description; - } - - /* the server hostname */ - editable = GTK_EDITABLE(glade_xml_get_widget(dialog->gui, "server-entry")); - server = gtk_editable_get_chars(editable, 0, -1); - if (server && *server) { - if (ldap_server->host) - g_free(ldap_server->host); - ldap_server->host = server; - } - - /* the server port */ - editable = GTK_EDITABLE(glade_xml_get_widget(dialog->gui, "port-entry")); - port = gtk_editable_get_chars(editable, 0, -1); - if (port && *port) { - if (ldap_server->port) - g_free (ldap_server->port); - ldap_server->port = port; - } - - /* the root dn */ - editable = GTK_EDITABLE(glade_xml_get_widget(dialog->gui, "root-dn-entry")); - rootdn = gtk_editable_get_chars(editable, 0, -1); - if (rootdn && *rootdn) { - if (ldap_server->rootdn) - g_free (ldap_server->rootdn); - ldap_server->rootdn = rootdn; - } -} - -void -e_ldap_server_editor_show(ELDAPServer *server) -{ - ELDAPServerDialog *dialog = g_new0 (ELDAPServerDialog, 1); - - dialog->server = server; - dialog->gui = glade_xml_new (EVOLUTION_GLADEDIR "/ldap-server-dialog.glade", NULL); - - dialog->dialog = glade_xml_get_widget(dialog->gui, "ldap-server-dialog"); - - fill_in_server_info (dialog); - - gnome_dialog_run (GNOME_DIALOG(dialog->dialog)); - - extract_server_info (dialog); - - gnome_dialog_close (GNOME_DIALOG(dialog->dialog)); -} diff --git a/addressbook/gui/component/e-ldap-server-dialog.h b/addressbook/gui/component/e-ldap-server-dialog.h deleted file mode 100644 index e5ae169f5c..0000000000 --- a/addressbook/gui/component/e-ldap-server-dialog.h +++ /dev/null @@ -1,9 +0,0 @@ - -#ifndef __E_LDAP_SERVER_DIALOG_H__ -#define __E_LDAP_SERVER_DIALOG_H__ - -#include "e-ldap-storage.h" - -void e_ldap_server_editor_show(ELDAPServer *server); - -#endif /* __E_LDAP_SERVER_DIALOG_H__ */ diff --git a/addressbook/gui/component/e-ldap-storage.c b/addressbook/gui/component/e-ldap-storage.c deleted file mode 100644 index aa1e153a2a..0000000000 --- a/addressbook/gui/component/e-ldap-storage.c +++ /dev/null @@ -1,314 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-ldap-storage.c - * - * Copyright (C) 2000 Helix Code, 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. - * - * Author: Chris Toshok - */ - -/* The ldap server file goes like this: - - <?xml version="1.0"?> - <contactservers> - <contactserver> - <name>LDAP Server</name> - <description>This is my company address book.</description> - <host>ldap.server.com</host> - <port>389</port> - <rootdn></rootdn> - </contactserver> - </contactservers> - - FIXME: Do we want to use a namespace for this? - FIXME: Do we want to have an internationalized description? - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo.h> - -#include "evolution-shell-component.h" -#include "evolution-storage.h" - -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> - -#include "e-ldap-storage.h" -#include "e-ldap-server-dialog.h" - -#include "e-util/e-util.h" -#include "e-util/e-xml-utils.h" - -#include <sys/types.h> -#include <sys/fcntl.h> -#include <sys/stat.h> -#include <errno.h> - -#define LDAPSERVER_XML "ldapservers.xml" - -static gboolean load_ldap_data (EvolutionStorage *storage, const char *file_path); -static gboolean save_ldap_data (const char *file_path); - -GHashTable *servers; -EvolutionStorage *storage; -static char *ldapservers; - -void -setup_ldap_storage (EvolutionShellComponent *shell_component, - const char *evolution_homedir) -{ - EvolutionShellClient *shell_client; - Evolution_Shell corba_shell; - - shell_client = evolution_shell_component_get_owner (shell_component); - if (shell_client == CORBA_OBJECT_NIL) { - g_warning ("We have no shell!?"); - return; - } - - corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client)); - - storage = evolution_storage_new (_("External Directories")); - if (evolution_storage_register_on_shell (storage, corba_shell) != EVOLUTION_STORAGE_OK) { - g_warning ("Cannot register storage"); - return; - } - - /* save the storage for later */ - servers = g_hash_table_new (g_str_hash, g_str_equal); - - gtk_object_set_data (GTK_OBJECT (shell_component), "e-storage", storage); - - if (ldapservers) - g_free (ldapservers); - ldapservers = g_strdup_printf ("%s/" LDAPSERVER_XML, evolution_homedir); - load_ldap_data (storage, ldapservers); -} - -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; -} - -static gboolean -load_ldap_data (EvolutionStorage *storage, - const char *file_path) -{ - xmlDoc *doc; - xmlNode *root; - xmlNode *child; - - tryagain: - doc = xmlParseFile (file_path); - if (doc == NULL) { - /* check to see if a ldapserver.xml.new file is - there. if it is, rename it and run with it */ - char *new_path = g_strdup_printf ("%s.new", file_path); - struct stat sb; - - if (stat (new_path, &sb) == 0) { - int rv; - - rv = rename (new_path, file_path); - g_free (new_path); - - if (0 > rv) { - g_error ("Failed to rename ldapserver.xml: %s\n", strerror(errno)); - return FALSE; - } - else { - goto tryagain; - } - } - - g_free (new_path); - return TRUE; - } - - root = xmlDocGetRootElement (doc); - if (root == NULL || strcmp (root->name, "contactservers") != 0) { - xmlFreeDoc (doc); - return FALSE; - } - - for (child = root->childs; child; child = child->next) { - char *path; - ELDAPServer *server; - - if (strcmp (child->name, "contactserver")) { - g_warning ("unknown node '%s' in %s", child->name, file_path); - continue; - } - - server = g_new (ELDAPServer, 1); - - server->name = get_string_value (child, "name"); - server->description = get_string_value (child, "description"); - server->port = get_string_value (child, "port"); - server->host = get_string_value (child, "host"); - server->rootdn = get_string_value (child, "rootdn"); - server->scope = get_string_value (child, "scope"); - server->uri = g_strdup_printf ("ldap://%s:%s/%s??%s", server->host, server->port, server->rootdn, server->scope); - - path = g_strdup_printf ("/%s", server->name); - evolution_storage_new_folder (storage, path, "contacts", server->uri, server->description); - - g_hash_table_insert (servers, server->name, server); - - g_free (path); - } - - xmlFreeDoc (doc); - - return TRUE; -} - -static void -ldap_server_foreach(gpointer key, gpointer value, gpointer user_data) -{ - ELDAPServer *server = (ELDAPServer*)value; - xmlNode *root = (xmlNode*)user_data; - xmlNode *server_root = xmlNewNode (NULL, - (xmlChar *) "contactserver"); - - xmlAddChild (root, server_root); - - xmlNewChild (server_root, NULL, (xmlChar *) "name", - (xmlChar *) server->name); - xmlNewChild (server_root, NULL, (xmlChar *) "description", - (xmlChar *) server->description); - - xmlNewChild (server_root, NULL, (xmlChar *) "port", - (xmlChar *) server->port); - xmlNewChild (server_root, NULL, (xmlChar *) "host", - (xmlChar *) server->host); - xmlNewChild (server_root, NULL, (xmlChar *) "rootdn", - (xmlChar *) server->rootdn); - xmlNewChild (server_root, NULL, (xmlChar *) "scope", - (xmlChar *) server->scope); -} - -static gboolean -save_ldap_data (const char *file_path) -{ - xmlDoc *doc; - xmlNode *root; - int fd, rv; - xmlChar *buf; - int buf_size; - char *new_path = g_strdup_printf ("%s.new", file_path); - - doc = xmlNewDoc ((xmlChar *) "1.0"); - root = xmlNewDocNode (doc, NULL, (xmlChar *) "contactservers", NULL); - xmlDocSetRootElement (doc, root); - - g_hash_table_foreach (servers, ldap_server_foreach, root); - - fd = open (new_path, O_CREAT | O_TRUNC | O_WRONLY, 0600); - fchmod (fd, 0600); - - xmlDocDumpMemory (doc, &buf, &buf_size); - - if (buf == NULL) { - g_error ("Failed to write ldapserver.xml: xmlBufferCreate() == NULL"); - return FALSE; - } - - rv = write (fd, buf, buf_size); - xmlFree (buf); - close (fd); - - if (0 > rv) { - g_error ("Failed to write new ldapserver.xml: %s\n", strerror(errno)); - unlink (new_path); - return FALSE; - } - else { - if (0 > rename (new_path, file_path)) { - g_error ("Failed to rename ldapserver.xml: %s\n", strerror(errno)); - unlink (new_path); - return FALSE; - } - return TRUE; - } -} - -void -e_ldap_storage_add_server (ELDAPServer *server) -{ - char *path; - /* add it to our hashtable */ - g_hash_table_insert (servers, server->name, server); - - /* and then to the ui */ - path = g_strdup_printf ("/%s", server->name); - evolution_storage_new_folder (storage, path, "contacts", server->uri, server->description); - - g_free (path); - - save_ldap_data (ldapservers); -} - -void -e_ldap_storage_remove_server (char *name) -{ - char *path; - ELDAPServer *server; - - /* remove it from our hashtable */ - server = (ELDAPServer*)g_hash_table_lookup (servers, name); - g_hash_table_remove (servers, name); - - g_free (server->name); - g_free (server->description); - g_free (server->host); - g_free (server->port); - g_free (server->rootdn); - g_free (server->scope); - g_free (server->uri); - - g_free (server); - - /* and then from the ui */ - path = g_strdup_printf ("/%s", name); - evolution_storage_removed_folder (storage, path); - - g_free (path); - - save_ldap_data (ldapservers); -} diff --git a/addressbook/gui/component/e-ldap-storage.h b/addressbook/gui/component/e-ldap-storage.h deleted file mode 100644 index 9d3e35b4db..0000000000 --- a/addressbook/gui/component/e-ldap-storage.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-ldap-storage.h - * - * Copyright (C) 2000 Helix Code, 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. - * - * Author: Chris Toshok - */ - -#ifndef __E_LDAP_STORAGE_H__ -#define __E_LDAP_STORAGE_H__ - -#include "evolution-shell-component.h" - -typedef struct { - char *name; - char *description; - char *host; - char *port; - char *rootdn; - char *scope; - char *uri; /* filled in from the above */ -} ELDAPServer; - -void setup_ldap_storage (EvolutionShellComponent *shell_component, - const char *evolution_homedir); -void e_ldap_storage_add_server (ELDAPServer *server); -void e_ldap_storage_remove_server (char *name); - -#endif /* __E_LDAP_STORAGE_H__ */ diff --git a/addressbook/gui/component/ldap-server-dialog.glade b/addressbook/gui/component/ldap-server-dialog.glade deleted file mode 100644 index a4dad9c2c2..0000000000 --- a/addressbook/gui/component/ldap-server-dialog.glade +++ /dev/null @@ -1,400 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>newserver</name> - <program_name>newserver</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> - <output_main_file>False</output_main_file> - <output_translatable_strings>True</output_translatable_strings> - <translatable_strings_file>ldap-server-dialog.glade.h</translatable_strings_file> -</project> - -<widget> - <class>GnomeDialog</class> - <name>ldap-server-dialog</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-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>GtkVBox</class> - <name>vbox1</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>table2</name> - <rows>5</rows> - <columns>2</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>description-entry</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>server-entry</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>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>port-entry</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>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>root-dn-entry</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <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>GtkAlignment</class> - <name>alignment1</name> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>1</yscale> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label1</name> - <label>Description:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment2</name> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>1</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>GtkLabel</class> - <name>label2</name> - <label>LDAP Server:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment3</name> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>1</yscale> - <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>GtkLabel</class> - <name>label3</name> - <label>Port Number:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment4</name> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>1</yscale> - <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> - <class>GtkLabel</class> - <name>label4</name> - <label>Root DN:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - - <widget> - <class>GtkEntry</class> - <name>name-entry</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment5</name> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>1</yscale> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label5</name> - <label>Name:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/addressbook/gui/component/ldap-server-dialog.glade.h b/addressbook/gui/component/ldap-server-dialog.glade.h deleted file mode 100644 index c99dfa3cb5..0000000000 --- a/addressbook/gui/component/ldap-server-dialog.glade.h +++ /dev/null @@ -1,11 +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_("Description:"); -gchar *s = N_("LDAP Server:"); -gchar *s = N_("Port Number:"); -gchar *s = N_("Root DN:"); -gchar *s = N_("Name:"); diff --git a/addressbook/gui/component/select-names/.cvsignore b/addressbook/gui/component/select-names/.cvsignore deleted file mode 100644 index 1d8db60890..0000000000 --- a/addressbook/gui/component/select-names/.cvsignore +++ /dev/null @@ -1,11 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -*.lo -*.la -Evolution-Addressbook-SelectNames-stubs.c -Evolution-Addressbook-SelectNames-skels.c -Evolution-Addressbook-SelectNames-common.c -Evolution-Addressbook-SelectNames.h diff --git a/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl b/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl deleted file mode 100644 index 2bc8154daf..0000000000 --- a/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * CORBA interface for the SelectNames dialog. - * - * Authors: - * Ettore Perazzoli <ettore@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#include <Bonobo.idl> - -module Evolution { -module Addressbook { - - interface SelectNames : Bonobo::Unknown { - struct Section { - string id; - string title; - }; - - typedef sequence<Section> SectionList; - - exception DuplicateID {}; - exception SectionNotFound {}; - - void add_section (in string id, in string title) - raises (DuplicateID); - - Bonobo::Control get_entry_for_section (in string section_id) - raises (SectionNotFound); - - void activate_dialog (in string section_id); - }; - -}; -}; diff --git a/addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.oaf.in b/addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.oaf.in deleted file mode 100644 index e66c3aa38a..0000000000 --- a/addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.oaf.in +++ /dev/null @@ -1,29 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:factory:addressbook:select-names:b39eb1a1-f341-4d5a-9a91-e2616e206b2e" - type="exe" - location="evolution-addressbook"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/GenericFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Factory for the Addressbook's name selection interface"/> - -</oaf_server> - -<oaf_server iid="OAFIID:addressbook:select-names:39301deb-174b-40d1-8a6e-5edc300f7b61" - type="factory" - location="OAFIID:factory:addressbook:select-names:b39eb1a1-f341-4d5a-9a91-e2616e206b2e"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:Evolution/Addressbook/SelectNames"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Evolution's addressbook name selection interface."/> - -</oaf_server> - -</oaf_info>
\ No newline at end of file diff --git a/addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.oafinfo b/addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.oafinfo deleted file mode 100644 index e66c3aa38a..0000000000 --- a/addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.oafinfo +++ /dev/null @@ -1,29 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:factory:addressbook:select-names:b39eb1a1-f341-4d5a-9a91-e2616e206b2e" - type="exe" - location="evolution-addressbook"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/GenericFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Factory for the Addressbook's name selection interface"/> - -</oaf_server> - -<oaf_server iid="OAFIID:addressbook:select-names:39301deb-174b-40d1-8a6e-5edc300f7b61" - type="factory" - location="OAFIID:factory:addressbook:select-names:b39eb1a1-f341-4d5a-9a91-e2616e206b2e"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:Evolution/Addressbook/SelectNames"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Evolution's addressbook name selection interface."/> - -</oaf_server> - -</oaf_info>
\ No newline at end of file diff --git a/addressbook/gui/component/select-names/Makefile.am b/addressbook/gui/component/select-names/Makefile.am deleted file mode 100644 index 44209b15f9..0000000000 --- a/addressbook/gui/component/select-names/Makefile.am +++ /dev/null @@ -1,73 +0,0 @@ -# CORBA stuff - -IDLS = \ - Evolution-Addressbook-SelectNames.idl - -IDL_GENERATED = \ - Evolution-Addressbook-SelectNames.h \ - Evolution-Addressbook-SelectNames-common.c \ - Evolution-Addressbook-SelectNames-skels.c \ - Evolution-Addressbook-SelectNames-stubs.c - -Evolution-Addressbook-SelectNames-impl.o: Evolution-Addressbook-SelectNames.h - -$(IDL_GENERATED): $(IDLS) - $(ORBIT_IDL) -I$(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \ - -I$(srcdir) $(srcdir)/Evolution-Addressbook-SelectNames.idl - -oafdir = $(datadir)/oaf -oaf_DATA = evolution-addressbook-select-names.oafinfo - -# - -CPPFLAGS = \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" - -INCLUDES = \ - -DG_LOG_DOMAIN=\"evolution-addressbook\" \ - $(EXTRA_GNOME_CFLAGS) \ - $(GNOME_INCLUDEDIR) \ - -I$(top_srcdir) \ - -I$(top_builddir) \ - -I$(top_srcdir)/shell \ - -I$(top_builddir)/shell \ - -I$(top_srcdir)/widgets/e-text \ - -I$(top_srcdir)/widgets/e-table \ - -I$(top_srcdir)/addressbook/gui/minicard \ - -I$(top_srcdir)/addressbook/contact-editor \ - -I$(top_srcdir)/addressbook/backend \ - -I$(top_builddir)/addressbook/backend \ - $(BONOBO_HTML_GNOME_CFLAGS) \ - -DEVOLUTION_VERSION=\""$(VERSION)"\" \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(datadir)/locale"\" \ - -DCAMEL_PROVIDERDIR=\""$(providerdir)"\" - -lib_LTLIBRARIES = libeselectnames.la - -libeselectnames_la_SOURCES = \ - $(IDL_GENERATED) \ - e-select-names-bonobo.c \ - e-select-names-bonobo.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-table-model.c \ - e-select-names-table-model.h \ - e-select-names-text-model.c \ - e-select-names-text-model.h \ - e-select-names.c \ - e-select-names.h - -gladedir = $(datadir)/evolution/glade -glade_DATA = select-names.glade - -EXTRA_DIST = \ - $(glade_DATA) \ - select-names.glade.h \ - $(oaf_DATA) \ - $(IDLS) diff --git a/addressbook/gui/component/select-names/e-select-names-bonobo.c b/addressbook/gui/component/select-names/e-select-names-bonobo.c deleted file mode 100644 index a7b8f5b11f..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-bonobo.c +++ /dev/null @@ -1,294 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-select-names-bonobo.c - * - * Copyright (C) 2000 Helix Code, 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. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gnome.h> - -#include <bonobo/bonobo-property-bag.h> -#include <bonobo/bonobo-control.h> - -#include "Evolution-Addressbook-SelectNames.h" - -#include "e-util/e-util.h" -#include "e-select-names-manager.h" - -#include "e-select-names-bonobo.h" - - -#define PARENT_TYPE bonobo_object_get_type () -static BonoboObjectClass *parent_class = NULL; - -struct _ESelectNamesBonoboPrivate { - ESelectNamesManager *manager; -}; - -enum _EntryPropertyID { - ENTRY_PROPERTY_ID_TEXT -}; -typedef enum _EntryPropertyID EntryPropertyID; - - -/* PropertyBag implementation for the entry widgets. */ - -static void -entry_get_property_fn (BonoboPropertyBag *bag, - BonoboArg *arg, - unsigned int arg_id, - void *user_data) -{ - GtkWidget *widget; - char *text; - - widget = GTK_WIDGET (user_data); - - switch (arg_id) { - case ENTRY_PROPERTY_ID_TEXT: - gtk_object_get (GTK_OBJECT (widget), "text", &text, NULL); - BONOBO_ARG_SET_STRING (arg, text); - break; - default: - break; - } -} - -static void -entry_set_property_fn (BonoboPropertyBag *bag, - const BonoboArg *arg, - guint arg_id, - gpointer user_data) -{ - GtkWidget *widget; - const char *text; - - widget = GTK_WIDGET (user_data); - - switch (arg_id) { - case ENTRY_PROPERTY_ID_TEXT: - text = BONOBO_ARG_GET_STRING (arg); - gtk_object_set (GTK_OBJECT (widget), "text", text, NULL); - break; - default: - break; - } -} - - -/* CORBA interface implementation. */ - -static POA_Evolution_Addressbook_SelectNames__vepv SelectNames_vepv; - -static POA_Evolution_Addressbook_SelectNames * -create_servant (void) -{ - POA_Evolution_Addressbook_SelectNames *servant; - CORBA_Environment ev; - - servant = (POA_Evolution_Addressbook_SelectNames *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &SelectNames_vepv; - - CORBA_exception_init (&ev); - - POA_Evolution_Addressbook_SelectNames__init ((PortableServer_Servant) servant, &ev); - if (ev._major != CORBA_NO_EXCEPTION) { - g_free (servant); - CORBA_exception_free (&ev); - return NULL; - } - - CORBA_exception_free (&ev); - - return servant; -} - -static void -impl_SelectNames_add_section (PortableServer_Servant servant, - const CORBA_char *id, - const CORBA_char *title, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - ESelectNamesBonobo *select_names; - ESelectNamesBonoboPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - select_names = E_SELECT_NAMES_BONOBO (bonobo_object); - priv = select_names->priv; - - e_select_names_manager_add_section (priv->manager, id, title); -} - -static Bonobo_Control -impl_SelectNames_get_entry_for_section (PortableServer_Servant servant, - const CORBA_char *section_id, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - ESelectNamesBonobo *select_names; - ESelectNamesBonoboPrivate *priv; - GtkWidget *entry_widget; - BonoboControl *control; - BonoboPropertyBag *property_bag; - - bonobo_object = bonobo_object_from_servant (servant); - select_names = E_SELECT_NAMES_BONOBO (bonobo_object); - priv = select_names->priv; - - entry_widget = e_select_names_manager_create_entry (priv->manager, section_id); - gtk_widget_show (entry_widget); - - if (entry_widget == NULL) { - CORBA_exception_set (ev, - CORBA_USER_EXCEPTION, - ex_Evolution_Addressbook_SelectNames_SectionNotFound, - NULL); - return CORBA_OBJECT_NIL; - } - - control = bonobo_control_new (entry_widget); - - property_bag = bonobo_property_bag_new (entry_get_property_fn, entry_set_property_fn, entry_widget); - bonobo_property_bag_add (property_bag, "text", ENTRY_PROPERTY_ID_TEXT, - BONOBO_ARG_STRING, NULL, NULL, - BONOBO_PROPERTY_READABLE | BONOBO_PROPERTY_WRITEABLE); - - bonobo_control_set_property_bag (control, property_bag); - - return bonobo_object_corba_objref (BONOBO_OBJECT (control)); -} - -static void -impl_SelectNames_activate_dialog (PortableServer_Servant servant, - const CORBA_char *section_id, - CORBA_Environment *ev) -{ - BonoboObject *bonobo_object; - ESelectNamesBonobo *select_names; - ESelectNamesBonoboPrivate *priv; - - bonobo_object = bonobo_object_from_servant (servant); - select_names = E_SELECT_NAMES_BONOBO (bonobo_object); - priv = select_names->priv; - - e_select_names_manager_activate_dialog (priv->manager, section_id); -} - - -/* GtkObject methods. */ - -static void -impl_destroy (GtkObject *object) -{ - ESelectNamesBonobo *select_names; - ESelectNamesBonoboPrivate *priv; - - select_names = E_SELECT_NAMES_BONOBO (object); - priv = select_names->priv; - - gtk_object_unref (GTK_OBJECT (priv->manager)); - - g_free (priv); -} - - -static void -corba_class_init () -{ - POA_Evolution_Addressbook_SelectNames__vepv *vepv; - POA_Evolution_Addressbook_SelectNames__epv *epv; - PortableServer_ServantBase__epv *base_epv; - - base_epv = g_new0 (PortableServer_ServantBase__epv, 1); - base_epv->_private = NULL; - base_epv->finalize = NULL; - base_epv->default_POA = NULL; - - epv = g_new0 (POA_Evolution_Addressbook_SelectNames__epv, 1); - epv->add_section = impl_SelectNames_add_section; - epv->get_entry_for_section = impl_SelectNames_get_entry_for_section; - epv->activate_dialog = impl_SelectNames_activate_dialog; - - vepv = &SelectNames_vepv; - vepv->Bonobo_Unknown_epv = bonobo_object_get_epv (); - vepv->Evolution_Addressbook_SelectNames_epv = epv; -} - -static void -class_init (ESelectNamesBonoboClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS (klass); - parent_class = gtk_type_class (bonobo_object_get_type ()); - - object_class->destroy = impl_destroy; - - corba_class_init (); -} - -static void -init (ESelectNamesBonobo *select_names) -{ - ESelectNamesBonoboPrivate *priv; - - priv = g_new (ESelectNamesBonoboPrivate, 1); - - priv->manager = e_select_names_manager_new (); - - select_names->priv = priv; -} - - -void -e_select_names_bonobo_construct (ESelectNamesBonobo *select_names, - Evolution_Addressbook_SelectNames corba_object) -{ - g_return_if_fail (select_names != NULL); - g_return_if_fail (E_IS_SELECT_NAMES_BONOBO (select_names)); - - bonobo_object_construct (BONOBO_OBJECT (select_names), corba_object); -} - -ESelectNamesBonobo * -e_select_names_bonobo_new (void) -{ - POA_Evolution_Addressbook_SelectNames *servant; - Evolution_Addressbook_SelectNames corba_object; - ESelectNamesBonobo *select_names; - - servant = create_servant (); - if (servant == NULL) - return NULL; - - select_names = gtk_type_new (e_select_names_bonobo_get_type ()); - - corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (select_names), servant); - e_select_names_bonobo_construct (select_names, corba_object); - - return select_names; -} - - -E_MAKE_TYPE (e_select_names_bonobo, "ESelectNamesBonobo", ESelectNamesBonobo, class_init, init, PARENT_TYPE) diff --git a/addressbook/gui/component/select-names/e-select-names-bonobo.h b/addressbook/gui/component/select-names/e-select-names-bonobo.h deleted file mode 100644 index 4531c1e024..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-bonobo.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-select-names-bonobo.h - * - * Copyright (C) 2000 Helix Code, 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. - * - * Author: Ettore Perazzoli - */ - -#ifndef __E_SELECT_NAMES_BONOBO_H__ -#define __E_SELECT_NAMES_BONOBO_H__ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo/bonobo-object.h> - -#include "Evolution-Addressbook-SelectNames.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_TYPE_SELECT_NAMES_BONOBO (e_select_names_bonobo_get_type ()) -#define E_SELECT_NAMES_BONOBO(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SELECT_NAMES_BONOBO, ESelectNamesBonobo)) -#define E_SELECT_NAMES_BONOBO_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_BONOBO, ESelectNamesBonoboClass)) -#define E_IS_SELECT_NAMES_BONOBO(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SELECT_NAMES_BONOBO)) -#define E_IS_SELECT_NAMES_BONOBO_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_SELECT_NAMES_BONOBO)) - - -typedef struct _ESelectNamesBonobo ESelectNamesBonobo; -typedef struct _ESelectNamesBonoboPrivate ESelectNamesBonoboPrivate; -typedef struct _ESelectNamesBonoboClass ESelectNamesBonoboClass; - -struct _ESelectNamesBonobo { - BonoboObject parent; - - ESelectNamesBonoboPrivate *priv; -}; - -struct _ESelectNamesBonoboClass { - BonoboObjectClass parent_class; -}; - - -GtkType e_select_names_bonobo_get_type (void); -void e_select_names_bonobo_construct (ESelectNamesBonobo *select_names, - Evolution_Addressbook_SelectNames corba_object); -ESelectNamesBonobo *e_select_names_bonobo_new (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __E_SELECT_NAMES_BONOBO_H__ */ diff --git a/addressbook/gui/component/select-names/e-select-names-factory.c b/addressbook/gui/component/select-names/e-select-names-factory.c deleted file mode 100644 index 9a45692071..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-factory.c +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-select-names-factory.c - * - * Copyright (C) 2000 Helix Code, 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. - * - * Author: Ettore Perazzoli - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <bonobo.h> - -#include "e-select-names-bonobo.h" - -#include "e-select-names-factory.h" - - -#define COMPONENT_FACTORY_ID "OAFIID:factory:addressbook:select-names:b39eb1a1-f341-4d5a-9a91-e2616e206b2e" - -static BonoboGenericFactory *factory = NULL; - - -static BonoboObject * -factory_fn (BonoboGenericFactory *factory, - void *closure) -{ - return BONOBO_OBJECT (e_select_names_bonobo_new ()); -} - - -gboolean -e_select_names_factory_init (void) -{ - if (factory != NULL) - return TRUE; - - factory = bonobo_generic_factory_new (COMPONENT_FACTORY_ID, factory_fn, NULL); - - if (factory == NULL) - return FALSE; - - return TRUE; -} diff --git a/addressbook/gui/component/select-names/e-select-names-factory.h b/addressbook/gui/component/select-names/e-select-names-factory.h deleted file mode 100644 index f65d5aaa9e..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-factory.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* e-select-names-factory.h - * - * Copyright (C) 2000 Helix Code, 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. - * - * Author: Ettore Perazzoli - */ - -#ifndef _E_SECELT_NAMES_FACTORY_H -#define _E_SECELT_NAMES_FACTORY_H - -#include <glib.h> - -gboolean e_select_names_factory_init (void); - -#endif diff --git a/addressbook/gui/component/select-names/e-select-names-manager.c b/addressbook/gui/component/select-names/e-select-names-manager.c deleted file mode 100644 index b67ea282e9..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-manager.c +++ /dev/null @@ -1,349 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#include <config.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <gtk/gtk.h> - -#include "e-select-names-manager.h" -#include "e-select-names-model.h" -#include "e-select-names-text-model.h" -#include "e-select-names.h" -#include "widgets/e-text/e-entry.h" - -/* Object argument IDs */ -enum { - ARG_0, - ARG_CARD, -}; - - -typedef struct { - char *id; - char *title; - ESelectNamesModel *model; -} ESelectNamesManagerSection; - -typedef struct { - char *id; - EEntry *entry; -} ESelectNamesManagerEntry; - -static void e_select_names_manager_init (ESelectNamesManager *manager); -static void e_select_names_manager_class_init (ESelectNamesManagerClass *klass); - -static void e_select_names_manager_destroy (GtkObject *object); -static void e_select_names_manager_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_select_names_manager_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - -/** - * e_select_names_manager_get_type: - * @void: - * - * Registers the &ESelectNamesManager class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &ESelectNamesManager class. - **/ -GtkType -e_select_names_manager_get_type (void) -{ - static GtkType manager_type = 0; - - if (!manager_type) { - GtkTypeInfo manager_info = { - "ESelectNamesManager", - sizeof (ESelectNamesManager), - sizeof (ESelectNamesManagerClass), - (GtkClassInitFunc) e_select_names_manager_class_init, - (GtkObjectInitFunc) e_select_names_manager_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - manager_type = gtk_type_unique (gtk_object_get_type (), &manager_info); - } - - return manager_type; -} - -/** - * e_select_names_manager_new: - * @VCard: a string in vCard format - * - * Returns: a new #ESelectNamesManager that wraps the @VCard. - */ -ESelectNamesManager * -e_select_names_manager_new (void) -{ - ESelectNamesManager *manager = E_SELECT_NAMES_MANAGER(gtk_type_new(e_select_names_manager_get_type())); - return manager; -} - -static void -e_select_names_manager_class_init (ESelectNamesManagerClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS(klass); - - gtk_object_add_arg_type ("ESelectNamesManager::card", - GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CARD); - - object_class->destroy = e_select_names_manager_destroy; - object_class->get_arg = e_select_names_manager_get_arg; - object_class->set_arg = e_select_names_manager_set_arg; -} - -/* - * ESelectNamesManager lifecycle management and vcard loading/saving. - */ - -static void -e_select_names_manager_destroy (GtkObject *object) -{ - ESelectNamesManager *manager; - - manager = E_SELECT_NAMES_MANAGER (object); - - gtk_object_unref(GTK_OBJECT(manager->sections)); - gtk_object_unref(GTK_OBJECT(manager->entries)); -} - - -/* Set_arg handler for the manager */ -static void -e_select_names_manager_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ESelectNamesManager *manager; - - manager = E_SELECT_NAMES_MANAGER (object); - - switch (arg_id) { - case ARG_CARD: - break; - default: - return; - } -} - -/* Get_arg handler for the manager */ -static void -e_select_names_manager_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ESelectNamesManager *manager; - - manager = E_SELECT_NAMES_MANAGER (object); - - switch (arg_id) { - case ARG_CARD: - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void * -section_copy(const void *sec, void *data) -{ - const ESelectNamesManagerSection *section = sec; - ESelectNamesManagerSection *newsec; - - newsec = g_new(ESelectNamesManagerSection, 1); - newsec->id = g_strdup(section->id); - newsec->title = g_strdup(section->title); - newsec->model = section->model; - if (newsec->model) - gtk_object_ref(GTK_OBJECT(newsec->model)); - return newsec; -} - -static void -section_free(void *sec, void *data) -{ - ESelectNamesManagerSection *section = sec; - g_free(section->id); - g_free(section->title); - if (section->model) - gtk_object_unref(GTK_OBJECT(section->model)); - g_free(section); -} - -static void * -entry_copy(const void *ent, void *data) -{ - const ESelectNamesManagerEntry *entry = ent; - ESelectNamesManagerEntry *newent; - - newent = g_new(ESelectNamesManagerEntry, 1); - newent->id = g_strdup(entry->id); - newent->entry = entry->entry; - if (newent->entry) - gtk_object_ref(GTK_OBJECT(newent->entry)); - return newent; -} - -static void -entry_free(void *ent, void *data) -{ - ESelectNamesManagerEntry *entry = ent; - g_free(entry->id); - if (entry->entry) - gtk_object_unref(GTK_OBJECT(entry->entry)); - g_free(entry); -} - -/** - * e_select_names_manager_init: - */ -static void -e_select_names_manager_init (ESelectNamesManager *manager) -{ - manager->sections = e_list_new(section_copy, section_free, manager); - manager->entries = e_list_new(entry_copy, entry_free, manager); -} - -void e_select_names_manager_add_section (ESelectNamesManager *manager, - const char *id, - const char *title) -{ - ESelectNamesManagerSection *section; - - section = g_new(ESelectNamesManagerSection, 1); - section->id = g_strdup(id); - section->title = g_strdup(title); - section->model = e_select_names_model_new(); - e_list_append(manager->sections, section); - section_free(section, manager); -} - -static void -entry_destroyed(EEntry *entry, ESelectNamesManager *manager) -{ - if(!GTK_OBJECT_DESTROYED(manager)) { - EIterator *iterator = e_list_get_iterator(manager->entries); - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - const ESelectNamesManagerEntry *this_entry = e_iterator_get(iterator); - if(entry == this_entry->entry) { - e_iterator_delete(iterator); - break; - } - } - } - gtk_object_unref(GTK_OBJECT(manager)); -} - -GtkWidget *e_select_names_manager_create_entry (ESelectNamesManager *manager, - const char *id) -{ - ETextModel *model; - EIterator *iterator; - iterator = e_list_get_iterator(manager->sections); - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - const ESelectNamesManagerSection *section = e_iterator_get(iterator); - if (!strcmp(section->id, id)) { - ESelectNamesManagerEntry *entry; - EEntry *eentry; - eentry = E_ENTRY(e_entry_new()); - - entry = g_new(ESelectNamesManagerEntry, 1); - entry->entry = eentry; - entry->id = (char *)id; - model = e_select_names_text_model_new(section->model); - e_list_append(manager->entries, entry); - g_free(entry); - - gtk_object_set(GTK_OBJECT(eentry), - "model", model, - "editable", TRUE, - "use_ellipsis", TRUE, - NULL); - gtk_signal_connect(GTK_OBJECT(eentry), "destroy", - GTK_SIGNAL_FUNC(entry_destroyed), manager); - gtk_object_ref(GTK_OBJECT(manager)); - return GTK_WIDGET(eentry); - } - } - return NULL; -} - -static void -e_select_names_clicked(ESelectNames *dialog, gint button, ESelectNamesManager *manager) -{ - switch(button) { - case 0: { - EList *list = manager->sections; - EIterator *iterator = e_list_get_iterator(list); - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - ESelectNamesManagerSection *section = (void *) e_iterator_get(iterator); - ESelectNamesModel *source = e_select_names_get_source(dialog, section->id); - if (section->model) - gtk_object_unref(GTK_OBJECT(section->model)); - section->model = source; - /* Don't ref because get_source returns a conceptual ref_count of 1. */ - } - gtk_object_unref(GTK_OBJECT(iterator)); - - list = manager->entries; - iterator = e_list_get_iterator(list); - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - ESelectNamesManagerEntry *entry = (void *) e_iterator_get(iterator); - ESelectNamesModel *source = e_select_names_get_source(dialog, entry->id); - if (source) { - ETextModel *model = e_select_names_text_model_new(source); - if (model) { - gtk_object_set(GTK_OBJECT(entry->entry), - "model", model, - NULL); - gtk_object_unref(GTK_OBJECT(source)); - } - gtk_object_unref(GTK_OBJECT(model)); - } - } - gtk_object_unref(GTK_OBJECT(iterator)); - break; - } - } - gnome_dialog_close(GNOME_DIALOG(dialog)); -} - -void e_select_names_manager_activate_dialog (ESelectNamesManager *manager, - const char *id) -{ - ESelectNames *names = E_SELECT_NAMES(e_select_names_new()); - EIterator *iterator; - iterator = e_list_get_iterator(manager->sections); - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - const ESelectNamesManagerSection *section = e_iterator_get(iterator); - ESelectNamesModel *newmodel = e_select_names_model_duplicate(section->model); - e_select_names_add_section(names, section->id, section->title, newmodel); - gtk_object_unref(GTK_OBJECT(newmodel)); - } - gtk_signal_connect(GTK_OBJECT(names), "clicked", - GTK_SIGNAL_FUNC(e_select_names_clicked), manager); - gtk_widget_show(GTK_WIDGET(names)); -} - -/* Of type ECard */ -EList *e_select_names_manager_get_cards (ESelectNamesManager *manager, - const char *id) -{ - EIterator *iterator; - iterator = e_list_get_iterator(manager->sections); - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - const ESelectNamesManagerSection *section = e_iterator_get(iterator); - if (!strcmp(section->id, id)) { - return e_select_names_model_get_cards(section->model); - } - } - return NULL; -} diff --git a/addressbook/gui/component/select-names/e-select-names-manager.h b/addressbook/gui/component/select-names/e-select-names-manager.h deleted file mode 100644 index b05348ae79..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-manager.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#ifndef __E_SELECT_NAMES_MANAGER_H__ -#define __E_SELECT_NAMES_MANAGER_H__ - -#include <time.h> -#include <gtk/gtk.h> -#include <stdio.h> -#include <e-util/e-list.h> - -#define E_TYPE_SELECT_NAMES_MANAGER (e_select_names_manager_get_type ()) -#define E_SELECT_NAMES_MANAGER(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SELECT_NAMES_MANAGER, ESelectNamesManager)) -#define E_SELECT_NAMES_MANAGER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_MANAGER, ESelectNamesManagerClass)) -#define E_IS_SELECT_NAMES_MANAGER(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SELECT_NAMES_MANAGER)) -#define E_IS_SELECT_NAMES_MANAGER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_MANAGER)) - -typedef struct _ESelectNamesManager ESelectNamesManager; -typedef struct _ESelectNamesManagerClass ESelectNamesManagerClass; - -struct _ESelectNamesManager { - GtkObject object; - - EList *sections; - EList *entries; -}; - -struct _ESelectNamesManagerClass { - GtkObjectClass parent_class; -}; - -ESelectNamesManager *e_select_names_manager_new (void); -void e_select_names_manager_add_section (ESelectNamesManager *manager, - const char *id, - const char *title); -GtkWidget *e_select_names_manager_create_entry (ESelectNamesManager *manager, - const char *id); -void e_select_names_manager_activate_dialog (ESelectNamesManager *manager, - const char *id); - -/* Of type ECard */ -EList *e_select_names_manager_get_cards (ESelectNamesManager *manager, - const char *id); - -/* Standard Gtk function */ -GtkType e_select_names_manager_get_type (void); - -#endif /* ! __E_SELECT_NAMES_MANAGER_H__ */ diff --git a/addressbook/gui/component/select-names/e-select-names-model.c b/addressbook/gui/component/select-names/e-select-names-model.c deleted file mode 100644 index 32f2a85a56..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-model.c +++ /dev/null @@ -1,441 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#include <config.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <gtk/gtk.h> - -#include "e-select-names-model.h" -#include "e-util/e-util.h" -#include "addressbook/backend/ebook/e-card-simple.h" - -enum { - E_SELECT_NAMES_MODEL_CHANGED, - E_SELECT_NAMES_MODEL_LAST_SIGNAL -}; - -static guint e_select_names_model_signals[E_SELECT_NAMES_MODEL_LAST_SIGNAL] = { 0 }; - -/* Object argument IDs */ -enum { - ARG_0, - ARG_CARD, -}; - -static void e_select_names_model_init (ESelectNamesModel *model); -static void e_select_names_model_class_init (ESelectNamesModelClass *klass); - -static void e_select_names_model_destroy (GtkObject *object); -static void e_select_names_model_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_select_names_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - -/** - * e_select_names_model_get_type: - * @void: - * - * Registers the &ESelectNamesModel class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &ESelectNamesModel class. - **/ -GtkType -e_select_names_model_get_type (void) -{ - static GtkType model_type = 0; - - if (!model_type) { - GtkTypeInfo model_info = { - "ESelectNamesModel", - sizeof (ESelectNamesModel), - sizeof (ESelectNamesModelClass), - (GtkClassInitFunc) e_select_names_model_class_init, - (GtkObjectInitFunc) e_select_names_model_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - model_type = gtk_type_unique (gtk_object_get_type (), &model_info); - } - - return model_type; -} - -/** - * e_select_names_model_new: - * @VCard: a string in vCard format - * - * Returns: a new #ESelectNamesModel that wraps the @VCard. - */ -ESelectNamesModel * -e_select_names_model_new (void) -{ - ESelectNamesModel *model = E_SELECT_NAMES_MODEL(gtk_type_new(e_select_names_model_get_type())); - return model; -} - -/** - * e_select_names_model_new: - * @VCard: a string in vCard format - * - * Returns: a new #ESelectNamesModel that wraps the @VCard. - */ -ESelectNamesModel * -e_select_names_model_duplicate (ESelectNamesModel *old) -{ - ESelectNamesModel *model = E_SELECT_NAMES_MODEL(gtk_type_new(e_select_names_model_get_type())); - model->data = e_list_duplicate(old->data); - model->id = g_strdup(old->id); - model->title = g_strdup(old->title); - return model; -} - -static void -e_select_names_model_class_init (ESelectNamesModelClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS(klass); - - e_select_names_model_signals[E_SELECT_NAMES_MODEL_CHANGED] = - gtk_signal_new ("changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ESelectNamesModelClass, changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, e_select_names_model_signals, E_SELECT_NAMES_MODEL_LAST_SIGNAL); - - gtk_object_add_arg_type ("ESelectNamesModel::card", - GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CARD); - - klass->changed = NULL; - - object_class->destroy = e_select_names_model_destroy; - object_class->get_arg = e_select_names_model_get_arg; - object_class->set_arg = e_select_names_model_set_arg; -} - -/* - * ESelectNamesModel lifecycle management and vcard loading/saving. - */ - -static void -e_select_names_model_destroy (GtkObject *object) -{ - ESelectNamesModel *model; - - model = E_SELECT_NAMES_MODEL (object); - - gtk_object_unref(GTK_OBJECT(model->data)); -} - - -/* Set_arg handler for the model */ -static void -e_select_names_model_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ESelectNamesModel *model; - - model = E_SELECT_NAMES_MODEL (object); - - switch (arg_id) { - case ARG_CARD: - break; - default: - return; - } -} - -/* Get_arg handler for the model */ -static void -e_select_names_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ESelectNamesModel *model; - - model = E_SELECT_NAMES_MODEL (object); - - switch (arg_id) { - case ARG_CARD: - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void * -data_copy(const void *sec, void *data) -{ - const ESelectNamesModelData *section = sec; - ESelectNamesModelData *newsec; - - newsec = g_new(ESelectNamesModelData, 1); - newsec->type = section->type; - newsec->card = section->card; - if (newsec->card) - gtk_object_ref(GTK_OBJECT(newsec->card)); - newsec->string = g_strdup(section->string); - return newsec; -} - -static void -data_free(void *sec, void *data) -{ - ESelectNamesModelData *section = sec; - if (section->card) - gtk_object_unref(GTK_OBJECT(section->card)); - g_free(section->string); - g_free(section); -} - -/** - * e_select_names_model_init: - */ -static void -e_select_names_model_init (ESelectNamesModel *model) -{ - model->data = e_list_new(data_copy, data_free, model); -} - -static void * -copy_func(const void *data, void *user_data) -{ - GtkObject *object = (void *) data; - if (object) - gtk_object_ref(object); - return object; -} - -static void -free_func(void *data, void *user_data) -{ - GtkObject *object = data; - if (object) - gtk_object_unref(object); -} - -/* Of type ECard */ -EList *e_select_names_model_get_cards (ESelectNamesModel *model) -{ - EList *list = e_list_new(copy_func, free_func, NULL); - EIterator *iterator = e_list_get_iterator(model->data); - EIterator *new_iterator = e_list_get_iterator(list); - - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - ESelectNamesModelData *node = (void *) e_iterator_get(iterator); - ECard *card; - ECardSimple *simple; - if (node->card) { - card = node->card; - gtk_object_ref(GTK_OBJECT(card)); - } else { - card = e_card_new(""); - } - simple = e_card_simple_new(card); - e_card_simple_set_arbitrary(simple, "text_version", "string", node->string); - e_iterator_insert(new_iterator, card, FALSE); - gtk_object_unref(GTK_OBJECT(card)); - gtk_object_unref(GTK_OBJECT(simple)); - } - return list; -} - -EList *e_select_names_model_get_data (ESelectNamesModel *model) -{ - return model->data; -} - -static void -e_select_names_model_changed (ESelectNamesModel *model) -{ - gtk_signal_emit(GTK_OBJECT(model), - e_select_names_model_signals[E_SELECT_NAMES_MODEL_CHANGED]); -} - -void -e_select_names_model_insert (ESelectNamesModel *model, - EIterator *iterator, /* Must be one of the iterators in the model, or NULL if the list is empty. */ - int index, - char *data) -{ - gchar **strings = e_strsplit(data, ",", -1); - int i; - if (iterator == NULL) { - ESelectNamesModelData new = {E_SELECT_NAMES_MODEL_DATA_TYPE_STRING_ADDRESS, NULL, ""}; - - e_list_append(model->data, &new); - iterator = e_list_get_iterator(model->data); - - index = 0; - } else { - gtk_object_ref(GTK_OBJECT(iterator)); - } - if (strings[0]) { - ESelectNamesModelData *node = (void *) e_iterator_get(iterator); - gchar *temp = g_strdup_printf("%.*s%s%s", index, node->string, strings[0], node->string + index); - g_free(node->string); - node->string = temp; - index += strlen(strings[0]); - - for (i = 1; strings[i]; i++) { - ESelectNamesModelData *node = (void *) e_iterator_get(iterator); - gchar *temp = g_strdup_printf("%.*s", index, node->string); - gchar *temp2 = g_strdup_printf("%s%s", strings[i], node->string + index); - - g_free(node->string); - node->type = E_SELECT_NAMES_MODEL_DATA_TYPE_STRING_ADDRESS; - node->string = temp; - if (node->card) - gtk_object_unref(GTK_OBJECT(node->card)); - node->card = NULL; - - node = g_new(ESelectNamesModelData, 1); - node->type = E_SELECT_NAMES_MODEL_DATA_TYPE_STRING_ADDRESS; - node->card = NULL; - node->string = temp2; - e_iterator_insert(iterator, node, 0); - index = strlen(strings[i]); - g_free(node->string); - g_free(node); - } - } - e_select_names_model_changed(model); - gtk_object_unref(GTK_OBJECT(iterator)); -} - -void -e_select_names_model_insert_length (ESelectNamesModel *model, - EIterator *iterator, /* Must be one of the iterators in the model. */ - int index, - char *data, - int length) -{ - gchar *string = g_new(char, length + 1); - strncpy(string, data, length); - string[length] = 0; - e_select_names_model_insert(model, iterator, index, string); - g_free(string); -} - -void -e_select_names_model_delete (ESelectNamesModel *model, - EIterator *iterator, /* Must be one of the iterators in the model. */ - int index, - int length) -{ - while (length > 0 && e_iterator_is_valid(iterator)) { - ESelectNamesModelData *node = (void *) e_iterator_get(iterator); - int this_length = strlen(node->string); - if (this_length <= index + length) { - gchar *temp = g_strdup_printf("%.*s", index, node->string); - g_free(node->string); - node->string = temp; - length -= this_length - index; - } else { - gchar *temp = g_strdup_printf("%.*s%s", index, node->string, node->string + index + length); - g_free(node->string); - node->string = temp; - break; - } - - if (length > 0) { - e_iterator_next(iterator); - if (e_iterator_is_valid(iterator)) { - ESelectNamesModelData *node2 = (void *) e_iterator_get(iterator); - gchar *temp = g_strdup_printf("%s%s", node->string, node2->string); - g_free(node2->string); - node2->string = temp; - e_iterator_prev(iterator); - e_iterator_delete(iterator); - length --; - } - } - } - e_select_names_model_changed(model); -} - -void -e_select_names_model_replace (ESelectNamesModel *model, - EIterator *iterator, /* Must be one of the iterators in the model. */ - int index, - int length, - char *data) -{ - if (iterator == NULL) { - ESelectNamesModelData new = {E_SELECT_NAMES_MODEL_DATA_TYPE_STRING_ADDRESS, NULL, ""}; - - e_list_append(model->data, &new); - iterator = e_list_get_iterator(model->data); - - index = 0; - } else { - gtk_object_ref(GTK_OBJECT(iterator)); - } - while (length > 0 && e_iterator_is_valid(iterator)) { - ESelectNamesModelData *node = (void *) e_iterator_get(iterator); - int this_length = strlen(node->string); - if (this_length <= index + length) { - gchar *temp = g_strdup_printf("%.*s", index, node->string); - g_free(node->string); - node->string = temp; - length -= this_length - index; - } else { - gchar *temp = g_strdup_printf("%.*s%s", index, node->string, node->string + index + length); - g_free(node->string); - node->string = temp; - length = 0; - } - - if (length > 0) { - e_iterator_next(iterator); - if (e_iterator_is_valid(iterator)) { - ESelectNamesModelData *node2 = (void *) e_iterator_get(iterator); - gchar *temp = g_strdup_printf("%s%s", node->string, node2->string); - g_free(node2->string); - node2->string = temp; - e_iterator_prev(iterator); - e_iterator_delete(iterator); - } - } - } - if (!e_iterator_is_valid(iterator)) { - ESelectNamesModelData *node; - e_iterator_last(iterator); - if (e_iterator_is_valid(iterator)) { - node = (void *) e_iterator_get(iterator); - index = strlen(node->string); - } else - index = 0; - } - e_select_names_model_insert (model, iterator, index, data); - gtk_object_unref(GTK_OBJECT(iterator)); -} - - -void -e_select_names_model_add_item (ESelectNamesModel *model, - EIterator *iterator, /* NULL for at the beginning. */ - ESelectNamesModelData *data) -{ - e_iterator_insert(iterator, data, FALSE); - e_select_names_model_changed(model); -} - -void -e_select_names_model_remove_item (ESelectNamesModel *model, - EIterator *iterator) -{ - e_iterator_delete(iterator); - e_select_names_model_changed(model); -} - - diff --git a/addressbook/gui/component/select-names/e-select-names-model.h b/addressbook/gui/component/select-names/e-select-names-model.h deleted file mode 100644 index 4ea1bdc8db..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-model.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#ifndef __E_SELECT_NAMES_MODEL_H__ -#define __E_SELECT_NAMES_MODEL_H__ - -#include <time.h> -#include <gtk/gtk.h> -#include <stdio.h> -#include <e-util/e-list.h> -#include <addressbook/backend/ebook/e-card.h> - -#define E_TYPE_SELECT_NAMES_MODEL (e_select_names_model_get_type ()) -#define E_SELECT_NAMES_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SELECT_NAMES_MODEL, ESelectNamesModel)) -#define E_SELECT_NAMES_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_MODEL, ESelectNamesModelClass)) -#define E_IS_SELECT_NAMES_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SELECT_NAMES_MODEL)) -#define E_IS_SELECT_NAMES_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_MODEL)) - -typedef enum _ESelectNamesModelDataType ESelectNamesModelDataType; -typedef struct _ESelectNamesModelData ESelectNamesModelData; -typedef struct _ESelectNamesModel ESelectNamesModel; -typedef struct _ESelectNamesModelClass ESelectNamesModelClass; - -enum _ESelectNamesModelDataType { - E_SELECT_NAMES_MODEL_DATA_TYPE_CARD, - E_SELECT_NAMES_MODEL_DATA_TYPE_STRING_ADDRESS, -}; - -struct _ESelectNamesModelData { - ESelectNamesModelDataType type; - ECard *card; - char *string; -}; - -struct _ESelectNamesModel { - GtkObject object; - - char *id; - char *title; - - EList *data; /* Of type ESelectNamesModelData. */ -}; - -struct _ESelectNamesModelClass { - GtkObjectClass parent_class; - - void (*changed) (ESelectNamesModel *model); -}; - -ESelectNamesModel *e_select_names_model_new (void); -ESelectNamesModel *e_select_names_model_duplicate (ESelectNamesModel *old); - -/* These lengths are allowed to go over objects and act just like the text model does. */ -void e_select_names_model_insert (ESelectNamesModel *model, - EIterator *iterator, /* Must be one of the iterators in the model. */ - int index, - char *data); -void e_select_names_model_insert_length (ESelectNamesModel *model, - EIterator *iterator, /* Must be one of the iterators in the model. */ - int index, - char *data, - int length); -void e_select_names_model_delete (ESelectNamesModel *model, - EIterator *iterator, /* Must be one of the iterators in the model. */ - int index, - int length); -void e_select_names_model_replace (ESelectNamesModel *model, - EIterator *iterator, /* Must be one of the iterators in the model. */ - int index, - int replacement_length, - char *data); - -void e_select_names_model_add_item (ESelectNamesModel *model, - EIterator *iterator, /* NULL for at the beginning. */ - ESelectNamesModelData *data); -void e_select_names_model_remove_item (ESelectNamesModel *model, - EIterator *iterator); - -/* Of type ECard */ -EList *e_select_names_model_get_cards (ESelectNamesModel *model); - -/* Of type ESelectNamesModelData */ -EList *e_select_names_model_get_data (ESelectNamesModel *model); - -/* Standard Gtk function */ -GtkType e_select_names_model_get_type (void); - -#endif /* ! __E_SELECT_NAMES_MODEL_H__ */ diff --git a/addressbook/gui/component/select-names/e-select-names-table-model.c b/addressbook/gui/component/select-names/e-select-names-table-model.c deleted file mode 100644 index 0c56606c31..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-table-model.c +++ /dev/null @@ -1,353 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#include <config.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <gtk/gtk.h> - -#include "e-util/e-util.h" -#include "e-select-names-table-model.h" -#include "addressbook/backend/ebook/e-card-simple.h" - -/* Object argument IDs */ -enum { - ARG_0, - ARG_SOURCE, -}; - -static void e_select_names_table_model_init (ESelectNamesTableModel *model); -static void e_select_names_table_model_class_init (ESelectNamesTableModelClass *klass); - -static void e_select_names_table_model_destroy (GtkObject *object); -static void e_select_names_table_model_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_select_names_table_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - -static void e_select_names_table_model_model_changed (ESelectNamesModel *source, - ESelectNamesTableModel *model); - - -static void -e_select_names_table_model_add_source (ESelectNamesTableModel *model, - ESelectNamesModel *source) -{ - model->source = source; - if (model->source) - gtk_object_ref(GTK_OBJECT(model->source)); - model->source_changed_id = gtk_signal_connect(GTK_OBJECT(model->source), "changed", - GTK_SIGNAL_FUNC(e_select_names_table_model_model_changed), - model); -} - -static void -e_select_names_table_model_drop_source (ESelectNamesTableModel *model) -{ - if (model->source_changed_id) - gtk_signal_disconnect(GTK_OBJECT(model->source), model->source_changed_id); - if (model->source) - gtk_object_unref(GTK_OBJECT(model->source)); - model->source = NULL; - model->source_changed_id = 0; -} - -/** - * e_select_names_table_model_get_type: - * @void: - * - * Registers the &ESelectNamesTableModel class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &ESelectNamesTableModel class. - **/ -GtkType -e_select_names_table_model_get_type (void) -{ - static GtkType model_type = 0; - - if (!model_type) { - GtkTypeInfo model_info = { - "ESelectNamesTableModel", - sizeof (ESelectNamesTableModel), - sizeof (ESelectNamesTableModelClass), - (GtkClassInitFunc) e_select_names_table_model_class_init, - (GtkObjectInitFunc) e_select_names_table_model_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - model_type = gtk_type_unique (e_table_model_get_type (), &model_info); - } - - return model_type; -} - -/** - * e_select_names_table_model_new: - * @VCard: a string in vCard format - * - * Returns: a new #ESelectNamesTableModel that wraps the @VCard. - */ -ETableModel * -e_select_names_table_model_new (ESelectNamesModel *source) -{ - ETableModel *model = E_TABLE_MODEL(gtk_type_new(e_select_names_table_model_get_type())); - gtk_object_set(GTK_OBJECT(model), - "source", source, - NULL); - return model; -} - -static void -fill_in_info (ESelectNamesTableModel *model) -{ - if (model->source) { - EList *list = e_select_names_model_get_data(model->source); - EIterator *iterator = e_list_get_iterator(list); - int count = 0; - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - count ++; - } - model->count = count; - model->data = g_new(ESelectNamesTableModelData, count); - count = 0; - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - const ESelectNamesModelData *data = e_iterator_get(iterator); - switch (data->type) { - case E_SELECT_NAMES_MODEL_DATA_TYPE_CARD: { - ECardSimple *simple = e_card_simple_new(data->card); - model->data[count].name = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_FULL_NAME); - if ((model->data[count].name == 0) || *model->data[count].name == 0) { - model->data[count].name = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_ORG); - } - if (model->data[count].name == 0) - model->data[count].name = g_strdup(""); - model->data[count].email = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_EMAIL); - if (model->data[count].email == 0) - model->data[count].email = g_strdup(""); - gtk_object_unref(GTK_OBJECT(simple)); - count ++; - break; - } - case E_SELECT_NAMES_MODEL_DATA_TYPE_STRING_ADDRESS: - model->data[count].name = e_strdup_strip(data->string); - model->data[count].email = e_strdup_strip(data->string); - count ++; - break; - } - } - } else { - model->count = 0; - } -} - -static void -clear_info (ESelectNamesTableModel *model) -{ - int i; - for (i = 0; i < model->count; i++) { - g_free(model->data[i].name); - g_free(model->data[i].email); - } - g_free(model->data); - model->data = NULL; - model->count = -1; -} - -/* - * ESelectNamesTableModel lifecycle management and vcard loading/saving. - */ - -static void -e_select_names_table_model_destroy (GtkObject *object) -{ - ESelectNamesTableModel *model; - - model = E_SELECT_NAMES_TABLE_MODEL (object); - - e_select_names_table_model_drop_source (model); - clear_info(model); -} - -/* This function returns the number of columns in our ETableModel. */ -static int -e_select_names_table_model_col_count (ETableModel *etc) -{ - return 2; -} - -/* This function returns the number of rows in our ETableModel. */ -static int -e_select_names_table_model_row_count (ETableModel *etc) -{ - ESelectNamesTableModel *e_select_names_table_model = E_SELECT_NAMES_TABLE_MODEL(etc); - if (e_select_names_table_model->count == -1) { - if (e_select_names_table_model->source) { - fill_in_info(e_select_names_table_model); - } else { - return 0; - } - } - return e_select_names_table_model->count; -} - -/* This function returns the value at a particular point in our ETableModel. */ -static void * -e_select_names_table_model_value_at (ETableModel *etc, int col, int row) -{ - ESelectNamesTableModel *e_select_names_table_model = E_SELECT_NAMES_TABLE_MODEL(etc); - if (e_select_names_table_model->data == NULL) { - fill_in_info(e_select_names_table_model); - } - switch (col) { - case 0: - if (e_select_names_table_model->data[row].name == NULL) { - fill_in_info(e_select_names_table_model); - } - return e_select_names_table_model->data[row].name; - break; - case 1: - if (e_select_names_table_model->data[row].email == NULL) { - fill_in_info(e_select_names_table_model); - } - return e_select_names_table_model->data[row].email; - break; - } - return ""; -} - -/* This function sets the value at a particular point in our ETableModel. */ -static void -e_select_names_table_model_set_value_at (ETableModel *etc, int col, int row, const void *val) -{ -} - -/* This function returns whether a particular cell is editable. */ -static gboolean -e_select_names_table_model_is_cell_editable (ETableModel *etc, int col, int row) -{ - return FALSE; -} - -/* This function duplicates the value passed to it. */ -static void * -e_select_names_table_model_duplicate_value (ETableModel *etc, int col, const void *value) -{ - return g_strdup(value); -} - -/* This function frees the value passed to it. */ -static void -e_select_names_table_model_free_value (ETableModel *etc, int col, void *value) -{ - g_free(value); -} - -static void * -e_select_names_table_model_initialize_value (ETableModel *etc, int col) -{ - return g_strdup(""); -} - -static gboolean -e_select_names_table_model_value_is_empty (ETableModel *etc, int col, const void *value) -{ - return !(value && *(char *)value); -} - -static char * -e_select_names_table_model_value_to_string (ETableModel *etc, int col, const void *value) -{ - return g_strdup(value); -} - -static void -e_select_names_table_model_model_changed (ESelectNamesModel *source, - ESelectNamesTableModel *model) -{ - clear_info(model); - e_table_model_changed(E_TABLE_MODEL(model)); -} - -/* Set_arg handler for the model */ -static void -e_select_names_table_model_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ESelectNamesTableModel *model; - - model = E_SELECT_NAMES_TABLE_MODEL (object); - - switch (arg_id) { - case ARG_SOURCE: - e_select_names_table_model_drop_source (model); - e_select_names_table_model_add_source (model, E_SELECT_NAMES_MODEL(GTK_VALUE_OBJECT (*arg))); - break; - default: - return; - } -} - -/* Get_arg handler for the model */ -static void -e_select_names_table_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ESelectNamesTableModel *model; - - model = E_SELECT_NAMES_TABLE_MODEL (object); - - switch (arg_id) { - case ARG_SOURCE: - GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(model->source); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -/** - * e_select_names_table_model_init: - */ -static void -e_select_names_table_model_init (ESelectNamesTableModel *model) -{ - model->source = NULL; - model->source_changed_id = 0; - - model->count = -1; - model->data = NULL; -} - -static void -e_select_names_table_model_class_init (ESelectNamesTableModelClass *klass) -{ - GtkObjectClass *object_class; - ETableModelClass *table_model_class; - - object_class = GTK_OBJECT_CLASS(klass); - table_model_class = E_TABLE_MODEL_CLASS(klass); - - gtk_object_add_arg_type ("ESelectNamesTableModel::source", - GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_SOURCE); - - object_class->destroy = e_select_names_table_model_destroy; - object_class->get_arg = e_select_names_table_model_get_arg; - object_class->set_arg = e_select_names_table_model_set_arg; - - table_model_class->column_count = e_select_names_table_model_col_count; - table_model_class->row_count = e_select_names_table_model_row_count; - table_model_class->value_at = e_select_names_table_model_value_at; - table_model_class->set_value_at = e_select_names_table_model_set_value_at; - table_model_class->is_cell_editable = e_select_names_table_model_is_cell_editable; - table_model_class->duplicate_value = e_select_names_table_model_duplicate_value; - table_model_class->free_value = e_select_names_table_model_free_value; - table_model_class->initialize_value = e_select_names_table_model_initialize_value; - table_model_class->value_is_empty = e_select_names_table_model_value_is_empty; - table_model_class->value_to_string = e_select_names_table_model_value_to_string; -} diff --git a/addressbook/gui/component/select-names/e-select-names-table-model.h b/addressbook/gui/component/select-names/e-select-names-table-model.h deleted file mode 100644 index e0f0f5d804..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-table-model.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#ifndef __E_SELECT_NAMES_TABLE_MODEL_H__ -#define __E_SELECT_NAMES_TABLE_MODEL_H__ - -#include <time.h> -#include <gtk/gtk.h> -#include <stdio.h> -#include "e-select-names-model.h" -#include <widgets/e-table/e-table-model.h> - -#define E_TYPE_SELECT_NAMES_TABLE_MODEL (e_select_names_table_model_get_type ()) -#define E_SELECT_NAMES_TABLE_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SELECT_NAMES_TABLE_MODEL, ESelectNamesTableModel)) -#define E_SELECT_NAMES_TABLE_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_TABLE_MODEL, ESelectNamesTableModelClass)) -#define E_IS_SELECT_NAMES_TABLE_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SELECT_NAMES_TABLE_MODEL)) -#define E_IS_SELECT_NAMES_TABLE_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_TABLE_MODEL)) - -typedef struct { - char *name; - char *email; -} ESelectNamesTableModelData; - -typedef struct _ESelectNamesTableModel ESelectNamesTableModel; -typedef struct _ESelectNamesTableModelClass ESelectNamesTableModelClass; - -struct _ESelectNamesTableModel { - ETableModel parent; - - ESelectNamesModel *source; - int source_changed_id; - - int count; - ESelectNamesTableModelData *data; /* This is used as an array. */ -}; - -struct _ESelectNamesTableModelClass { - ETableModelClass parent_class; -}; - -ETableModel *e_select_names_table_model_new (ESelectNamesModel *source); - -/* Standard Gtk function */ -GtkType e_select_names_table_model_get_type (void); - -#endif /* ! __E_SELECT_NAMES_TABLE_MODEL_H__ */ diff --git a/addressbook/gui/component/select-names/e-select-names-text-model.c b/addressbook/gui/component/select-names/e-select-names-text-model.c deleted file mode 100644 index 71934c46dc..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-text-model.c +++ /dev/null @@ -1,357 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#include <config.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <gtk/gtk.h> - -#include "e-select-names-text-model.h" - -/* Object argument IDs */ -enum { - ARG_0, - ARG_SOURCE, -}; - -static void e_select_names_text_model_init (ESelectNamesTextModel *model); -static void e_select_names_text_model_class_init (ESelectNamesTextModelClass *klass); - -static void e_select_names_text_model_destroy (GtkObject *object); -static void e_select_names_text_model_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_select_names_text_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - -static void e_select_names_text_model_set_text (ETextModel *model, gchar *text); -static void e_select_names_text_model_insert (ETextModel *model, gint position, gchar *text); -static void e_select_names_text_model_insert_length (ETextModel *model, gint position, gchar *text, gint length); -static void e_select_names_text_model_delete (ETextModel *model, gint position, gint length); - -static void e_select_names_text_model_model_changed (ESelectNamesModel *source, - ESelectNamesTextModel *model); - - -ETextModelClass *parent_class; -#define PARENT_TYPE e_text_model_get_type() - -/** - * e_select_names_text_model_get_type: - * @void: - * - * Registers the &ESelectNamesTextModel class if necessary, and returns the type ID - * associated to it. - * - * Return value: The type ID of the &ESelectNamesTextModel class. - **/ -GtkType -e_select_names_text_model_get_type (void) -{ - static GtkType model_type = 0; - - if (!model_type) { - GtkTypeInfo model_info = { - "ESelectNamesTextModel", - sizeof (ESelectNamesTextModel), - sizeof (ESelectNamesTextModelClass), - (GtkClassInitFunc) e_select_names_text_model_class_init, - (GtkObjectInitFunc) e_select_names_text_model_init, - NULL, /* reserved_1 */ - NULL, /* reserved_2 */ - (GtkClassInitFunc) NULL - }; - - model_type = gtk_type_unique (PARENT_TYPE, &model_info); - } - - return model_type; -} - -/** - * e_select_names_text_model_new: - * @VCard: a string in vCard format - * - * Returns: a new #ESelectNamesTextModel that wraps the @VCard. - */ -ETextModel * -e_select_names_text_model_new (ESelectNamesModel *source) -{ - ETextModel *model = E_TEXT_MODEL(gtk_type_new(e_select_names_text_model_get_type())); - gtk_object_set(GTK_OBJECT(model), - "source", source, - NULL); - e_select_names_text_model_model_changed (source, E_SELECT_NAMES_TEXT_MODEL(model)); - return model; -} - -static void -e_select_names_text_model_class_init (ESelectNamesTextModelClass *klass) -{ - GtkObjectClass *object_class; - ETextModelClass *text_model_class; - - object_class = GTK_OBJECT_CLASS(klass); - text_model_class = E_TEXT_MODEL_CLASS(klass); - - parent_class = gtk_type_class(PARENT_TYPE); - - gtk_object_add_arg_type ("ESelectNamesTextModel::source", - GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_SOURCE); - - object_class->destroy = e_select_names_text_model_destroy; - object_class->get_arg = e_select_names_text_model_get_arg; - object_class->set_arg = e_select_names_text_model_set_arg; - - text_model_class->set_text = e_select_names_text_model_set_text; - text_model_class->insert = e_select_names_text_model_insert; - text_model_class->insert_length = e_select_names_text_model_insert_length; - text_model_class->delete = e_select_names_text_model_delete; -} - -static int -get_length(EIterator *iterator) -{ - const ESelectNamesModelData *data = e_iterator_get(iterator); - return strlen(data->string); -} - -static void -e_select_names_text_model_set_text (ETextModel *model, gchar *text) -{ - ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL(model)->source; - EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(source)); - int length = 0; - if (model->text) { - length = strlen(model->text); - } - - e_iterator_reset(iterator); - if (!e_iterator_is_valid(iterator)) { - gtk_object_unref(GTK_OBJECT(iterator)); - iterator = NULL; - } - e_select_names_model_replace(source, - iterator, - 0, - length, - text); - if (iterator) - gtk_object_unref(GTK_OBJECT(iterator)); -} - -static void -e_select_names_text_model_insert (ETextModel *model, gint position, gchar *text) -{ - ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL(model)->source; - EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(source)); - - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - int this_length = get_length(iterator); - if (position <= this_length) { - break; - } else { - position -= this_length + 1; - } - } - if (!e_iterator_is_valid(iterator)) { - gtk_object_unref(GTK_OBJECT(iterator)); - iterator = NULL; - } - e_select_names_model_insert(source, - iterator, - position, - text); - if (iterator) - gtk_object_unref(GTK_OBJECT(iterator)); -} - -static void -e_select_names_text_model_insert_length (ETextModel *model, gint position, gchar *text, gint length) -{ - ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL(model)->source; - EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(source)); - - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - int this_length = get_length(iterator); - if (position <= this_length) { - break; - } else { - position -= this_length + 1; - } - } - if (!e_iterator_is_valid(iterator)) { - gtk_object_unref(GTK_OBJECT(iterator)); - iterator = NULL; - } - e_select_names_model_insert_length(source, - iterator, - position, - text, - length); - if (iterator) - gtk_object_unref(GTK_OBJECT(iterator)); -} - -static void -e_select_names_text_model_delete (ETextModel *model, gint position, gint length) -{ - ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL(model)->source; - EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(source)); - - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - int this_length = get_length(iterator); - if (position <= this_length) { - e_select_names_model_delete(source, - iterator, - position, - length); - break; - } else { - position -= this_length + 1; - } - } - if (iterator) - gtk_object_unref(GTK_OBJECT(iterator)); -} - -static void -e_select_names_text_model_model_changed (ESelectNamesModel *source, - ESelectNamesTextModel *model) -{ - EList *list = e_select_names_model_get_data(source); - EIterator *iterator = e_list_get_iterator(list); - int length = 0; - int length_count = 0; - int *lengthsp; - char *string; - char *stringp; - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - const ESelectNamesModelData *data = e_iterator_get(iterator); - length += strlen(data->string); - length ++; - length_count++; - } - if (length > 0) - length --; - - g_free(model->lengths); - model->lengths = g_new(int, length_count + 1); - lengthsp = model->lengths; - - string = g_new(char, length + 1); - stringp = string; - *stringp = 0; - for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { - const ESelectNamesModelData *data = e_iterator_get(iterator); - int this_length; - - strcpy(stringp, data->string); - this_length = strlen(stringp); - stringp += this_length; - *(stringp++) = ','; - *(lengthsp++) = this_length; - } - if (stringp != string) { - stringp --; - *stringp = 0; - } - *lengthsp = -1; - g_free(E_TEXT_MODEL(model)->text); - E_TEXT_MODEL(model)->text = string; - e_text_model_changed(E_TEXT_MODEL(model)); -} - - -static void -e_select_names_text_model_add_source (ESelectNamesTextModel *model, - ESelectNamesModel *source) -{ - model->source = source; - if (model->source) - gtk_object_ref(GTK_OBJECT(model->source)); - model->source_changed_id = gtk_signal_connect(GTK_OBJECT(model->source), "changed", - GTK_SIGNAL_FUNC(e_select_names_text_model_model_changed), - model); -} - -static void -e_select_names_text_model_drop_source (ESelectNamesTextModel *model) -{ - if (model->source_changed_id) - gtk_signal_disconnect(GTK_OBJECT(model->source), model->source_changed_id); - if (model->source) - gtk_object_unref(GTK_OBJECT(model->source)); - model->source = NULL; - model->source_changed_id = 0; -} - -/* - * ESelectNamesTextModel lifecycle management and vcard loading/saving. - */ - -static void -e_select_names_text_model_destroy (GtkObject *object) -{ - ESelectNamesTextModel *model; - - model = E_SELECT_NAMES_TEXT_MODEL (object); - - e_select_names_text_model_drop_source(model); - g_free(model->lengths); - - if (GTK_OBJECT_CLASS(parent_class)->destroy) - GTK_OBJECT_CLASS(parent_class)->destroy(object); -} - - -/* Set_arg handler for the model */ -static void -e_select_names_text_model_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ESelectNamesTextModel *model; - - model = E_SELECT_NAMES_TEXT_MODEL (object); - - switch (arg_id) { - case ARG_SOURCE: - e_select_names_text_model_drop_source(model); - e_select_names_text_model_add_source(model, E_SELECT_NAMES_MODEL(GTK_VALUE_OBJECT(*arg))); - break; - default: - return; - } -} - -/* Get_arg handler for the model */ -static void -e_select_names_text_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ESelectNamesTextModel *model; - - model = E_SELECT_NAMES_TEXT_MODEL (object); - - switch (arg_id) { - case ARG_SOURCE: - GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(model->source); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -/** - * e_select_names_text_model_init: - */ -static void -e_select_names_text_model_init (ESelectNamesTextModel *model) -{ - model->source = NULL; - model->source_changed_id = 0; - model->lengths = NULL; -} - diff --git a/addressbook/gui/component/select-names/e-select-names-text-model.h b/addressbook/gui/component/select-names/e-select-names-text-model.h deleted file mode 100644 index aa23544251..0000000000 --- a/addressbook/gui/component/select-names/e-select-names-text-model.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: - * Chris Lahey <clahey@helixcode.com> - * - * Copyright (C) 2000 Helix Code, Inc. - */ - -#ifndef __E_SELECT_NAMES_TEXT_MODEL_H__ -#define __E_SELECT_NAMES_TEXT_MODEL_H__ - -#include <time.h> -#include <gtk/gtk.h> -#include <stdio.h> -#include "e-select-names-model.h" -#include <widgets/e-text/e-text-model.h> - -#define E_TYPE_SELECT_NAMES_TEXT_MODEL (e_select_names_text_model_get_type ()) -#define E_SELECT_NAMES_TEXT_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SELECT_NAMES_TEXT_MODEL, ESelectNamesTextModel)) -#define E_SELECT_NAMES_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_TEXT_MODEL, ESelectNamesTextModelClass)) -#define E_IS_SELECT_NAMES_TEXT_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SELECT_NAMES_TEXT_MODEL)) -#define E_IS_SELECT_NAMES_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_TEXT_MODEL)) - -typedef struct _ESelectNamesTextModel ESelectNamesTextModel; -typedef struct _ESelectNamesTextModelClass ESelectNamesTextModelClass; - -struct _ESelectNamesTextModel { - ETextModel parent; - - ESelectNamesModel *source; - int source_changed_id; - int *lengths; -}; - -struct _ESelectNamesTextModelClass { - ETextModelClass parent_class; -}; - -ETextModel *e_select_names_text_model_new (ESelectNamesModel *source); - -/* Standard Gtk function */ -GtkType e_select_names_text_model_get_type (void); - -#endif /* ! __E_SELECT_NAMES_TEXT_MODEL_H__ */ diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c deleted file mode 100644 index 2303f13ad1..0000000000 --- a/addressbook/gui/component/select-names/e-select-names.c +++ /dev/null @@ -1,424 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-select-names.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 "e-select-names.h" -#include <e-table-simple.h> -#include <e-cell-text.h> -#include <addressbook/gui/component/e-addressbook-model.h> -#include <addressbook/gui/component/e-cardlist-model.h> -#include <addressbook/backend/ebook/e-book.h> -#include "e-select-names-table-model.h" - -static void e_select_names_init (ESelectNames *card); -static void e_select_names_class_init (ESelectNamesClass *klass); -static void e_select_names_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_select_names_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_select_names_destroy (GtkObject *object); - -static GnomeDialogClass *parent_class = NULL; -#define PARENT_TYPE gnome_dialog_get_type() - -/* The arguments we take */ -enum { - ARG_0, -}; - -typedef struct { - char *title; - ETableModel *model; - ESelectNamesModel *source; - ESelectNames *names; -} ESelectNamesChild; - -GtkType -e_select_names_get_type (void) -{ - static GtkType type = 0; - - if (!type) { - static const GtkTypeInfo info = - { - "ESelectNames", - sizeof (ESelectNames), - sizeof (ESelectNamesClass), - (GtkClassInitFunc) e_select_names_class_init, - (GtkObjectInitFunc) e_select_names_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -static void -e_select_names_class_init (ESelectNamesClass *klass) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) klass; - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->set_arg = e_select_names_set_arg; - object_class->get_arg = e_select_names_get_arg; - object_class->destroy = e_select_names_destroy; -} - -#define SPEC "<ETableSpecification no-header=\"1\"> \ - <columns-shown> \ - <column> 2 </column> \ - </columns-shown> \ - <grouping> <leaf column=\"1\" ascending=\"1\"/> </grouping> \ -</ETableSpecification>" - -#define SPEC2 "<ETableSpecification no-header=\"1\"> \ - <columns-shown> \ - <column> 0 </column> \ - </columns-shown> \ - <grouping> </grouping> \ -</ETableSpecification>" - -GtkWidget *e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int num1, int num2); - -static void -set_book(EBook *book, EBookStatus status, ETableModel *model) -{ - gtk_object_set(GTK_OBJECT(model), - "book", book, - "query", "(contains \"email\" \"\")", - NULL); - gtk_object_unref(GTK_OBJECT(book)); -} - -GtkWidget * -e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int num1, int num2) -{ - ETableModel *model; - ETableHeader *header; - ECell *cell_left_just; - EBook *book; - GtkWidget *table; - char *filename; - char *uri; - - model = e_addressbook_model_new(); - gtk_object_set(GTK_OBJECT(model), - "editable", FALSE, - NULL); - cell_left_just = e_cell_text_new (model, NULL, GTK_JUSTIFY_LEFT); - - header = e_table_header_new (); - e_table_header_add_column (header, e_table_col_new (0, "Full Name", 1.0, 20, cell_left_just, - g_str_compare, TRUE), -1); - e_table_header_add_column (header, e_table_col_new (1, "Email", 1.0, 20, cell_left_just, - g_str_compare, TRUE), -1); - e_table_header_add_column (header, e_table_col_new (34, "Name", 1.0, 20, cell_left_just, - g_str_compare, TRUE), -1); - - book = e_book_new(); - gtk_object_ref(GTK_OBJECT(model)); - gtk_object_ref(GTK_OBJECT(book)); - filename = gnome_util_prepend_user_home("evolution/local/Contacts/addressbook.db"); - uri = g_strdup_printf("file://%s", filename); - e_book_load_uri(book, uri, (EBookCallback) set_book, model); - g_free(uri); - g_free(filename); - table = e_table_scrolled_new (header, model, SPEC); - - gtk_object_set(GTK_OBJECT(table), - "cursor_mode", E_TABLE_CURSOR_LINE, - NULL); - - gtk_object_set_data(GTK_OBJECT(table), "model", model); - return table; -} - -static void -set_current_selection(ETableScrolled *table, int row, ESelectNames *names) -{ - names->currently_selected = row; -} - -static void -e_select_names_init (ESelectNames *e_select_names) -{ - GladeXML *gui; - GtkWidget *widget; - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/select-names.glade", NULL); - e_select_names->gui = gui; - - e_select_names->children = g_hash_table_new(g_str_hash, g_str_equal); - e_select_names->child_count = 0; - - 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(e_select_names)->vbox), widget, TRUE, TRUE, 0); - gtk_widget_unref(widget); - - gnome_dialog_append_buttons(GNOME_DIALOG(e_select_names), - GNOME_STOCK_BUTTON_OK, - GNOME_STOCK_BUTTON_CANCEL, - NULL); - - gtk_window_set_policy(GTK_WINDOW(e_select_names), FALSE, TRUE, FALSE); - - e_select_names->table = E_TABLE_SCROLLED(glade_xml_get_widget(gui, "table-source")); - e_select_names->model = gtk_object_get_data(GTK_OBJECT(e_select_names->table), "model"); - - e_select_names->currently_selected = -1; - - gtk_signal_connect(GTK_OBJECT(e_select_names->table), "cursor_change", - GTK_SIGNAL_FUNC(set_current_selection), e_select_names); -} - -static void e_select_names_child_free(char *key, ESelectNamesChild *child, ESelectNames *e_select_names) -{ - g_free(child->title); - gtk_object_unref(GTK_OBJECT(child->model)); - gtk_object_unref(GTK_OBJECT(child->source)); - g_free(key); -} - -static void -e_select_names_destroy (GtkObject *object) { - ESelectNames *e_select_names = E_SELECT_NAMES(object); - - gtk_object_unref(GTK_OBJECT(e_select_names->gui)); - g_hash_table_foreach(e_select_names->children, (GHFunc) e_select_names_child_free, e_select_names); - g_hash_table_destroy(e_select_names->children); -} - -GtkWidget* -e_select_names_new (void) -{ - GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_select_names_get_type ())); - return widget; -} - -static void -e_select_names_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - ESelectNames *editor; - - editor = E_SELECT_NAMES (o); - - switch (arg_id){ - default: - return; - } -} - -static void -e_select_names_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - ESelectNames *e_select_names; - - e_select_names = E_SELECT_NAMES (object); - - switch (arg_id) { - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -button_clicked(GtkWidget *button, ESelectNamesChild *child) -{ - ESelectNames *names = child->names; - int row = names->currently_selected; - if (row != -1) { - ECard *card = e_addressbook_model_get_card(E_ADDRESSBOOK_MODEL(names->model), row); - ESelectNamesModelData new = {E_SELECT_NAMES_MODEL_DATA_TYPE_CARD, - card, - NULL}; - char *name, *email; - ECardSimple *simple = e_card_simple_new(card); - EIterator *iterator; - - name = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_FULL_NAME); - email = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_EMAIL); - if (name && *name && email && *email) { - new.string = g_strdup_printf("%s <%s>", name, email); - } else if (email && *email) { - new.string = g_strdup_printf("%s", email); - } else if (name && *name) { - new.string = g_strdup_printf("%s <>", name); - } else { - new.string = g_strdup(""); - } - - iterator = e_list_get_iterator(e_select_names_model_get_data(child->source)); - e_iterator_last(iterator); - e_select_names_model_add_item(child->source, iterator, &new); - - gtk_object_unref(GTK_OBJECT(simple)); - gtk_object_unref(GTK_OBJECT(card)); - g_free(email); - g_free(name); - g_free(new.string); - } -} - -static void -remove_address(ETableScrolled *table, int row, ESelectNamesChild *child) -{ - EIterator *iterator = e_list_get_iterator(e_select_names_model_get_data(child->source)); - e_iterator_reset(iterator); - for (; row > 0; row--) { - e_iterator_next(iterator); - } - e_select_names_model_remove_item(child->source, iterator); -} - -void -e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, ESelectNamesModel *source) -{ - ESelectNamesChild *child; - GtkWidget *button; - GtkWidget *alignment; - GtkTable *table; - char *label; - - ETableModel *model; - GtkWidget *etable; - ETableHeader *header; - ECell *cell_left_just; - - if (g_hash_table_lookup(e_select_names->children, id)) { - return; - } - - table = GTK_TABLE(glade_xml_get_widget (e_select_names->gui, "table-recipients")); - - child = g_new(ESelectNamesChild, 1); - - child->names = e_select_names; - child->title = g_strdup(_(name)); - - e_select_names->child_count++; - - alignment = gtk_alignment_new(0, 0, 1, 0); - label = g_strdup_printf("%s ->", child->title); - button = gtk_button_new_with_label(label); - g_free(label); - gtk_container_add(GTK_CONTAINER(alignment), button); - gtk_widget_show_all(alignment); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(button_clicked), child); - gtk_table_attach(table, alignment, - 0, 1, - e_select_names->child_count, - e_select_names->child_count + 1, - GTK_FILL, GTK_FILL, - 0, 0); - - model = e_select_names_table_model_new(source); - header = e_table_header_new (); - cell_left_just = e_cell_text_new (model, NULL, GTK_JUSTIFY_LEFT); - e_table_header_add_column (header, e_table_col_new (0, "Name", 1.0, 20, cell_left_just, - g_str_compare, TRUE), -1); - e_table_header_add_column (header, e_table_col_new (1, "Email", 1.0, 20, cell_left_just, - g_str_compare, TRUE), -1); - etable = e_table_scrolled_new (header, model, SPEC2); - - gtk_signal_connect(GTK_OBJECT(etable), "double_click", - GTK_SIGNAL_FUNC(remove_address), child); - - gtk_object_set(GTK_OBJECT(etable), - "cursor_mode", E_TABLE_CURSOR_LINE, - NULL); - - child->model = model; - child->source = source; - gtk_object_ref(GTK_OBJECT(child->model)); - gtk_object_ref(GTK_OBJECT(child->source)); - - gtk_widget_show(etable); - - gtk_table_attach(table, etable, - 1, 2, - e_select_names->child_count, - e_select_names->child_count + 1, - GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, - 0, 0); - - g_hash_table_insert(e_select_names->children, g_strdup(id), child); -} - -static void * -card_copy(const void *value, void *closure) -{ - gtk_object_ref(GTK_OBJECT(value)); - return (void *)value; -} - -static void -card_free(void *value, void *closure) -{ - gtk_object_unref(GTK_OBJECT(value)); -} - -EList * -e_select_names_get_section(ESelectNames *e_select_names, char *id) -{ - ESelectNamesChild *child; - int i; - int rows; - EList *list; - - child = g_hash_table_lookup(e_select_names->children, id); - if (!child) - return NULL; - rows = e_table_model_row_count(child->model); - - list = e_list_new(card_copy, card_free, NULL); - for (i = 0; i < rows; i++) { - ECard *card = e_cardlist_model_get(E_CARDLIST_MODEL(child->model), i); - e_list_append(list, card); - gtk_object_unref(GTK_OBJECT(card)); - } - return list; -} - -ESelectNamesModel * -e_select_names_get_source(ESelectNames *e_select_names, - char *id) -{ - ESelectNamesChild *child = g_hash_table_lookup(e_select_names->children, id); - if (child) { - if (child->source) - gtk_object_ref(GTK_OBJECT(child->source)); - return child->source; - } else - return NULL; -} diff --git a/addressbook/gui/component/select-names/e-select-names.h b/addressbook/gui/component/select-names/e-select-names.h deleted file mode 100644 index b1c11eb473..0000000000 --- a/addressbook/gui/component/select-names/e-select-names.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-select-names.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_SELECT_NAMES_H__ -#define __E_SELECT_NAMES_H__ - -#include <gnome.h> -#include <glade/glade.h> -#include <e-util/e-list.h> -#include <widgets/e-table/e-table.h> -#include <widgets/e-table/e-table-scrolled.h> -#include "e-select-names-model.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* ESelectNames - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - */ - -#define E_SELECT_NAMES_TYPE (e_select_names_get_type ()) -#define E_SELECT_NAMES(obj) (GTK_CHECK_CAST ((obj), E_SELECT_NAMES_TYPE, ESelectNames)) -#define E_SELECT_NAMES_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_SELECT_NAMES_TYPE, ESelectNamesClass)) -#define E_IS_SELECT_NAMES(obj) (GTK_CHECK_TYPE ((obj), E_SELECT_NAMES_TYPE)) -#define E_IS_SELECT_NAMES_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_SELECT_NAMES_TYPE)) - -typedef struct _ESelectNames ESelectNames; -typedef struct _ESelectNamesClass ESelectNamesClass; - -struct _ESelectNames -{ - GnomeDialog parent; - - /* item specific fields */ - GladeXML *gui; - - GHashTable *children; /* Of type char * to ESelectNamesChild */ - int child_count; - ETableScrolled *table; - ETableModel *model; - int currently_selected; -}; - -struct _ESelectNamesClass -{ - GnomeDialogClass parent_class; -}; - - -GtkWidget *e_select_names_new (void); -GtkType e_select_names_get_type (void); - -void e_select_names_add_section (ESelectNames *e_select_names, - char *name, - char *id, - ESelectNamesModel *source); -ESelectNamesModel *e_select_names_get_source (ESelectNames *e_select_names, - char *id); -/* Returns a ref counted list of addresses. */ -EList *e_select_names_get_section (ESelectNames *e_select_names, - char *id); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_SELECT_NAMES_H__ */ diff --git a/addressbook/gui/component/select-names/evolution-addressbook-select-names.oafinfo b/addressbook/gui/component/select-names/evolution-addressbook-select-names.oafinfo deleted file mode 100644 index e66c3aa38a..0000000000 --- a/addressbook/gui/component/select-names/evolution-addressbook-select-names.oafinfo +++ /dev/null @@ -1,29 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:factory:addressbook:select-names:b39eb1a1-f341-4d5a-9a91-e2616e206b2e" - type="exe" - location="evolution-addressbook"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/GenericFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Factory for the Addressbook's name selection interface"/> - -</oaf_server> - -<oaf_server iid="OAFIID:addressbook:select-names:39301deb-174b-40d1-8a6e-5edc300f7b61" - type="factory" - location="OAFIID:factory:addressbook:select-names:b39eb1a1-f341-4d5a-9a91-e2616e206b2e"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:Evolution/Addressbook/SelectNames"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Evolution's addressbook name selection interface."/> - -</oaf_server> - -</oaf_info>
\ No newline at end of file diff --git a/addressbook/gui/component/select-names/recipient.glade b/addressbook/gui/component/select-names/recipient.glade deleted file mode 100644 index b60972d094..0000000000 --- a/addressbook/gui/component/select-names/recipient.glade +++ /dev/null @@ -1,61 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>Recipient</name> - <program_name>recipient</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> - <use_widget_names>True</use_widget_names> - <output_main_file>False</output_main_file> - <output_support_files>False</output_support_files> - <output_build_files>False</output_build_files> - <gnome_help_support>True</gnome_help_support> -</project> - -<widget> - <class>GtkWindow</class> - <name>window1</name> - <visible>False</visible> - <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>GtkHBox</class> - <name>hbox-top</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkAlignment</class> - <name>alignment1</name> - <xalign>1.08033e-07</xalign> - <yalign>0</yalign> - <xscale>1</xscale> - <yscale>0</yscale> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkButton</class> - <name>text-button</name> - <can_focus>True</can_focus> - <label>-></label> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/addressbook/gui/component/select-names/select-names.glade b/addressbook/gui/component/select-names/select-names.glade deleted file mode 100644 index 90ca93bd3a..0000000000 --- a/addressbook/gui/component/select-names/select-names.glade +++ /dev/null @@ -1,247 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>Select-names</name> - <program_name>select-names</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> - <output_main_file>False</output_main_file> - <output_support_files>False</output_support_files> - <output_build_files>False</output_build_files> - <output_translatable_strings>True</output_translatable_strings> - <translatable_strings_file>select-names.glade.h</translatable_strings_file> -</project> - -<widget> - <class>GnomeDialog</class> - <name>dialog-top</name> - <visible>False</visible> - <title>Select Names</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>False</modal> - <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>3</rows> - <columns>2</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>GtkHBox</class> - <name>hbox1</name> - <homogeneous>False</homogeneous> - <spacing>4</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>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkEntry</class> - <name>entry-find</name> - <visible>False</visible> - <can_focus>True</can_focus> - <has_focus>True</has_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-find</name> - <visible>False</visible> - <can_focus>True</can_focus> - <label>Find...</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel1</name> - <label>Select name from List:</label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0</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>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>table-source</name> - <creation_function>e_addressbook_create_ebook_table</creation_function> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Sat, 10 Jun 2000 22:02:57 GMT</last_modification_time> - <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>True</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkTable</class> - <name>table-recipients</name> - <rows>1</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - <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> - <class>GtkAccelLabel</class> - <name>accellabel2</name> - <label>Message Recipients</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/addressbook/gui/component/select-names/select-names.glade.h b/addressbook/gui/component/select-names/select-names.glade.h deleted file mode 100644 index 1cb9702956..0000000000 --- a/addressbook/gui/component/select-names/select-names.glade.h +++ /dev/null @@ -1,10 +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_("Select Names"); -gchar *s = N_("Find..."); -gchar *s = N_("Select name from List:"); -gchar *s = N_("Message Recipients"); diff --git a/addressbook/gui/contact-editor/.cvsignore b/addressbook/gui/contact-editor/.cvsignore deleted file mode 100644 index 6fd0b5075c..0000000000 --- a/addressbook/gui/contact-editor/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -*.lo -*.la -contact-editor-test diff --git a/addressbook/gui/contact-editor/Makefile.am b/addressbook/gui/contact-editor/Makefile.am deleted file mode 100644 index f51a0109ac..0000000000 --- a/addressbook/gui/contact-editor/Makefile.am +++ /dev/null @@ -1,65 +0,0 @@ -CPPFLAGS = \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DDATADIR=\""$(datadir)"\" \ - -DEVOLUTIONDIR=\""$(evolutiondir)"\" - -INCLUDES = \ - $(BONOBO_GNOME_CFLAGS) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/addressbook/ \ - -I$(top_srcdir)/addressbook/backend \ - -I$(top_srcdir)/widgets/e-table \ - -DG_LOG_DOMAIN=\"contact-editor\" - -noinst_LIBRARIES = \ - libecontacteditor.a - -libecontacteditor_a_SOURCES = \ - e-contact-editor-categories.c \ - e-contact-editor-categories.h \ - e-contact-editor-fullname.c \ - e-contact-editor-fullname.h \ - e-contact-editor.c \ - e-contact-editor.h \ - e-contact-save-as.c \ - e-contact-save-as.h - -noinst_PROGRAMS = \ - contact-editor-test - -contact_editor_test_SOURCES = \ - test-editor.c - -contact_editor_test_LDADD = \ - libecontacteditor.a \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/addressbook/printing/libecontactprint.a \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/addressbook/ename/libename.la \ - $(top_builddir)/libversit/libversit.la \ - $(GNOMEGNORBA_LIBS) \ - $(BONOBO_GNOME_LIBS) \ - $(top_builddir)/widgets/e-table/libetable.a \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/widgets/e-text/libetext.a \ - $(EXTRA_GNOME_LIBS) - -evolutiondir = $(datadir)/evolution - -evolution_DATA = arrow.png - -gladedir = $(datadir)/evolution/glade - -glade_DATA = \ - contact-editor.glade \ - fullname.glade \ - categories.glade \ - e-contact-editor-confirm-delete.glade - -EXTRA_DIST = $(evolution_DATA) \ - $(glade_DATA) \ - e-contact-editor-strings.h \ - fullname-strings.h \ - categories-strings.h \ - e-contact-editor-confirm-delete.glade.h diff --git a/addressbook/gui/contact-editor/arrow.png b/addressbook/gui/contact-editor/arrow.png Binary files differdeleted file mode 100644 index b102356c78..0000000000 --- a/addressbook/gui/contact-editor/arrow.png +++ /dev/null diff --git a/addressbook/gui/contact-editor/briefcase.png b/addressbook/gui/contact-editor/briefcase.png Binary files differdeleted file mode 100644 index dd59b8fd39..0000000000 --- a/addressbook/gui/contact-editor/briefcase.png +++ /dev/null diff --git a/addressbook/gui/contact-editor/categories-strings.h b/addressbook/gui/contact-editor/categories-strings.h deleted file mode 100644 index 813018a00e..0000000000 --- a/addressbook/gui/contact-editor/categories-strings.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_("categories"); -gchar *s = N_("Item(s) belong to these categories:"); -gchar *s = N_("Available Categories:"); diff --git a/addressbook/gui/contact-editor/categories.glade b/addressbook/gui/contact-editor/categories.glade deleted file mode 100644 index bf78008940..0000000000 --- a/addressbook/gui/contact-editor/categories.glade +++ /dev/null @@ -1,190 +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> - <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>categories-strings.h</translatable_strings_file> -</project> - -<widget> - <class>GnomeDialog</class> - <name>categories</name> - <cxx_use_heap>True</cxx_use_heap> - <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> - <cxx_use_heap>True</cxx_use_heap> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>table-categories</name> - <cxx_use_heap>True</cxx_use_heap> - <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>GtkAccelLabel</class> - <name>accellabel1</name> - <cxx_use_heap>True</cxx_use_heap> - <label>Item(s) belong to these categories:</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>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel2</name> - <cxx_use_heap>True</cxx_use_heap> - <label>Available Categories:</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>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-categories</name> - <cxx_use_heap>True</cxx_use_heap> - <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> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>dialog-action_area1</name> - <cxx_use_heap>True</cxx_use_heap> - <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> - <cxx_use_heap>True</cxx_use_heap> - <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> - <cxx_use_heap>True</cxx_use_heap> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/addressbook/gui/contact-editor/contact-editor.glade b/addressbook/gui/contact-editor/contact-editor.glade deleted file mode 100644 index 7c328a72ce..0000000000 --- a/addressbook/gui/contact-editor/contact-editor.glade +++ /dev/null @@ -1,2332 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>Contact-editor</name> - <program_name>contact-editor</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> - <backup_source_files>False</backup_source_files> - <output_translatable_strings>True</output_translatable_strings> - <translatable_strings_file>e-contact-editor-strings.h</translatable_strings_file> -</project> - -<widget> - <class>GnomeDialog</class> - <name>dialog2</name> - <border_width>2</border_width> - <visible>False</visible> - <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-vbox2</name> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>dialog-action_area2</name> - <layout_style>GTK_BUTTONBOX_END</layout_style> - <spacing>8</spacing> - <child_min_width>85</child_min_width> - <child_min_height>27</child_min_height> - <child_ipad_x>7</child_ipad_x> - <child_ipad_y>0</child_ipad_y> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - <pack>GTK_PACK_END</pack> - </child> - - <widget> - <class>GtkButton</class> - <name>button28</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>button29</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>button30</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>table2</name> - <rows>2</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>0</row_spacing> - <column_spacing>2</column_spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkEntry</class> - <name>entry2</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>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>GtkVBox</class> - <name>vbox1</name> - <homogeneous>False</homogeneous> - <spacing>2</spacing> - <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>True</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkButton</class> - <name>button31</name> - <border_width>2</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>button32</name> - <border_width>2</border_width> - <can_focus>True</can_focus> - <label>_Delete</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkScrolledWindow</class> - <name>scrolledwindow1</name> - <height>200</height> - <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> - <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>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>True</show_titles> - <shadow_type>GTK_SHADOW_NONE</shadow_type> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>label20</name> - <label>Phone Types</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> - -<widget> - <class>GnomeDialog</class> - <name>dialog-add-phone</name> - <visible>False</visible> - <title>New phone type</title> - <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>vbox2</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHButtonBox</class> - <child_name>GnomeDialog:action_area</child_name> - <name>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> - <has_default>True</has_default> - <can_focus>True</can_focus> - <label>Add</label> - <stock_pixmap>GNOME_STOCK_PIXMAP_ADD</stock_pixmap> - </widget> - - <widget> - <class>GtkButton</class> - <name>button44</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>frame-add-phone</name> - <border_width>4</border_width> - <label>New phone type</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>GtkAlignment</class> - <name>alignment9</name> - <border_width>9</border_width> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>1</yscale> - - <widget> - <class>GtkEntry</class> - <name>entry-add-phone</name> - <can_focus>True</can_focus> - <has_focus>True</has_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - </widget> - </widget> - </widget> - </widget> -</widget> - -<widget> - <class>GnomeApp</class> - <name>contact editor</name> - <title>Contact Editor</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> - <enable_layout_config>True</enable_layout_config> - - <widget> - <class>GnomeDock</class> - <child_name>GnomeApp:dock</child_name> - <name>dock1</name> - <allow_floating>True</allow_floating> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkNotebook</class> - <child_name>GnomeDock:contents</child_name> - <name>notebook-contact-editor</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> - - <widget> - <class>GtkTable</class> - <name>table-contact-editor-general</name> - <border_width>7</border_width> - <rows>14</rows> - <columns>8</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - - <widget> - <class>GtkEntry</class> - <name>entry-phone1</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>7</left_attach> - <right_attach>8</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>entry-phone2</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>7</left_attach> - <right_attach>8</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-phone3</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>7</left_attach> - <right_attach>8</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-phone4</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>7</left_attach> - <right_attach>8</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>GtkText</class> - <name>text-address</name> - <width>1</width> - <height>1</height> - <can_focus>True</can_focus> - <editable>True</editable> - <text></text> - <child> - <left_attach>7</left_attach> - <right_attach>8</right_attach> - <top_attach>5</top_attach> - <bottom_attach>9</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-fullname</name> - <can_focus>True</can_focus> - <label>_Full Name...</label> - <child> - <left_attach>1</left_attach> - <right_attach>3</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel-fileas</name> - <label>File As:</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>3</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel-web</name> - <label>Web page 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>3</right_attach> - <top_attach>8</top_attach> - <bottom_attach>9</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>1</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>1</yscale> - <child> - <left_attach>2</left_attach> - <right_attach>3</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>True</yfill> - </child> - - <widget> - <class>GtkButton</class> - <name>button-email1</name> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment5</name> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <left_attach>6</left_attach> - <right_attach>7</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>GtkButton</class> - <name>button-phone4</name> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment7</name> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <left_attach>6</left_attach> - <right_attach>7</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkButton</class> - <name>button-phone2</name> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment8</name> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <left_attach>6</left_attach> - <right_attach>7</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkButton</class> - <name>button-phone1</name> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GtkHSeparator</class> - <name>hseparator4</name> - <child> - <left_attach>4</left_attach> - <right_attach>8</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> - <xpad>0</xpad> - <ypad>2</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment6</name> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <left_attach>6</left_attach> - <right_attach>7</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-phone3</name> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-fullname</name> - <has_default>True</has_default> - <can_focus>True</can_focus> - <has_focus>True</has_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>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>GtkEntry</class> - <name>entry-jobtitle</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>4</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-company</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>4</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-email1</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>4</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> - - <widget> - <class>GtkEntry</class> - <name>entry-web</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>4</right_attach> - <top_attach>8</top_attach> - <bottom_attach>9</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>GtkHSeparator</class> - <name>hseparator5</name> - <child> - <left_attach>0</left_attach> - <right_attach>4</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> - <xpad>0</xpad> - <ypad>2</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkCombo</class> - <name>combo-file-as</name> - <value_in_list>False</value_in_list> - <ok_if_empty>True</ok_if_empty> - <case_sensitive>True</case_sensitive> - <use_arrows>True</use_arrows> - <use_arrows_always>False</use_arrows_always> - <items></items> - <child> - <left_attach>3</left_attach> - <right_attach>4</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - - <widget> - <class>GtkEntry</class> - <child_name>GtkCombo:entry</child_name> - <name>entry-file-as</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>GtkHSeparator</class> - <name>hseparator6</name> - <child> - <left_attach>0</left_attach> - <right_attach>4</right_attach> - <top_attach>7</top_attach> - <bottom_attach>8</bottom_attach> - <xpad>0</xpad> - <ypad>2</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment10</name> - <xalign>0.5</xalign> - <yalign>0</yalign> - <xscale>1</xscale> - <yscale>1</yscale> - <child> - <left_attach>3</left_attach> - <right_attach>4</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>True</xshrink> - <yshrink>True</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkCheckButton</class> - <name>checkbutton-htmlmail</name> - <visible>False</visible> - <label>Wants to receive _HTML mail</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment4</name> - <xalign>1</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <left_attach>6</left_attach> - <right_attach>7</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>True</yfill> - </child> - - <widget> - <class>GtkButton</class> - <name>button-address</name> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <name>address-label</name> - <label>Address:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>text-address</focus_target> - <child> - <left_attach>5</left_attach> - <right_attach>7</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>True</yfill> - </child> - </widget> - - <widget> - <class>GtkEventBox</class> - <name>eventbox1</name> - <child> - <left_attach>5</left_attach> - <right_attach>6</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label-phone1</name> - <label>_Business</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - - <widget> - <class>GtkEventBox</class> - <name>eventbox2</name> - <child> - <left_attach>5</left_attach> - <right_attach>6</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label-phone2</name> - <label>_Home</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-phone2</focus_target> - </widget> - </widget> - - <widget> - <class>GtkEventBox</class> - <name>eventbox3</name> - <child> - <left_attach>5</left_attach> - <right_attach>6</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>GtkLabel</class> - <name>label-phone3</name> - <label>Business _Fax</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-phone3</focus_target> - </widget> - </widget> - - <widget> - <class>GtkEventBox</class> - <name>eventbox4</name> - <child> - <left_attach>5</left_attach> - <right_attach>6</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>GtkLabel</class> - <name>label-phone4</name> - <label>_Mobile</label> - <justify>GTK_JUSTIFY_LEFT</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>entry-phone4</focus_target> - </widget> - </widget> - - <widget> - <class>GtkEventBox</class> - <name>eventbox5</name> - <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>True</yfill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label-email1</name> - <label>Primary Email</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-email1</focus_target> - </widget> - </widget> - - <widget> - <class>GtkEventBox</class> - <name>eventbox-business</name> - <child> - <left_attach>5</left_attach> - <right_attach>6</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>True</yfill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label-address</name> - <label>B_usiness</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>text-address</focus_target> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment2</name> - <xalign>0</xalign> - <yalign>0</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <left_attach>7</left_attach> - <right_attach>8</right_attach> - <top_attach>9</top_attach> - <bottom_attach>10</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>GtkCheckButton</class> - <name>checkbutton-mailingaddress</name> - <visible>False</visible> - <label>_This is the mailing address</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - </widget> - </widget> - - <widget> - <class>GtkHSeparator</class> - <name>hseparator9</name> - <child> - <left_attach>0</left_attach> - <right_attach>4</right_attach> - <top_attach>11</top_attach> - <bottom_attach>12</bottom_attach> - <xpad>0</xpad> - <ypad>2</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkHSeparator</class> - <name>hseparator10</name> - <child> - <left_attach>4</left_attach> - <right_attach>8</right_attach> - <top_attach>11</top_attach> - <bottom_attach>12</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>GtkAlignment</class> - <name>alignment-contacts</name> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>0</yscale> - <child> - <left_attach>1</left_attach> - <right_attach>3</right_attach> - <top_attach>12</top_attach> - <bottom_attach>13</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-contacts</name> - <can_focus>True</can_focus> - <label>C_ontacts...</label> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment15</name> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>0</yscale> - <child> - <left_attach>7</left_attach> - <right_attach>8</right_attach> - <top_attach>12</top_attach> - <bottom_attach>13</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>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> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment14</name> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>0</yscale> - <child> - <left_attach>3</left_attach> - <right_attach>4</right_attach> - <top_attach>12</top_attach> - <bottom_attach>13</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>GtkEntry</class> - <name>entry-contacts</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>GtkAlignment</class> - <name>alignment16</name> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>1</xscale> - <yscale>0</yscale> - <child> - <left_attach>5</left_attach> - <right_attach>7</right_attach> - <top_attach>12</top_attach> - <bottom_attach>13</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-categories</name> - <can_focus>True</can_focus> - <label>Ca_tegories...</label> - </widget> - </widget> - - <widget> - <class>GtkEventBox</class> - <name>eventbox7</name> - <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>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label34</name> - <label>_Job title:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <focus_target>entry-jobtitle</focus_target> - </widget> - </widget> - - <widget> - <class>Custom</class> - <name>custom1</name> - <creation_function>e_create_image_widget</creation_function> - <string1>malehead.png</string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 18 May 2000 12:19:47 GMT</last_modification_time> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>custom2</name> - <creation_function>e_create_image_widget</creation_function> - <string1>cellphone.png</string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 18 May 2000 12:20:02 GMT</last_modification_time> - <child> - <left_attach>4</left_attach> - <right_attach>5</right_attach> - <top_attach>0</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>custom3</name> - <creation_function>e_create_image_widget</creation_function> - <string1>envelope.png</string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 18 May 2000 12:19:51 GMT</last_modification_time> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>5</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>True</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>custom4</name> - <creation_function>e_create_image_widget</creation_function> - <string1>house.png</string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 18 May 2000 12:20:06 GMT</last_modification_time> - <child> - <left_attach>4</left_attach> - <right_attach>5</right_attach> - <top_attach>5</top_attach> - <bottom_attach>10</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>Custom</class> - <name>custom5</name> - <creation_function>e_create_image_widget</creation_function> - <string1>evolution-contacts.png</string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 18 May 2000 12:19:59 GMT</last_modification_time> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>12</top_attach> - <bottom_attach>14</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>Custom</class> - <name>custom6</name> - <creation_function>e_create_image_widget</creation_function> - <string1>briefcase.png</string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 18 May 2000 12:20:09 GMT</last_modification_time> - <child> - <left_attach>4</left_attach> - <right_attach>5</right_attach> - <top_attach>12</top_attach> - <bottom_attach>14</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>Custom</class> - <name>custom10</name> - <creation_function>e_create_image_widget</creation_function> - <string1>globe.png</string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 18 May 2000 12:19:56 GMT</last_modification_time> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>8</top_attach> - <bottom_attach>10</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label35</name> - <label>_Company:</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-company</focus_target> - <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>True</xfill> - <yfill>True</yfill> - </child> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>label15</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>GtkTable</class> - <name>table-contact-editor-details</name> - <border_width>7</border_width> - <rows>9</rows> - <columns>6</columns> - <homogeneous>False</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - - <widget> - <class>GtkLabel</class> - <name>label21</name> - <label>_Department:</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-department</focus_target> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label22</name> - <label>_Office:</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-office</focus_target> - <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>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label23</name> - <label>_Profession:</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-profession</focus_target> - <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>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label24</name> - <label>_Nickname:</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-nickname</focus_target> - <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>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label25</name> - <label>_Spouse:</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-spouse</focus_target> - <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>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label31</name> - <label>_Birthday:</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>3</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>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label30</name> - <label>_Assistant's name:</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-assistant</focus_target> - <child> - <left_attach>3</left_attach> - <right_attach>4</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label29</name> - <label>_Manager's Name:</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-manager</focus_target> - <child> - <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>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label32</name> - <label>Anni_versary:</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>3</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>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-spouse</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>2</left_attach> - <right_attach>3</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> - - <widget> - <class>GtkEntry</class> - <name>entry-department</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>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>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-office</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>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>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-profession</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>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>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-nickname</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>2</left_attach> - <right_attach>3</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>GnomeDateEdit</class> - <name>dateedit-anniversary</name> - <show_time>False</show_time> - <use_24_format>False</use_24_format> - <week_start_monday>False</week_start_monday> - <lower_hour>7</lower_hour> - <upper_hour>19</upper_hour> - <child> - <left_attach>4</left_attach> - <right_attach>6</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> - - <widget> - <class>GnomeDateEdit</class> - <name>dateedit-birthday</name> - <show_time>False</show_time> - <use_24_format>False</use_24_format> - <week_start_monday>False</week_start_monday> - <lower_hour>7</lower_hour> - <upper_hour>19</upper_hour> - <child> - <left_attach>4</left_attach> - <right_attach>6</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>GtkEntry</class> - <name>entry-assistant</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>6</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-manager</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>6</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>GtkHSeparator</class> - <name>hseparator7</name> - <child> - <left_attach>0</left_attach> - <right_attach>6</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>2</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label33</name> - <label>No_tes:</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>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>True</yfill> - </child> - </widget> - - <widget> - <class>GtkHSeparator</class> - <name>hseparator8</name> - <child> - <left_attach>0</left_attach> - <right_attach>6</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>True</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>custom7</name> - <creation_function>e_create_image_widget</creation_function> - <string1>briefcase.png</string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 18 May 2000 12:20:13 GMT</last_modification_time> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>Custom</class> - <name>custom8</name> - <creation_function>e_create_image_widget</creation_function> - <string1>malehead.png</string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 18 May 2000 12:20:16 GMT</last_modification_time> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>4</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>True</yfill> - </child> - </widget> - - <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> - <left_attach>1</left_attach> - <right_attach>6</right_attach> - <top_attach>8</top_attach> - <bottom_attach>9</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>GtkText</class> - <name>text-comments</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text></text> - </widget> - </widget> - - <widget> - <class>Custom</class> - <name>custom9</name> - <creation_function>e_create_image_widget</creation_function> - <string1>globe.png</string1> - <string2></string2> - <int1>0</int1> - <int2>0</int2> - <last_modification_time>Thu, 18 May 2000 12:20:19 GMT</last_modification_time> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>7</top_attach> - <bottom_attach>9</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>label16</name> - <label>Details</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - </widget> - - <widget> - <class>GnomeAppBar</class> - <child_name>GnomeApp:appbar</child_name> - <name>appbar1</name> - <has_progress>True</has_progress> - <has_status>True</has_status> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> -</widget> - -</GTK-Interface> diff --git a/addressbook/gui/contact-editor/e-contact-editor-categories.c b/addressbook/gui/contact-editor/e-contact-editor-categories.c deleted file mode 100644 index 9251a86948..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor-categories.c +++ /dev/null @@ -1,470 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-editor-categories.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 <e-contact-editor-categories.h> -#include <e-table-scrolled.h> -#include <e-table.h> -#include <e-table-simple.h> -#include <e-cell-text.h> -#include <e-cell-checkbox.h> - -static void e_contact_editor_categories_init (EContactEditorCategories *card); -static void e_contact_editor_categories_class_init (EContactEditorCategoriesClass *klass); -static void e_contact_editor_categories_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_contact_editor_categories_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_contact_editor_categories_destroy (GtkObject *object); -static int e_contact_editor_categories_col_count (ETableModel *etc, gpointer data); -static int e_contact_editor_categories_row_count (ETableModel *etc, gpointer data); -static void *e_contact_editor_categories_value_at (ETableModel *etc, int col, int row, gpointer data); -static void e_contact_editor_categories_set_value_at (ETableModel *etc, int col, int row, const void *val, gpointer data); -static gboolean e_contact_editor_categories_is_cell_editable (ETableModel *etc, int col, int row, gpointer data); -static void *e_contact_editor_categories_duplicate_value (ETableModel *etc, int col, const void *value, gpointer data); -static void e_contact_editor_categories_free_value (ETableModel *etc, int col, void *value, gpointer data); -static void *e_contact_editor_categories_initialize_value (ETableModel *etc, int col, gpointer data); -static gboolean e_contact_editor_categories_value_is_empty (ETableModel *etc, int col, const void *value, gpointer data); -static char * e_contact_editor_categories_value_to_string (ETableModel *etc, int col, const void *value, gpointer data); - -static GnomeDialogClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0, - ARG_CATEGORIES -}; - -GtkType -e_contact_editor_categories_get_type (void) -{ - static GtkType contact_editor_categories_type = 0; - - if (!contact_editor_categories_type) - { - static const GtkTypeInfo contact_editor_categories_info = - { - "EContactEditorCategories", - sizeof (EContactEditorCategories), - sizeof (EContactEditorCategoriesClass), - (GtkClassInitFunc) e_contact_editor_categories_class_init, - (GtkObjectInitFunc) e_contact_editor_categories_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - contact_editor_categories_type = gtk_type_unique (gnome_dialog_get_type (), &contact_editor_categories_info); - } - - return contact_editor_categories_type; -} - -static void -e_contact_editor_categories_class_init (EContactEditorCategoriesClass *klass) -{ - GtkObjectClass *object_class; - GnomeDialogClass *dialog_class; - - object_class = (GtkObjectClass*) klass; - dialog_class = (GnomeDialogClass *) klass; - - parent_class = gtk_type_class (gnome_dialog_get_type ()); - - gtk_object_add_arg_type ("EContactEditorCategories::categories", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_CATEGORIES); - - object_class->set_arg = e_contact_editor_categories_set_arg; - object_class->get_arg = e_contact_editor_categories_get_arg; - object_class->destroy = e_contact_editor_categories_destroy; -} - -gchar *builtin_categories[] = { - "Business", - "Competition", - "Favorites", - "Gifts", - "Goals/Objectives", - "Holiday", - "Holiday Cards", - "Hot Contacts", - "Ideas", - "International", - "Key Customer", - "Miscellaneous", - "Personal", - "Phone Calls", - "Status", - "Strategies", - "Suppliers", - "Time & Expenses", - "VIP", - "Waiting", -}; - -#define BUILTIN_CATEGORY_COUNT (sizeof(builtin_categories) / sizeof(builtin_categories[0])) - -static void -add_list_unique(EContactEditorCategories *categories, char *string) -{ - int k; - char *temp = e_strdup_strip(string); - char **list = categories->category_list; - - if (!*temp) { - g_free(temp); - return; - } - for (k = 0; k < categories->list_length; k++) { - if (!strcmp(list[k], temp)) { - categories->selected_list[k] = TRUE; - break; - } - } - if (k == categories->list_length) { - categories->selected_list[categories->list_length] = TRUE; - list[categories->list_length++] = temp; - } else { - g_free(temp); - } -} - -static void -do_parse_categories(EContactEditorCategories *categories) -{ - char *str = categories->categories; - int length = strlen(str); - char *copy = g_new(char, length + 1); - int i, j; - char **list; - int count = 1; - - e_table_model_pre_change(categories->model); - - for (i = 0; i < categories->list_length; i++) - g_free(categories->category_list[i]); - g_free(categories->category_list); - g_free(categories->selected_list); - - for (i = 0; str[i]; i++) { - switch (str[i]) { - case '\\': - i++; - if (!str[i]) - i--; - break; - case ',': - count ++; - break; - } - } - list = g_new(char *, count + 1 + BUILTIN_CATEGORY_COUNT); - categories->category_list = list; - - categories->selected_list = g_new(gboolean, count + 1 + BUILTIN_CATEGORY_COUNT); - - for (count = 0; count < BUILTIN_CATEGORY_COUNT; count++) { - list[count] = g_strdup(builtin_categories[count]); - categories->selected_list[count] = 0; - } - - categories->list_length = count; - - for (i = 0, j = 0; str[i]; i++, j++) { - switch (str[i]) { - case '\\': - i++; - if (str[i]) { - copy[j] = str[i]; - } else - i--; - break; - case ',': - copy[j] = 0; - add_list_unique(categories, copy); - j = -1; - break; - default: - copy[j] = str[i]; - break; - } - } - copy[j] = 0; - add_list_unique(categories, copy); - g_free(copy); - e_table_model_changed(categories->model); -} - -static void -e_contact_editor_categories_entry_change (GtkWidget *entry, - EContactEditorCategories *categories) -{ - g_free(categories->categories); - categories->categories = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry))); - do_parse_categories(categories); -} - - -#define INITIAL_SPEC "<ETableSpecification no-header=\"1\"> \ - <columns-shown> \ - <column> 0 </column> \ - <column> 1 </column> \ - </columns-shown> \ - <grouping> <leaf column=\"1\" ascending=\"1\"/> </grouping> \ -</ETableSpecification>" - -static void -e_contact_editor_categories_init (EContactEditorCategories *categories) -{ - GladeXML *gui; - GtkWidget *table; - ECell *cell_left_just; - ECell *cell_checkbox; - ETableHeader *header; - ETableCol *col; - GtkWidget *e_table; - - categories->list_length = 0; - categories->category_list = NULL; - categories->selected_list = NULL; - categories->categories = NULL; - - gnome_dialog_append_button ( GNOME_DIALOG(categories), - GNOME_STOCK_BUTTON_OK); - - gnome_dialog_append_button ( GNOME_DIALOG(categories), - GNOME_STOCK_BUTTON_CANCEL); - - gtk_window_set_policy(GTK_WINDOW(categories), FALSE, TRUE, FALSE); - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/categories.glade", NULL); - categories->gui = gui; - - table = glade_xml_get_widget(gui, "table-categories"); - gtk_widget_ref(table); - gtk_container_remove(GTK_CONTAINER(table->parent), table); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (categories)->vbox), table, TRUE, TRUE, 0); - gtk_widget_unref(table); - - categories->entry = glade_xml_get_widget(gui, "entry-categories"); - - gtk_signal_connect(GTK_OBJECT(categories->entry), "changed", - GTK_SIGNAL_FUNC(e_contact_editor_categories_entry_change), categories); - - categories->model = e_table_simple_new(e_contact_editor_categories_col_count, - e_contact_editor_categories_row_count, - e_contact_editor_categories_value_at, - e_contact_editor_categories_set_value_at, - e_contact_editor_categories_is_cell_editable, - e_contact_editor_categories_duplicate_value, - e_contact_editor_categories_free_value, - e_contact_editor_categories_initialize_value, - e_contact_editor_categories_value_is_empty, - e_contact_editor_categories_value_to_string, - categories); - - header = e_table_header_new(); - - cell_checkbox = e_cell_checkbox_new(); - col = e_table_col_new (0, "", - 0, 20, cell_checkbox, - g_int_compare, TRUE); - e_table_header_add_column (header, col, 0); - - cell_left_just = e_cell_text_new (categories->model, NULL, GTK_JUSTIFY_LEFT); - col = e_table_col_new (1, "Category", - 1.0, 20, cell_left_just, - g_str_compare, TRUE); - e_table_header_add_column (header, col, 1); - - e_table = e_table_scrolled_new (header, categories->model, INITIAL_SPEC); - - gtk_object_sink(GTK_OBJECT(categories->model)); - - gtk_widget_show(e_table); - - gtk_table_attach_defaults(GTK_TABLE(table), - e_table, - 0, 1, - 3, 4); -} - -void -e_contact_editor_categories_destroy (GtkObject *object) -{ - EContactEditorCategories *categories = E_CONTACT_EDITOR_CATEGORIES(object); - int i; - - if (categories->gui) - gtk_object_unref(GTK_OBJECT(categories->gui)); - - g_free(categories->categories); - for (i = 0; i < categories->list_length; i++) - g_free(categories->category_list[i]); - g_free(categories->category_list); - g_free(categories->selected_list); -} - -GtkWidget* -e_contact_editor_categories_new (char *categories) -{ - GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_categories_get_type ())); - gtk_object_set (GTK_OBJECT(widget), - "categories", categories, - NULL); - return widget; -} - -static void -e_contact_editor_categories_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - EContactEditorCategories *e_contact_editor_categories; - - e_contact_editor_categories = E_CONTACT_EDITOR_CATEGORIES (o); - - switch (arg_id){ - case ARG_CATEGORIES: - gtk_entry_set_text(GTK_ENTRY(e_contact_editor_categories->entry), GTK_VALUE_STRING (*arg)); - break; - } -} - -static void -e_contact_editor_categories_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EContactEditorCategories *e_contact_editor_categories; - - e_contact_editor_categories = E_CONTACT_EDITOR_CATEGORIES (object); - - switch (arg_id) { - case ARG_CATEGORIES: - GTK_VALUE_STRING (*arg) = g_strdup(e_contact_editor_categories->categories); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -/* This function returns the number of columns in our ETableModel. */ -static int -e_contact_editor_categories_col_count (ETableModel *etc, gpointer data) -{ - return 2; -} - -/* This function returns the number of rows in our ETableModel. */ -static int -e_contact_editor_categories_row_count (ETableModel *etc, gpointer data) -{ - EContactEditorCategories *categories = E_CONTACT_EDITOR_CATEGORIES(data); - return categories->list_length; -} - -/* This function returns the value at a particular point in our ETableModel. */ -static void * -e_contact_editor_categories_value_at (ETableModel *etc, int col, int row, gpointer data) -{ - EContactEditorCategories *categories = E_CONTACT_EDITOR_CATEGORIES(data); - if (col == 0) - return (void *) categories->selected_list[row]; - else - return categories->category_list[row]; -} - -/* This function sets the value at a particular point in our ETableModel. */ -static void -e_contact_editor_categories_set_value_at (ETableModel *etc, int col, int row, const void *val, gpointer data) -{ - EContactEditorCategories *categories = E_CONTACT_EDITOR_CATEGORIES(data); - if ( col == 0 ) { - char **strs; - int i, j; - char *string; - categories->selected_list[row] = (gboolean) val; - strs = g_new(char *, categories->list_length + 1); - for (i = 0, j = 0; i < categories->list_length; i++) { - if (categories->selected_list[i]) - strs[j++] = categories->category_list[i]; - } - strs[j] = 0; - string = g_strjoinv(", ", strs); - gtk_entry_set_text(GTK_ENTRY(categories->entry), string); - g_free(string); - g_free(strs); - } - if ( col == 1 ) - return; -} - -/* This function returns whether a particular cell is editable. */ -static gboolean -e_contact_editor_categories_is_cell_editable (ETableModel *etc, int col, int row, gpointer data) -{ - return col == 0; -} - -/* This function duplicates the value passed to it. */ -static void * -e_contact_editor_categories_duplicate_value (ETableModel *etc, int col, const void *value, gpointer data) -{ - if (col == 0) - return (void *)value; - else - return g_strdup(value); -} - -/* This function frees the value passed to it. */ -static void -e_contact_editor_categories_free_value (ETableModel *etc, int col, void *value, gpointer data) -{ - if (col == 0) - return; - else - g_free(value); -} - -static void * -e_contact_editor_categories_initialize_value (ETableModel *etc, int col, gpointer data) -{ - if (col == 0) - return NULL; - else - return g_strdup(""); -} - -static gboolean -e_contact_editor_categories_value_is_empty (ETableModel *etc, int col, const void *value, gpointer data) -{ - if (col == 0) - return value == NULL; - else - return !(value && *(char *)value); -} - -static char * -e_contact_editor_categories_value_to_string (ETableModel *etc, int col, const void *value, gpointer data) -{ - if (col == 0) - return g_strdup_printf("%d", (int) value); - else - return g_strdup(value); -} diff --git a/addressbook/gui/contact-editor/e-contact-editor-categories.h b/addressbook/gui/contact-editor/e-contact-editor-categories.h deleted file mode 100644 index 529ef71b68..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor-categories.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-editor-categories.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_CONTACT_EDITOR_CATEGORIES_H__ -#define __E_CONTACT_EDITOR_CATEGORIES_H__ - -#include <gnome.h> -#include <glade/glade.h> -#include <ebook/e-card.h> -#include <widgets/e-table/e-table-model.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EContactEditorCategories - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * name ECardName * RW The card currently being edited. Returns a copy. - */ - -#define E_CONTACT_EDITOR_CATEGORIES_TYPE (e_contact_editor_categories_get_type ()) -#define E_CONTACT_EDITOR_CATEGORIES(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_CATEGORIES_TYPE, EContactEditorCategories)) -#define E_CONTACT_EDITOR_CATEGORIES_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_CATEGORIES_TYPE, EContactEditorCategoriesClass)) -#define E_IS_CONTACT_EDITOR_CATEGORIES(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_CATEGORIES_TYPE)) -#define E_IS_CONTACT_EDITOR_CATEGORIES_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_CATEGORIES_TYPE)) - - -typedef struct _EContactEditorCategories EContactEditorCategories; -typedef struct _EContactEditorCategoriesClass EContactEditorCategoriesClass; - -struct _EContactEditorCategories -{ - GnomeDialog parent; - - /* item specific fields */ - char *categories; - GtkWidget *entry; - ETableModel *model; - - int list_length; - char **category_list; - gboolean *selected_list; - - GladeXML *gui; -}; - -struct _EContactEditorCategoriesClass -{ - GnomeDialogClass parent_class; -}; - - -GtkWidget *e_contact_editor_categories_new(char *categories); -GtkType e_contact_editor_categories_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_CONTACT_EDITOR_CATEGORIES_H__ */ diff --git a/addressbook/gui/contact-editor/e-contact-editor-confirm-delete.glade b/addressbook/gui/contact-editor/e-contact-editor-confirm-delete.glade deleted file mode 100644 index 7f52321021..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor-confirm-delete.glade +++ /dev/null @@ -1,85 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>e-contact-editor-confirm-delete</name> - <program_name>e-contact-editor-confirm-delete</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-contact-editor-confirm-delete.glade.h</translatable_strings_file> -</project> - -<widget> - <class>GnomeMessageBox</class> - <name>confirm-dialog</name> - <message_box_type>GNOME_MESSAGE_BOX_QUESTION</message_box_type> - <message>Are you sure you want -to delete this contact?</message> - <title>Delete Contact?</title> - <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>True</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>button2</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/addressbook/gui/contact-editor/e-contact-editor-confirm-delete.glade.h b/addressbook/gui/contact-editor/e-contact-editor-confirm-delete.glade.h deleted file mode 100644 index 7168db0a5c..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor-confirm-delete.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_("Are you sure you want\n" - "to delete this contact?"); -gchar *s = N_("Delete Contact?"); diff --git a/addressbook/gui/contact-editor/e-contact-editor-fullname.c b/addressbook/gui/contact-editor/e-contact-editor-fullname.c deleted file mode 100644 index b2e598fdde..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor-fullname.c +++ /dev/null @@ -1,214 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-editor-fullname.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 <e-contact-editor-fullname.h> - -static void e_contact_editor_fullname_init (EContactEditorFullname *card); -static void e_contact_editor_fullname_class_init (EContactEditorFullnameClass *klass); -static void e_contact_editor_fullname_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_contact_editor_fullname_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_contact_editor_fullname_destroy (GtkObject *object); - -static void fill_in_info(EContactEditorFullname *editor); -static void extract_info(EContactEditorFullname *editor); - -static GnomeDialogClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0, - ARG_NAME -}; - -GtkType -e_contact_editor_fullname_get_type (void) -{ - static GtkType contact_editor_fullname_type = 0; - - if (!contact_editor_fullname_type) - { - static const GtkTypeInfo contact_editor_fullname_info = - { - "EContactEditorFullname", - sizeof (EContactEditorFullname), - sizeof (EContactEditorFullnameClass), - (GtkClassInitFunc) e_contact_editor_fullname_class_init, - (GtkObjectInitFunc) e_contact_editor_fullname_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - contact_editor_fullname_type = gtk_type_unique (gnome_dialog_get_type (), &contact_editor_fullname_info); - } - - return contact_editor_fullname_type; -} - -static void -e_contact_editor_fullname_class_init (EContactEditorFullnameClass *klass) -{ - GtkObjectClass *object_class; - GnomeDialogClass *dialog_class; - - object_class = (GtkObjectClass*) klass; - dialog_class = (GnomeDialogClass *) klass; - - parent_class = gtk_type_class (gnome_dialog_get_type ()); - - gtk_object_add_arg_type ("EContactEditorFullname::name", GTK_TYPE_POINTER, - GTK_ARG_READWRITE, ARG_NAME); - - object_class->set_arg = e_contact_editor_fullname_set_arg; - object_class->get_arg = e_contact_editor_fullname_get_arg; - object_class->destroy = e_contact_editor_fullname_destroy; -} - -static void -e_contact_editor_fullname_init (EContactEditorFullname *e_contact_editor_fullname) -{ - GladeXML *gui; - GtkWidget *widget; - - gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_fullname), - GNOME_STOCK_BUTTON_OK); - - gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_fullname), - GNOME_STOCK_BUTTON_CANCEL); - - gtk_window_set_policy(GTK_WINDOW(e_contact_editor_fullname), TRUE, TRUE, FALSE); - - e_contact_editor_fullname->name = NULL; - gui = glade_xml_new (EVOLUTION_GLADEDIR "/fullname.glade", NULL); - e_contact_editor_fullname->gui = gui; - - widget = glade_xml_get_widget(gui, "table-checkfullname"); - gtk_widget_ref(widget); - gtk_container_remove(GTK_CONTAINER(widget->parent), widget); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (e_contact_editor_fullname)->vbox), widget, TRUE, TRUE, 0); - gtk_widget_unref(widget); -} - -void -e_contact_editor_fullname_destroy (GtkObject *object) -{ - EContactEditorFullname *e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME(object); - - if (e_contact_editor_fullname->gui) - gtk_object_unref(GTK_OBJECT(e_contact_editor_fullname->gui)); - e_card_name_free(e_contact_editor_fullname->name); -} - -GtkWidget* -e_contact_editor_fullname_new (ECardName *name) -{ - GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_fullname_get_type ())); - gtk_object_set (GTK_OBJECT(widget), - "name", name, - NULL); - return widget; -} - -static void -e_contact_editor_fullname_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - EContactEditorFullname *e_contact_editor_fullname; - - e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME (o); - - switch (arg_id){ - case ARG_NAME: - if (e_contact_editor_fullname->name) - e_card_name_free(e_contact_editor_fullname->name); - e_contact_editor_fullname->name = e_card_name_copy(GTK_VALUE_POINTER (*arg)); - fill_in_info(e_contact_editor_fullname); - break; - } -} - -static void -e_contact_editor_fullname_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EContactEditorFullname *e_contact_editor_fullname; - - e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME (object); - - switch (arg_id) { - case ARG_NAME: - extract_info(e_contact_editor_fullname); - GTK_VALUE_POINTER (*arg) = e_card_name_copy(e_contact_editor_fullname->name); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -fill_in_field(EContactEditorFullname *editor, char *field, char *string) -{ - GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, field)); - if (entry) { - if (string) - gtk_entry_set_text(entry, string); - else - gtk_entry_set_text(entry, ""); - } -} - -static void -fill_in_info(EContactEditorFullname *editor) -{ - ECardName *name = editor->name; - if (name) { - fill_in_field(editor, "entry-title", name->prefix); - fill_in_field(editor, "entry-first", name->given); - fill_in_field(editor, "entry-middle", name->additional); - fill_in_field(editor, "entry-last", name->family); - fill_in_field(editor, "entry-suffix", name->suffix); - } -} - -static char * -extract_field(EContactEditorFullname *editor, char *field) -{ - GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, field)); - if (entry) - return g_strdup(gtk_entry_get_text(entry)); - else - return NULL; -} - -static void -extract_info(EContactEditorFullname *editor) -{ - ECardName *name = editor->name; - if (!name) - name = e_card_name_new(); - name->prefix = extract_field(editor, "entry-title" ); - name->given = extract_field(editor, "entry-first" ); - name->additional = extract_field(editor, "entry-middle"); - name->family = extract_field(editor, "entry-last" ); - name->suffix = extract_field(editor, "entry-suffix"); -} diff --git a/addressbook/gui/contact-editor/e-contact-editor-fullname.h b/addressbook/gui/contact-editor/e-contact-editor-fullname.h deleted file mode 100644 index 409ffc72d0..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor-fullname.h +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-editor-fullname.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_CONTACT_EDITOR_FULLNAME_H__ -#define __E_CONTACT_EDITOR_FULLNAME_H__ - -#include <gnome.h> -#include <glade/glade.h> -#include <ebook/e-card.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EContactEditorFullname - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * name ECardName * RW The card currently being edited. Returns a copy. - */ - -#define E_CONTACT_EDITOR_FULLNAME_TYPE (e_contact_editor_fullname_get_type ()) -#define E_CONTACT_EDITOR_FULLNAME(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_FULLNAME_TYPE, EContactEditorFullname)) -#define E_CONTACT_EDITOR_FULLNAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_FULLNAME_TYPE, EContactEditorFullnameClass)) -#define E_IS_CONTACT_EDITOR_FULLNAME(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_FULLNAME_TYPE)) -#define E_IS_CONTACT_EDITOR_FULLNAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_FULLNAME_TYPE)) - - -typedef struct _EContactEditorFullname EContactEditorFullname; -typedef struct _EContactEditorFullnameClass EContactEditorFullnameClass; - -struct _EContactEditorFullname -{ - GnomeDialog parent; - - /* item specific fields */ - ECardName *name; - GladeXML *gui; -}; - -struct _EContactEditorFullnameClass -{ - GnomeDialogClass parent_class; -}; - - -GtkWidget *e_contact_editor_fullname_new(ECardName *name); -GtkType e_contact_editor_fullname_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_CONTACT_EDITOR_FULLNAME_H__ */ diff --git a/addressbook/gui/contact-editor/e-contact-editor-strings.h b/addressbook/gui/contact-editor/e-contact-editor-strings.h deleted file mode 100644 index d5ac9daf24..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor-strings.h +++ /dev/null @@ -1,41 +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_("_Add"); -gchar *s = N_("_Delete"); -gchar *s = N_("Phone Types"); -gchar *s = N_("New phone type"); -gchar *s = N_("Add"); -gchar *s = N_("New phone type"); -gchar *s = N_("Contact Editor"); -gchar *s = N_("_Full Name..."); -gchar *s = N_("File As:"); -gchar *s = N_("Web page address:"); -gchar *s = N_("Wants to receive _HTML mail"); -gchar *s = N_("Address:"); -gchar *s = N_("_Business"); -gchar *s = N_("_Home"); -gchar *s = N_("Business _Fax"); -gchar *s = N_("_Mobile"); -gchar *s = N_("Primary Email"); -gchar *s = N_("B_usiness"); -gchar *s = N_("_This is the mailing address"); -gchar *s = N_("C_ontacts..."); -gchar *s = N_("Ca_tegories..."); -gchar *s = N_("_Job title:"); -gchar *s = N_("_Company:"); -gchar *s = N_("General"); -gchar *s = N_("_Department:"); -gchar *s = N_("_Office:"); -gchar *s = N_("_Profession:"); -gchar *s = N_("_Nickname:"); -gchar *s = N_("_Spouse:"); -gchar *s = N_("_Birthday:"); -gchar *s = N_("_Assistant's name:"); -gchar *s = N_("_Manager's Name:"); -gchar *s = N_("Anni_versary:"); -gchar *s = N_("No_tes:"); -gchar *s = N_("Details"); diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c deleted file mode 100644 index e8062d83b9..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ /dev/null @@ -1,1809 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-editor.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 "e-contact-editor.h" -#include <e-contact-editor-fullname.h> -#include <e-contact-editor-categories.h> -#include <gdk-pixbuf/gdk-pixbuf.h> -#include <gdk-pixbuf/gnome-canvas-pixbuf.h> -#include <e-util/e-gui-utils.h> -#include <e-contact-save-as.h> -#include "addressbook/printing/e-contact-print.h" - -/* Signal IDs */ -enum { - ADD_CARD, - COMMIT_CARD, - DELETE_CARD, - EDITOR_CLOSED, - LAST_SIGNAL -}; - -static void e_contact_editor_init (EContactEditor *card); -static void e_contact_editor_class_init (EContactEditorClass *klass); -static void e_contact_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_contact_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_contact_editor_destroy (GtkObject *object); - -#if 0 -static GtkWidget *e_contact_editor_build_dialog(EContactEditor *editor, gchar *entry_id, gchar *label_id, gchar *title, GList **list, GnomeUIInfo **info); -#endif -static void _email_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor); -static void _phone_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor); -static void _address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor); -static void fill_in_info(EContactEditor *editor); -static void extract_info(EContactEditor *editor); -static void set_fields(EContactEditor *editor); -static void set_address_field(EContactEditor *editor, int result); -static void add_field_callback(GtkWidget *widget, EContactEditor *editor); - -static GtkObjectClass *parent_class = NULL; - -static guint contact_editor_signals[LAST_SIGNAL]; - -/* The arguments we take */ -enum { - ARG_0, - ARG_CARD, - ARG_IS_NEW_CARD -}; - -enum { - DYNAMIC_LIST_EMAIL, - DYNAMIC_LIST_PHONE, - DYNAMIC_LIST_ADDRESS -}; - -GtkType -e_contact_editor_get_type (void) -{ - static GtkType contact_editor_type = 0; - - if (!contact_editor_type) - { - static const GtkTypeInfo contact_editor_info = - { - "EContactEditor", - sizeof (EContactEditor), - sizeof (EContactEditorClass), - (GtkClassInitFunc) e_contact_editor_class_init, - (GtkObjectInitFunc) e_contact_editor_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - contact_editor_type = gtk_type_unique (GTK_TYPE_OBJECT, &contact_editor_info); - } - - return contact_editor_type; -} - -static void -e_contact_editor_class_init (EContactEditorClass *klass) -{ - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) klass; - - parent_class = gtk_type_class (GTK_TYPE_OBJECT); - - gtk_object_add_arg_type ("EContactEditor::card", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_CARD); - gtk_object_add_arg_type ("EContactEditor::is_new_card", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_IS_NEW_CARD); - - contact_editor_signals[ADD_CARD] = - gtk_signal_new ("add_card", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EContactEditorClass, add_card), - gtk_marshal_NONE__OBJECT, - GTK_TYPE_NONE, 1, - GTK_TYPE_OBJECT); - - contact_editor_signals[COMMIT_CARD] = - gtk_signal_new ("commit_card", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EContactEditorClass, commit_card), - gtk_marshal_NONE__OBJECT, - GTK_TYPE_NONE, 1, - GTK_TYPE_OBJECT); - - contact_editor_signals[DELETE_CARD] = - gtk_signal_new ("delete_card", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EContactEditorClass, delete_card), - gtk_marshal_NONE__OBJECT, - GTK_TYPE_NONE, 1, - GTK_TYPE_OBJECT); - - contact_editor_signals[EDITOR_CLOSED] = - gtk_signal_new ("editor_closed", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EContactEditorClass, editor_closed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, contact_editor_signals, LAST_SIGNAL); - - object_class->set_arg = e_contact_editor_set_arg; - object_class->get_arg = e_contact_editor_get_arg; - object_class->destroy = e_contact_editor_destroy; -} - -static void -_replace_button(EContactEditor *editor, gchar *button_xml, gchar *image, GtkSignalFunc func) -{ - GladeXML *gui = editor->gui; - GtkWidget *button = glade_xml_get_widget(gui, button_xml); - GtkWidget *pixmap; - gchar *image_temp; - if (button && GTK_IS_BUTTON(button)) { - image_temp = g_strdup_printf("%s/%s", EVOLUTIONDIR, image); - pixmap = e_create_image_widget(NULL, image_temp, NULL, 0, 0); - gtk_container_add(GTK_CONTAINER(button), - pixmap); - g_free(image_temp); - gtk_widget_show(pixmap); - gtk_signal_connect(GTK_OBJECT(button), "button_press_event", func, editor); - } -} - -static void -_replace_buttons(EContactEditor *editor) -{ - _replace_button(editor, "button-phone1", "arrow.png", _phone_arrow_pressed); - _replace_button(editor, "button-phone2", "arrow.png", _phone_arrow_pressed); - _replace_button(editor, "button-phone3", "arrow.png", _phone_arrow_pressed); - _replace_button(editor, "button-phone4", "arrow.png", _phone_arrow_pressed); - _replace_button(editor, "button-address", "arrow.png", _address_arrow_pressed); - _replace_button(editor, "button-email1", "arrow.png", _email_arrow_pressed); -} - -static void -phone_entry_changed (GtkWidget *widget, EContactEditor *editor) -{ - int which; - gchar *string; - GtkEntry *entry = GTK_ENTRY(widget); - ECardPhone *phone; - - if ( widget == glade_xml_get_widget(editor->gui, "entry-phone1") ) { - which = 1; - } else if ( widget == glade_xml_get_widget(editor->gui, "entry-phone2") ) { - which = 2; - } else if ( widget == glade_xml_get_widget(editor->gui, "entry-phone3") ) { - which = 3; - } else if ( widget == glade_xml_get_widget(editor->gui, "entry-phone4") ) { - which = 4; - } else - return; - string = gtk_entry_get_text(entry); - phone = e_card_phone_new(); - phone->number = string; - e_card_simple_set_phone(editor->simple, editor->phone_choice[which - 1], phone); - phone->number = NULL; - e_card_phone_free(phone); - set_fields(editor); -} - -static void -email_entry_changed (GtkWidget *widget, EContactEditor *editor) -{ - gchar *string; - GtkEntry *entry = GTK_ENTRY(widget); - - string = gtk_entry_get_text(entry); - - e_card_simple_set_email(editor->simple, editor->email_choice, string); -} - -static void -address_text_changed (GtkWidget *widget, EContactEditor *editor) -{ - GtkEditable *editable = GTK_EDITABLE(widget); - ECardAddrLabel *address; - - if (editor->address_choice == -1) - return; - - address = e_card_address_label_new(); - address->data = gtk_editable_get_chars(editable, 0, -1); - e_card_simple_set_address(editor->simple, editor->address_choice, address); - e_card_address_label_free(address); -} - -/* This function tells you whether name_to_style will make sense. */ -static gboolean -style_makes_sense(const ECardName *name, char *company, int style) -{ - switch (style) { - case 0: /* Fall Through */ - case 1: - return TRUE; - case 2: - if (company && *company) - return TRUE; - else - return FALSE; - case 3: /* Fall Through */ - case 4: - if (company && *company && ((name->given && *name->given) || (name->family && *name->family))) - return TRUE; - else - return FALSE; - default: - return FALSE; - } -} - -static char * -name_to_style(const ECardName *name, char *company, int style) -{ - char *string; - char *strings[4], **stringptr; - char *substring; - switch (style) { - case 0: - stringptr = strings; - if (name->family && *name->family) - *(stringptr++) = name->family; - if (name->given && *name->given) - *(stringptr++) = name->given; - *stringptr = NULL; - string = g_strjoinv(", ", strings); - break; - case 1: - stringptr = strings; - if (name->given && *name->given) - *(stringptr++) = name->given; - if (name->family && *name->family) - *(stringptr++) = name->family; - *stringptr = NULL; - string = g_strjoinv(" ", strings); - break; - case 2: - string = g_strdup(company); - break; - case 3: /* Fall Through */ - case 4: - stringptr = strings; - if (name->family && *name->family) - *(stringptr++) = name->family; - if (name->given && *name->given) - *(stringptr++) = name->given; - *stringptr = NULL; - substring = g_strjoinv(", ", strings); - if (!(company && *company)) - company = ""; - if (style == 3) - string = g_strdup_printf("%s (%s)", substring, company); - else - string = g_strdup_printf("%s (%s)", company, substring); - g_free(substring); - break; - default: - string = g_strdup(""); - } - return string; -} - -static int -file_as_get_style (EContactEditor *editor) -{ - GtkEntry *file_as = GTK_ENTRY(glade_xml_get_widget(editor->gui, "entry-file-as")); - char *filestring = gtk_entry_get_text(file_as); - char *trystring; - ECardName *name = editor->name; - int i; - int style; - - if (!name) return 0; - - style = -1; - for (i = 0; i < 5; i++) { - trystring = name_to_style(name, editor->company, i); - if (!strcmp(trystring, filestring)) { - g_free(trystring); - return i; - } - g_free(trystring); - } - return -1; -} - -static void -file_as_set_style(EContactEditor *editor, int style) -{ - char *string; - int i; - GList *strings = NULL; - GtkEntry *file_as = GTK_ENTRY(glade_xml_get_widget(editor->gui, "entry-file-as")); - GtkWidget *widget; - - - if (style == -1) { - string = g_strdup(gtk_entry_get_text(file_as)); - strings = g_list_append(strings, string); - } - - for (i = 0; i < 5; i++) { - if (style_makes_sense(editor->name, editor->company, i)) { - string = name_to_style(editor->name, editor->company, i); - strings = g_list_append(strings, string); - } - } - - widget = glade_xml_get_widget(editor->gui, "combo-file-as"); - if (widget && GTK_IS_COMBO(widget)) { - GtkCombo *combo = GTK_COMBO(widget); - gtk_combo_set_popdown_strings(combo, strings); - g_list_foreach(strings, (GFunc) g_free, NULL); - g_list_free(strings); - } - - if (style != -1) { - string = name_to_style(editor->name, editor->company, style); - gtk_entry_set_text(file_as, string); - g_free(string); - } -} - -static void -name_entry_changed (GtkWidget *widget, EContactEditor *editor) -{ - GtkWidget *file_as; - int style = 0; - - file_as = glade_xml_get_widget(editor->gui, "entry-file-as"); - - if (file_as && GTK_IS_ENTRY(file_as)) { - style = file_as_get_style(editor); - } - - e_card_name_free(editor->name); - editor->name = e_card_name_from_string(gtk_entry_get_text(GTK_ENTRY(widget))); - - if (file_as && GTK_IS_ENTRY(file_as)) { - file_as_set_style(editor, style); - } -} - -static void -company_entry_changed (GtkWidget *widget, EContactEditor *editor) -{ - int style = 0; - GtkWidget *file_as; - - file_as = glade_xml_get_widget(editor->gui, "entry-file-as"); - - if (file_as && GTK_IS_ENTRY(file_as)) { - style = file_as_get_style(editor); - } - - g_free(editor->company); - - editor->company = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget))); - - if (file_as && GTK_IS_ENTRY(file_as)) { - file_as_set_style(editor, style); - } -} - -static void -set_entry_changed_signal_phone(EContactEditor *editor, char *id) -{ - GtkWidget *widget = glade_xml_get_widget(editor->gui, id); - if (widget && GTK_IS_ENTRY(widget)) - gtk_signal_connect(GTK_OBJECT(widget), "changed", - phone_entry_changed, editor); -} - -static void -set_entry_changed_signals(EContactEditor *editor) -{ - GtkWidget *widget; - set_entry_changed_signal_phone(editor, "entry-phone1"); - set_entry_changed_signal_phone(editor, "entry-phone2"); - set_entry_changed_signal_phone(editor, "entry-phone3"); - set_entry_changed_signal_phone(editor, "entry-phone4"); - widget = glade_xml_get_widget(editor->gui, "entry-email1"); - if (widget && GTK_IS_ENTRY(widget)) { - gtk_signal_connect(GTK_OBJECT(widget), "changed", - email_entry_changed, editor); - } - widget = glade_xml_get_widget(editor->gui, "text-address"); - if (widget && GTK_IS_TEXT(widget)) { - gtk_signal_connect(GTK_OBJECT(widget), "changed", - address_text_changed, editor); - } - widget = glade_xml_get_widget(editor->gui, "entry-fullname"); - if (widget && GTK_IS_ENTRY(widget)) { - gtk_signal_connect(GTK_OBJECT(widget), "changed", - name_entry_changed, editor); - } - widget = glade_xml_get_widget(editor->gui, "entry-company"); - if (widget && GTK_IS_ENTRY(widget)) { - gtk_signal_connect(GTK_OBJECT(widget), "changed", - company_entry_changed, editor); - } -} - -static void -full_name_clicked(GtkWidget *button, EContactEditor *editor) -{ - GnomeDialog *dialog = GNOME_DIALOG(e_contact_editor_fullname_new(editor->name)); - int result; - gtk_widget_show(GTK_WIDGET(dialog)); - result = gnome_dialog_run_and_close (dialog); - if (result == 0) { - ECardName *name; - GtkWidget *fname_widget; - - gtk_object_get(GTK_OBJECT(dialog), - "name", &name, - NULL); - e_card_name_free(editor->name); - editor->name = e_card_name_copy(name); - - fname_widget = glade_xml_get_widget(editor->gui, "entry-fullname"); - if (fname_widget && GTK_IS_ENTRY(fname_widget)) { - char *full_name = e_card_name_to_string(name); - gtk_entry_set_text(GTK_ENTRY(fname_widget), full_name); - g_free(full_name); - } - } - gtk_object_unref(GTK_OBJECT(dialog)); -} - -static void -categories_clicked(GtkWidget *button, EContactEditor *editor) -{ - char *categories; - GnomeDialog *dialog; - int result; - GtkWidget *entry = glade_xml_get_widget(editor->gui, "entry-categories"); - if (entry && GTK_IS_ENTRY(entry)) - categories = gtk_entry_get_text(GTK_ENTRY(entry)); - else if (editor->card) - gtk_object_get(GTK_OBJECT(editor->card), - "categories", &categories, - NULL); - dialog = GNOME_DIALOG(e_contact_editor_categories_new(categories)); - gtk_widget_show(GTK_WIDGET(dialog)); - result = gnome_dialog_run (dialog); - if (result == 0) { - gtk_object_get(GTK_OBJECT(dialog), - "categories", &categories, - NULL); - if (entry && GTK_IS_ENTRY(entry)) - gtk_entry_set_text(GTK_ENTRY(entry), categories); - else - gtk_object_set(GTK_OBJECT(editor->card), - "categories", categories, - NULL); - g_free(categories); - } - gtk_object_destroy(GTK_OBJECT(dialog)); - if (!entry) - g_free(categories); -} - -/* Emits the signal to request saving a card */ -static void -save_card (EContactEditor *ce) -{ - extract_info (ce); - e_card_simple_sync_card (ce->simple); - - if (ce->is_new_card) - gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[ADD_CARD], - ce->card); - else - gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[COMMIT_CARD], - ce->card); - - /* FIXME: should we set the ce->is_new_card here or have the client code - * set the "is_new_card" argument on the contact editor object? - */ - - ce->is_new_card = FALSE; -} - -/* Closes the dialog box and emits the appropriate signals */ -static void -close_dialog (EContactEditor *ce) -{ - g_assert (ce->app != NULL); - - gtk_widget_destroy (ce->app); - ce->app = NULL; - - gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[EDITOR_CLOSED]); -} - -/* Menu callbacks */ - -/* File/Save callback */ -static void -file_save_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - save_card (ce); -} - -/* File/Close callback */ -static void -file_close_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - close_dialog (ce); -} - -static void -file_save_as_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - ECard *card; - - ce = E_CONTACT_EDITOR (data); - - extract_info (ce); - e_card_simple_sync_card (ce->simple); - - card = ce->card; - e_contact_save_as("Save as VCard", card); -} - -gboolean -e_contact_editor_confirm_delete(void) -{ - GnomeDialog *dialog; - GladeXML *gui; - int result; - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/e-contact-editor-confirm-delete.glade", NULL); - - dialog = GNOME_DIALOG(glade_xml_get_widget(gui, "confirm-dialog")); - - result = gnome_dialog_run_and_close(dialog); - - gtk_object_unref(GTK_OBJECT(gui)); - - return !result; -} - -static void -delete_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - - if (e_contact_editor_confirm_delete()) { - - ce = E_CONTACT_EDITOR (data); - - extract_info (ce); - e_card_simple_sync_card (ce->simple); - - if (!ce->is_new_card) - gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[DELETE_CARD], - ce->card); - - file_close_cb(widget, data); - } -} - -/* Emits the signal to request printing a card */ -static void -print_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - - extract_info (ce); - e_card_simple_sync_card (ce->simple); - - gtk_widget_show(e_contact_print_card_dialog_new(ce->card)); -} - - -/* Menu bar */ - -static GnomeUIInfo file_new_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Appointment"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Meeting Re_quest"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Mail Message"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Contact"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Task"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Task _Request"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Journal Entry"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Note"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Ch_oose Form..."), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo file_page_setup_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Memo Style"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Define Print _Styles..."), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo file_menu[] = { - GNOMEUIINFO_MENU_NEW_SUBTREE (file_new_menu), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: S_end"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_SAVE_ITEM (file_save_cb, NULL), - GNOMEUIINFO_MENU_SAVE_AS_ITEM (file_save_as_cb, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Save Attac_hments..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("_Delete"), NULL, delete_cb), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Move to Folder..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Cop_y to Folder..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_SUBTREE (N_("Page Set_up"), file_page_setup_menu), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Print Pre_view"), NULL, NULL), - GNOMEUIINFO_MENU_PRINT_ITEM (print_cb, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_PROPERTIES_ITEM (NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_CLOSE_ITEM (file_close_cb, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo edit_object_menu[] = { - GNOMEUIINFO_ITEM_NONE ("FIXME: what goes here?", NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo edit_menu[] = { - GNOMEUIINFO_MENU_UNDO_ITEM (NULL, NULL), - GNOMEUIINFO_MENU_REDO_ITEM (NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_CUT_ITEM (NULL, NULL), - GNOMEUIINFO_MENU_COPY_ITEM (NULL, NULL), - GNOMEUIINFO_MENU_PASTE_ITEM (NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Paste _Special..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_CLEAR_ITEM (NULL, NULL), - GNOMEUIINFO_MENU_SELECT_ALL_ITEM (NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Mark as U_nread"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_MENU_FIND_ITEM (NULL, NULL), - GNOMEUIINFO_MENU_FIND_AGAIN_ITEM (NULL, NULL), - GNOMEUIINFO_SUBTREE (N_("_Object"), edit_object_menu), - GNOMEUIINFO_END -}; - -static GnomeUIInfo view_previous_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Item"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Unread Item"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Fi_rst Item in Folder"), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo view_next_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Item"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Unread Item"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Last Item in Folder"), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo view_toolbars_menu[] = { - { GNOME_APP_UI_TOGGLEITEM, N_("FIXME: _Standard"), NULL, NULL, NULL, NULL, - GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, - { GNOME_APP_UI_TOGGLEITEM, N_("FIXME: __Formatting"), NULL, NULL, NULL, NULL, - GNOME_APP_PIXMAP_NONE, NULL, 0, 0, NULL }, - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Customize..."), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo view_menu[] = { - GNOMEUIINFO_SUBTREE (N_("Pre_vious"), view_previous_menu), - GNOMEUIINFO_SUBTREE (N_("Ne_xt"), view_next_menu), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_SUBTREE (N_("_Toolbars"), view_toolbars_menu), - GNOMEUIINFO_END -}; - -static GnomeUIInfo insert_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _File..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: It_em..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Object..."), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo format_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Font..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Paragraph..."), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo tools_forms_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Ch_oose Form..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Desi_gn This Form"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: D_esign a Form..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Publish _Form..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Pu_blish Form As..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Script _Debugger"), NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo tools_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Spelling..."), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_SUBTREE (N_("_Forms"), tools_forms_menu), - GNOMEUIINFO_END -}; - -static GnomeUIInfo actions_menu[] = { - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _New Contact"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: New _Contact from Same Company"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: New _Letter to Contact"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: New _Message to Contact"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: New Meetin_g with Contact"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Plan a Meeting..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: New _Task for Contact"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: New _Journal Entry for Contact"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Flag for Follow Up..."), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Display Map of Address"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Open Web Page"), NULL, NULL), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Forward as _vCard"), NULL, NULL), - GNOMEUIINFO_ITEM_NONE (N_("FIXME: For_ward"), NULL, NULL) -}; - -static GnomeUIInfo help_menu[] = { - GNOMEUIINFO_ITEM_NONE ("FIXME: fix Bonobo so it supports help items!", NULL, NULL), - GNOMEUIINFO_END -}; - -static GnomeUIInfo main_menu[] = { - GNOMEUIINFO_MENU_FILE_TREE (file_menu), - GNOMEUIINFO_MENU_EDIT_TREE (edit_menu), - GNOMEUIINFO_MENU_VIEW_TREE (view_menu), - GNOMEUIINFO_SUBTREE (N_("_Insert"), insert_menu), - GNOMEUIINFO_SUBTREE (N_("F_ormat"), format_menu), - GNOMEUIINFO_SUBTREE (N_("_Tools"), tools_menu), - GNOMEUIINFO_SUBTREE (N_("Actio_ns"), actions_menu), - GNOMEUIINFO_MENU_HELP_TREE (help_menu), - GNOMEUIINFO_END -}; - -/* Creates the menu bar for the contact editor */ -static void -create_menu (EContactEditor *ce) -{ - BonoboUIHandlerMenuItem *list; - - bonobo_ui_handler_create_menubar (ce->uih); - - list = bonobo_ui_handler_menu_parse_uiinfo_list_with_data (main_menu, ce); - bonobo_ui_handler_menu_add_list (ce->uih, "/", list); -} - -/* Toolbar/Save and Close callback */ -static void -tb_save_and_close_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - save_card (ce); - close_dialog (ce); -} - -/* Toolbar */ - -static GnomeUIInfo toolbar[] = { - GNOMEUIINFO_ITEM_STOCK (N_("Save and Close"), - N_("Save the appointment and close the dialog box"), - tb_save_and_close_cb, - GNOME_STOCK_PIXMAP_SAVE), - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_STOCK (N_("Print..."), - N_("Print this item"), print_cb, - GNOME_STOCK_PIXMAP_PRINT), -#if 0 - GNOMEUIINFO_ITEM_NONE (N_("FIXME: Insert File..."), - N_("Insert a file as an attachment"), NULL), -#endif - GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_STOCK (N_("Delete"), - N_("Delete this item"), delete_cb, - GNOME_STOCK_PIXMAP_TRASH), - GNOMEUIINFO_SEPARATOR, -#if 0 - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Previous"), - N_("Go to the previous item"), NULL, - GNOME_STOCK_PIXMAP_BACK), - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Next"), - N_("Go to the next item"), NULL, - GNOME_STOCK_PIXMAP_FORWARD), -#endif - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Help"), - N_("See online help"), NULL, GNOME_STOCK_PIXMAP_HELP), - GNOMEUIINFO_END -}; - -/* Creates the toolbar for the contact editor */ -static void -create_toolbar (EContactEditor *ce) -{ - BonoboUIHandlerToolbarItem *list; - GnomeDockItem *dock_item; - GtkWidget *toolbar_child; - - bonobo_ui_handler_create_toolbar (ce->uih, "Toolbar"); - - /* Fetch the toolbar. What a pain in the ass. */ - - dock_item = gnome_app_get_dock_item_by_name (GNOME_APP (ce->app), GNOME_APP_TOOLBAR_NAME); - g_assert (dock_item != NULL); - - toolbar_child = gnome_dock_item_get_child (dock_item); - g_assert (toolbar_child != NULL && GTK_IS_TOOLBAR (toolbar_child)); - - /* Turn off labels as GtkToolbar sucks */ - gtk_toolbar_set_style (GTK_TOOLBAR (toolbar_child), GTK_TOOLBAR_ICONS); - - list = bonobo_ui_handler_toolbar_parse_uiinfo_list_with_data (toolbar, ce); - bonobo_ui_handler_toolbar_add_list (ce->uih, "/Toolbar", list); -} - -/* Callback used when the dialog box is destroyed */ -static gint -app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - - close_dialog (ce); - return TRUE; -} - -static GList * -add_to_tab_order(GList *list, GladeXML *gui, char *name) -{ - GtkWidget *widget = glade_xml_get_widget(gui, name); - return g_list_prepend(list, widget); -} - -static void -setup_tab_order(GladeXML *gui) -{ - GtkWidget *container; - GList *list = NULL; - - container = glade_xml_get_widget(gui, "table-contact-editor-general"); - - if (container) { - list = add_to_tab_order(list, gui, "entry-fullname"); - list = add_to_tab_order(list, gui, "entry-jobtitle"); - list = add_to_tab_order(list, gui, "entry-company"); - list = add_to_tab_order(list, gui, "combo-file-as"); - list = add_to_tab_order(list, gui, "entry-phone1"); - list = add_to_tab_order(list, gui, "entry-phone2"); - list = add_to_tab_order(list, gui, "entry-phone3"); - list = add_to_tab_order(list, gui, "entry-phone4"); - list = g_list_reverse(list); - e_container_change_tab_order(GTK_CONTAINER(container), list); - g_list_free(list); - - list = NULL; - list = add_to_tab_order(list, gui, "entry-email1"); - list = add_to_tab_order(list, gui, "entry-web"); - list = add_to_tab_order(list, gui, "text-address"); - list = add_to_tab_order(list, gui, "alignment-contacts"); - list = g_list_reverse(list); - e_container_change_tab_order(GTK_CONTAINER(container), list); - g_list_free(list); - } -} - -static void -e_contact_editor_init (EContactEditor *e_contact_editor) -{ - GladeXML *gui; - GtkWidget *widget; - - e_contact_editor->email_info = NULL; - e_contact_editor->phone_info = NULL; - e_contact_editor->address_info = NULL; - e_contact_editor->email_popup = NULL; - e_contact_editor->phone_popup = NULL; - e_contact_editor->address_popup = NULL; - e_contact_editor->email_list = NULL; - e_contact_editor->phone_list = NULL; - e_contact_editor->address_list = NULL; - e_contact_editor->name = NULL; - e_contact_editor->company = g_strdup(""); - - e_contact_editor->email_choice = 0; - e_contact_editor->phone_choice[0] = E_CARD_SIMPLE_PHONE_ID_BUSINESS; - e_contact_editor->phone_choice[1] = E_CARD_SIMPLE_PHONE_ID_HOME; - e_contact_editor->phone_choice[2] = E_CARD_SIMPLE_PHONE_ID_BUSINESS_FAX; - e_contact_editor->phone_choice[3] = E_CARD_SIMPLE_PHONE_ID_MOBILE; - e_contact_editor->address_choice = 0; - - e_contact_editor->arbitrary_fields = NULL; - - e_contact_editor->simple = e_card_simple_new(NULL); - - e_contact_editor->card = NULL; - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/contact-editor.glade", NULL); - e_contact_editor->gui = gui; - - setup_tab_order(gui); - - e_contact_editor->app = glade_xml_get_widget (gui, "contact editor"); - - e_container_foreach_leaf (GTK_CONTAINER (e_contact_editor->app), - (GtkCallback) add_field_callback, - e_contact_editor); - - _replace_buttons(e_contact_editor); - set_entry_changed_signals(e_contact_editor); - - widget = glade_xml_get_widget(e_contact_editor->gui, "button-fullname"); - if (widget && GTK_IS_BUTTON(widget)) - gtk_signal_connect(GTK_OBJECT(widget), "clicked", - full_name_clicked, e_contact_editor); - - widget = glade_xml_get_widget(e_contact_editor->gui, "button-categories"); - if (widget && GTK_IS_BUTTON(widget)) - gtk_signal_connect(GTK_OBJECT(widget), "clicked", - categories_clicked, e_contact_editor); - - /* Build the menu and toolbar */ - - e_contact_editor->uih = bonobo_ui_handler_new (); - if (!e_contact_editor->uih) { - g_message ("e_contact_editor_init(): eeeeek, could not create the UI handler!"); - return; - } - - bonobo_ui_handler_set_app (e_contact_editor->uih, GNOME_APP (e_contact_editor->app)); - - create_menu (e_contact_editor); - create_toolbar (e_contact_editor); - - /* Connect to the deletion of the dialog */ - - gtk_signal_connect (GTK_OBJECT (e_contact_editor->app), "delete_event", - GTK_SIGNAL_FUNC (app_delete_event_cb), e_contact_editor); -} - -void -e_contact_editor_destroy (GtkObject *object) { - EContactEditor *e_contact_editor = E_CONTACT_EDITOR(object); - - if (e_contact_editor->email_list) { - g_list_foreach(e_contact_editor->email_list, (GFunc) g_free, NULL); - g_list_free(e_contact_editor->email_list); - } - if (e_contact_editor->email_info) { - g_free(e_contact_editor->email_info); - } - if (e_contact_editor->email_popup) { - gtk_widget_unref(e_contact_editor->email_popup); - } - - if (e_contact_editor->phone_list) { - g_list_foreach(e_contact_editor->phone_list, (GFunc) g_free, NULL); - g_list_free(e_contact_editor->phone_list); - } - if (e_contact_editor->phone_info) { - g_free(e_contact_editor->phone_info); - } - if (e_contact_editor->phone_popup) { - gtk_widget_unref(e_contact_editor->phone_popup); - } - - if (e_contact_editor->address_list) { - g_list_foreach(e_contact_editor->address_list, (GFunc) g_free, NULL); - g_list_free(e_contact_editor->address_list); - } - if (e_contact_editor->address_info) { - g_free(e_contact_editor->address_info); - } - if (e_contact_editor->address_popup) { - gtk_widget_unref(e_contact_editor->address_popup); - } - - if (e_contact_editor->simple) - gtk_object_unref(GTK_OBJECT(e_contact_editor->simple)); - - g_free (e_contact_editor->company); - - gtk_object_unref(GTK_OBJECT(e_contact_editor->gui)); -} - -EContactEditor * -e_contact_editor_new (ECard *card, gboolean is_new_card) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (gtk_type_new (E_CONTACT_EDITOR_TYPE)); - - gtk_object_set (GTK_OBJECT (ce), - "card", card, - "is_new_card", is_new_card, - NULL); - - gtk_widget_show (ce->app); - return ce; -} - -static void -e_contact_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - EContactEditor *editor; - - editor = E_CONTACT_EDITOR (o); - - switch (arg_id){ - case ARG_CARD: - if (editor->card) - gtk_object_unref(GTK_OBJECT(editor->card)); - editor->card = e_card_duplicate(E_CARD(GTK_VALUE_OBJECT (*arg))); - gtk_object_set(GTK_OBJECT(editor->simple), - "card", editor->card, - NULL); - fill_in_info(editor); - break; - - case ARG_IS_NEW_CARD: - editor->is_new_card = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE; - break; - } -} - -static void -e_contact_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EContactEditor *e_contact_editor; - - e_contact_editor = E_CONTACT_EDITOR (object); - - switch (arg_id) { - case ARG_CARD: - e_card_simple_sync_card(e_contact_editor->simple); - extract_info(e_contact_editor); - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_contact_editor->card); - break; - - case ARG_IS_NEW_CARD: - GTK_VALUE_BOOL (*arg) = e_contact_editor->is_new_card ? TRUE : FALSE; - break; - - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -_popup_position(GtkMenu *menu, - gint *x, - gint *y, - gpointer data) -{ - GtkWidget *button = GTK_WIDGET(data); - GtkRequisition request; - int mh, mw; - gdk_window_get_origin (button->window, x, y); - *x += button->allocation.width; - *y += button->allocation.height; - - gtk_widget_size_request(GTK_WIDGET(menu), &request); - - mh = request.height; - mw = request.width; - - *x -= mw; - if (*x < 0) - *x = 0; - - if (*y < 0) - *y = 0; - - if ((*x + mw) > gdk_screen_width ()) - *x = gdk_screen_width () - mw; - - if ((*y + mh) > gdk_screen_height ()) - *y = gdk_screen_height () - mh; -} - -static gint -_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor, GtkWidget *popup, GList **list, GnomeUIInfo **info, gchar *label, gchar *entry, gchar *dialog_title) -{ - gint menu_item; - gtk_signal_emit_stop_by_name(GTK_OBJECT(widget), "button_press_event"); - gtk_widget_realize(popup); - menu_item = gnome_popup_menu_do_popup_modal(popup, _popup_position, widget, button, editor); - if ( menu_item != -1 ) { -#if 0 - if (menu_item == g_list_length (*list)) { - e_contact_editor_build_dialog(editor, entry, label, dialog_title, list, info); - } else { -#endif - GtkWidget *label_widget = glade_xml_get_widget(editor->gui, label); - if (label_widget && GTK_IS_LABEL(label_widget)) { - gtk_object_set(GTK_OBJECT(label_widget), - "label", g_list_nth_data(*list, menu_item), - NULL); - } -#if 0 - } -#endif - } - return menu_item; -} - -static void -e_contact_editor_build_ui_info(GList *list, GnomeUIInfo **infop) -{ - GnomeUIInfo *info; - GnomeUIInfo singleton = { GNOME_APP_UI_TOGGLEITEM, NULL, NULL, NULL, NULL, NULL, GNOME_APP_PIXMAP_NONE, 0, 0, 0, NULL }; - GnomeUIInfo end = GNOMEUIINFO_END; - int length; - int i; - - info = *infop; - - if ( info ) - g_free(info); - length = g_list_length( list ); - info = g_new(GnomeUIInfo, length + 2); - for (i = 0; i < length; i++) { - info[i] = singleton; - info[i].label = _(list->data); - list = list->next; - } - info[i] = end; - - *infop = info; -} - -#if 0 -static void -_dialog_clicked(GtkWidget *dialog, gint button, EContactEditor *editor) -{ - GtkWidget *label = gtk_object_get_data(GTK_OBJECT(dialog), - "e_contact_editor_label"); - - GtkWidget *dialog_entry = gtk_object_get_data(GTK_OBJECT(dialog), - "e_contact_editor_dialog_entry"); - - GList **list = gtk_object_get_data(GTK_OBJECT(dialog), - "e_contact_editor_list"); - GList **info = gtk_object_get_data(GTK_OBJECT(dialog), - "e_contact_editor_info"); - switch (button) { - case 0: - if (label && GTK_IS_LABEL(label)) { - gtk_object_set(GTK_OBJECT(label), - "label", gtk_entry_get_text(GTK_ENTRY(dialog_entry)), - NULL); - *list = g_list_append(*list, g_strdup(gtk_entry_get_text(GTK_ENTRY(dialog_entry)))); - g_free(*info); - *info = NULL; - } - break; - } - gnome_dialog_close(GNOME_DIALOG(dialog)); -} - -static void -_dialog_destroy(EContactEditor *editor, GtkWidget *dialog) -{ - gnome_dialog_close(GNOME_DIALOG(dialog)); -} - -static GtkWidget * -e_contact_editor_build_dialog(EContactEditor *editor, gchar *entry_id, gchar *label_id, gchar *title, GList **list, GnomeUIInfo **info) -{ - GtkWidget *dialog_entry = gtk_entry_new(); - GtkWidget *entry = glade_xml_get_widget(editor->gui, entry_id); - GtkWidget *label = glade_xml_get_widget(editor->gui, label_id); - - GtkWidget *dialog = gnome_dialog_new(title, - NULL); - - gtk_container_add(GTK_CONTAINER(GNOME_DIALOG(dialog)->vbox), - gtk_widget_new (gtk_frame_get_type(), - "border_width", 4, - "label", title, - "child", gtk_widget_new(gtk_alignment_get_type(), - "child", dialog_entry, - "xalign", .5, - "yalign", .5, - "xscale", 1.0, - "yscale", 1.0, - "border_width", 9, - NULL), - NULL)); - - gnome_dialog_append_button_with_pixmap(GNOME_DIALOG(dialog), - "Add", - GNOME_STOCK_PIXMAP_ADD); - gnome_dialog_append_button(GNOME_DIALOG(dialog), GNOME_STOCK_BUTTON_CANCEL); - gnome_dialog_set_default(GNOME_DIALOG(dialog), 0); - - gtk_signal_connect(GTK_OBJECT(dialog), "clicked", - _dialog_clicked, editor); - gtk_signal_connect_while_alive(GTK_OBJECT(editor), "destroy", - _dialog_destroy, GTK_OBJECT(dialog), GTK_OBJECT(dialog)); - - gtk_object_set_data(GTK_OBJECT(dialog), - "e_contact_editor_entry", entry); - gtk_object_set_data(GTK_OBJECT(dialog), - "e_contact_editor_label", label); - gtk_object_set_data(GTK_OBJECT(dialog), - "e_contact_editor_dialog_entry", dialog_entry); - gtk_object_set_data(GTK_OBJECT(dialog), - "e_contact_editor_list", list); - gtk_object_set_data(GTK_OBJECT(dialog), - "e_contact_editor_info", info); - - gtk_widget_show_all(dialog); - return dialog; -} -#endif - -static void -_phone_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor) -{ - int which; - int i; - gchar *label; - gchar *entry; - int result; - if ( widget == glade_xml_get_widget(editor->gui, "button-phone1") ) { - which = 1; - } else if ( widget == glade_xml_get_widget(editor->gui, "button-phone2") ) { - which = 2; - } else if ( widget == glade_xml_get_widget(editor->gui, "button-phone3") ) { - which = 3; - } else if ( widget == glade_xml_get_widget(editor->gui, "button-phone4") ) { - which = 4; - } else - return; - - label = g_strdup_printf("label-phone%d", which); - entry = g_strdup_printf("entry-phone%d", which); - - if (editor->phone_list == NULL) { - static char *info[] = { - N_("Assistant"), - N_("Business"), - N_("Business 2"), - N_("Business Fax"), - N_("Callback"), - N_("Car"), - N_("Company"), - N_("Home"), - N_("Home 2"), - N_("Home Fax"), - N_("ISDN"), - N_("Mobile"), - N_("Other"), - N_("Other Fax"), - N_("Pager"), - N_("Primary"), - N_("Radio"), - N_("Telex"), - N_("TTY/TDD") - }; - - for (i = 0; i < sizeof(info) / sizeof(info[0]); i++) { - editor->phone_list = g_list_append(editor->phone_list, g_strdup(info[i])); - } - } - if (editor->phone_info == NULL) { - e_contact_editor_build_ui_info(editor->phone_list, &editor->phone_info); - - if ( editor->phone_popup ) - gtk_widget_unref(editor->phone_popup); - - editor->phone_popup = gnome_popup_menu_new(editor->phone_info); - } - - for(i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i++) { - const ECardPhone *phone = e_card_simple_get_phone(editor->simple, i); - gboolean checked; - checked = phone && phone->number && *phone->number; - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(editor->phone_info[i].widget), - checked); - gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(editor->phone_info[i].widget), - TRUE); - } - - result = _arrow_pressed (widget, button, editor, editor->phone_popup, &editor->phone_list, &editor->phone_info, label, entry, "Add new phone number type"); - - if (result != -1) { - editor->phone_choice[which - 1] = result; - set_fields(editor); - } - - g_free(label); - g_free(entry); -} - -static void -_email_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor) -{ - int i; - int result; - if (editor->email_list == NULL) { - static char *info[] = { - N_("Primary Email"), - N_("Email 2"), - N_("Email 3") - }; - - for (i = 0; i < sizeof(info) / sizeof(info[0]); i++) { - editor->email_list = g_list_append(editor->email_list, g_strdup(info[i])); - } - } - if (editor->email_info == NULL) { - e_contact_editor_build_ui_info(editor->email_list, &editor->email_info); - - if ( editor->email_popup ) - gtk_widget_unref(editor->email_popup); - - editor->email_popup = gnome_popup_menu_new(editor->email_info); - } - - for(i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i++) { - const char *string = e_card_simple_get_email(editor->simple, i); - gboolean checked; - checked = string && *string; - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(editor->email_info[i].widget), - checked); - gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(editor->email_info[i].widget), - TRUE); - } - - result = _arrow_pressed (widget, button, editor, editor->email_popup, &editor->email_list, &editor->email_info, "label-email1", "entry-email1", "Add new Email type"); - - if (result != -1) { - editor->email_choice = result; - set_fields(editor); - } -} - -static void -_address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor) -{ - int i; - int result; - if (editor->address_list == NULL) { - static char *info[] = { - N_("Business"), - N_("Home"), - N_("Other") - }; - - for (i = 0; i < sizeof(info) / sizeof(info[0]); i++) { - editor->address_list = g_list_append(editor->address_list, g_strdup(info[i])); - } - } - if (editor->address_info == NULL) { - e_contact_editor_build_ui_info(editor->address_list, &editor->address_info); - - if ( editor->address_popup ) - gtk_widget_unref(editor->address_popup); - - editor->address_popup = gnome_popup_menu_new(editor->address_info); - } - - for(i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) { - const ECardAddrLabel *address = e_card_simple_get_address(editor->simple, i); - gboolean checked; - checked = address && address->data && *address->data; - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(editor->address_info[i].widget), - checked); - gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(editor->address_info[i].widget), - TRUE); - } - - result = _arrow_pressed (widget, button, editor, editor->address_popup, &editor->address_list, &editor->address_info, "label-address", "text-address", "Add new Address type"); - - if (result != -1) { - set_address_field(editor, result); - } -} - -static void -set_field(GtkEntry *entry, const char *string) -{ - char *oldstring = gtk_entry_get_text(entry); - if (!string) - string = ""; - if (strcmp(string, oldstring)) - gtk_entry_set_text(entry, string); -} - -static void -set_phone_field(GtkWidget *entry, const ECardPhone *phone) -{ - set_field(GTK_ENTRY(entry), phone ? phone->number : ""); -} - -static void -set_fields(EContactEditor *editor) -{ - GtkWidget *entry; - - entry = glade_xml_get_widget(editor->gui, "entry-phone1"); - if (entry && GTK_IS_ENTRY(entry)) - set_phone_field(entry, e_card_simple_get_phone(editor->simple, editor->phone_choice[0])); - - entry = glade_xml_get_widget(editor->gui, "entry-phone2"); - if (entry && GTK_IS_ENTRY(entry)) - set_phone_field(entry, e_card_simple_get_phone(editor->simple, editor->phone_choice[1])); - - entry = glade_xml_get_widget(editor->gui, "entry-phone3"); - if (entry && GTK_IS_ENTRY(entry)) - set_phone_field(entry, e_card_simple_get_phone(editor->simple, editor->phone_choice[2])); - - entry = glade_xml_get_widget(editor->gui, "entry-phone4"); - if (entry && GTK_IS_ENTRY(entry)) - set_phone_field(entry, e_card_simple_get_phone(editor->simple, editor->phone_choice[3])); - - entry = glade_xml_get_widget(editor->gui, "entry-email1"); - if (entry && GTK_IS_ENTRY(entry)) - set_field(GTK_ENTRY(entry), e_card_simple_get_email(editor->simple, editor->email_choice)); - - set_address_field(editor, -1); -} - -static void -set_address_field(EContactEditor *editor, int result) -{ - GtkWidget *widget; - - widget = glade_xml_get_widget(editor->gui, "text-address"); - - if (widget && GTK_IS_TEXT(widget)) { - int position; - GtkEditable *editable; - const ECardAddrLabel *address; - - if (result == -1) - result = editor->address_choice; - editor->address_choice = -1; - - position = 0; - editable = GTK_EDITABLE(widget); - gtk_editable_delete_text(editable, 0, -1); - address = e_card_simple_get_address(editor->simple, result); - if (address && address->data) - gtk_editable_insert_text(editable, address->data, strlen(address->data), &position); - - editor->address_choice = result; - } -} - -static void -add_field_callback(GtkWidget *widget, EContactEditor *editor) -{ - const char *name; - int i; - static const char *builtins[] = { - "entry-fullname", - "entry-web", - "entry-company", - "entry-department", - "entry-office", - "entry-jobtitle", - "entry-profession", - "entry-manager", - "entry-assistant", - "entry-nickname", - "entry-spouse", - "text-comments", - "entry-categories", - "entry-contacts", - "entry-file-as", - "dateedit-anniversary", - "dateedit-birthday", - "entry-phone1", - "entry-phone2", - "entry-phone3", - "entry-phone4", - "entry-email1", - "text-address", - "checkbutton-mailingaddress", - "checkbutton-htmlmail", - NULL - }; - name = glade_get_widget_name(widget); - if (name) { - for (i = 0; builtins[i]; i++) { - if (!strcmp(name, builtins[i])) - return; - } - if (GTK_IS_ENTRY(widget) || GTK_IS_TEXT(widget)) { - editor->arbitrary_fields = g_list_prepend(editor->arbitrary_fields, g_strdup(name)); - } - } -} - -struct { - char *id; - char *key; -} field_mapping [] = { - { "entry-fullname", "full_name" }, - { "entry-web", "url" }, - { "entry-company", "org" }, - { "entry-department", "org_unit" }, - { "entry-office", "office" }, - { "entry-jobtitle", "title" }, - { "entry-profession", "role" }, - { "entry-manager", "manager" }, - { "entry-assistant", "assistant" }, - { "entry-nickname", "nickname" }, - { "entry-spouse", "spouse" }, - { "text-comments", "note" }, - { "entry-categories", "categories" }, -}; - -static void -fill_in_field(EContactEditor *editor, char *id, char *value) -{ - GtkWidget *widget = glade_xml_get_widget(editor->gui, id); - if (widget && GTK_IS_EDITABLE(widget)) { - int position = 0; - GtkEditable *editable = GTK_EDITABLE(widget); - gtk_editable_delete_text(editable, 0, -1); - if (value) - gtk_editable_insert_text(editable, value, strlen(value), &position); - } -} - -static void -fill_in_card_field(EContactEditor *editor, ECard *card, char *id, char *key) -{ - char *string; - gtk_object_get(GTK_OBJECT(card), - key, &string, - NULL); - fill_in_field(editor, id, string); -} - -static void -fill_in_single_field(EContactEditor *editor, char *name) -{ - ECardSimple *simple = editor->simple; - GtkWidget *widget = glade_xml_get_widget(editor->gui, name); - if (widget && GTK_IS_EDITABLE(widget)) { - int position = 0; - GtkEditable *editable = GTK_EDITABLE(widget); - const ECardArbitrary *arbitrary; - - gtk_editable_delete_text(editable, 0, -1); - arbitrary = e_card_simple_get_arbitrary(simple, - name); - if (arbitrary && arbitrary->value) - gtk_editable_insert_text(editable, arbitrary->value, strlen(arbitrary->value), &position); - } -} - -static void -fill_in_info(EContactEditor *editor) -{ - ECard *card = editor->card; - if (card) { - char *file_as; - ECardName *name; - const ECardDate *anniversary; - const ECardDate *bday; - int i; - GtkWidget *widget; - GList *list; - - gtk_object_get(GTK_OBJECT(card), - "file_as", &file_as, - "name", &name, - "anniversary", &anniversary, - "birth_date", &bday, - NULL); - - for (i = 0; i < sizeof(field_mapping) / sizeof(field_mapping[0]); i++) { - fill_in_card_field(editor, card, field_mapping[i].id, field_mapping[i].key); - } - - for (list = editor->arbitrary_fields; list; list = list->next) { - fill_in_single_field(editor, list->data); - } - - /* File as has to come after company and name or else it'll get messed up when setting them. */ - fill_in_field(editor, "entry-file-as", file_as); - - e_card_name_free(editor->name); - editor->name = e_card_name_copy(name); - - widget = glade_xml_get_widget(editor->gui, "dateedit-anniversary"); - if (anniversary && widget && GNOME_IS_DATE_EDIT(widget)) { - struct tm time_struct = {0,0,0,0,0,0,0,0,0}; - time_t time_val; - GnomeDateEdit *dateedit; - - time_struct.tm_mday = anniversary->day; - time_struct.tm_mon = anniversary->month - 1; - time_struct.tm_year = anniversary->year - 1900; - time_val = mktime(&time_struct); - dateedit = GNOME_DATE_EDIT(widget); - gnome_date_edit_set_time(dateedit, time_val); - } - - widget = glade_xml_get_widget(editor->gui, "dateedit-birthday"); - if (bday && widget && GNOME_IS_DATE_EDIT(widget)) { - struct tm time_struct = {0,0,0,0,0,0,0,0,0}; - time_t time_val; - GnomeDateEdit *dateedit; - time_struct.tm_mday = bday->day; - time_struct.tm_mon = bday->month - 1; - time_struct.tm_year = bday->year - 1900; - time_val = mktime(&time_struct); - dateedit = GNOME_DATE_EDIT(widget); - gnome_date_edit_set_time(dateedit, time_val); - } - - set_fields(editor); - } -} - -static void -extract_field(EContactEditor *editor, ECard *card, char *editable_id, char *key) -{ - GtkWidget *widget = glade_xml_get_widget(editor->gui, editable_id); - if (widget && GTK_IS_EDITABLE(widget)) { - GtkEditable *editable = GTK_EDITABLE(widget); - char *string = gtk_editable_get_chars(editable, 0, -1); - if (string && *string) - gtk_object_set(GTK_OBJECT(card), - key, string, - NULL); - else - gtk_object_set(GTK_OBJECT(card), - key, NULL, - NULL); - g_free(string); - } -} - -static void -extract_single_field(EContactEditor *editor, char *name) -{ - GtkWidget *widget = glade_xml_get_widget(editor->gui, name); - ECardSimple *simple = editor->simple; - if (widget && GTK_IS_EDITABLE(widget)) { - GtkEditable *editable = GTK_EDITABLE(widget); - char *string = gtk_editable_get_chars(editable, 0, -1); - - if (string && *string) - e_card_simple_set_arbitrary(simple, - name, - NULL, - string); - else - e_card_simple_set_arbitrary(simple, - name, - NULL, - NULL); - g_free(string); - } -} - -static void -extract_info(EContactEditor *editor) -{ - ECard *card = editor->card; - if (card) { - ECardDate *anniversary; - ECardDate *bday; - struct tm time_struct; - time_t time_val; - int i; - GtkWidget *widget; - GList *list; - - widget = glade_xml_get_widget(editor->gui, "entry-file-as"); - if (widget && GTK_IS_EDITABLE(widget)) { - GtkEditable *editable = GTK_EDITABLE(widget); - char *string = gtk_editable_get_chars(editable, 0, -1); - if (string && *string) - gtk_object_set(GTK_OBJECT(card), - "file_as", string, - NULL); - g_free(string); - } - - for (i = 0; i < sizeof(field_mapping) / sizeof(field_mapping[0]); i++) { - extract_field(editor, card, field_mapping[i].id, field_mapping[i].key); - } - - for (list = editor->arbitrary_fields; list; list = list->next) { - extract_single_field(editor, list->data); - } - - if (editor->name) - gtk_object_set(GTK_OBJECT(card), - "name", editor->name, - NULL); - - widget = glade_xml_get_widget(editor->gui, "dateedit-anniversary"); - if (widget && GNOME_IS_DATE_EDIT(widget)) { - time_val = gnome_date_edit_get_date(GNOME_DATE_EDIT(widget)); - gmtime_r(&time_val, - &time_struct); - anniversary = g_new(ECardDate, 1); - anniversary->day = time_struct.tm_mday; - anniversary->month = time_struct.tm_mon + 1; - anniversary->year = time_struct.tm_year + 1900; - gtk_object_set(GTK_OBJECT(card), - "anniversary", anniversary, - NULL); - } - - widget = glade_xml_get_widget(editor->gui, "dateedit-birthday"); - if (widget && GNOME_IS_DATE_EDIT(widget)) { - time_val = gnome_date_edit_get_date(GNOME_DATE_EDIT(widget)); - gmtime_r(&time_val, - &time_struct); - bday = g_new(ECardDate, 1); - bday->day = time_struct.tm_mday; - bday->month = time_struct.tm_mon + 1; - bday->year = time_struct.tm_year + 1900; - gtk_object_set(GTK_OBJECT(card), - "birth_date", bday, - NULL); - } - } -} diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h deleted file mode 100644 index de14b84ca3..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor.h +++ /dev/null @@ -1,114 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-editor.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_CONTACT_EDITOR_H__ -#define __E_CONTACT_EDITOR_H__ - -#include <gnome.h> -#include <glade/glade.h> -#include <bonobo.h> -#include <ebook/e-card.h> -#include <ebook/e-card-simple.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EContactEditor - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * card ECard * RW The card currently being edited - */ - -#define E_CONTACT_EDITOR_TYPE (e_contact_editor_get_type ()) -#define E_CONTACT_EDITOR(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_TYPE, EContactEditor)) -#define E_CONTACT_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_TYPE, EContactEditorClass)) -#define E_IS_CONTACT_EDITOR(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_TYPE)) -#define E_IS_CONTACT_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_TYPE)) - - -typedef struct _EContactEditor EContactEditor; -typedef struct _EContactEditorClass EContactEditorClass; - -struct _EContactEditor -{ - GtkObject object; - - /* item specific fields */ - ECard *card; - ECardSimple *simple; - - /* UI handler */ - BonoboUIHandler *uih; - - GladeXML *gui; - GtkWidget *app; - GnomeUIInfo *email_info; - GnomeUIInfo *phone_info; - GnomeUIInfo *address_info; - GtkWidget *email_popup; - GtkWidget *phone_popup; - GtkWidget *address_popup; - GList *email_list; - GList *phone_list; - GList *address_list; - - ECardName *name; - char *company; - - ECardSimpleEmailId email_choice; - ECardSimplePhoneId phone_choice[4]; - ECardSimpleAddressId address_choice; - - GList *arbitrary_fields; - - /* Whether we are editing a new card or an existing one */ - guint is_new_card : 1; -}; - -struct _EContactEditorClass -{ - GtkObjectClass parent_class; - - /* Notification signals */ - - void (* add_card) (EContactEditor *ce, ECard *card); - void (* commit_card) (EContactEditor *ce, ECard *card); - void (* delete_card) (EContactEditor *ce, ECard *card); - void (* editor_closed) (EContactEditor *ce); -}; - - -EContactEditor *e_contact_editor_new (ECard *card, gboolean is_new_card); -GtkType e_contact_editor_get_type (void); - - -gboolean e_contact_editor_confirm_delete(void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_CONTACT_EDITOR_H__ */ diff --git a/addressbook/gui/contact-editor/e-contact-save-as.c b/addressbook/gui/contact-editor/e-contact-save-as.c deleted file mode 100644 index 51cb2619e7..0000000000 --- a/addressbook/gui/contact-editor/e-contact-save-as.c +++ /dev/null @@ -1,77 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-editor.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. - */ - -#include <e-contact-save-as.h> -#include <e-util/e-util.h> -#include <unistd.h> -#include <fcntl.h> - -typedef struct { - GtkFileSelection *filesel; - ECard *card; -} SaveAsInfo; - -static void -save_it(GtkWidget *widget, SaveAsInfo *info) -{ - char *vcard = e_card_get_vcard(info->card); - const char *filename = gtk_file_selection_get_filename(info->filesel); - e_write_file(filename, vcard, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC); - g_free(vcard); - gtk_object_unref(GTK_OBJECT(info->card)); - gtk_widget_destroy(GTK_WIDGET(info->filesel)); - g_free(info); -} - -static void -close_it(GtkWidget *widget, SaveAsInfo *info) -{ - gtk_object_unref(GTK_OBJECT(info->card)); - gtk_widget_destroy(GTK_WIDGET(info->filesel)); - g_free(info); -} - -static void -delete_it(GtkWidget *widget, SaveAsInfo *info) -{ - gtk_object_unref(GTK_OBJECT(info->card)); - g_free(info); -} - -void -e_contact_save_as(char *title, ECard *card) -{ - GtkFileSelection *filesel; - SaveAsInfo *info = g_new(SaveAsInfo, 1); - - filesel = GTK_FILE_SELECTION(gtk_file_selection_new(title)); - - info->filesel = filesel; - info->card = e_card_duplicate(card); - - gtk_signal_connect(GTK_OBJECT(filesel->ok_button), "clicked", - save_it, info); - gtk_signal_connect(GTK_OBJECT(filesel->cancel_button), "clicked", - close_it, info); - gtk_signal_connect(GTK_OBJECT(filesel), "delete_event", - delete_it, info); - gtk_widget_show(GTK_WIDGET(filesel)); -} diff --git a/addressbook/gui/contact-editor/e-contact-save-as.h b/addressbook/gui/contact-editor/e-contact-save-as.h deleted file mode 100644 index e6af13e8fd..0000000000 --- a/addressbook/gui/contact-editor/e-contact-save-as.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-save-as.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_CONTACT_SAVE_AS_H__ -#define __E_CONTACT_SAVE_AS_H__ - -#include <gnome.h> -#include <glade/glade.h> -#include <ebook/e-card.h> -#include <ebook/e-card-simple.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -void -e_contact_save_as(gchar *title, ECard *card); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_CONTACT_EDITOR_H__ */ diff --git a/addressbook/gui/contact-editor/email.png b/addressbook/gui/contact-editor/email.png Binary files differdeleted file mode 100644 index f3ff02e343..0000000000 --- a/addressbook/gui/contact-editor/email.png +++ /dev/null diff --git a/addressbook/gui/contact-editor/fullname-strings.h b/addressbook/gui/contact-editor/fullname-strings.h deleted file mode 100644 index 0c84dfdc8f..0000000000 --- a/addressbook/gui/contact-editor/fullname-strings.h +++ /dev/null @@ -1,25 +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_("Check Full Name"); -gchar *s = N_("_Title:"); -gchar *s = N_("_First:"); -gchar *s = N_("_Middle:"); -gchar *s = N_("_Last:"); -gchar *s = N_("_Suffix:"); -gchar *s = N_("\n" - "Mr.\n" - "Mrs.\n" - "Dr.\n" - ""); -gchar *s = N_("\n" - "Sr.\n" - "Jr.\n" - "I\n" - "II\n" - "III\n" - "Esq.\n" - ""); diff --git a/addressbook/gui/contact-editor/fullname.glade b/addressbook/gui/contact-editor/fullname.glade deleted file mode 100644 index 8f811c5616..0000000000 --- a/addressbook/gui/contact-editor/fullname.glade +++ /dev/null @@ -1,391 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>fullname</name> - <program_name>fullname</program_name> - <directory></directory> - <source_directory>src</source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>True</gnome_support> - <gettext_support>True</gettext_support> - <use_widget_names>True</use_widget_names> - <output_main_file>False</output_main_file> - <output_support_files>False</output_support_files> - <output_build_files>False</output_build_files> - <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>fullname-strings.h</translatable_strings_file> -</project> - -<widget> - <class>GnomeDialog</class> - <name>dialog-checkfullname</name> - <visible>False</visible> - <title>Check Full Name</title> - <type>GTK_WINDOW_TOPLEVEL</type> - <position>GTK_WIN_POS_NONE</position> - <modal>True</modal> - <allow_shrink>True</allow_shrink> - <allow_grow>True</allow_grow> - <auto_shrink>False</auto_shrink> - <auto_close>False</auto_close> - <hide_on_close>False</hide_on_close> - - <widget> - <class>GtkVBox</class> - <child_name>GnomeDialog:vbox</child_name> - <name>vbox-container</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkTable</class> - <name>table-checkfullname</name> - <border_width>8</border_width> - <rows>5</rows> - <columns>3</columns> - <homogeneous>False</homogeneous> - <row_spacing>6</row_spacing> - <column_spacing>21</column_spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel1</name> - <label>_Title:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel2</name> - <label>_First:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel3</name> - <label>_Middle:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel4</name> - <label>_Last:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAccelLabel</class> - <name>accellabel5</name> - <label>_Suffix:</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - <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>GtkCombo</class> - <name>combo-title</name> - <value_in_list>False</value_in_list> - <ok_if_empty>True</ok_if_empty> - <case_sensitive>False</case_sensitive> - <use_arrows>True</use_arrows> - <use_arrows_always>False</use_arrows_always> - <items> -Mr. -Mrs. -Dr. -</items> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - - <widget> - <class>GtkEntry</class> - <child_name>GtkCombo:entry</child_name> - <name>entry-title</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - </widget> - </widget> - - <widget> - <class>GtkCombo</class> - <name>combo-suffix</name> - <value_in_list>False</value_in_list> - <ok_if_empty>True</ok_if_empty> - <case_sensitive>False</case_sensitive> - <use_arrows>True</use_arrows> - <use_arrows_always>False</use_arrows_always> - <items> -Sr. -Jr. -I -II -III -Esq. -</items> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>4</top_attach> - <bottom_attach>5</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - - <widget> - <class>GtkEntry</class> - <child_name>GtkCombo:entry</child_name> - <name>entry-suffix</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - </widget> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-first</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>3</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-middle</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>3</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry-last</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>3</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - </widget> - - <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>button1</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_OK</stock_button> - </widget> - - <widget> - <class>GtkButton</class> - <name>button2</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/addressbook/gui/contact-editor/head.png b/addressbook/gui/contact-editor/head.png Binary files differdeleted file mode 100644 index ca00b75f92..0000000000 --- a/addressbook/gui/contact-editor/head.png +++ /dev/null diff --git a/addressbook/gui/contact-editor/netfreebusy.png b/addressbook/gui/contact-editor/netfreebusy.png Binary files differdeleted file mode 100644 index 09ec8a2a5c..0000000000 --- a/addressbook/gui/contact-editor/netfreebusy.png +++ /dev/null diff --git a/addressbook/gui/contact-editor/netmeeting.png b/addressbook/gui/contact-editor/netmeeting.png Binary files differdeleted file mode 100644 index 4cb90c121e..0000000000 --- a/addressbook/gui/contact-editor/netmeeting.png +++ /dev/null diff --git a/addressbook/gui/contact-editor/phone.png b/addressbook/gui/contact-editor/phone.png Binary files differdeleted file mode 100644 index ebec84ba0b..0000000000 --- a/addressbook/gui/contact-editor/phone.png +++ /dev/null diff --git a/addressbook/gui/contact-editor/snailmail.png b/addressbook/gui/contact-editor/snailmail.png Binary files differdeleted file mode 100644 index 647ae8f68c..0000000000 --- a/addressbook/gui/contact-editor/snailmail.png +++ /dev/null diff --git a/addressbook/gui/contact-editor/test-editor.c b/addressbook/gui/contact-editor/test-editor.c deleted file mode 100644 index 80db2fe848..0000000000 --- a/addressbook/gui/contact-editor/test-editor.c +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * test-editor.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 <glade/glade.h> -#include "e-contact-editor.h" - -#define TEST_VCARD \ -"BEGIN:VCARD -" \ -"FN:Nat -" \ -"N:Friedman;Nat;D;Mr. -" \ -"BDAY:1977-08-06 -" \ -"TEL;WORK:617 679 1984 -" \ -"TEL;CELL:123 456 7890 -" \ -"EMAIL;INTERNET:nat@nat.org -" \ -"EMAIL;INTERNET:nat@helixcode.com -" \ -"ADR;WORK;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234; -" \ -"ADR;HOME;POSTAL;INTL:P.O. Box 202;;;Any Town 2;MI;12344-4321;USA -" \ -"END:VCARD -" \ -" -" - -static char * -read_file (char *name) -{ - int len; - char buff[65536]; - char line[1024]; - FILE *f; - - f = fopen (name, "r"); - if (f == NULL) - g_error ("Unable to open %s!\n", name); - - len = 0; - while (fgets (line, sizeof (line), f) != NULL) { - strcpy (buff + len, line); - len += strlen (line); - } - - fclose (f); - - return g_strdup (buff); -} - -/* Callback used when a contact editor is closed */ -static void -editor_closed_cb (EContactEditor *ce, gpointer data) -{ - static int count = 2; - - count--; - gtk_object_unref (GTK_OBJECT (ce)); - - if (count == 0) - 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 ( _( "Contact Editor Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the contact editor canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -int main( int argc, char *argv[] ) -{ - char *cardstr; - EContactEditor *ce; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Contact Editor Test", VERSION, argc, argv); - - glade_gnome_init (); - - cardstr = NULL; - if (argc == 2) - cardstr = read_file (argv [1]); - - if (cardstr == NULL) - cardstr = TEST_VCARD; - - ce = e_contact_editor_new (e_card_new (cardstr), TRUE); - gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", - GTK_SIGNAL_FUNC (editor_closed_cb), NULL); - - ce = e_contact_editor_new (e_card_new (cardstr), TRUE); - gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", - GTK_SIGNAL_FUNC (editor_closed_cb), NULL); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/gui/contact-editor/web.png b/addressbook/gui/contact-editor/web.png Binary files differdeleted file mode 100644 index 3211a11b19..0000000000 --- a/addressbook/gui/contact-editor/web.png +++ /dev/null diff --git a/addressbook/gui/minicard/.cvsignore b/addressbook/gui/minicard/.cvsignore deleted file mode 100644 index 472fd2593f..0000000000 --- a/addressbook/gui/minicard/.cvsignore +++ /dev/null @@ -1,12 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -*.lo -*.la -minicard-label-test -minicard-test -minicard-view-test -minicard-widget-test -reflow-test diff --git a/addressbook/gui/minicard/Makefile.am b/addressbook/gui/minicard/Makefile.am deleted file mode 100644 index 17f6d00548..0000000000 --- a/addressbook/gui/minicard/Makefile.am +++ /dev/null @@ -1,124 +0,0 @@ -INCLUDES = \ - -DG_LOG_DOMAIN=\"e-minicard\" \ - -I$(top_srcdir) \ - -I$(top_srcdir)/addressbook/backend \ - -I$(top_builddir)/addressbook/backend \ - -I$(top_srcdir)/addressbook/contact-editor \ - -I$(top_srcdir)/widgets/e-text \ - -I$(top_srcdir)/widgets/misc \ - $(BONOBO_GNOME_CFLAGS) - -noinst_LIBRARIES = \ - libeminicard.a - -libeminicard_a_SOURCES = \ - e-minicard-control.c \ - e-minicard-control.h \ - e-minicard-label.c \ - e-minicard-label.h \ - e-minicard-view-widget.c \ - e-minicard-view-widget.h \ - e-minicard-view.c \ - e-minicard-view.h \ - e-minicard-widget.c \ - e-minicard-widget.h \ - e-minicard.c \ - e-minicard.h \ - e-reflow-sorted.c \ - e-reflow-sorted.h \ - e-reflow.c \ - e-reflow.h - -noinst_PROGRAMS = \ - minicard-widget-test \ - minicard-label-test \ - minicard-test \ - reflow-test \ - minicard-view-test - -minicard_label_test_SOURCES = \ - test-minicard-label.c - -minicard_label_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - $(GNOMEGNORBA_LIBS) \ - libeminicard.a \ - $(BONOBO_GNOME_LIBS) \ - $(top_builddir)/widgets/e-text/libetext.a \ - $(top_builddir)/e-util/libeutil.la - -minicard_test_SOURCES = \ - test-minicard.c - -minicard_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - $(GNOMEGNORBA_LIBS) \ - libeminicard.a \ - $(BONOBO_GNOME_LIBS) \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/addressbook/ename/libename.la \ - $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \ - $(top_builddir)/addressbook/printing/libecontactprint.a \ - $(top_builddir)/widgets/e-table/libetable.a \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/widgets/e-text/libetext.a - -reflow_test_SOURCES = \ - test-reflow.c - -reflow_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - $(GNOMEGNORBA_LIBS) \ - $(BONOBO_GNOME_LIBS) \ - libeminicard.a \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/addressbook/ename/libename.la \ - $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \ - $(top_builddir)/addressbook/printing/libecontactprint.a \ - $(top_builddir)/widgets/e-table/libetable.a \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/widgets/e-text/libetext.a - -minicard_view_test_SOURCES = \ - test-minicard-view.c - -minicard_view_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - $(GNOMEGNORBA_LIBS) \ - $(BONOBO_GNOME_LIBS) \ - libeminicard.a \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/addressbook/ename/libename.la \ - $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \ - $(top_builddir)/addressbook/printing/libecontactprint.a \ - $(top_builddir)/widgets/e-table/libetable.a \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/widgets/e-text/libetext.a - -minicard_widget_test_SOURCES = \ - e-minicard-widget-test.c - -minicard_widget_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - $(GNOMEGNORBA_LIBS) \ - $(BONOBO_GNOME_LIBS) \ - libeminicard.a \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/addressbook/ename/libename.la \ - $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \ - $(top_builddir)/addressbook/printing/libecontactprint.a \ - $(top_builddir)/widgets/e-table/libetable.a \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/widgets/e-text/libetext.a diff --git a/addressbook/gui/minicard/e-minicard-control.c b/addressbook/gui/minicard/e-minicard-control.c deleted file mode 100644 index 7c1838b568..0000000000 --- a/addressbook/gui/minicard/e-minicard-control.c +++ /dev/null @@ -1,336 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard-control.c - * - * Authors: - * Chris Lahey <clahey@helixcode.com> - * - * Copyright 1999, 2000, Helix Code, Inc. - */ - -#include <config.h> -#include <gnome.h> -#include <bonobo.h> - -#include "addressbook/backend/ebook/e-book.h" - -#include "e-minicard-control.h" -#include "e-minicard-widget.h" -#include "addressbook/backend/ebook/e-card.h" - -#if 0 -enum { - PROP_RUNNING -} MyArgs; - -#define RUNNING_KEY "Clock::Running" - -static void -get_prop (BonoboPropertyBag *bag, - BonoboArg *arg, - guint arg_id, - gpointer user_data) -{ - GtkObject *clock = user_data; - - switch (arg_id) { - - case PROP_RUNNING: - { - gboolean b = GPOINTER_TO_UINT (gtk_object_get_data (clock, RUNNING_KEY)); - BONOBO_ARG_SET_BOOLEAN (arg, b); - break; - } - - default: - g_warning ("Unhandled arg %d", arg_id); - break; - } -} - -static void -set_prop (BonoboPropertyBag *bag, - const BonoboArg *arg, - guint arg_id, - gpointer user_data) -{ - GtkClock *clock = user_data; - - switch (arg_id) { - - case PROP_RUNNING: - { - guint i; - - i = BONOBO_ARG_GET_BOOLEAN (arg); - - if (i) - gtk_clock_start (clock); - else - gtk_clock_stop (clock); - - gtk_object_set_data (GTK_OBJECT (clock), RUNNING_KEY, - GUINT_TO_POINTER (i)); - break; - } - - default: - g_warning ("Unhandled arg %d", arg_id); - break; - } -} -#endif - -/* - * Bonobo::PersistStream - * - * These two functions implement the Bonobo::PersistStream load and - * save methods which allow data to be loaded into and out of the - * BonoboObject. - */ -static char * -stream_read (Bonobo_Stream stream) -{ - Bonobo_Stream_iobuf *buffer; - CORBA_Environment ev; - char *data = NULL; - gint length = 0; - - CORBA_exception_init (&ev); - do { -#define READ_CHUNK_SIZE 65536 - Bonobo_Stream_read (stream, READ_CHUNK_SIZE, - &buffer, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - return NULL; - } - - if (buffer->_length <= 0) - break; - - data = g_realloc (data, - length + buffer->_length); - - memcpy (data + length, - buffer->_buffer, buffer->_length); - - length += buffer->_length; - - CORBA_free (buffer); - } while (1); - - CORBA_free (buffer); - CORBA_exception_free (&ev); - - if (data == NULL) - data = g_strdup(""); - - return data; -} /* stream_read */ - -/* - * This function implements the Bonobo::PersistStream:load method. - */ -static void -pstream_load (BonoboPersistStream *ps, const Bonobo_Stream stream, - Bonobo_Persist_ContentType type, void *data, - CORBA_Environment *ev) -{ - ECard *card; - char *vcard; - GtkWidget *minicard = data; - - if (type && g_strcasecmp (type, "text/vCard") != 0 && - g_strcasecmp (type, "text/x-vCard") != 0) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Bonobo_Persist_WrongDataType, NULL); - return; - } - - if ((vcard = stream_read (stream)) == NULL) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Bonobo_Persist_FileNotFound, NULL); - return; - } - - card = e_card_new(vcard); - g_free(vcard); - gtk_object_set(GTK_OBJECT(minicard), - "card", card, - NULL); - gtk_object_unref(GTK_OBJECT(card)); -} /* pstream_load */ - -/* - * This function implements the Bonobo::PersistStream:save method. - */ -static void -pstream_save (BonoboPersistStream *ps, const Bonobo_Stream stream, - Bonobo_Persist_ContentType type, void *data, - CORBA_Environment *ev) -{ - char *vcard; - ECard *card; - EMinicardWidget *minicard = data; - int length; - - if (type && g_strcasecmp (type, "text/vCard") != 0 && - g_strcasecmp (type, "text/x-vCard") != 0) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Bonobo_Persist_WrongDataType, NULL); - return; - } - - gtk_object_get (GTK_OBJECT (minicard), - "card", &card, - NULL); - vcard = e_card_get_vcard(card); - length = strlen (vcard); - bonobo_stream_client_write (stream, vcard, length, ev); - g_free (vcard); -} /* pstream_save */ - -static CORBA_long -pstream_get_max_size (BonoboPersistStream *ps, void *data, - CORBA_Environment *ev) -{ - GtkWidget *minicard = data; - ECard *card; - char *vcard; - gint length; - - gtk_object_get (GTK_OBJECT (minicard), - "card", &card, NULL); - vcard = e_card_get_vcard(card); - length = strlen (vcard); - g_free (vcard); - - return length; -} - -static Bonobo_Persist_ContentTypeList * -pstream_get_content_types (BonoboPersistStream *ps, void *closure, - CORBA_Environment *ev) -{ - return bonobo_persist_generate_content_types (2, "text/vCard", "text/x-vCard"); -} - -static void -book_open_cb (EBook *book, EBookStatus status, gpointer closure) -{ - ECard *card = closure; - e_book_add_card(book, card, NULL, NULL); -} - -static void -save_in_addressbook(GtkWidget *button, EMinicardWidget *minicard) -{ - EBook *book; - gchar *path, *uri; - ECard *card; - - book = e_book_new (); - - if (!book) { - printf ("%s: %s(): Couldn't create EBook, bailing.\n", - __FILE__, - __FUNCTION__); - return; - } - - - path = g_concat_dir_and_file (g_get_home_dir (), - "evolution/local/Contacts/addressbook.db"); - uri = g_strdup_printf ("file://%s", path); - g_free (path); - - gtk_object_get(GTK_OBJECT(minicard), - "card", &card, - NULL); - - if (! e_book_load_uri (book, uri, book_open_cb, card)) { - printf ("error calling load_uri!\n"); - } - g_free(uri); -} - -static BonoboObject * -e_minicard_control_factory (BonoboGenericFactory *Factory, void *closure) -{ -#if 0 - BonoboPropertyBag *pb; -#endif - BonoboControl *control; - BonoboPersistStream *stream; - GtkWidget *minicard; - GtkWidget *button; - GtkWidget *vbox; - - /* Create the control. */ - - minicard = e_minicard_widget_new (); - gtk_widget_show (minicard); - - button = gtk_button_new_with_label(_("Save in addressbook")); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(save_in_addressbook), minicard); - gtk_widget_show (button); - - vbox = gtk_vbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), minicard, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); - gtk_widget_show (vbox); - - control = bonobo_control_new (vbox); - - stream = bonobo_persist_stream_new (pstream_load, pstream_save, - pstream_get_max_size, - pstream_get_content_types, - minicard); - -#if 0 - /* Create the properties. */ - pb = bonobo_property_bag_new (get_prop, set_prop, clock); - bonobo_control_set_property_bag (control, pb); - - bonobo_property_bag_add (pb, "running", PROP_RUNNING, - BONOBO_ARG_BOOLEAN, NULL, - "Whether or not the clock is running", 0); -#endif - - if (stream == NULL) { - bonobo_object_unref (BONOBO_OBJECT (control)); - return NULL; - } - - bonobo_object_add_interface (BONOBO_OBJECT (control), - BONOBO_OBJECT (stream)); - - return BONOBO_OBJECT (control); -} - -void -e_minicard_control_factory_init (void) -{ - static BonoboGenericFactory *factory = NULL; - - if (factory != NULL) - return; - -#if USING_OAF - factory = - bonobo_generic_factory_new ( - "OAFIID:control-factory:e_minicard:16bb7c25-c7d2-46dc-a5f0-a0975d0e0595", - e_minicard_control_factory, NULL); -#else - factory = - bonobo_generic_factory_new ( - "control-factory:e-minicard", - e_minicard_control_factory, NULL); -#endif - - if (factory == NULL) - g_error ("I could not register a EMinicard control factory."); -} diff --git a/addressbook/gui/minicard/e-minicard-control.gnorba b/addressbook/gui/minicard/e-minicard-control.gnorba deleted file mode 100644 index 73daffd203..0000000000 --- a/addressbook/gui/minicard/e-minicard-control.gnorba +++ /dev/null @@ -1,24 +0,0 @@ -[control-factory:clock] -type=exe -repo_id=IDL:Bonobo/GenericFactory:1.0 -description=Factory for the sample BonoboClock control -location_info=sample-control-factory - -[control:clock] -type=factory -repo_id=IDL:BonoboControl/clock-control:1.0 IDL:Bonobo/Control:1.0 -description=A sample Bonobo control which displays a clock. -location_info=control-factory:clock - -[control-factory:entry] -type=exe -repo_id=IDL:Bonobo/GenericFactory:1.0 -description=Factory for the sample GtkEntry control -location_info=sample-control-factory - -[control:entry] -type=factory -repo_id=IDL:BonoboControl/entry-control:1.0 IDL:Bonobo/Control:1.0 -description=A sample Bonbobo control wrapping a Gtk Entry widget. -location_info=control-factory:entry - diff --git a/addressbook/gui/minicard/e-minicard-control.h b/addressbook/gui/minicard/e-minicard-control.h deleted file mode 100644 index 4a0da88435..0000000000 --- a/addressbook/gui/minicard/e-minicard-control.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __E_MINICARD_CONTROL_H__ -#define __E_MINICARD_CONTROL_H__ - -#include <bonobo/bonobo-control.h> - -void e_minicard_control_factory_init (void); - -#endif /* __E_MINICARD_CONTROL_H__ */ diff --git a/addressbook/gui/minicard/e-minicard-label.c b/addressbook/gui/minicard/e-minicard-label.c deleted file mode 100644 index e765a89f21..0000000000 --- a/addressbook/gui/minicard/e-minicard-label.c +++ /dev/null @@ -1,446 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard-label.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 "e-minicard-label.h" -#include "e-text.h" -#include <e-util/e-canvas.h> -#include <e-util/e-util.h> -#include <e-util/e-canvas-utils.h> - -static void e_minicard_label_init (EMinicardLabel *card); -static void e_minicard_label_class_init (EMinicardLabelClass *klass); -static void e_minicard_label_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static gboolean e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event); -static void e_minicard_label_realize (GnomeCanvasItem *item); -static void e_minicard_label_unrealize (GnomeCanvasItem *item); -static void e_minicard_label_reflow(GnomeCanvasItem *item, int flags); - -static void e_minicard_label_resize_children( EMinicardLabel *e_minicard_label ); - -static GnomeCanvasGroupClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0, - ARG_WIDTH, - ARG_HEIGHT, - ARG_HAS_FOCUS, - ARG_FIELD, - ARG_FIELDNAME, - ARG_TEXT_MODEL, - ARG_MAX_FIELD_NAME_WIDTH, -}; - -GtkType -e_minicard_label_get_type (void) -{ - static GtkType minicard_label_type = 0; - - if (!minicard_label_type) - { - static const GtkTypeInfo minicard_label_info = - { - "EMinicardLabel", - sizeof (EMinicardLabel), - sizeof (EMinicardLabelClass), - (GtkClassInitFunc) e_minicard_label_class_init, - (GtkObjectInitFunc) e_minicard_label_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - minicard_label_type = gtk_type_unique (gnome_canvas_group_get_type (), &minicard_label_info); - } - - return minicard_label_type; -} - -static void -e_minicard_label_class_init (EMinicardLabelClass *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 ("EMinicardLabel::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("EMinicardLabel::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("EMinicardLabel::has_focus", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_HAS_FOCUS); - gtk_object_add_arg_type ("EMinicardLabel::field", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_FIELD); - gtk_object_add_arg_type ("EMinicardLabel::fieldname", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_FIELDNAME); - gtk_object_add_arg_type ("EMinicardLabel::text_model", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_TEXT_MODEL); - gtk_object_add_arg_type ("EMinicardLabel::max_field_name_length", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_MAX_FIELD_NAME_WIDTH); - - object_class->set_arg = e_minicard_label_set_arg; - object_class->get_arg = e_minicard_label_get_arg; - /* object_class->destroy = e_minicard_label_destroy; */ - - /* GnomeCanvasItem method overrides */ - item_class->realize = e_minicard_label_realize; - item_class->unrealize = e_minicard_label_unrealize; - item_class->event = e_minicard_label_event; -} - -static void -e_minicard_label_init (EMinicardLabel *minicard_label) -{ - minicard_label->width = 10; - minicard_label->height = 10; - minicard_label->rect = NULL; - minicard_label->fieldname = NULL; - minicard_label->field = NULL; - - minicard_label->max_field_name_length = -1; - - e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(minicard_label), e_minicard_label_reflow); -} - -static void -e_minicard_label_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EMinicardLabel *e_minicard_label; - - item = GNOME_CANVAS_ITEM (o); - e_minicard_label = E_MINICARD_LABEL (o); - - switch (arg_id){ - case ARG_WIDTH: - e_minicard_label->width = GTK_VALUE_DOUBLE (*arg); - e_minicard_label_resize_children(e_minicard_label); - e_canvas_item_request_reflow (item); - break; - case ARG_HAS_FOCUS: - if (e_minicard_label->field && (GTK_VALUE_ENUM(*arg) != E_FOCUS_NONE)) - e_canvas_item_grab_focus(e_minicard_label->field); - break; - case ARG_FIELD: - gnome_canvas_item_set( e_minicard_label->field, "text", GTK_VALUE_STRING (*arg), NULL ); - break; - case ARG_FIELDNAME: - gnome_canvas_item_set( e_minicard_label->fieldname, "text", GTK_VALUE_STRING (*arg), NULL ); - break; - case ARG_TEXT_MODEL: - gnome_canvas_item_set( e_minicard_label->field, "model", GTK_VALUE_OBJECT (*arg), NULL); - break; - case ARG_MAX_FIELD_NAME_WIDTH: - e_minicard_label->max_field_name_length = GTK_VALUE_DOUBLE (*arg); - break; - } -} - -static void -e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EMinicardLabel *e_minicard_label; - char *temp; - ETextModel *tempmodel; - - e_minicard_label = E_MINICARD_LABEL (object); - - switch (arg_id) { - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_minicard_label->width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = e_minicard_label->height; - break; - case ARG_HAS_FOCUS: - GTK_VALUE_ENUM (*arg) = e_minicard_label->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE; - break; - case ARG_FIELD: - gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - break; - case ARG_FIELDNAME: - gtk_object_get( GTK_OBJECT( e_minicard_label->fieldname ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - break; - case ARG_TEXT_MODEL: - gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "model", &tempmodel, NULL ); - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(tempmodel); - break; - case ARG_MAX_FIELD_NAME_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_minicard_label->max_field_name_length; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_minicard_label_realize (GnomeCanvasItem *item) -{ - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) - (* GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) (item); - - e_canvas_item_request_reflow(item); - - if (!item->canvas->aa) - { - } -} - -void -e_minicard_label_construct (GnomeCanvasItem *item) -{ - EMinicardLabel *e_minicard_label; - GnomeCanvasGroup *group; - static GdkFont *font = NULL; - - if (font == NULL) { - font = gdk_font_load("lucidasans-10"); - } - - e_minicard_label = E_MINICARD_LABEL (item); - group = GNOME_CANVAS_GROUP( item ); - - e_minicard_label->rect = - gnome_canvas_item_new( group, - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) e_minicard_label->width - 1, - "y2", (double) e_minicard_label->height - 1, - "outline_color", NULL, - NULL ); - e_minicard_label->fieldname = - gnome_canvas_item_new( group, - e_text_get_type(), - "anchor", GTK_ANCHOR_NW, - "clip_width", (double) ( e_minicard_label->width / 2 - 4 ), - "clip", TRUE, - "use_ellipsis", TRUE, - "font_gdk", font, - "fill_color", "black", - NULL ); - e_canvas_item_move_absolute(e_minicard_label->fieldname, 2, 1); - - e_minicard_label->field = - gnome_canvas_item_new( group, - e_text_get_type(), - "anchor", GTK_ANCHOR_NW, - "clip_width", (double) ( ( e_minicard_label->width + 1 ) / 2 - 4 ), - "clip", TRUE, - "use_ellipsis", TRUE, - "font_gdk", font, - "fill_color", "black", - "editable", TRUE, - NULL ); - e_canvas_item_move_absolute(e_minicard_label->field, ( e_minicard_label->width / 2 + 2), 1); - - e_canvas_item_request_reflow(item); -} - -static void -e_minicard_label_unrealize (GnomeCanvasItem *item) -{ - EMinicardLabel *e_minicard_label; - - e_minicard_label = E_MINICARD_LABEL (item); - - if (!item->canvas->aa) - { - } - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->unrealize) - (* GNOME_CANVAS_ITEM_CLASS( parent_class )->unrealize) (item); -} - -static gboolean -e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EMinicardLabel *e_minicard_label; - - e_minicard_label = E_MINICARD_LABEL (item); - - switch( event->type ) - { - case GDK_FOCUS_CHANGE: - { - GdkEventFocus *focus_event = (GdkEventFocus *) event; - if ( focus_event->in ) - { - gnome_canvas_item_set( e_minicard_label->rect, - "outline_color", "grey50", - "fill_color", "grey90", - NULL ); - e_minicard_label->has_focus = TRUE; - } - else - { - gnome_canvas_item_set( e_minicard_label->rect, - "outline_color", NULL, - "fill_color", NULL, - NULL ); - e_minicard_label->has_focus = FALSE; - } - } - break; - case GDK_BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - case GDK_MOTION_NOTIFY: - case GDK_ENTER_NOTIFY: - case GDK_LEAVE_NOTIFY: { - gboolean return_val; -#if 0 - GnomeCanvasItem *field; - ArtPoint p; - double inv[6], affine[6]; - - field = e_minicard_label->field; - art_affine_identity (affine); - - if (field->xform != NULL) { - if (field->object.flags & GNOME_CANVAS_ITEM_AFFINE_FULL) { - art_affine_multiply (affine, affine, field->xform); - } else { - affine[4] += field->xform[0]; - affine[5] += field->xform[1]; - } - } - - art_affine_invert (inv, affine); - switch(event->type) { - case GDK_MOTION_NOTIFY: - p.x = event->motion.x; - p.y = event->motion.y; - art_affine_point (&p, &p, inv); - event->motion.x = p.x; - event->motion.y = p.y; - break; - case GDK_BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - p.x = event->button.x; - p.y = event->button.y; - art_affine_point (&p, &p, inv); - event->button.x = p.x; - event->button.y = p.y; - break; - case GDK_ENTER_NOTIFY: - case GDK_LEAVE_NOTIFY: - p.x = event->crossing.x; - p.y = event->crossing.y; - art_affine_point (&p, &p, inv); - event->crossing.x = p.x; - event->crossing.y = p.y; - break; - default: - break; - } -#endif - gtk_signal_emit_by_name(GTK_OBJECT(e_minicard_label->field), "event", event, &return_val); - return return_val; - 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_minicard_label_resize_children(EMinicardLabel *e_minicard_label) -{ - double left_width; - if (e_minicard_label->max_field_name_length != -1 && ((e_minicard_label->width / 2) - 4 > e_minicard_label->max_field_name_length)) - left_width = e_minicard_label->max_field_name_length; - else - left_width = e_minicard_label->width / 2 - 4; - - gnome_canvas_item_set( e_minicard_label->fieldname, - "clip_width", (double) ( left_width ), - NULL ); - gnome_canvas_item_set( e_minicard_label->field, - "clip_width", (double) ( e_minicard_label->width - 8 - left_width ), - NULL ); -} - -static void -e_minicard_label_reflow(GnomeCanvasItem *item, int flags) -{ - EMinicardLabel *e_minicard_label = E_MINICARD_LABEL(item); - - gint old_height; - gdouble text_height; - gdouble left_width; - - old_height = e_minicard_label->height; - - gtk_object_get(GTK_OBJECT(e_minicard_label->fieldname), - "text_height", &text_height, - NULL); - - e_minicard_label->height = text_height; - - - gtk_object_get(GTK_OBJECT(e_minicard_label->field), - "text_height", &text_height, - NULL); - - if (e_minicard_label->height < text_height) - e_minicard_label->height = text_height; - e_minicard_label->height += 3; - - gnome_canvas_item_set( e_minicard_label->rect, - "x2", (double) e_minicard_label->width - 1, - "y2", (double) e_minicard_label->height - 1, - NULL ); - - if (e_minicard_label->max_field_name_length != -1 && ((e_minicard_label->width / 2) - 4 > e_minicard_label->max_field_name_length)) - left_width = e_minicard_label->max_field_name_length; - else - left_width = e_minicard_label->width / 2 - 4; - - e_canvas_item_move_absolute(e_minicard_label->field, left_width + 6, 1); - - if (old_height != e_minicard_label->height) - e_canvas_item_request_parent_reflow(item); -} - -GnomeCanvasItem * -e_minicard_label_new(GnomeCanvasGroup *parent) -{ - GnomeCanvasItem *item = gnome_canvas_item_new(parent, e_minicard_label_get_type(), NULL); - e_minicard_label_construct(item); - return item; -} - diff --git a/addressbook/gui/minicard/e-minicard-label.h b/addressbook/gui/minicard/e-minicard-label.h deleted file mode 100644 index 08eb51ee53..0000000000 --- a/addressbook/gui/minicard/e-minicard-label.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard-label.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_MINICARD_LABEL_H__ -#define __E_MINICARD_LABEL_H__ - -#include <gnome.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EMinicardLabel - A label doing focus with non-marching ants. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * width double RW width of the label - * height double R height of the label - * field string RW text in the field label - * fieldname string RW text in the fieldname label - */ - -#define E_MINICARD_LABEL_TYPE (e_minicard_label_get_type ()) -#define E_MINICARD_LABEL(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_LABEL_TYPE, EMinicardLabel)) -#define E_MINICARD_LABEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_LABEL_TYPE, EMiniCardLabelClass)) -#define E_IS_MINICARD_LABEL(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_LABEL_TYPE)) -#define E_IS_MINICARD_LABEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_LABEL_TYPE)) - - -typedef struct _EMinicardLabel EMinicardLabel; -typedef struct _EMinicardLabelClass EMinicardLabelClass; - -struct _EMinicardLabel -{ - GnomeCanvasGroup parent; - - /* item specific fields */ - double width; - double height; - double max_field_name_length; - GnomeCanvasItem *fieldname; - GnomeCanvasItem *field; - GnomeCanvasItem *rect; - - gboolean has_focus; -}; - -struct _EMinicardLabelClass -{ - GnomeCanvasGroupClass parent_class; -}; - - -GtkType e_minicard_label_get_type (void); -GnomeCanvasItem *e_minicard_label_new(GnomeCanvasGroup *parent); -void e_minicard_label_construct (GnomeCanvasItem *item); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_MINICARD_LABEL_H__ */ diff --git a/addressbook/gui/minicard/e-minicard-view-widget.c b/addressbook/gui/minicard/e-minicard-view-widget.c deleted file mode 100644 index cd1a999f14..0000000000 --- a/addressbook/gui/minicard/e-minicard-view-widget.c +++ /dev/null @@ -1,267 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard-view-widget.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 <e-util/e-canvas.h> -#include "e-minicard-view-widget.h" -static void e_minicard_view_widget_init (EMinicardViewWidget *widget); -static void e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass); -static void e_minicard_view_widget_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_minicard_view_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_minicard_view_widget_destroy (GtkObject *object); -static void e_minicard_view_widget_reflow (ECanvas *canvas); -static void e_minicard_view_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static void e_minicard_view_widget_realize (GtkWidget *widget); - -static ECanvasClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0, - ARG_BOOK, - ARG_QUERY -}; - -GtkType -e_minicard_view_widget_get_type (void) -{ - static GtkType type = 0; - - if (!type) - { - static const GtkTypeInfo info = - { - "EMinicardViewWidget", - sizeof (EMinicardViewWidget), - sizeof (EMinicardViewWidgetClass), - (GtkClassInitFunc) e_minicard_view_widget_class_init, - (GtkObjectInitFunc) e_minicard_view_widget_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (e_canvas_get_type (), &info); - } - - return type; -} - -static void -e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - ECanvasClass *canvas_class; - - object_class = (GtkObjectClass*) klass; - widget_class = GTK_WIDGET_CLASS (klass); - canvas_class = E_CANVAS_CLASS (klass); - - parent_class = gtk_type_class (e_canvas_get_type ()); - - gtk_object_add_arg_type ("EMinicardViewWidget::book", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_BOOK); - gtk_object_add_arg_type ("EMinicardViewWidget::query", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_QUERY); - - object_class->set_arg = e_minicard_view_widget_set_arg; - object_class->get_arg = e_minicard_view_widget_get_arg; - object_class->destroy = e_minicard_view_widget_destroy; - - widget_class->realize = e_minicard_view_widget_realize; - widget_class->size_allocate = e_minicard_view_widget_size_allocate; - - canvas_class->reflow = e_minicard_view_widget_reflow; -} - -static void -e_minicard_view_widget_init (EMinicardViewWidget *view) -{ - view->emv = NULL; - view->rect = NULL; - - view->book = NULL; - view->query = NULL; -} - -GtkWidget * -e_minicard_view_widget_new (void) -{ - return GTK_WIDGET (gtk_type_new (e_minicard_view_widget_get_type ())); -} - -static void -e_minicard_view_widget_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - EMinicardViewWidget *emvw; - - emvw = E_MINICARD_VIEW_WIDGET (o); - - switch (arg_id){ - case ARG_BOOK: - if (emvw->book) - gtk_object_unref(GTK_OBJECT(emvw->book)); - emvw->book = E_BOOK(GTK_VALUE_OBJECT (*arg)); - if (emvw->book) - gtk_object_ref(GTK_OBJECT(emvw->book)); - if (emvw->emv) - gtk_object_set(GTK_OBJECT(emvw->emv), - "book", emvw->book, - NULL); - break; - case ARG_QUERY: - emvw->query = g_strdup(GTK_VALUE_STRING (*arg)); - if (emvw->emv) - gtk_object_set(GTK_OBJECT(emvw->emv), - "query", emvw->query, - NULL); - break; - } -} - -static void -e_minicard_view_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EMinicardViewWidget *emvw; - - emvw = E_MINICARD_VIEW_WIDGET (object); - - switch (arg_id) { - case ARG_BOOK: - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(emvw->book); - break; - case ARG_QUERY: - GTK_VALUE_STRING (*arg) = g_strdup(emvw->query); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_minicard_view_widget_destroy (GtkObject *object) -{ - EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(object); - - if (view->book) - gtk_object_unref(GTK_OBJECT(view->book)); - g_free(view->query); - - GTK_OBJECT_CLASS(parent_class)->destroy (object); -} - -static void -e_minicard_view_widget_realize (GtkWidget *widget) -{ - EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(widget); - - view->rect = gnome_canvas_item_new( - gnome_canvas_root( GNOME_CANVAS(view) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - - view->emv = gnome_canvas_item_new( - gnome_canvas_root( GNOME_CANVAS(view) ), - e_minicard_view_get_type(), - "height", (double) 100, - "minimum_width", (double) 100, - NULL ); - gtk_object_set(GTK_OBJECT(view->emv), - "book", view->book, - "query", view->query, - NULL); - - if (GTK_WIDGET_CLASS(parent_class)->realize) - GTK_WIDGET_CLASS(parent_class)->realize (widget); -} - -static void -e_minicard_view_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation) -{ - if (GTK_WIDGET_CLASS(parent_class)->size_allocate) - GTK_WIDGET_CLASS(parent_class)->size_allocate (widget, allocation); - - if (GTK_WIDGET_REALIZED(widget)) { - double width; - EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(widget); - - gnome_canvas_item_set( view->emv, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( view->emv, - "minimum_width", (double) allocation->width, - NULL ); - gtk_object_get(GTK_OBJECT(view->emv), - "width", &width, - NULL); - width = MAX(width, allocation->width); - gnome_canvas_set_scroll_region (GNOME_CANVAS (view), 0, 0, width - 1, allocation->height - 1); - gnome_canvas_item_set( view->rect, - "x2", (double) width, - "y2", (double) allocation->height, - NULL ); - } -} - -static void -e_minicard_view_widget_reflow(ECanvas *canvas) -{ - double width; - EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(canvas); - - if (E_CANVAS_CLASS(parent_class)->reflow) - E_CANVAS_CLASS(parent_class)->reflow (canvas); - - gtk_object_get(GTK_OBJECT(view->emv), - "width", &width, - NULL); - width = MAX(width, GTK_WIDGET(canvas)->allocation.width); - gnome_canvas_set_scroll_region(GNOME_CANVAS(canvas), 0, 0, width - 1, GTK_WIDGET(canvas)->allocation.width - 1); - gnome_canvas_item_set( view->rect, - "x2", (double) width, - "y2", (double) GTK_WIDGET(canvas)->allocation.height, - NULL ); -} - -void -e_minicard_view_widget_remove_selection(EMinicardViewWidget *view, - EBookCallback cb, - gpointer closure) -{ - if (view->emv) - e_minicard_view_remove_selection(E_MINICARD_VIEW(view->emv), cb, closure); -} - -void e_minicard_view_widget_jump_to_letter (EMinicardViewWidget *view, - char letter) -{ - if (view->emv) - e_minicard_view_jump_to_letter(E_MINICARD_VIEW(view->emv), letter); -} diff --git a/addressbook/gui/minicard/e-minicard-view-widget.h b/addressbook/gui/minicard/e-minicard-view-widget.h deleted file mode 100644 index 340fb1e03c..0000000000 --- a/addressbook/gui/minicard/e-minicard-view-widget.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard-view-widget.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_MINICARD_VIEW_WIDGET_H__ -#define __E_MINICARD_VIEW_WIDGET_H__ - -#include <gnome.h> -#include "e-minicard-view.h" -#include "e-util/e-canvas.h" -#include <ebook/e-book.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_MINICARD_VIEW_WIDGET_TYPE (e_minicard_view_widget_get_type ()) -#define E_MINICARD_VIEW_WIDGET(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_VIEW_WIDGET_TYPE, EMinicardViewWidget)) -#define E_MINICARD_VIEW_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_VIEW_WIDGET_TYPE, EMinicardViewWidgetClass)) -#define E_IS_MINICARD_VIEW_WIDGET(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_VIEW_WIDGET_TYPE)) -#define E_IS_MINICARD_VIEW_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_VIEW_WIDGET_TYPE)) - - -typedef struct _EMinicardViewWidget EMinicardViewWidget; -typedef struct _EMinicardViewWidgetClass EMinicardViewWidgetClass; - -struct _EMinicardViewWidget -{ - ECanvas parent; - - GnomeCanvasItem *rect; - GnomeCanvasItem *emv; - - EBook *book; - char *query; -}; - -struct _EMinicardViewWidgetClass -{ - ECanvasClass parent_class; -}; - -GtkType e_minicard_view_widget_get_type (void); -void e_minicard_view_widget_remove_selection (EMinicardViewWidget *view, - EBookCallback cb, - gpointer closure); -void e_minicard_view_widget_jump_to_letter (EMinicardViewWidget *view, - char letter); - -GtkWidget *e_minicard_view_widget_new (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __E_MINICARD_VIEW_WIDGET_H__ */ diff --git a/addressbook/gui/minicard/e-minicard-view.c b/addressbook/gui/minicard/e-minicard-view.c deleted file mode 100644 index 011ff9158f..0000000000 --- a/addressbook/gui/minicard/e-minicard-view.c +++ /dev/null @@ -1,432 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard-view.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 <e-util/e-canvas.h> -#include "e-minicard-view.h" -#include "e-minicard.h" -#include "e-contact-editor.h" -static void e_minicard_view_init (EMinicardView *reflow); -static void e_minicard_view_class_init (EMinicardViewClass *klass); -static void e_minicard_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_minicard_view_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_minicard_view_destroy (GtkObject *object); -static gboolean e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event); -static void canvas_destroy (GtkObject *object, EMinicardView *view); -static void disconnect_signals (EMinicardView *view); - -static EReflowSortedClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0, - ARG_BOOK, - ARG_QUERY -}; - -GtkType -e_minicard_view_get_type (void) -{ - static GtkType reflow_type = 0; - - if (!reflow_type) - { - static const GtkTypeInfo reflow_info = - { - "EMinicardView", - sizeof (EMinicardView), - sizeof (EMinicardViewClass), - (GtkClassInitFunc) e_minicard_view_class_init, - (GtkObjectInitFunc) e_minicard_view_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - reflow_type = gtk_type_unique (e_reflow_sorted_get_type (), &reflow_info); - } - - return reflow_type; -} - -static void -e_minicard_view_class_init (EMinicardViewClass *klass) -{ - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GtkObjectClass*) klass; - item_class = (GnomeCanvasItemClass *) klass; - - parent_class = gtk_type_class (e_reflow_sorted_get_type ()); - - gtk_object_add_arg_type ("EMinicardView::book", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_BOOK); - gtk_object_add_arg_type ("EMinicardView::query", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_QUERY); - - object_class->set_arg = e_minicard_view_set_arg; - object_class->get_arg = e_minicard_view_get_arg; - object_class->destroy = e_minicard_view_destroy; - - item_class->event = e_minicard_view_event; - - /* GnomeCanvasItem method overrides */ -} - -static void -e_minicard_view_init (EMinicardView *view) -{ - view->book = NULL; - view->query = g_strdup("(contains \"x-evolution-any-field\" \"\")"); - view->book_view = NULL; - view->get_view_idle = 0; - view->create_card_id = 0; - view->remove_card_id = 0; - view->modify_card_id = 0; - view->canvas_destroy_id = 0; - - gtk_object_set(GTK_OBJECT(view), - "empty_message", _("\n\nThere are no items to show in this view\n\n" - "Double-click here to create a new Contact."), - NULL); - - E_REFLOW_SORTED(view)->compare_func = (GCompareFunc) e_minicard_compare; - E_REFLOW_SORTED(view)->string_func = (EReflowStringFunc) e_minicard_get_card_id; -} - -static void -create_card(EBookView *book_view, const GList *cards, EMinicardView *view) -{ - for (; cards; cards = g_list_next(cards)) { - GnomeCanvasItem *item = gnome_canvas_item_new(GNOME_CANVAS_GROUP(view), - e_minicard_get_type(), - "card", cards->data, - NULL); - e_reflow_add_item(E_REFLOW(view), item); - } -} - -static void -modify_card(EBookView *book_view, const GList *cards, EMinicardView *view) -{ - for (; cards; cards = g_list_next(cards)) { - ECard *card = cards->data; - gchar *id = e_card_get_id(card); - GnomeCanvasItem *item = e_reflow_sorted_get_item(E_REFLOW_SORTED(view), id); - if (item && !GTK_OBJECT_DESTROYED(item)) { - gnome_canvas_item_set(item, - "card", card, - NULL); - e_reflow_sorted_reorder_item(E_REFLOW_SORTED(view), id); - } - } -} - -static void -remove_card(EBookView *book_view, const char *id, EMinicardView *view) -{ - e_reflow_sorted_remove_item(E_REFLOW_SORTED(view), id); -} - -static void -book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointer closure) -{ - EMinicardView *view = closure; - disconnect_signals(view); - if (view->book_view) - gtk_object_unref(GTK_OBJECT(view->book_view)); - - if (!view->canvas_destroy_id) - view->canvas_destroy_id = - gtk_signal_connect(GTK_OBJECT(GNOME_CANVAS_ITEM(view)->canvas), - "destroy", GTK_SIGNAL_FUNC(canvas_destroy), - view); - - view->book_view = book_view; - if (view->book_view) - gtk_object_ref(GTK_OBJECT(view->book_view)); - - - view->create_card_id = gtk_signal_connect(GTK_OBJECT(view->book_view), - "card_added", - GTK_SIGNAL_FUNC(create_card), - view); - view->remove_card_id = gtk_signal_connect(GTK_OBJECT(view->book_view), - "card_removed", - GTK_SIGNAL_FUNC(remove_card), - view); - view->modify_card_id = gtk_signal_connect(GTK_OBJECT(view->book_view), - "card_changed", - GTK_SIGNAL_FUNC(modify_card), - view); - - g_list_foreach(E_REFLOW(view)->items, (GFunc) gtk_object_unref, NULL); - g_list_foreach(E_REFLOW(view)->items, (GFunc) gtk_object_destroy, NULL); - g_list_free(E_REFLOW(view)->items); - E_REFLOW(view)->items = NULL; - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(view)); -} - -static gboolean -get_view(EMinicardView *view) -{ - if (view->book && view->query) - e_book_get_book_view(view->book, view->query, book_view_loaded, view); - - view->get_view_idle = 0; - return FALSE; -} - -static void -e_minicard_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EMinicardView *view; - - item = GNOME_CANVAS_ITEM (o); - view = E_MINICARD_VIEW (o); - - switch (arg_id){ - case ARG_BOOK: - if (view->book) - gtk_object_unref(GTK_OBJECT(view->book)); - if (GTK_VALUE_OBJECT (*arg)) { - view->book = E_BOOK(GTK_VALUE_OBJECT (*arg)); - gtk_object_ref(GTK_OBJECT(view->book)); - if (view->get_view_idle == 0) - view->get_view_idle = g_idle_add((GSourceFunc)get_view, view); - } - else - view->book = NULL; - break; - case ARG_QUERY: - g_free(view->query); - view->query = g_strdup(GTK_VALUE_STRING (*arg)); - if (view->get_view_idle == 0) - view->get_view_idle = g_idle_add((GSourceFunc)get_view, view); - break; - } -} - -static void -e_minicard_view_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EMinicardView *e_minicard_view; - - e_minicard_view = E_MINICARD_VIEW (object); - - switch (arg_id) { - case ARG_BOOK: - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_minicard_view->book); - break; - case ARG_QUERY: - GTK_VALUE_STRING (*arg) = g_strdup(e_minicard_view->query); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_minicard_view_destroy (GtkObject *object) -{ - EMinicardView *view = E_MINICARD_VIEW(object); - - if (view->get_view_idle) - g_source_remove(view->get_view_idle); - if (view->canvas_destroy_id) - gtk_signal_disconnect(GTK_OBJECT (GNOME_CANVAS_ITEM(view)->canvas), - view->canvas_destroy_id); - disconnect_signals(view); - g_free(view->query); - if (view->book) - gtk_object_unref(GTK_OBJECT(view->book)); - if (view->book_view) - gtk_object_unref(GTK_OBJECT(view->book_view)); - - GTK_OBJECT_CLASS(parent_class)->destroy (object); -} - -static void -card_added_cb (EBook* book, EBookStatus status, const char *id, - gpointer user_data) -{ - g_print ("%s: %s(): a card was added\n", __FILE__, __FUNCTION__); -} - -static void -card_changed_cb (EBook* book, EBookStatus status, gpointer user_data) -{ - g_print ("%s: %s(): a card was changed with status %d\n", __FILE__, __FUNCTION__, status); -} - -/* Callback for the add_card signal from the contact editor */ -static void -add_card_cb (EContactEditor *ce, ECard *card, gpointer data) -{ - EBook *book; - - book = E_BOOK (data); - e_book_add_card (book, card, card_added_cb, NULL); -} - -/* Callback for the commit_card signal from the contact editor */ -static void -commit_card_cb (EContactEditor *ce, ECard *card, gpointer data) -{ - EBook *book; - - book = E_BOOK (data); - e_book_commit_card (book, card, card_changed_cb, NULL); -} - -/* Callback used when the contact editor is closed */ -static void -editor_closed_cb (EContactEditor *ce, gpointer data) -{ - gtk_object_unref (GTK_OBJECT (ce)); -} - -static gboolean -e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EMinicardView *view; - - view = E_MINICARD_VIEW (item); - - switch( event->type ) { - case GDK_2BUTTON_PRESS: - if (((GdkEventButton *)event)->button == 1) - { - ECard *card; - EContactEditor *ce; - EBook *book; - - card = e_card_new(""); - - gtk_object_get(GTK_OBJECT(view), "book", &book, NULL); - g_assert (E_IS_BOOK (book)); - - ce = e_contact_editor_new (card, TRUE); - - gtk_signal_connect (GTK_OBJECT (ce), "add_card", - GTK_SIGNAL_FUNC (add_card_cb), book); - gtk_signal_connect (GTK_OBJECT (ce), "commit_card", - GTK_SIGNAL_FUNC (commit_card_cb), book); - gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", - GTK_SIGNAL_FUNC (editor_closed_cb), NULL); - - gtk_object_sink(GTK_OBJECT(card)); - } - return TRUE; - default: - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event) - return GNOME_CANVAS_ITEM_CLASS(parent_class)->event(item, event); - else - return FALSE; - break; - } -} - -static void -disconnect_signals(EMinicardView *view) -{ - if (view->book_view && view->create_card_id) - gtk_signal_disconnect(GTK_OBJECT (view->book_view), - view->create_card_id); - if (view->book_view && view->remove_card_id) - gtk_signal_disconnect(GTK_OBJECT (view->book_view), - view->remove_card_id); - if (view->book_view && view->modify_card_id) - gtk_signal_disconnect(GTK_OBJECT (view->book_view), - view->modify_card_id); - - view->create_card_id = 0; - view->remove_card_id = 0; - view->modify_card_id = 0; -} - -static void -canvas_destroy(GtkObject *object, EMinicardView *view) -{ - disconnect_signals(view); -} - -void -e_minicard_view_remove_selection(EMinicardView *view, - EBookCallback cb, - gpointer closure) -{ - if (view->book) { - EReflow *reflow = E_REFLOW(view); - GList *list; - for (list = reflow->items; list; list = g_list_next(list)) { - GnomeCanvasItem *item = list->data; - gboolean has_focus; - gtk_object_get(GTK_OBJECT(item), - "has_focus", &has_focus, - NULL); - if (has_focus) { - ECard *card; - gtk_object_get(GTK_OBJECT(item), - "card", &card, - NULL); - e_book_remove_card(view->book, card, cb, closure); - return; - } - } - } -} - -static int -compare_to_letter(EMinicard *card, char *letter) -{ - g_return_val_if_fail(card != NULL, 0); - g_return_val_if_fail(E_IS_MINICARD(card), 0); - - if (*letter == '1') - return 1; - - if (card->card) { - char *file_as; - gtk_object_get(GTK_OBJECT(card->card), - "file_as", &file_as, - NULL); - if (file_as) - return strncasecmp(file_as, letter, 1); - else - return 0; - } else { - return 0; - } -} - -void e_minicard_view_jump_to_letter (EMinicardView *view, - char letter) -{ - e_reflow_sorted_jump(E_REFLOW_SORTED(view), - (GCompareFunc) compare_to_letter, - &letter); -} diff --git a/addressbook/gui/minicard/e-minicard-view.h b/addressbook/gui/minicard/e-minicard-view.h deleted file mode 100644 index a166a6ade1..0000000000 --- a/addressbook/gui/minicard/e-minicard-view.h +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard-view.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_MINICARD_VIEW_H__ -#define __E_MINICARD_VIEW_H__ - -#include <gnome.h> -#include "e-reflow-sorted.h" -#include <ebook/e-book.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EMinicardView - A canvas item container. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * book EBook RW book to query - * query string RW query string - * - * From EReflowSorted: (you should really know what you're doing if you set these.) - * compare_func GCompareFunc RW compare function - * string_func EReflowStringFunc RW string function - * - * From EReflow: - * 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_MINICARD_VIEW_TYPE (e_minicard_view_get_type ()) -#define E_MINICARD_VIEW(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_VIEW_TYPE, EMinicardView)) -#define E_MINICARD_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_VIEW_TYPE, EMinicardViewClass)) -#define E_IS_MINICARD_VIEW(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_VIEW_TYPE)) -#define E_IS_MINICARD_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_VIEW_TYPE)) - - -typedef struct _EMinicardView EMinicardView; -typedef struct _EMinicardViewClass EMinicardViewClass; - -struct _EMinicardView -{ - EReflowSorted parent; - - /* item specific fields */ - EBook *book; - char *query; - EBookView *book_view; - - int get_view_idle; - - int canvas_destroy_id; - - int create_card_id, remove_card_id, modify_card_id; -}; - -struct _EMinicardViewClass -{ - EReflowSortedClass parent_class; -}; - -GtkType e_minicard_view_get_type (void); -void e_minicard_view_remove_selection (EMinicardView *view, - EBookCallback cb, - gpointer closure); -void e_minicard_view_jump_to_letter (EMinicardView *view, - char letter); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_MINICARD_VIEW_H__ */ diff --git a/addressbook/gui/minicard/e-minicard-widget-test.c b/addressbook/gui/minicard/e-minicard-widget-test.c deleted file mode 100644 index f6489f2a6a..0000000000 --- a/addressbook/gui/minicard/e-minicard-widget-test.c +++ /dev/null @@ -1,113 +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. - */ - -#define TEST_VCARD \ -"BEGIN:VCARD -" \ -"FN:Nat -" \ -"N:Friedman;Nat;D;Mr. -" \ -"ORG:Helix Code, Inc. -" \ -"TITLE:Head Geek -" \ -"ROLE:Programmer/Executive -" \ -"BDAY:1977-08-06 -" \ -"TEL;WORK:617 679 1984 -" \ -"TEL;CELL:123 456 7890 -" \ -"EMAIL;INTERNET:nat@nat.org -" \ -"EMAIL;INTERNET:nat@helixcode.com -" \ -"ADR;WORK;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234; -" \ -"ADR;HOME;POSTAL;INTL:P.O. Box 202;;;Any Town 2;MI;12344-4321;USA -" \ -"END:VCARD -" \ -" -" - -#include "config.h" - -#include <gnome.h> -#include "e-minicard-widget.h" - -/* This is a horrible thing to do, but it is just a test. */ - -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 Widget Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the minicard widget" ), - NULL); - gtk_widget_show (about); -} -#endif - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *minicard; - ECard *card; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Minicard Widget Test", VERSION, argc, argv); - app = gnome_app_new("Minicard Widget Test", NULL); - - minicard = e_minicard_widget_new(); - card = e_card_new(TEST_VCARD); - gtk_object_set(GTK_OBJECT(minicard), - "card", card, - NULL); - - gnome_app_set_contents( GNOME_APP( app ), minicard ); - - /* 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/addressbook/gui/minicard/e-minicard-widget.c b/addressbook/gui/minicard/e-minicard-widget.c deleted file mode 100644 index 3f765425e4..0000000000 --- a/addressbook/gui/minicard/e-minicard-widget.c +++ /dev/null @@ -1,236 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-table-field-chooser.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 "e-minicard-widget.h" -#include "e-minicard.h" - -static void e_minicard_widget_init (EMinicardWidget *card); -static void e_minicard_widget_class_init (EMinicardWidgetClass *klass); -static void e_minicard_widget_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_minicard_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_minicard_widget_destroy (GtkObject *object); -static void e_minicard_widget_size_request (GtkWidget *widget, GtkRequisition *requisition); -static void e_minicard_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static void e_minicard_widget_reflow (ECanvas *canvas); - -static ECanvasClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0, - ARG_CARD, -}; - -GtkType -e_minicard_widget_get_type (void) -{ - static GtkType type = 0; - - if (!type) - { - static const GtkTypeInfo info = - { - "EMinicardWidget", - sizeof (EMinicardWidget), - sizeof (EMinicardWidgetClass), - (GtkClassInitFunc) e_minicard_widget_class_init, - (GtkObjectInitFunc) e_minicard_widget_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (e_canvas_get_type (), &info); - } - - return type; -} - -static void -e_minicard_widget_class_init (EMinicardWidgetClass *klass) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - ECanvasClass *ecanvas_class; - - object_class = GTK_OBJECT_CLASS(klass); - widget_class = GTK_WIDGET_CLASS(klass); - ecanvas_class = E_CANVAS_CLASS(klass); - - parent_class = gtk_type_class (e_canvas_get_type ()); - - object_class->set_arg = e_minicard_widget_set_arg; - object_class->get_arg = e_minicard_widget_get_arg; - object_class->destroy = e_minicard_widget_destroy; - - widget_class->size_request = e_minicard_widget_size_request; - widget_class->size_allocate = e_minicard_widget_size_allocate; - - ecanvas_class->reflow = e_minicard_widget_reflow; - - gtk_object_add_arg_type ("EMinicardWidget::card", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_CARD); -} - -static void -e_minicard_widget_size_request(GtkWidget *widget, GtkRequisition *requisition) -{ - double height; - EMinicardWidget *emw = E_MINICARD_WIDGET(widget); - gtk_object_get(GTK_OBJECT(emw->item), - "height", &height, - NULL); - if (height <= 0) - height = 1; - widget->requisition.height = height; - widget->requisition.width = 200; - requisition->height = height; - requisition->width = 200; -} - -static void -e_minicard_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation) -{ - double height; - EMinicardWidget *emw = E_MINICARD_WIDGET(widget); - gnome_canvas_item_set( emw->item, - "width", (double) allocation->width, - NULL ); - gtk_object_get(GTK_OBJECT(emw->item), - "height", &height, - NULL); - height = MAX(height, allocation->height); - gnome_canvas_set_scroll_region(GNOME_CANVAS( emw ), 0, 0, allocation->width - 1, height - 1); - gnome_canvas_item_set( emw->rect, - "x2", (double) allocation->width, - "y2", (double) height, - NULL ); - if (GTK_WIDGET_CLASS(parent_class)->size_allocate) - GTK_WIDGET_CLASS(parent_class)->size_allocate(widget, allocation); -} - -static void e_minicard_widget_reflow(ECanvas *canvas) -{ - double height; - EMinicardWidget *emw = E_MINICARD_WIDGET(canvas); - gtk_object_get(GTK_OBJECT(emw->item), - "height", &height, - NULL); - - height = MAX(height, GTK_WIDGET(emw)->allocation.height); - - gnome_canvas_set_scroll_region (GNOME_CANVAS(emw), 0, 0, GTK_WIDGET(emw)->allocation.width - 1, height - 1); - gnome_canvas_item_set( emw->rect, - "x2", (double) GTK_WIDGET(emw)->allocation.width, - "y2", (double) height, - NULL ); - - gtk_widget_queue_resize(GTK_WIDGET(canvas)); -} - -static void -e_minicard_widget_init (EMinicardWidget *emw) -{ - emw->rect = gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(emw)), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - - emw->item = gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(emw)), - e_minicard_get_type(), - "width", (double) 100, - NULL ); - - gnome_canvas_set_scroll_region ( GNOME_CANVAS( emw ), - 0, 0, - 100, 100 ); - - emw->card = NULL; -} - -static void -e_minicard_widget_destroy (GtkObject *object) -{ - EMinicardWidget *emw = E_MINICARD_WIDGET(object); - - if (emw->card) - gtk_object_unref(GTK_OBJECT(emw->card)); - - if (GTK_OBJECT_CLASS(parent_class)->destroy) - GTK_OBJECT_CLASS(parent_class)->destroy(object); -} - -GtkWidget* -e_minicard_widget_new (void) -{ - GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_minicard_widget_get_type ())); - return widget; -} - -static void -e_minicard_widget_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EMinicardWidget *emw = E_MINICARD_WIDGET(object); - - switch (arg_id){ - case ARG_CARD: - if (emw->card) - gtk_object_unref(GTK_OBJECT(emw->card)); - if (GTK_VALUE_OBJECT(*arg)) { - emw->card = E_CARD(GTK_VALUE_OBJECT(*arg)); - gtk_object_ref(GTK_OBJECT(emw->card)); - } - else - emw->card = NULL; - if (emw->item) - gtk_object_set(GTK_OBJECT(emw->item), - "card", emw->card, - NULL); - break; - default: - break; - } -} - -static void -e_minicard_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EMinicardWidget *emw = E_MINICARD_WIDGET(object); - - switch (arg_id) { - case ARG_CARD: - if (emw->card) - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(emw->card); - else - GTK_VALUE_OBJECT (*arg) = NULL; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} diff --git a/addressbook/gui/minicard/e-minicard-widget.h b/addressbook/gui/minicard/e-minicard-widget.h deleted file mode 100644 index 8a3ec0ae16..0000000000 --- a/addressbook/gui/minicard/e-minicard-widget.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard-widget.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_MINICARD_WIDGET_H__ -#define __E_MINICARD_WIDGET_H__ - -#include <gnome.h> -#include "addressbook/backend/ebook/e-card.h" -#include "e-util/e-canvas.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EMinicardWidget - A card displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - */ - -#define E_MINICARD_WIDGET_TYPE (e_minicard_widget_get_type ()) -#define E_MINICARD_WIDGET(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_WIDGET_TYPE, EMinicardWidget)) -#define E_MINICARD_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_WIDGET_TYPE, EMinicardWidgetClass)) -#define E_IS_MINICARD_WIDGET(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_WIDGET_TYPE)) -#define E_IS_MINICARD_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_WIDGET_TYPE)) - - -typedef struct _EMinicardWidget EMinicardWidget; -typedef struct _EMinicardWidgetClass EMinicardWidgetClass; - -struct _EMinicardWidget -{ - ECanvas parent; - - /* item specific fields */ - GnomeCanvasItem *item; - - GnomeCanvasItem *rect; - ECard *card; -}; - -struct _EMinicardWidgetClass -{ - ECanvasClass parent_class; -}; - - -GtkWidget *e_minicard_widget_new(void); -GtkType e_minicard_widget_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_MINICARD_WIDGET_H__ */ diff --git a/addressbook/gui/minicard/e-minicard.c b/addressbook/gui/minicard/e-minicard.c deleted file mode 100644 index e9bb85c89d..0000000000 --- a/addressbook/gui/minicard/e-minicard.c +++ /dev/null @@ -1,797 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard.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 "e-minicard.h" -#include "e-minicard-label.h" -#include "e-text.h" -#include <ebook/e-book.h> -#include <e-util/e-canvas.h> -#include <e-util/e-util.h> -#include <e-util/e-canvas-utils.h> -#include <e-util/e-popup-menu.h> -#include "addressbook/printing/e-contact-print.h" -#include "e-contact-editor.h" -#include "e-contact-save-as.h" -#include "e-minicard-view.h" - -static void e_minicard_init (EMinicard *card); -static void e_minicard_class_init (EMinicardClass *klass); -static void e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_minicard_destroy (GtkObject *object); -static gboolean e_minicard_event (GnomeCanvasItem *item, GdkEvent *event); -static void e_minicard_realize (GnomeCanvasItem *item); -static void e_minicard_unrealize (GnomeCanvasItem *item); -static void e_minicard_reflow ( GnomeCanvasItem *item, int flags ); - -static void e_minicard_resize_children( EMinicard *e_minicard ); -static void remodel( EMinicard *e_minicard ); - -static GnomeCanvasGroupClass *parent_class = NULL; - -typedef struct _EMinicardField EMinicardField; - -struct _EMinicardField { - ECardSimpleField field; - GnomeCanvasItem *label; -}; - -#define E_MINICARD_FIELD(field) ((EMinicardField *)(field)) - -static void -e_minicard_field_destroy(EMinicardField *field) -{ - gtk_object_destroy(GTK_OBJECT(field->label)); - g_free(field); -} - -/* The arguments we take */ -enum { - ARG_0, - ARG_WIDTH, - ARG_HEIGHT, - ARG_HAS_FOCUS, - ARG_CARD -}; - -GtkType -e_minicard_get_type (void) -{ - static GtkType minicard_type = 0; - - if (!minicard_type) - { - static const GtkTypeInfo minicard_info = - { - "EMinicard", - sizeof (EMinicard), - sizeof (EMinicardClass), - (GtkClassInitFunc) e_minicard_class_init, - (GtkObjectInitFunc) e_minicard_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - minicard_type = gtk_type_unique (gnome_canvas_group_get_type (), &minicard_info); - } - - return minicard_type; -} - -static void -e_minicard_class_init (EMinicardClass *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 ("EMinicard::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("EMinicard::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("EMinicard::has_focus", GTK_TYPE_ENUM, - GTK_ARG_READWRITE, ARG_HAS_FOCUS); - gtk_object_add_arg_type ("EMinicard::card", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_CARD); - - object_class->set_arg = e_minicard_set_arg; - object_class->get_arg = e_minicard_get_arg; - object_class->destroy = e_minicard_destroy; - - /* GnomeCanvasItem method overrides */ - item_class->realize = e_minicard_realize; - item_class->unrealize = e_minicard_unrealize; - item_class->event = e_minicard_event; -} - -static void -e_minicard_init (EMinicard *minicard) -{ - /* minicard->card = NULL;*/ - minicard->rect = NULL; - minicard->fields = NULL; - minicard->width = 10; - minicard->height = 10; - minicard->has_focus = FALSE; - - minicard->card = NULL; - minicard->simple = e_card_simple_new(NULL); - - e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(minicard), e_minicard_reflow); -} - -static void -e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EMinicard *e_minicard; - - item = GNOME_CANVAS_ITEM (o); - e_minicard = E_MINICARD (o); - - switch (arg_id){ - case ARG_WIDTH: - if (e_minicard->width != GTK_VALUE_DOUBLE (*arg)) { - e_minicard->width = GTK_VALUE_DOUBLE (*arg); - e_minicard_resize_children(e_minicard); - if ( GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED ) - e_canvas_item_request_reflow(item); - } - break; - case ARG_HAS_FOCUS: - if (e_minicard->fields) { - if ( GTK_VALUE_ENUM(*arg) == E_FOCUS_START || - GTK_VALUE_ENUM(*arg) == E_FOCUS_CURRENT) { - gnome_canvas_item_set(E_MINICARD_FIELD(e_minicard->fields->data)->label, - "has_focus", GTK_VALUE_ENUM(*arg), - NULL); - } else if ( GTK_VALUE_ENUM(*arg) == E_FOCUS_END ) { - gnome_canvas_item_set(E_MINICARD_FIELD(g_list_last(e_minicard->fields)->data)->label, - "has_focus", GTK_VALUE_ENUM(*arg), - NULL); - } - } - else - e_canvas_item_grab_focus(item); - break; - case ARG_CARD: - if (e_minicard->card) - gtk_object_unref (GTK_OBJECT(e_minicard->card)); - e_minicard->card = E_CARD(GTK_VALUE_OBJECT (*arg)); - if (e_minicard->card) - gtk_object_ref (GTK_OBJECT(e_minicard->card)); - gtk_object_set(GTK_OBJECT(e_minicard->simple), - "card", e_minicard->card, - NULL); - remodel(e_minicard); - e_canvas_item_request_reflow(item); - break; - } -} - -static void -e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EMinicard *e_minicard; - - e_minicard = E_MINICARD (object); - - switch (arg_id) { - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_minicard->width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = e_minicard->height; - break; - case ARG_HAS_FOCUS: - GTK_VALUE_ENUM (*arg) = e_minicard->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE; - break; - case ARG_CARD: - e_card_simple_sync_card(e_minicard->simple); - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_minicard->card); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_minicard_destroy (GtkObject *object) -{ - EMinicard *e_minicard; - - g_return_if_fail (object != NULL); - g_return_if_fail (E_IS_MINICARD (object)); - - e_minicard = E_MINICARD (object); - - g_list_foreach(e_minicard->fields, (GFunc) e_minicard_field_destroy, NULL); - g_list_free(e_minicard->fields); - - if (e_minicard->card) - gtk_object_unref (GTK_OBJECT(e_minicard->card)); - if (e_minicard->simple) - gtk_object_unref (GTK_OBJECT(e_minicard->simple)); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -static void -e_minicard_realize (GnomeCanvasItem *item) -{ - EMinicard *e_minicard; - GnomeCanvasGroup *group; - GtkWidget *canvas; - - e_minicard = E_MINICARD (item); - group = GNOME_CANVAS_GROUP( item ); - canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (item)->canvas); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item); - - e_minicard->rect = - gnome_canvas_item_new( group, - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) e_minicard->width - 1, - "y2", (double) e_minicard->height - 1, - "outline_color", NULL, - NULL ); - - e_minicard->header_rect = - gnome_canvas_item_new( group, - gnome_canvas_rect_get_type(), - "x1", (double) 2, - "y1", (double) 2, - "x2", (double) e_minicard->width - 3, - "y2", (double) e_minicard->height - 3, - "fill_color_gdk", &canvas->style->bg[GTK_STATE_NORMAL], - NULL ); - - e_minicard->header_text = - gnome_canvas_item_new( group, - e_text_get_type(), - "anchor", GTK_ANCHOR_NW, - "width", (double) ( e_minicard->width - 12 ), - "clip", TRUE, - "use_ellipsis", TRUE, - "font", "lucidasans-bold-10", - "fill_color_gdk", &canvas->style->fg[GTK_STATE_NORMAL], - "text", "", - NULL ); - e_canvas_item_move_absolute(e_minicard->header_text, 6, 6); - - remodel(e_minicard); - e_canvas_item_request_reflow(item); - - if (!item->canvas->aa) { - } -} - -static void -e_minicard_unrealize (GnomeCanvasItem *item) -{ - EMinicard *e_minicard; - - e_minicard = E_MINICARD (item); - - if (!item->canvas->aa) - { - } - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item); -} - -static void -card_added_cb (EBook* book, EBookStatus status, const char *id, gpointer user_data) -{ - g_print ("%s: %s(): a card was added\n", __FILE__, __FUNCTION__); -} - -static void -card_changed_cb (EBook* book, EBookStatus status, gpointer user_data) -{ - g_print ("%s: %s(): a card was changed with status %d\n", __FILE__, __FUNCTION__, status); -} - -static void -save_as (GtkWidget *widget, EMinicard *minicard) -{ - e_card_simple_sync_card(minicard->simple); - e_contact_save_as(_("Save as VCard"), minicard->card); -} - -static void -delete (GtkWidget *widget, EMinicard *minicard) -{ - EBook *book; - - if (e_contact_editor_confirm_delete()) { - e_card_simple_sync_card(minicard->simple); - - gtk_object_get(GTK_OBJECT(GNOME_CANVAS_ITEM(minicard)->parent), - "book", &book, - NULL); - - /* Add the card in the contact editor to our ebook */ - e_book_remove_card (book, - minicard->card, - card_changed_cb, - NULL); - } -} - -static void -print (GtkWidget *widget, EMinicard *minicard) -{ - e_card_simple_sync_card(minicard->simple); - - gtk_widget_show(e_contact_print_card_dialog_new(minicard->card)); -} - -/* Callback for the add_card signal from the contact editor */ -static void -add_card_cb (EContactEditor *ce, ECard *card, gpointer data) -{ - EBook *book; - - book = E_BOOK (data); - e_book_add_card (book, card, card_added_cb, NULL); -} - -/* Callback for the commit_card signal from the contact editor */ -static void -commit_card_cb (EContactEditor *ce, ECard *card, gpointer data) -{ - EBook *book; - - book = E_BOOK (data); - e_book_commit_card (book, card, card_changed_cb, NULL); -} - -/* Callback for the commit_card signal from the contact editor */ -static void -delete_card_cb (EContactEditor *ce, ECard *card, gpointer data) -{ - EBook *book; - - book = E_BOOK (data); - e_book_remove_card (book, card, card_changed_cb, NULL); -} - -/* Callback used when the contact editor is closed */ -static void -editor_closed_cb (EContactEditor *ce, gpointer data) -{ - gtk_object_unref (GTK_OBJECT (ce)); -} - -static gboolean -e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EMinicard *e_minicard; - GtkWidget *canvas; - - e_minicard = E_MINICARD (item); - canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (item)->canvas); - - switch( event->type ) { - case GDK_FOCUS_CHANGE: - { - GdkEventFocus *focus_event = (GdkEventFocus *) event; - if ( focus_event->in ) { - gnome_canvas_item_set( e_minicard->rect, - "outline_color_gdk", &canvas->style->bg[GTK_STATE_NORMAL], - NULL ); - gnome_canvas_item_set( e_minicard->header_rect, - "fill_color_gdk", &canvas->style->bg[GTK_STATE_SELECTED], - NULL ); - gnome_canvas_item_set( e_minicard->header_text, - "fill_color_gdk", &canvas->style->text[GTK_STATE_SELECTED], - NULL ); - e_minicard->has_focus = TRUE; - } else { - EBook *book = NULL; - - e_card_simple_sync_card(e_minicard->simple); - - if (E_IS_MINICARD_VIEW(GNOME_CANVAS_ITEM(e_minicard)->parent)) { - - gtk_object_get(GTK_OBJECT(GNOME_CANVAS_ITEM(e_minicard)->parent), - "book", &book, - NULL); - - } - - if (book) { - - /* Add the card in the contact editor to our ebook */ - e_book_commit_card (book, - e_minicard->card, - card_changed_cb, - NULL); - } else { - remodel(e_minicard); - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(e_minicard)); - } - - gnome_canvas_item_set( e_minicard->rect, - "outline_color", NULL, - NULL ); - gnome_canvas_item_set( e_minicard->header_rect, - "fill_color_gdk", - &canvas->style->bg[GTK_STATE_NORMAL], - NULL ); - gnome_canvas_item_set( e_minicard->header_text, - "fill_color_gdk", - &canvas->style->fg[GTK_STATE_NORMAL], - NULL ); - e_minicard->has_focus = FALSE; - } - } - break; - case GDK_BUTTON_PRESS: - if (event->button.button == 1) { - e_canvas_item_grab_focus(item); - } else if (event->button.button == 3) { - if (E_IS_MINICARD_VIEW(item->parent)) { - EPopupMenu menu[] = { {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), 0}, - {"Print", NULL, GTK_SIGNAL_FUNC(print), 0}, - {"Delete", NULL, GTK_SIGNAL_FUNC(delete), 0}, - {NULL, NULL, NULL, 0}}; - e_popup_menu_run (menu, (GdkEventButton *)event, 0, 0, e_minicard); - } else { - EPopupMenu menu[] = { {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), 0}, - {"Print", NULL, GTK_SIGNAL_FUNC(print), 0}, - {NULL, NULL, NULL, 0}}; - e_popup_menu_run (menu, (GdkEventButton *)event, 0, 0, e_minicard); - } - } - break; - - case GDK_2BUTTON_PRESS: - if (event->button.button == 1 && E_IS_MINICARD_VIEW(item->parent)) { - EContactEditor *ce; - EBook *book = NULL; - if (E_IS_MINICARD_VIEW(item->parent)) { - - gtk_object_get(GTK_OBJECT(item->parent), - "book", &book, - NULL); - } - ce = e_contact_editor_new (e_minicard->card, FALSE); - - if (book != NULL) { - gtk_signal_connect (GTK_OBJECT (ce), "add_card", - GTK_SIGNAL_FUNC (add_card_cb), book); - gtk_signal_connect (GTK_OBJECT (ce), "commit_card", - GTK_SIGNAL_FUNC (commit_card_cb), book); - gtk_signal_connect (GTK_OBJECT (ce), "delete_card", - GTK_SIGNAL_FUNC (delete_card_cb), book); - } - - gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", - GTK_SIGNAL_FUNC (editor_closed_cb), NULL); - return TRUE; - } - break; - 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_minicard->fields; list; list = list->next) { - EMinicardField *field = E_MINICARD_FIELD(list->data); - GnomeCanvasItem *item = field->label; - EFocus has_focus; - gtk_object_get(GTK_OBJECT(item), - "has_focus", &has_focus, - NULL); - if (has_focus != E_FOCUS_NONE) { - if (event->key.state & GDK_SHIFT_MASK) - list = list->prev; - else - list = list->next; - if (list) { - EMinicardField *field = E_MINICARD_FIELD(list->data); - GnomeCanvasItem *item = field->label; - 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; - } - } - } - } - 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_minicard_resize_children( EMinicard *e_minicard ) -{ - GList *list; - - if (e_minicard->header_text) { - gnome_canvas_item_set( e_minicard->header_text, - "width", (double) e_minicard->width - 12, - NULL ); - } - for ( list = e_minicard->fields; list; list = g_list_next( list ) ) { - gnome_canvas_item_set( E_MINICARD_FIELD( list->data )->label, - "width", (double) e_minicard->width - 4.0, - NULL ); - } -} - -static void -field_changed (EText *text, EMinicard *e_minicard) -{ - ECardSimpleType type; - char *string; - - type = GPOINTER_TO_INT - (gtk_object_get_data(GTK_OBJECT(text), - "EMinicard:field")); - gtk_object_get(GTK_OBJECT(text), - "text", &string, - NULL); - e_card_simple_set(e_minicard->simple, - type, - string); - g_free(string); -} - -static void -add_field (EMinicard *e_minicard, ECardSimpleField field, gdouble left_width) -{ - GnomeCanvasItem *new_item; - GnomeCanvasGroup *group; - ECardSimpleType type; - EMinicardField *minicard_field; - char *name; - char *string; - - group = GNOME_CANVAS_GROUP( e_minicard ); - - type = e_card_simple_type(e_minicard->simple, field); - name = g_strdup_printf("%s:", e_card_simple_get_name(e_minicard->simple, field)); - string = e_card_simple_get(e_minicard->simple, field); - - new_item = e_minicard_label_new(group); - gnome_canvas_item_set( new_item, - "width", e_minicard->width - 4.0, - "fieldname", name, - "field", string, - "max_field_name_length", left_width, - NULL ); - gtk_signal_connect(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field), - "changed", GTK_SIGNAL_FUNC(field_changed), e_minicard); - gtk_object_set_data(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field), - "EMinicard:field", - GINT_TO_POINTER(field)); - - minicard_field = g_new(EMinicardField, 1); - minicard_field->field = field; - minicard_field->label = new_item; - - e_minicard->fields = g_list_append( e_minicard->fields, minicard_field); - e_canvas_item_move_absolute(new_item, 2, e_minicard->height); - g_free(name); - g_free(string); -} - -static gdouble -get_left_width(EMinicard *e_minicard) -{ - gchar *name; - ECardSimpleField field; - gdouble width = -1; - static GdkFont *font = NULL; - - if (font == NULL) { - font = gdk_font_load("lucidasans-10"); - } - - for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST; field++) { - gdouble this_width; - name = g_strdup_printf("%s:", e_card_simple_get_name(e_minicard->simple, field)); - this_width = gdk_text_width(font, name, strlen(name)); - if (width < this_width) - width = this_width; - g_free(name); - } - return width; -} - -static void -remodel( EMinicard *e_minicard ) -{ - int count = 0; - if (e_minicard->simple) { - ECardSimpleField field; - GList *list; - char *file_as; - gdouble left_width = -1; - - if (e_minicard->header_text) { - file_as = e_card_simple_get(e_minicard->simple, E_CARD_SIMPLE_FIELD_FILE_AS); - gnome_canvas_item_set( e_minicard->header_text, - "text", file_as ? file_as : "", - NULL ); - g_free(file_as); - } - - list = e_minicard->fields; - e_minicard->fields = NULL; - - for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST - 2 && count < 5; field++) { - EMinicardField *minicard_field = NULL; - - if (list) - minicard_field = list->data; - if (minicard_field && minicard_field->field == field) { - GList *this_list = list; - char *string; - - string = e_card_simple_get(e_minicard->simple, field); - if (string && *string) { - e_minicard->fields = g_list_append(e_minicard->fields, minicard_field); - gtk_object_set(GTK_OBJECT(minicard_field->label), - "field", string, - NULL); - count ++; - } else { - e_minicard_field_destroy(minicard_field); - } - list = g_list_remove_link(list, this_list); - g_list_free_1(this_list); - g_free(string); - } else { - char *string; - if (left_width == -1) { - left_width = get_left_width(e_minicard); - } - - string = e_card_simple_get(e_minicard->simple, field); - if (string && *string) { - add_field(e_minicard, field, left_width); - count++; - } - g_free(string); - } - } - - g_list_foreach(list, (GFunc) e_minicard_field_destroy, NULL); - g_list_free(list); - } -} - -static void -e_minicard_reflow( GnomeCanvasItem *item, int flags ) -{ - EMinicard *e_minicard = E_MINICARD(item); - if ( GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED ) { - GList *list; - gdouble text_height; - gint old_height; - - old_height = e_minicard->height; - - gtk_object_get( GTK_OBJECT( e_minicard->header_text ), - "text_height", &text_height, - NULL ); - - e_minicard->height = text_height + 10.0; - - gnome_canvas_item_set( e_minicard->header_rect, - "y2", text_height + 9.0, - NULL ); - - for(list = e_minicard->fields; list; list = g_list_next(list)) { - EMinicardField *field = E_MINICARD_FIELD(list->data); - GnomeCanvasItem *item = field->label; - gtk_object_get (GTK_OBJECT(item), - "height", &text_height, - NULL); - e_canvas_item_move_absolute(item, 2, e_minicard->height); - e_minicard->height += text_height; - } - e_minicard->height += 2; - - gnome_canvas_item_set( e_minicard->rect, - "y2", (double) e_minicard->height - 1, - NULL ); - - gnome_canvas_item_set( e_minicard->rect, - "x2", (double) e_minicard->width - 1.0, - "y2", (double) e_minicard->height - 1.0, - NULL ); - gnome_canvas_item_set( e_minicard->header_rect, - "x2", (double) e_minicard->width - 3.0, - NULL ); - - if (old_height != e_minicard->height) - e_canvas_item_request_parent_reflow(item); - } -} - -char * -e_minicard_get_card_id (EMinicard *minicard) -{ - g_return_val_if_fail(minicard != NULL, NULL); - g_return_val_if_fail(E_IS_MINICARD(minicard), NULL); - - if (minicard->card) { - return e_card_get_id(minicard->card); - } else { - return ""; - } -} - -int -e_minicard_compare (EMinicard *minicard1, EMinicard *minicard2) -{ - g_return_val_if_fail(minicard1 != NULL, 0); - g_return_val_if_fail(E_IS_MINICARD(minicard1), 0); - g_return_val_if_fail(minicard2 != NULL, 0); - g_return_val_if_fail(E_IS_MINICARD(minicard2), 0); - - if (minicard1->card && minicard2->card) { - char *file_as1, *file_as2; - gtk_object_get(GTK_OBJECT(minicard1->card), - "file_as", &file_as1, - NULL); - gtk_object_get(GTK_OBJECT(minicard2->card), - "file_as", &file_as2, - NULL); - if (file_as1 && file_as2) - return strcasecmp(file_as1, file_as2); - if (file_as1) - return -1; - if (file_as2) - return 1; - return strcmp(e_minicard_get_card_id(minicard1), e_minicard_get_card_id(minicard2)); - } else { - return 0; - } -} diff --git a/addressbook/gui/minicard/e-minicard.h b/addressbook/gui/minicard/e-minicard.h deleted file mode 100644 index 47da8110c2..0000000000 --- a/addressbook/gui/minicard/e-minicard.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard.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_MINICARD_H__ -#define __E_MINICARD_H__ - -#include <gnome.h> -#include <ebook/e-card.h> -#include <ebook/e-card-simple.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EMinicard - A small card displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * width double RW width of the card - * height double R height of the card - * card ECard* RW Pointer to the ECard - */ - -#define E_MINICARD_TYPE (e_minicard_get_type ()) -#define E_MINICARD(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_TYPE, EMinicard)) -#define E_MINICARD_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_TYPE, EMinicardClass)) -#define E_IS_MINICARD(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_TYPE)) -#define E_IS_MINICARD_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_TYPE)) - - -typedef struct _EMinicard EMinicard; -typedef struct _EMinicardClass EMinicardClass; -typedef enum _EMinicardFocusType EMinicardFocusType; - -enum _EMinicardFocusType { - E_MINICARD_FOCUS_TYPE_START, - E_MINICARD_FOCUS_TYPE_END -}; - -struct _EMinicard -{ - GnomeCanvasGroup parent; - - /* item specific fields */ - ECard *card; - ECardSimple *simple; - - GnomeCanvasItem *rect; - GnomeCanvasItem *header_rect; - GnomeCanvasItem *header_text; - - GList *fields; /* Of type EMinicardField */ - guint needs_remodeling : 1; - - gboolean has_focus; - - double width; - double height; -}; - -struct _EMinicardClass -{ - GnomeCanvasGroupClass parent_class; - - void (* resize) (EMinicard *minicard); -}; - - -GtkType e_minicard_get_type (void); -char *e_minicard_get_card_id (EMinicard *minicard); -int e_minicard_compare (EMinicard *minicard1, EMinicard *minicard2); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_MINICARD_H__ */ diff --git a/addressbook/gui/minicard/e-reflow-sorted.c b/addressbook/gui/minicard/e-reflow-sorted.c deleted file mode 100644 index 2d2dcee787..0000000000 --- a/addressbook/gui/minicard/e-reflow-sorted.c +++ /dev/null @@ -1,272 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-reflow-sorted.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 <math.h> -#include <gnome.h> -#include "e-reflow-sorted.h" -#include <e-util/e-canvas-utils.h> -#include <e-util/e-canvas.h> -#include <e-util/e-util.h> - -static void e_reflow_sorted_init (EReflowSorted *card); -static void e_reflow_sorted_class_init (EReflowSortedClass *klass); -static void e_reflow_sorted_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_reflow_sorted_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_reflow_sorted_add_item(EReflow *e_reflow, 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 EReflowClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0, - ARG_COMPARE_FUNC, - ARG_STRING_FUNC -}; - -GtkType -e_reflow_sorted_get_type (void) -{ - static GtkType reflow_type = 0; - - if (!reflow_type) - { - static const GtkTypeInfo reflow_info = - { - "EReflowSorted", - sizeof (EReflowSorted), - sizeof (EReflowSortedClass), - (GtkClassInitFunc) e_reflow_sorted_class_init, - (GtkObjectInitFunc) e_reflow_sorted_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - reflow_type = gtk_type_unique (e_reflow_get_type (), &reflow_info); - } - - return reflow_type; -} - -static void -e_reflow_sorted_class_init (EReflowSortedClass *klass) -{ - GtkObjectClass *object_class; - EReflowClass *reflow_class; - - object_class = (GtkObjectClass*) klass; - reflow_class = E_REFLOW_CLASS (klass); - - parent_class = gtk_type_class (e_reflow_get_type ()); - - gtk_object_add_arg_type ("EReflowSorted::compare_func", GTK_TYPE_POINTER, - GTK_ARG_READWRITE, ARG_COMPARE_FUNC); - gtk_object_add_arg_type ("EReflowSorted::string_func", GTK_TYPE_POINTER, - GTK_ARG_READWRITE, ARG_STRING_FUNC); - - reflow_class->add_item = e_reflow_sorted_add_item; - - object_class->set_arg = e_reflow_sorted_set_arg; - object_class->get_arg = e_reflow_sorted_get_arg; -} - -static void -e_reflow_sorted_init (EReflowSorted *reflow) -{ - reflow->compare_func = NULL; - reflow->string_func = NULL; -} - -static void -e_reflow_sorted_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EReflowSorted *e_reflow_sorted; - - item = GNOME_CANVAS_ITEM (o); - e_reflow_sorted = E_REFLOW_SORTED (o); - - switch (arg_id){ - case ARG_COMPARE_FUNC: - e_reflow_sorted->compare_func = GTK_VALUE_POINTER (*arg); - break; - case ARG_STRING_FUNC: - e_reflow_sorted->string_func = GTK_VALUE_POINTER (*arg); - break; - } -} - -static void -e_reflow_sorted_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EReflowSorted *e_reflow_sorted; - - e_reflow_sorted = E_REFLOW_SORTED (object); - - switch (arg_id) { - case ARG_COMPARE_FUNC: - GTK_VALUE_POINTER (*arg) = e_reflow_sorted->compare_func; - break; - case ARG_STRING_FUNC: - GTK_VALUE_POINTER (*arg) = e_reflow_sorted->string_func; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static GList * -e_reflow_sorted_get_list(EReflowSorted *e_reflow_sorted, const gchar *id) -{ - if (e_reflow_sorted->string_func) { - EReflow *reflow = E_REFLOW(e_reflow_sorted); - GList *list; - for (list = reflow->items; list; list = g_list_next(list)) { - GnomeCanvasItem *item = list->data; - char *string = e_reflow_sorted->string_func (item); - if (string && !strcmp(string, id)) { - return list; - } - } - } - return NULL; -} - -void -e_reflow_sorted_remove_item(EReflowSorted *e_reflow_sorted, const gchar *id) -{ - GList *list; - GnomeCanvasItem *item = NULL; - - list = e_reflow_sorted_get_list(e_reflow_sorted, id); - if (list) - item = list->data; - - if (item) { - EReflow *reflow = E_REFLOW(e_reflow_sorted); - reflow->items = g_list_remove_link(reflow->items, list); - g_list_free_1(list); - gtk_object_unref(GTK_OBJECT(item)); - gtk_object_destroy(GTK_OBJECT(item)); - if ( GTK_OBJECT_FLAGS( e_reflow_sorted ) & GNOME_CANVAS_ITEM_REALIZED ) { - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(e_reflow_sorted)); - e_reflow_post_add_item(E_REFLOW(e_reflow_sorted), NULL); - } - } -} - -void -e_reflow_sorted_replace_item(EReflowSorted *e_reflow_sorted, GnomeCanvasItem *item) -{ - if (e_reflow_sorted->string_func) { - char *string = e_reflow_sorted->string_func (item); - e_reflow_sorted_remove_item(e_reflow_sorted, string); - e_reflow_sorted_add_item(E_REFLOW(e_reflow_sorted), item); - } -} - -GnomeCanvasItem * -e_reflow_sorted_get_item(EReflowSorted *e_reflow_sorted, const gchar *id) -{ - GList *list; - list = e_reflow_sorted_get_list(e_reflow_sorted, id); - if (list) - return list->data; - else - return NULL; -} - -void -e_reflow_sorted_reorder_item(EReflowSorted *e_reflow_sorted, const gchar *id) -{ - GList *list; - GnomeCanvasItem *item = NULL; - - list = e_reflow_sorted_get_list(e_reflow_sorted, id); - if (list) - item = list->data; - if (item) { - EReflow *reflow = E_REFLOW(e_reflow_sorted); - reflow->items = g_list_remove_link(reflow->items, list); - gtk_object_unref(GTK_OBJECT(item)); - g_list_free_1(list); - e_reflow_sorted_add_item(reflow, item); - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(e_reflow_sorted)); - } -} - -static void -e_reflow_sorted_add_item(EReflow *reflow, GnomeCanvasItem *item) -{ - EReflowSorted *e_reflow_sorted = E_REFLOW_SORTED(reflow); - if ( e_reflow_sorted->compare_func ) { - reflow->items = g_list_insert_sorted(reflow->items, item, e_reflow_sorted->compare_func); - gtk_object_ref(GTK_OBJECT(item)); - - if ( GTK_OBJECT_FLAGS( e_reflow_sorted ) & GNOME_CANVAS_ITEM_REALIZED ) { - gnome_canvas_item_set(item, - "width", (double) reflow->column_width, - NULL); - - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(e_reflow_sorted)); - } - } - e_reflow_post_add_item(reflow, item); -} - -void e_reflow_sorted_jump (EReflowSorted *sorted, - GCompareFunc compare_func, - void *value) -{ - int columns = 0; - EReflow *reflow = E_REFLOW(sorted); - GList *list; - GtkAdjustment *adjustment; - - for (list = reflow->columns; list; list = g_list_next(list)) { - if (compare_func(((GList *)list->data)->data, value) >= 0) { - GList *last = list->prev; - if (last) { - GList *walk; - for (walk = last->data; walk != list->data; walk = g_list_next(walk)) { - if (compare_func(walk->data, value) >= 0) { - columns --; - break; - } - } - } - adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(GNOME_CANVAS_ITEM(sorted)->canvas)); - gtk_adjustment_set_value(adjustment, (reflow->column_width + E_REFLOW_FULL_GUTTER) * columns); - return; - } - columns ++; - } - columns --; - adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(GNOME_CANVAS_ITEM(sorted)->canvas)); - gtk_adjustment_set_value(adjustment, (reflow->column_width + E_REFLOW_FULL_GUTTER) * columns); -} diff --git a/addressbook/gui/minicard/e-reflow-sorted.h b/addressbook/gui/minicard/e-reflow-sorted.h deleted file mode 100644 index 1be4971fb2..0000000000 --- a/addressbook/gui/minicard/e-reflow-sorted.h +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-reflow-sorted.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_SORTED_H__ -#define __E_REFLOW_SORTED_H__ - -#include <addressbook/gui/minicard/e-reflow.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EReflowSorted - A canvas item container. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * compare_func GCompareFunc RW compare function - * string_func EReflowStringFunc RW string function - * - * From EReflow: - * 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_SORTED_TYPE (e_reflow_sorted_get_type ()) -#define E_REFLOW_SORTED(obj) (GTK_CHECK_CAST ((obj), E_REFLOW_SORTED_TYPE, EReflowSorted)) -#define E_REFLOW_SORTED_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_REFLOW_SORTED_TYPE, EReflowSortedClass)) -#define E_IS_REFLOW_SORTED(obj) (GTK_CHECK_TYPE ((obj), E_REFLOW_SORTED_TYPE)) -#define E_IS_REFLOW_SORTED_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_REFLOW_SORTED_TYPE)) - -typedef char * (* EReflowStringFunc) (GnomeCanvasItem *); - -typedef struct _EReflowSorted EReflowSorted; -typedef struct _EReflowSortedClass EReflowSortedClass; - -/* FIXME: Try reimplementing this as a hash table with key as string - and change EReflow to use a GTree. */ -struct _EReflowSorted -{ - EReflow parent; - - /* item specific fields */ - GCompareFunc compare_func; - EReflowStringFunc string_func; -}; - -struct _EReflowSortedClass -{ - EReflowClass parent_class; -}; - -/* - * 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_sorted_remove_item (EReflowSorted *sorted, const char *id); -void e_reflow_sorted_replace_item (EReflowSorted *sorted, GnomeCanvasItem *item); -void e_reflow_sorted_reorder_item (EReflowSorted *e_reflow_sorted, const gchar *id); -GnomeCanvasItem *e_reflow_sorted_get_item (EReflowSorted *e_reflow_sorted, const gchar *id); -GtkType e_reflow_sorted_get_type (void); -void e_reflow_sorted_jump (EReflowSorted *sorted, GCompareFunc compare_func, void *value); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __E_REFLOW_SORTED_H__ */ diff --git a/addressbook/gui/minicard/e-reflow.c b/addressbook/gui/minicard/e-reflow.c deleted file mode 100644 index 0e9c8b92b1..0000000000 --- a/addressbook/gui/minicard/e-reflow.c +++ /dev/null @@ -1,859 +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 "e-text.h" -#include <e-util/e-canvas-utils.h> -#include <e-util/e-canvas.h> -#include <e-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); -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) -{ - 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); - } - -} - -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, - 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) -{ - if (E_REFLOW_CLASS(GTK_OBJECT(e_reflow)->klass)->add_item) - (E_REFLOW_CLASS(GTK_OBJECT(e_reflow)->klass)->add_item) (e_reflow, item); -} - -void -e_reflow_post_add_item(EReflow *e_reflow, GnomeCanvasItem *item) -{ - set_empty(e_reflow); -} diff --git a/addressbook/gui/minicard/e-reflow.h b/addressbook/gui/minicard/e-reflow.h deleted file mode 100644 index eb66b094a5..0000000000 --- a/addressbook/gui/minicard/e-reflow.h +++ /dev/null @@ -1,112 +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); -}; - -/* - * 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); -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/addressbook/gui/minicard/test-minicard-label.c b/addressbook/gui/minicard/test-minicard-label.c deleted file mode 100644 index 57bc69222a..0000000000 --- a/addressbook/gui/minicard/test-minicard-label.c +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-minicard-label.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-minicard-label.h" -#include <e-util/e-canvas.h> - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *label; -GnomeCanvasItem *rect; - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, allocation->height ); - gnome_canvas_item_set( label, - "width", (double) allocation->width, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( rect, - "x2", (double) allocation->width, - "y2", (double) allocation->height, - NULL ); -} - -#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 Label Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the minicard label canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -static void button_press_callback( GtkWidget *widget, gpointer data ) -{ - gnome_canvas_item_grab_focus( label ); -} - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *canvas; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Minicard Label Test", VERSION, argc, argv); - app = gnome_app_new("Minicard Label Test", NULL); - - canvas = e_canvas_new(); - 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 ); - label = e_minicard_label_new(gnome_canvas_root( GNOME_CANVAS( canvas ) )); - gnome_canvas_item_set( label, - "width", (double) 100, - "height", (double) 100, - "fieldname", "Full Name:", - "field", "Christopher James Lahey", - NULL ); - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - gnome_app_set_contents( GNOME_APP( app ), canvas ); - - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate", - GTK_SIGNAL_FUNC( allocate_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "button_press_event", - GTK_SIGNAL_FUNC( button_press_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/gui/minicard/test-minicard-view.c b/addressbook/gui/minicard/test-minicard-view.c deleted file mode 100644 index c03d11d07e..0000000000 --- a/addressbook/gui/minicard/test-minicard-view.c +++ /dev/null @@ -1,206 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-reflow.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 <libgnorba/gnorba.h> -#include <bonobo.h> -#include <e-util/e-canvas.h> -#include "e-minicard-view.h" - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *reflow; -GnomeCanvasItem *rect; -GtkAllocation last_alloc; - -CORBA_Environment ev; -CORBA_ORB orb; - -static void -init_bonobo (int argc, char **argv) -{ - - gnome_CORBA_init_with_popt_table ( - "Reflow Test", VERSION, - &argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); - - orb = gnome_CORBA_ORB (); - - if (bonobo_init (orb, NULL, NULL) == FALSE) - g_error (_("Could not initialize Bonobo")); - -} - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - double width; - last_alloc = *allocation; - gnome_canvas_item_set( reflow, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( reflow, - "minimum_width", (double) allocation->width, - NULL ); - gtk_object_get(GTK_OBJECT(reflow), - "width", &width, - NULL); - width = MAX(width, allocation->width); - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, width, allocation->height ); - gnome_canvas_item_set( rect, - "x2", (double) width, - "y2", (double) allocation->height, - NULL ); -} - -static void resize(GnomeCanvas *canvas, gpointer data) -{ - double width; - gtk_object_get(GTK_OBJECT(reflow), - "width", &width, - NULL); - width = MAX(width, last_alloc.width); - gnome_canvas_set_scroll_region(canvas , 0, 0, width, last_alloc.height ); - gnome_canvas_item_set( rect, - "x2", (double) width, - "y2", (double) last_alloc.height, - NULL ); -} - -#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 ( _( "Reflow Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the reflow canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -static void -book_open_cb (EBook *book, EBookStatus status, gpointer closure) -{ - if (status == E_BOOK_STATUS_SUCCESS) - gnome_canvas_item_set(reflow, - "book", book, - NULL); -} - -static guint -ebook_create (void) -{ - EBook *book; - - book = e_book_new (); - - if (!book) { - printf ("%s: %s(): Couldn't create EBook, bailing.\n", - __FILE__, - __FUNCTION__); - return FALSE; - } - - - if (! e_book_load_uri (book, "file:/tmp/test.db", book_open_cb, NULL)) { - printf ("error calling load_uri!\n"); - } - - - return FALSE; -} - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *canvas; - GtkWidget *vbox; - GtkWidget *scrollbar; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - CORBA_exception_init (&ev); - init_bonobo (argc, argv); - - app = gnome_app_new("Reflow Test", NULL); - - vbox = gtk_vbox_new(FALSE, 0); - - canvas = e_canvas_new(); - 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 ); - reflow = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - e_minicard_view_get_type(), - "height", (double) 100, - "minimum_width", (double) 100, - NULL ); - gtk_signal_connect( GTK_OBJECT( canvas ), "reflow", - GTK_SIGNAL_FUNC( resize ), - ( gpointer ) app); - - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - gtk_box_pack_start(GTK_BOX(vbox), canvas, TRUE, TRUE, 0); - - scrollbar = gtk_hscrollbar_new(gtk_layout_get_hadjustment(GTK_LAYOUT(canvas))); - - gtk_box_pack_start(GTK_BOX(vbox), scrollbar, FALSE, FALSE, 0); - - gnome_app_set_contents( GNOME_APP( app ), vbox ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate", - GTK_SIGNAL_FUNC( allocate_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - gdk_window_set_back_pixmap( GTK_LAYOUT(canvas)->bin_window, NULL, FALSE); - - gtk_idle_add ((GtkFunction) ebook_create, NULL); - - bonobo_main (); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/gui/minicard/test-minicard.c b/addressbook/gui/minicard/test-minicard.c deleted file mode 100644 index e16ca675b3..0000000000 --- a/addressbook/gui/minicard/test-minicard.c +++ /dev/null @@ -1,115 +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-minicard.h" - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *card; -GnomeCanvasItem *rect; - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, allocation->height ); - gnome_canvas_item_set( card, - "width", (double) allocation->width, - NULL ); - gnome_canvas_item_set( rect, - "x2", (double) allocation->width, - "y2", (double) allocation->height, - NULL ); -} - -#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 *canvas; - int i; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Minicard Test", VERSION, argc, argv); - app = gnome_app_new("Minicard Test", NULL); - - canvas = gnome_canvas_new(); - 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 ); - for ( i = 0; i < 1; i++ ) - { - card = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - e_minicard_get_type(), - "width", (double) 100, - NULL ); - } - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - gnome_app_set_contents( GNOME_APP( app ), canvas ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate", - GTK_SIGNAL_FUNC( allocate_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/gui/minicard/test-reflow.c b/addressbook/gui/minicard/test-reflow.c deleted file mode 100644 index 8013c428d5..0000000000 --- a/addressbook/gui/minicard/test-reflow.c +++ /dev/null @@ -1,194 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-reflow.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. - */ - - -#define TEST_VCARD \ -"BEGIN:VCARD -" \ -"FN:Nat -" \ -"N:Friedman;Nat;D;Mr. -" \ -"TITLE:Head Geek -" \ -"BDAY:1977-08-06 -" \ -"TEL;WORK:617 679 1984 -" \ -"TEL;CELL:123 456 7890 -" \ -"EMAIL;INTERNET:nat@nat.org -" \ -"EMAIL;INTERNET:nat@helixcode.com -" \ -"ADR;WORK;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234; -" \ -"ADR;HOME;POSTAL;INTL:P.O. Box 202;;;Any Town 2;MI;12344-4321;USA -" \ -"END:VCARD -" \ -" -" - - -#include "config.h" - -#include <gnome.h> -#include <e-util/e-canvas.h> -#include "e-reflow.h" -#include "e-minicard.h" -#include "e-scroll-frame.h" - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *reflow; -GnomeCanvasItem *rect; -GtkAllocation last_alloc; - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - double width; - last_alloc = *allocation; - gnome_canvas_item_set( reflow, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( reflow, - "minimum_width", (double) allocation->width, - NULL ); - gtk_object_get(GTK_OBJECT(reflow), - "width", &width, - NULL); - width = MAX(width, allocation->width); - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, width - 1, allocation->height - 1); - gnome_canvas_item_set( rect, - "x2", (double) width, - "y2", (double) allocation->height, - NULL ); -} - -static void resize(GnomeCanvas *canvas, gpointer data) -{ - double width; - gtk_object_get(GTK_OBJECT(reflow), - "width", &width, - NULL); - width = MAX(width, last_alloc.width); - gnome_canvas_set_scroll_region(canvas , 0, 0, width - 1, last_alloc.height - 1); - gnome_canvas_item_set( rect, - "x2", (double) width, - "y2", (double) last_alloc.height, - NULL ); -} - -#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 ( _( "Reflow Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the reflow canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *canvas; - GtkWidget *vbox; - GtkWidget *scrollframe; - int i; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Reflow Test", VERSION, argc, argv); - app = gnome_app_new("Reflow Test", NULL); - - vbox = gtk_vbox_new(FALSE, 0); - - canvas = e_canvas_new(); - 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 ); - reflow = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - e_reflow_get_type(), - "height", (double) 100, - "minimum_width", (double) 100, - NULL ); - gtk_signal_connect( GTK_OBJECT( canvas ), "reflow", - GTK_SIGNAL_FUNC( resize ), - ( gpointer ) app); - for ( i = 0; i < 200; i++ ) - { - GnomeCanvasItem *item; - ECard *card = e_card_new (TEST_VCARD); - item = gnome_canvas_item_new( GNOME_CANVAS_GROUP(reflow), - e_minicard_get_type(), - "card", card, - NULL); - e_reflow_add_item(E_REFLOW(reflow), item); - } - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - scrollframe = e_scroll_frame_new (gtk_layout_get_hadjustment(GTK_LAYOUT(canvas)), - gtk_layout_get_vadjustment(GTK_LAYOUT(canvas))); - e_scroll_frame_set_policy (E_SCROLL_FRAME (scrollframe), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_NEVER); - - gtk_container_add (GTK_CONTAINER (scrollframe), canvas); - - gnome_app_set_contents( GNOME_APP( app ), scrollframe ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate", - GTK_SIGNAL_FUNC( allocate_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - gdk_window_set_back_pixmap( GTK_LAYOUT(canvas)->bin_window, NULL, FALSE); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/gui/search/.cvsignore b/addressbook/gui/search/.cvsignore deleted file mode 100644 index d6c55c7345..0000000000 --- a/addressbook/gui/search/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -*.lo -*.la diff --git a/addressbook/gui/search/Makefile.am b/addressbook/gui/search/Makefile.am deleted file mode 100644 index 1050da1843..0000000000 --- a/addressbook/gui/search/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -INCLUDES = \ - -DG_LOG_DOMAIN=\"e-addressbook-search\" \ - -I$(top_srcdir) \ - -I$(top_srcdir)/addressbook/backend \ - -I$(top_builddir)/addressbook/backend \ - -I$(top_srcdir)/addressbook/contact-editor \ - -I$(top_srcdir)/widgets/e-text \ - -I$(top_srcdir)/widgets/misc \ - $(BONOBO_GNOME_CFLAGS) - -noinst_LIBRARIES = \ - libeaddressbooksearch.a - -libeaddressbooksearch_a_SOURCES = \ - e-addressbook-search-dialog.c \ - e-addressbook-search-dialog.h diff --git a/addressbook/gui/search/addresstypes.xml b/addressbook/gui/search/addresstypes.xml deleted file mode 100644 index d855561cce..0000000000 --- a/addressbook/gui/search/addresstypes.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0"?> -<filterdescription> -<partset> - <part name="name"> - <title>Sender</title> - <input type="optionlist" name="name-type"> - <option value="contains"> - <title>contains</title> - <code>(contains "fullname" ${name}))</code> - </option> - <option value="not contains"> - <title>does not contain</title> - <code>(not (contains "fullname" ${name})))</code> - </option> - </input> - <input type="string" name="name"/> - </part> - <part name="email"> - <title>Sender</title> - <input type="optionlist" name="email-type"> - <option value="contains"> - <title>contains</title> - <code>(contains "email" ${email}))</code> - </option> - <option value="not contains"> - <title>does not contain</title> - <code>(not (contains "email" ${email})))</code> - </option> - </input> - <input type="string" name="email"/> - </part> - <part name="sexp"> - <title>Expression</title> - <input type="code" name="code"/> - </part> -</partset> -</filterdescription> diff --git a/addressbook/gui/search/e-addressbook-search-dialog.c b/addressbook/gui/search/e-addressbook-search-dialog.c deleted file mode 100644 index 4acfd1585c..0000000000 --- a/addressbook/gui/search/e-addressbook-search-dialog.c +++ /dev/null @@ -1,192 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-addressbook-search-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 <e-util/e-canvas.h> -#include "e-addressbook-search-dialog.h" -#include "addressbook/gui/minicard/e-minicard-view-widget.h" -#include "widgets/misc/e-scroll-frame.h" -static void e_addressbook_search_dialog_init (EAddressbookSearchDialog *widget); -static void e_addressbook_search_dialog_class_init (EAddressbookSearchDialogClass *klass); -static void e_addressbook_search_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_addressbook_search_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_addressbook_search_dialog_destroy (GtkObject *object); - -static ECanvasClass *parent_class = NULL; - -#define PARENT_TYPE (gnome_dialog_get_type()) - -/* The arguments we take */ -enum { - ARG_0, - ARG_BOOK, -}; - -GtkType -e_addressbook_search_dialog_get_type (void) -{ - static GtkType type = 0; - - if (!type) - { - static const GtkTypeInfo info = - { - "EAddressbookSearchDialog", - sizeof (EAddressbookSearchDialog), - sizeof (EAddressbookSearchDialogClass), - (GtkClassInitFunc) e_addressbook_search_dialog_class_init, - (GtkObjectInitFunc) e_addressbook_search_dialog_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -static void -e_addressbook_search_dialog_class_init (EAddressbookSearchDialogClass *klass) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - ECanvasClass *canvas_class; - - object_class = (GtkObjectClass*) klass; - widget_class = GTK_WIDGET_CLASS (klass); - canvas_class = E_CANVAS_CLASS (klass); - - parent_class = gtk_type_class (PARENT_TYPE); - - gtk_object_add_arg_type ("EAddressbookSearchDialog::book", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_BOOK); - - object_class->set_arg = e_addressbook_search_dialog_set_arg; - object_class->get_arg = e_addressbook_search_dialog_get_arg; - object_class->destroy = e_addressbook_search_dialog_destroy; -} - -static GtkWidget * -get_widget () -{ - return gtk_entry_new(); -} - -static char * -get_query () -{ - return "(contains \"email\" \"\")"; -} - -static void -button_press (GtkWidget *widget, EAddressbookSearchDialog *dialog) -{ - char *query; - gtk_widget_show(dialog->scrolled_window); - query = get_query(); - gtk_object_set(GTK_OBJECT(dialog->view), - "query", query, - NULL); - g_free(query); -} - -static void -e_addressbook_search_dialog_init (EAddressbookSearchDialog *view) -{ - GtkWidget *button; - GnomeDialog *dialog = GNOME_DIALOG (view); - - gtk_window_set_policy(GTK_WINDOW(view), FALSE, TRUE, FALSE); - - view->search = get_widget(); - gtk_box_pack_start(GTK_BOX(dialog->vbox), view->search, TRUE, TRUE, 0); - gtk_widget_show(view->search); - - button = gtk_button_new_with_label(_("Search")); - gtk_box_pack_start(GTK_BOX(dialog->vbox), button, FALSE, FALSE, 0); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(button_press), view); - gtk_widget_show(button); - - view->view = e_minicard_view_widget_new(); - gtk_widget_show(view->view); - - view->scrolled_window = e_scroll_frame_new(NULL, NULL); - e_scroll_frame_set_policy(E_SCROLL_FRAME(view->scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER); - gtk_container_add(GTK_CONTAINER(view->scrolled_window), view->view); - - gtk_box_pack_start(GTK_BOX(dialog->vbox), view->scrolled_window, TRUE, TRUE, 0); -} - -GtkWidget * -e_addressbook_search_dialog_new (EBook *book) -{ - EAddressbookSearchDialog *view = gtk_type_new (e_addressbook_search_dialog_get_type ()); - gtk_object_set(GTK_OBJECT(view->view), - "book", book, - NULL); - return GTK_WIDGET(view); -} - -static void -e_addressbook_search_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - EAddressbookSearchDialog *emvw; - - emvw = E_ADDRESSBOOK_SEARCH_DIALOG (o); - - switch (arg_id){ - case ARG_BOOK: - gtk_object_set(GTK_OBJECT(emvw->view), - "book", GTK_VALUE_OBJECT (*arg), - NULL); - break; - } -} - -static void -e_addressbook_search_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EAddressbookSearchDialog *emvw; - - emvw = E_ADDRESSBOOK_SEARCH_DIALOG (object); - - switch (arg_id) { - case ARG_BOOK: - gtk_object_get(GTK_OBJECT(emvw->view), - "book", &(GTK_VALUE_OBJECT (*arg)), - NULL); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_addressbook_search_dialog_destroy (GtkObject *object) -{ - GTK_OBJECT_CLASS(parent_class)->destroy (object); -} diff --git a/addressbook/gui/search/e-addressbook-search-dialog.h b/addressbook/gui/search/e-addressbook-search-dialog.h deleted file mode 100644 index 84af66b4e1..0000000000 --- a/addressbook/gui/search/e-addressbook-search-dialog.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard-view-widget.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_ADDRESSBOOK_SEARCH_DIALOG_H__ -#define __E_ADDRESSBOOK_SEARCH_DIALOG_H__ - -#include <gnome.h> -#include <ebook/e-book.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_ADDRESSBOOK_SEARCH_DIALOG_TYPE (e_addressbook_search_dialog_get_type ()) -#define E_ADDRESSBOOK_SEARCH_DIALOG(obj) (GTK_CHECK_CAST ((obj), E_ADDRESSBOOK_SEARCH_DIALOG_TYPE, EAddressbookSearchDialog)) -#define E_ADDRESSBOOK_SEARCH_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_ADDRESSBOOK_SEARCH_DIALOG_TYPE, EAddressbookSearchDialogClass)) -#define E_IS_ADDRESSBOOK_SEARCH_DIALOG(obj) (GTK_CHECK_TYPE ((obj), E_ADDRESSBOOK_SEARCH_DIALOG_TYPE)) -#define E_IS_ADDRESSBOOK_SEARCH_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_ADDRESSBOOK_SEARCH_DIALOG_TYPE)) - - -typedef struct _EAddressbookSearchDialog EAddressbookSearchDialog; -typedef struct _EAddressbookSearchDialogClass EAddressbookSearchDialogClass; - -struct _EAddressbookSearchDialog -{ - GnomeDialog parent; - - GtkWidget *search; - GtkWidget *view; - GtkWidget *scrolled_window; -}; - -struct _EAddressbookSearchDialogClass -{ - GnomeDialogClass parent_class; -}; - -GtkType e_addressbook_search_dialog_get_type (void); - -GtkWidget *e_addressbook_search_dialog_new (EBook *book); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __E_ADDRESSBOOK_SEARCH_DIALOG_H__ */ diff --git a/addressbook/gui/widgets/Makefile.am b/addressbook/gui/widgets/Makefile.am deleted file mode 100644 index 17f6d00548..0000000000 --- a/addressbook/gui/widgets/Makefile.am +++ /dev/null @@ -1,124 +0,0 @@ -INCLUDES = \ - -DG_LOG_DOMAIN=\"e-minicard\" \ - -I$(top_srcdir) \ - -I$(top_srcdir)/addressbook/backend \ - -I$(top_builddir)/addressbook/backend \ - -I$(top_srcdir)/addressbook/contact-editor \ - -I$(top_srcdir)/widgets/e-text \ - -I$(top_srcdir)/widgets/misc \ - $(BONOBO_GNOME_CFLAGS) - -noinst_LIBRARIES = \ - libeminicard.a - -libeminicard_a_SOURCES = \ - e-minicard-control.c \ - e-minicard-control.h \ - e-minicard-label.c \ - e-minicard-label.h \ - e-minicard-view-widget.c \ - e-minicard-view-widget.h \ - e-minicard-view.c \ - e-minicard-view.h \ - e-minicard-widget.c \ - e-minicard-widget.h \ - e-minicard.c \ - e-minicard.h \ - e-reflow-sorted.c \ - e-reflow-sorted.h \ - e-reflow.c \ - e-reflow.h - -noinst_PROGRAMS = \ - minicard-widget-test \ - minicard-label-test \ - minicard-test \ - reflow-test \ - minicard-view-test - -minicard_label_test_SOURCES = \ - test-minicard-label.c - -minicard_label_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - $(GNOMEGNORBA_LIBS) \ - libeminicard.a \ - $(BONOBO_GNOME_LIBS) \ - $(top_builddir)/widgets/e-text/libetext.a \ - $(top_builddir)/e-util/libeutil.la - -minicard_test_SOURCES = \ - test-minicard.c - -minicard_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - $(GNOMEGNORBA_LIBS) \ - libeminicard.a \ - $(BONOBO_GNOME_LIBS) \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/addressbook/ename/libename.la \ - $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \ - $(top_builddir)/addressbook/printing/libecontactprint.a \ - $(top_builddir)/widgets/e-table/libetable.a \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/widgets/e-text/libetext.a - -reflow_test_SOURCES = \ - test-reflow.c - -reflow_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - $(GNOMEGNORBA_LIBS) \ - $(BONOBO_GNOME_LIBS) \ - libeminicard.a \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/addressbook/ename/libename.la \ - $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \ - $(top_builddir)/addressbook/printing/libecontactprint.a \ - $(top_builddir)/widgets/e-table/libetable.a \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/widgets/e-text/libetext.a - -minicard_view_test_SOURCES = \ - test-minicard-view.c - -minicard_view_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - $(GNOMEGNORBA_LIBS) \ - $(BONOBO_GNOME_LIBS) \ - libeminicard.a \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/addressbook/ename/libename.la \ - $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \ - $(top_builddir)/addressbook/printing/libecontactprint.a \ - $(top_builddir)/widgets/e-table/libetable.a \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/widgets/e-text/libetext.a - -minicard_widget_test_SOURCES = \ - e-minicard-widget-test.c - -minicard_widget_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - $(GNOMEGNORBA_LIBS) \ - $(BONOBO_GNOME_LIBS) \ - libeminicard.a \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/addressbook/ename/libename.la \ - $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \ - $(top_builddir)/addressbook/printing/libecontactprint.a \ - $(top_builddir)/widgets/e-table/libetable.a \ - $(top_builddir)/widgets/misc/libemiscwidgets.a \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/widgets/e-text/libetext.a diff --git a/addressbook/gui/widgets/alphabet.glade b/addressbook/gui/widgets/alphabet.glade deleted file mode 100644 index bc6e5f3798..0000000000 --- a/addressbook/gui/widgets/alphabet.glade +++ /dev/null @@ -1,357 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>alphabet</name> - <program_name>alphabet</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>alphabet.glade.h</translatable_strings_file> -</project> - -<widget> - <class>GtkWindow</class> - <name>window2</name> - <visible>False</visible> - <title>window2</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>GtkScrolledWindow</class> - <name>scrolledwindow-top</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> - - <widget> - <class>GtkViewport</class> - <name>viewport1</name> - <border_width>4</border_width> - <shadow_type>GTK_SHADOW_NONE</shadow_type> - - <widget> - <class>GtkVBox</class> - <name>vbox2</name> - <width>27</width> - <homogeneous>False</homogeneous> - <spacing>4</spacing> - - <widget> - <class>GtkButton</class> - <name>button-1</name> - <label>123</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-a</name> - <label>a</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-b</name> - <label>b</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-c</name> - <label>c</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-d</name> - <label>d</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-e</name> - <label>e</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-f</name> - <label>f</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-g</name> - <label>g</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-h</name> - <label>h</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-i</name> - <label>i</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-j</name> - <label>j</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-k</name> - <label>k</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-l</name> - <label>l</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-m</name> - <label>m</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-n</name> - <label>n</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-o</name> - <label>o</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-p</name> - <label>p</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-q</name> - <label>q</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-r</name> - <label>r</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-s</name> - <label>s</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-t</name> - <label>t</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-u</name> - <label>u</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-v</name> - <label>v</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-w</name> - <can_focus>True</can_focus> - <label>w</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-x</name> - <label>x</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-y</name> - <label>y</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - - <widget> - <class>GtkButton</class> - <name>button-z</name> - <label>z</label> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/addressbook/gui/widgets/alphabet.glade.h b/addressbook/gui/widgets/alphabet.glade.h deleted file mode 100644 index 2448eeb4fc..0000000000 --- a/addressbook/gui/widgets/alphabet.glade.h +++ /dev/null @@ -1,34 +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_("window2"); -gchar *s = N_("123"); -gchar *s = N_("a"); -gchar *s = N_("b"); -gchar *s = N_("c"); -gchar *s = N_("d"); -gchar *s = N_("e"); -gchar *s = N_("f"); -gchar *s = N_("g"); -gchar *s = N_("h"); -gchar *s = N_("i"); -gchar *s = N_("j"); -gchar *s = N_("k"); -gchar *s = N_("l"); -gchar *s = N_("m"); -gchar *s = N_("n"); -gchar *s = N_("o"); -gchar *s = N_("p"); -gchar *s = N_("q"); -gchar *s = N_("r"); -gchar *s = N_("s"); -gchar *s = N_("t"); -gchar *s = N_("u"); -gchar *s = N_("v"); -gchar *s = N_("w"); -gchar *s = N_("x"); -gchar *s = N_("y"); -gchar *s = N_("z"); diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c deleted file mode 100644 index d46b42fe00..0000000000 --- a/addressbook/gui/widgets/e-addressbook-model.c +++ /dev/null @@ -1,421 +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 "e-addressbook-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; - -/* - * EAddressbookModel callbacks - * These are the callbacks that define the behavior of our custom model. - */ -static void e_addressbook_model_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_addressbook_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); - - -enum { - ARG_0, - ARG_BOOK, - ARG_QUERY, - ARG_EDITABLE, -}; - -static void -addressbook_destroy(GtkObject *object) -{ - EAddressbookModel *model = E_ADDRESSBOOK_MODEL(object); - int i; - - if (model->get_view_idle) - g_source_remove(model->get_view_idle); - if (model->book_view && model->create_card_id) - gtk_signal_disconnect(GTK_OBJECT (model->book_view), - model->create_card_id); - if (model->book_view && model->remove_card_id) - gtk_signal_disconnect(GTK_OBJECT (model->book_view), - model->remove_card_id); - if (model->book_view && model->modify_card_id) - gtk_signal_disconnect(GTK_OBJECT (model->book_view), - model->modify_card_id); - if (model->book) - gtk_object_unref(GTK_OBJECT(model->book)); - if (model->book_view) - gtk_object_unref(GTK_OBJECT(model->book_view)); - - for ( i = 0; i < model->data_count; i++ ) { - gtk_object_unref(GTK_OBJECT(model->data[i])); - } - g_free(model->data); -} - -/* This function returns the number of columns in our ETableModel. */ -static int -addressbook_col_count (ETableModel *etc) -{ - return E_CARD_SIMPLE_FIELD_LAST; -} - -/* This function returns the number of rows in our ETableModel. */ -static int -addressbook_row_count (ETableModel *etc) -{ - EAddressbookModel *addressbook = E_ADDRESSBOOK_MODEL(etc); - return addressbook->data_count; -} - -/* This function returns the value at a particular point in our ETableModel. */ -static void * -addressbook_value_at (ETableModel *etc, int col, int row) -{ - EAddressbookModel *addressbook = E_ADDRESSBOOK_MODEL(etc); - const char *value; - if ( col >= E_CARD_SIMPLE_FIELD_LAST - 1 || row >= addressbook->data_count ) - return NULL; - - value = e_card_simple_get_const(addressbook->data[row], - col + 1); - return (void *)(value ? value : ""); -} - -/* This function sets the value at a particular point in our ETableModel. */ -static void -addressbook_set_value_at (ETableModel *etc, int col, int row, const void *val) -{ - EAddressbookModel *addressbook = E_ADDRESSBOOK_MODEL(etc); - ECard *card; - if (addressbook->editable) { - if ( col >= E_CARD_SIMPLE_FIELD_LAST - 1|| row >= addressbook->data_count ) - return; - e_card_simple_set(addressbook->data[row], - col + 1, - val); - gtk_object_get(GTK_OBJECT(addressbook->data[row]), - "card", &card, - NULL); - e_book_commit_card(addressbook->book, card, NULL, NULL); - - e_table_model_cell_changed(etc, col, row); - } -} - -/* This function returns whether a particular cell is editable. */ -static gboolean -addressbook_is_cell_editable (ETableModel *etc, int col, int row) -{ - return E_ADDRESSBOOK_MODEL(etc)->editable; -} - -static void -addressbook_append_row (ETableModel *etm, ETableModel *source, gint row) -{ - ECard *card; - ECardSimple *simple; - EAddressbookModel *addressbook = E_ADDRESSBOOK_MODEL(etm); - int col; - - card = e_card_new(""); - simple = e_card_simple_new(card); - - for (col = 0; col < E_CARD_SIMPLE_FIELD_LAST - 1; col++) { - const void *val = e_table_model_value_at(source, col, row); - e_card_simple_set(simple, - col + 1, - val); - } - e_card_simple_sync_card(simple); - e_book_add_card(addressbook->book, card, NULL, NULL); - gtk_object_unref(GTK_OBJECT(simple)); - gtk_object_unref(GTK_OBJECT(card)); -} - -/* This function duplicates the value passed to it. */ -static void * -addressbook_duplicate_value (ETableModel *etc, int col, const void *value) -{ - return g_strdup(value); -} - -/* This function frees the value passed to it. */ -static void -addressbook_free_value (ETableModel *etc, int col, void *value) -{ - g_free(value); -} - -static void * -addressbook_initialize_value (ETableModel *etc, int col) -{ - return g_strdup(""); -} - -static gboolean -addressbook_value_is_empty (ETableModel *etc, int col, const void *value) -{ - return !(value && *(char *)value); -} - -static char * -addressbook_value_to_string (ETableModel *etc, int col, const void *value) -{ - return g_strdup(value); -} - -static void -create_card(EBookView *book_view, - const GList *cards, - EAddressbookModel *model) -{ - model->data = g_realloc(model->data, (model->data_count + g_list_length((GList *)cards)) * sizeof(ECard *)); - for ( ; cards; cards = cards->next) { - model->data[model->data_count++] = e_card_simple_new (E_CARD(cards->data)); - e_table_model_row_inserted(E_TABLE_MODEL(model), model->data_count - 1); - } -} - -static void -remove_card(EBookView *book_view, - const char *id, - EAddressbookModel *model) -{ - int i; - for ( i = 0; i < model->data_count; i++) { - if ( !strcmp(e_card_simple_get_id(model->data[i]), id) ) { - gtk_object_unref(GTK_OBJECT(model->data[i])); - memmove(model->data + i, model->data + i + 1, (model->data_count - i - 1) * sizeof (ECard *)); - e_table_model_row_deleted(E_TABLE_MODEL(model), i); - } - } -} - -static void -modify_card(EBookView *book_view, - const GList *cards, - EAddressbookModel *model) -{ - for ( ; cards; cards = cards->next) { - int i; - for ( i = 0; i < model->data_count; i++) { - if ( !strcmp(e_card_simple_get_id(model->data[i]), e_card_get_id(E_CARD(cards->data))) ) { - gtk_object_unref(GTK_OBJECT(model->data[i])); - model->data[i] = e_card_simple_new(E_CARD(cards->data)); - gtk_object_ref(GTK_OBJECT(model->data[i])); - e_table_model_row_changed(E_TABLE_MODEL(model), i); - break; - } - } - } -} - -static void -e_addressbook_model_class_init (GtkObjectClass *object_class) -{ - ETableModelClass *model_class = (ETableModelClass *) object_class; - - parent_class = gtk_type_class (PARENT_TYPE); - - object_class->destroy = addressbook_destroy; - object_class->set_arg = e_addressbook_model_set_arg; - object_class->get_arg = e_addressbook_model_get_arg; - - gtk_object_add_arg_type ("EAddressbookModel::book", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_BOOK); - gtk_object_add_arg_type ("EAddressbookModel::query", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_QUERY); - gtk_object_add_arg_type ("EAddressbookModel::editable", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_EDITABLE); - - model_class->column_count = addressbook_col_count; - model_class->row_count = addressbook_row_count; - model_class->value_at = addressbook_value_at; - model_class->set_value_at = addressbook_set_value_at; - model_class->is_cell_editable = addressbook_is_cell_editable; - model_class->append_row = addressbook_append_row; - model_class->duplicate_value = addressbook_duplicate_value; - model_class->free_value = addressbook_free_value; - model_class->initialize_value = addressbook_initialize_value; - model_class->value_is_empty = addressbook_value_is_empty; - model_class->value_to_string = addressbook_value_to_string; -} - -static void -e_addressbook_model_init (GtkObject *object) -{ - EAddressbookModel *model = E_ADDRESSBOOK_MODEL(object); - model->book = NULL; - model->query = g_strdup("(contains \"x-evolution-any-field\" \"\")"); - model->book_view = NULL; - model->get_view_idle = 0; - model->create_card_id = 0; - model->remove_card_id = 0; - model->modify_card_id = 0; - model->data = NULL; - model->data_count = 0; - model->editable = TRUE; -} - -static void -book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointer closure) -{ - EAddressbookModel *model = closure; - int i; - if (model->book_view && model->create_card_id) - gtk_signal_disconnect(GTK_OBJECT (model->book_view), - model->create_card_id); - if (model->book_view && model->remove_card_id) - gtk_signal_disconnect(GTK_OBJECT (model->book_view), - model->remove_card_id); - if (model->book_view && model->modify_card_id) - gtk_signal_disconnect(GTK_OBJECT (model->book_view), - model->modify_card_id); - if (model->book_view) - gtk_object_unref(GTK_OBJECT(model->book_view)); - model->book_view = book_view; - if (model->book_view) - gtk_object_ref(GTK_OBJECT(model->book_view)); - model->create_card_id = gtk_signal_connect(GTK_OBJECT(model->book_view), - "card_added", - GTK_SIGNAL_FUNC(create_card), - model); - model->remove_card_id = gtk_signal_connect(GTK_OBJECT(model->book_view), - "card_removed", - GTK_SIGNAL_FUNC(remove_card), - model); - model->modify_card_id = gtk_signal_connect(GTK_OBJECT(model->book_view), - "card_changed", - GTK_SIGNAL_FUNC(modify_card), - model); - - for ( i = 0; i < model->data_count; i++ ) { - gtk_object_unref(GTK_OBJECT(model->data[i])); - } - - e_table_model_pre_change(E_TABLE_MODEL(model)); - g_free(model->data); - model->data = NULL; - model->data_count = 0; - e_table_model_changed(E_TABLE_MODEL(model)); -} - -static gboolean -get_view(EAddressbookModel *model) -{ - if (model->book && model->query) - e_book_get_book_view(model->book, model->query, book_view_loaded, model); - - model->get_view_idle = 0; - return FALSE; -} - -ECard * -e_addressbook_model_get_card(EAddressbookModel *model, - int row) -{ - if (model->data && row < model->data_count) { - ECard *card; - gtk_object_get(GTK_OBJECT(model->data[row]), - "card", &card, - NULL); - gtk_object_ref(GTK_OBJECT(card)); - return card; - } - return NULL; -} - -static void -e_addressbook_model_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - EAddressbookModel *model; - - model = E_ADDRESSBOOK_MODEL (o); - - switch (arg_id){ - case ARG_BOOK: - if (model->book) - gtk_object_unref(GTK_OBJECT(model->book)); - model->book = E_BOOK(GTK_VALUE_OBJECT (*arg)); - if (model->book) { - gtk_object_ref(GTK_OBJECT(model->book)); - if (model->get_view_idle == 0) - model->get_view_idle = g_idle_add((GSourceFunc)get_view, model); - } - break; - case ARG_QUERY: - if (model->query) - g_free(model->query); - model->query = g_strdup(GTK_VALUE_STRING (*arg)); - if (model->get_view_idle == 0) - model->get_view_idle = g_idle_add((GSourceFunc)get_view, model); - break; - case ARG_EDITABLE: - model->editable = GTK_VALUE_BOOL (*arg); - break; - } -} - -static void -e_addressbook_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EAddressbookModel *e_addressbook_model; - - e_addressbook_model = E_ADDRESSBOOK_MODEL (object); - - switch (arg_id) { - case ARG_BOOK: - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_addressbook_model->book); - break; - case ARG_QUERY: - GTK_VALUE_STRING (*arg) = g_strdup(e_addressbook_model->query); - break; - case ARG_EDITABLE: - GTK_VALUE_BOOL (*arg) = e_addressbook_model->editable; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -GtkType -e_addressbook_model_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "EAddressbookModel", - sizeof (EAddressbookModel), - sizeof (EAddressbookModelClass), - (GtkClassInitFunc) e_addressbook_model_class_init, - (GtkObjectInitFunc) e_addressbook_model_init, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (PARENT_TYPE, &info); - } - - return type; -} - -ETableModel * -e_addressbook_model_new (void) -{ - EAddressbookModel *et; - - et = gtk_type_new (e_addressbook_model_get_type ()); - - return E_TABLE_MODEL(et); -} diff --git a/addressbook/gui/widgets/e-addressbook-model.h b/addressbook/gui/widgets/e-addressbook-model.h deleted file mode 100644 index 8f5f6485cf..0000000000 --- a/addressbook/gui/widgets/e-addressbook-model.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -#ifndef _E_ADDRESSBOOK_MODEL_H_ -#define _E_ADDRESSBOOK_MODEL_H_ - -#include "e-table-model.h" -#include <ebook/e-book.h> -#include <ebook/e-book-view.h> -#include <ebook/e-card-simple.h> - -#define E_ADDRESSBOOK_MODEL_TYPE (e_addressbook_model_get_type ()) -#define E_ADDRESSBOOK_MODEL(o) (GTK_CHECK_CAST ((o), E_ADDRESSBOOK_MODEL_TYPE, EAddressbookModel)) -#define E_ADDRESSBOOK_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_ADDRESSBOOK_MODEL_TYPE, EAddressbookModelClass)) -#define E_IS_ADDRESSBOOK_MODEL(o) (GTK_CHECK_TYPE ((o), E_ADDRESSBOOK_MODEL_TYPE)) -#define E_IS_ADDRESSBOOK_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_ADDRESSBOOK_MODEL_TYPE)) - -/* Virtual Column list: - 0 Email - 1 Full Name - 2 Street - 3 Phone -*/ - -typedef struct { - ETableModel parent; - - /* item specific fields */ - EBook *book; - char *query; - EBookView *book_view; - - int get_view_idle; - - ECardSimple **data; - int data_count; - - int create_card_id, remove_card_id, modify_card_id; - - guint editable : 1; -} EAddressbookModel; - - -typedef struct { - ETableModelClass parent_class; -} EAddressbookModelClass; - - -GtkType e_addressbook_model_get_type (void); -ETableModel *e_addressbook_model_new (void); - -/* Returns object with ref count of 1. */ -ECard *e_addressbook_model_get_card(EAddressbookModel *model, - int row); - -#endif /* _E_ADDRESSBOOK_MODEL_H_ */ diff --git a/addressbook/gui/widgets/e-minicard-control.c b/addressbook/gui/widgets/e-minicard-control.c deleted file mode 100644 index 7c1838b568..0000000000 --- a/addressbook/gui/widgets/e-minicard-control.c +++ /dev/null @@ -1,336 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard-control.c - * - * Authors: - * Chris Lahey <clahey@helixcode.com> - * - * Copyright 1999, 2000, Helix Code, Inc. - */ - -#include <config.h> -#include <gnome.h> -#include <bonobo.h> - -#include "addressbook/backend/ebook/e-book.h" - -#include "e-minicard-control.h" -#include "e-minicard-widget.h" -#include "addressbook/backend/ebook/e-card.h" - -#if 0 -enum { - PROP_RUNNING -} MyArgs; - -#define RUNNING_KEY "Clock::Running" - -static void -get_prop (BonoboPropertyBag *bag, - BonoboArg *arg, - guint arg_id, - gpointer user_data) -{ - GtkObject *clock = user_data; - - switch (arg_id) { - - case PROP_RUNNING: - { - gboolean b = GPOINTER_TO_UINT (gtk_object_get_data (clock, RUNNING_KEY)); - BONOBO_ARG_SET_BOOLEAN (arg, b); - break; - } - - default: - g_warning ("Unhandled arg %d", arg_id); - break; - } -} - -static void -set_prop (BonoboPropertyBag *bag, - const BonoboArg *arg, - guint arg_id, - gpointer user_data) -{ - GtkClock *clock = user_data; - - switch (arg_id) { - - case PROP_RUNNING: - { - guint i; - - i = BONOBO_ARG_GET_BOOLEAN (arg); - - if (i) - gtk_clock_start (clock); - else - gtk_clock_stop (clock); - - gtk_object_set_data (GTK_OBJECT (clock), RUNNING_KEY, - GUINT_TO_POINTER (i)); - break; - } - - default: - g_warning ("Unhandled arg %d", arg_id); - break; - } -} -#endif - -/* - * Bonobo::PersistStream - * - * These two functions implement the Bonobo::PersistStream load and - * save methods which allow data to be loaded into and out of the - * BonoboObject. - */ -static char * -stream_read (Bonobo_Stream stream) -{ - Bonobo_Stream_iobuf *buffer; - CORBA_Environment ev; - char *data = NULL; - gint length = 0; - - CORBA_exception_init (&ev); - do { -#define READ_CHUNK_SIZE 65536 - Bonobo_Stream_read (stream, READ_CHUNK_SIZE, - &buffer, &ev); - - if (ev._major != CORBA_NO_EXCEPTION) { - CORBA_exception_free (&ev); - return NULL; - } - - if (buffer->_length <= 0) - break; - - data = g_realloc (data, - length + buffer->_length); - - memcpy (data + length, - buffer->_buffer, buffer->_length); - - length += buffer->_length; - - CORBA_free (buffer); - } while (1); - - CORBA_free (buffer); - CORBA_exception_free (&ev); - - if (data == NULL) - data = g_strdup(""); - - return data; -} /* stream_read */ - -/* - * This function implements the Bonobo::PersistStream:load method. - */ -static void -pstream_load (BonoboPersistStream *ps, const Bonobo_Stream stream, - Bonobo_Persist_ContentType type, void *data, - CORBA_Environment *ev) -{ - ECard *card; - char *vcard; - GtkWidget *minicard = data; - - if (type && g_strcasecmp (type, "text/vCard") != 0 && - g_strcasecmp (type, "text/x-vCard") != 0) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Bonobo_Persist_WrongDataType, NULL); - return; - } - - if ((vcard = stream_read (stream)) == NULL) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Bonobo_Persist_FileNotFound, NULL); - return; - } - - card = e_card_new(vcard); - g_free(vcard); - gtk_object_set(GTK_OBJECT(minicard), - "card", card, - NULL); - gtk_object_unref(GTK_OBJECT(card)); -} /* pstream_load */ - -/* - * This function implements the Bonobo::PersistStream:save method. - */ -static void -pstream_save (BonoboPersistStream *ps, const Bonobo_Stream stream, - Bonobo_Persist_ContentType type, void *data, - CORBA_Environment *ev) -{ - char *vcard; - ECard *card; - EMinicardWidget *minicard = data; - int length; - - if (type && g_strcasecmp (type, "text/vCard") != 0 && - g_strcasecmp (type, "text/x-vCard") != 0) { - CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_Bonobo_Persist_WrongDataType, NULL); - return; - } - - gtk_object_get (GTK_OBJECT (minicard), - "card", &card, - NULL); - vcard = e_card_get_vcard(card); - length = strlen (vcard); - bonobo_stream_client_write (stream, vcard, length, ev); - g_free (vcard); -} /* pstream_save */ - -static CORBA_long -pstream_get_max_size (BonoboPersistStream *ps, void *data, - CORBA_Environment *ev) -{ - GtkWidget *minicard = data; - ECard *card; - char *vcard; - gint length; - - gtk_object_get (GTK_OBJECT (minicard), - "card", &card, NULL); - vcard = e_card_get_vcard(card); - length = strlen (vcard); - g_free (vcard); - - return length; -} - -static Bonobo_Persist_ContentTypeList * -pstream_get_content_types (BonoboPersistStream *ps, void *closure, - CORBA_Environment *ev) -{ - return bonobo_persist_generate_content_types (2, "text/vCard", "text/x-vCard"); -} - -static void -book_open_cb (EBook *book, EBookStatus status, gpointer closure) -{ - ECard *card = closure; - e_book_add_card(book, card, NULL, NULL); -} - -static void -save_in_addressbook(GtkWidget *button, EMinicardWidget *minicard) -{ - EBook *book; - gchar *path, *uri; - ECard *card; - - book = e_book_new (); - - if (!book) { - printf ("%s: %s(): Couldn't create EBook, bailing.\n", - __FILE__, - __FUNCTION__); - return; - } - - - path = g_concat_dir_and_file (g_get_home_dir (), - "evolution/local/Contacts/addressbook.db"); - uri = g_strdup_printf ("file://%s", path); - g_free (path); - - gtk_object_get(GTK_OBJECT(minicard), - "card", &card, - NULL); - - if (! e_book_load_uri (book, uri, book_open_cb, card)) { - printf ("error calling load_uri!\n"); - } - g_free(uri); -} - -static BonoboObject * -e_minicard_control_factory (BonoboGenericFactory *Factory, void *closure) -{ -#if 0 - BonoboPropertyBag *pb; -#endif - BonoboControl *control; - BonoboPersistStream *stream; - GtkWidget *minicard; - GtkWidget *button; - GtkWidget *vbox; - - /* Create the control. */ - - minicard = e_minicard_widget_new (); - gtk_widget_show (minicard); - - button = gtk_button_new_with_label(_("Save in addressbook")); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(save_in_addressbook), minicard); - gtk_widget_show (button); - - vbox = gtk_vbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), minicard, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); - gtk_widget_show (vbox); - - control = bonobo_control_new (vbox); - - stream = bonobo_persist_stream_new (pstream_load, pstream_save, - pstream_get_max_size, - pstream_get_content_types, - minicard); - -#if 0 - /* Create the properties. */ - pb = bonobo_property_bag_new (get_prop, set_prop, clock); - bonobo_control_set_property_bag (control, pb); - - bonobo_property_bag_add (pb, "running", PROP_RUNNING, - BONOBO_ARG_BOOLEAN, NULL, - "Whether or not the clock is running", 0); -#endif - - if (stream == NULL) { - bonobo_object_unref (BONOBO_OBJECT (control)); - return NULL; - } - - bonobo_object_add_interface (BONOBO_OBJECT (control), - BONOBO_OBJECT (stream)); - - return BONOBO_OBJECT (control); -} - -void -e_minicard_control_factory_init (void) -{ - static BonoboGenericFactory *factory = NULL; - - if (factory != NULL) - return; - -#if USING_OAF - factory = - bonobo_generic_factory_new ( - "OAFIID:control-factory:e_minicard:16bb7c25-c7d2-46dc-a5f0-a0975d0e0595", - e_minicard_control_factory, NULL); -#else - factory = - bonobo_generic_factory_new ( - "control-factory:e-minicard", - e_minicard_control_factory, NULL); -#endif - - if (factory == NULL) - g_error ("I could not register a EMinicard control factory."); -} diff --git a/addressbook/gui/widgets/e-minicard-control.h b/addressbook/gui/widgets/e-minicard-control.h deleted file mode 100644 index 4a0da88435..0000000000 --- a/addressbook/gui/widgets/e-minicard-control.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __E_MINICARD_CONTROL_H__ -#define __E_MINICARD_CONTROL_H__ - -#include <bonobo/bonobo-control.h> - -void e_minicard_control_factory_init (void); - -#endif /* __E_MINICARD_CONTROL_H__ */ diff --git a/addressbook/gui/widgets/e-minicard-label.c b/addressbook/gui/widgets/e-minicard-label.c deleted file mode 100644 index e765a89f21..0000000000 --- a/addressbook/gui/widgets/e-minicard-label.c +++ /dev/null @@ -1,446 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard-label.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 "e-minicard-label.h" -#include "e-text.h" -#include <e-util/e-canvas.h> -#include <e-util/e-util.h> -#include <e-util/e-canvas-utils.h> - -static void e_minicard_label_init (EMinicardLabel *card); -static void e_minicard_label_class_init (EMinicardLabelClass *klass); -static void e_minicard_label_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static gboolean e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event); -static void e_minicard_label_realize (GnomeCanvasItem *item); -static void e_minicard_label_unrealize (GnomeCanvasItem *item); -static void e_minicard_label_reflow(GnomeCanvasItem *item, int flags); - -static void e_minicard_label_resize_children( EMinicardLabel *e_minicard_label ); - -static GnomeCanvasGroupClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0, - ARG_WIDTH, - ARG_HEIGHT, - ARG_HAS_FOCUS, - ARG_FIELD, - ARG_FIELDNAME, - ARG_TEXT_MODEL, - ARG_MAX_FIELD_NAME_WIDTH, -}; - -GtkType -e_minicard_label_get_type (void) -{ - static GtkType minicard_label_type = 0; - - if (!minicard_label_type) - { - static const GtkTypeInfo minicard_label_info = - { - "EMinicardLabel", - sizeof (EMinicardLabel), - sizeof (EMinicardLabelClass), - (GtkClassInitFunc) e_minicard_label_class_init, - (GtkObjectInitFunc) e_minicard_label_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - minicard_label_type = gtk_type_unique (gnome_canvas_group_get_type (), &minicard_label_info); - } - - return minicard_label_type; -} - -static void -e_minicard_label_class_init (EMinicardLabelClass *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 ("EMinicardLabel::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("EMinicardLabel::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("EMinicardLabel::has_focus", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_HAS_FOCUS); - gtk_object_add_arg_type ("EMinicardLabel::field", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_FIELD); - gtk_object_add_arg_type ("EMinicardLabel::fieldname", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_FIELDNAME); - gtk_object_add_arg_type ("EMinicardLabel::text_model", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_TEXT_MODEL); - gtk_object_add_arg_type ("EMinicardLabel::max_field_name_length", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_MAX_FIELD_NAME_WIDTH); - - object_class->set_arg = e_minicard_label_set_arg; - object_class->get_arg = e_minicard_label_get_arg; - /* object_class->destroy = e_minicard_label_destroy; */ - - /* GnomeCanvasItem method overrides */ - item_class->realize = e_minicard_label_realize; - item_class->unrealize = e_minicard_label_unrealize; - item_class->event = e_minicard_label_event; -} - -static void -e_minicard_label_init (EMinicardLabel *minicard_label) -{ - minicard_label->width = 10; - minicard_label->height = 10; - minicard_label->rect = NULL; - minicard_label->fieldname = NULL; - minicard_label->field = NULL; - - minicard_label->max_field_name_length = -1; - - e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(minicard_label), e_minicard_label_reflow); -} - -static void -e_minicard_label_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EMinicardLabel *e_minicard_label; - - item = GNOME_CANVAS_ITEM (o); - e_minicard_label = E_MINICARD_LABEL (o); - - switch (arg_id){ - case ARG_WIDTH: - e_minicard_label->width = GTK_VALUE_DOUBLE (*arg); - e_minicard_label_resize_children(e_minicard_label); - e_canvas_item_request_reflow (item); - break; - case ARG_HAS_FOCUS: - if (e_minicard_label->field && (GTK_VALUE_ENUM(*arg) != E_FOCUS_NONE)) - e_canvas_item_grab_focus(e_minicard_label->field); - break; - case ARG_FIELD: - gnome_canvas_item_set( e_minicard_label->field, "text", GTK_VALUE_STRING (*arg), NULL ); - break; - case ARG_FIELDNAME: - gnome_canvas_item_set( e_minicard_label->fieldname, "text", GTK_VALUE_STRING (*arg), NULL ); - break; - case ARG_TEXT_MODEL: - gnome_canvas_item_set( e_minicard_label->field, "model", GTK_VALUE_OBJECT (*arg), NULL); - break; - case ARG_MAX_FIELD_NAME_WIDTH: - e_minicard_label->max_field_name_length = GTK_VALUE_DOUBLE (*arg); - break; - } -} - -static void -e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EMinicardLabel *e_minicard_label; - char *temp; - ETextModel *tempmodel; - - e_minicard_label = E_MINICARD_LABEL (object); - - switch (arg_id) { - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_minicard_label->width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = e_minicard_label->height; - break; - case ARG_HAS_FOCUS: - GTK_VALUE_ENUM (*arg) = e_minicard_label->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE; - break; - case ARG_FIELD: - gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - break; - case ARG_FIELDNAME: - gtk_object_get( GTK_OBJECT( e_minicard_label->fieldname ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - break; - case ARG_TEXT_MODEL: - gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "model", &tempmodel, NULL ); - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(tempmodel); - break; - case ARG_MAX_FIELD_NAME_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_minicard_label->max_field_name_length; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_minicard_label_realize (GnomeCanvasItem *item) -{ - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) - (* GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) (item); - - e_canvas_item_request_reflow(item); - - if (!item->canvas->aa) - { - } -} - -void -e_minicard_label_construct (GnomeCanvasItem *item) -{ - EMinicardLabel *e_minicard_label; - GnomeCanvasGroup *group; - static GdkFont *font = NULL; - - if (font == NULL) { - font = gdk_font_load("lucidasans-10"); - } - - e_minicard_label = E_MINICARD_LABEL (item); - group = GNOME_CANVAS_GROUP( item ); - - e_minicard_label->rect = - gnome_canvas_item_new( group, - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) e_minicard_label->width - 1, - "y2", (double) e_minicard_label->height - 1, - "outline_color", NULL, - NULL ); - e_minicard_label->fieldname = - gnome_canvas_item_new( group, - e_text_get_type(), - "anchor", GTK_ANCHOR_NW, - "clip_width", (double) ( e_minicard_label->width / 2 - 4 ), - "clip", TRUE, - "use_ellipsis", TRUE, - "font_gdk", font, - "fill_color", "black", - NULL ); - e_canvas_item_move_absolute(e_minicard_label->fieldname, 2, 1); - - e_minicard_label->field = - gnome_canvas_item_new( group, - e_text_get_type(), - "anchor", GTK_ANCHOR_NW, - "clip_width", (double) ( ( e_minicard_label->width + 1 ) / 2 - 4 ), - "clip", TRUE, - "use_ellipsis", TRUE, - "font_gdk", font, - "fill_color", "black", - "editable", TRUE, - NULL ); - e_canvas_item_move_absolute(e_minicard_label->field, ( e_minicard_label->width / 2 + 2), 1); - - e_canvas_item_request_reflow(item); -} - -static void -e_minicard_label_unrealize (GnomeCanvasItem *item) -{ - EMinicardLabel *e_minicard_label; - - e_minicard_label = E_MINICARD_LABEL (item); - - if (!item->canvas->aa) - { - } - - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->unrealize) - (* GNOME_CANVAS_ITEM_CLASS( parent_class )->unrealize) (item); -} - -static gboolean -e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EMinicardLabel *e_minicard_label; - - e_minicard_label = E_MINICARD_LABEL (item); - - switch( event->type ) - { - case GDK_FOCUS_CHANGE: - { - GdkEventFocus *focus_event = (GdkEventFocus *) event; - if ( focus_event->in ) - { - gnome_canvas_item_set( e_minicard_label->rect, - "outline_color", "grey50", - "fill_color", "grey90", - NULL ); - e_minicard_label->has_focus = TRUE; - } - else - { - gnome_canvas_item_set( e_minicard_label->rect, - "outline_color", NULL, - "fill_color", NULL, - NULL ); - e_minicard_label->has_focus = FALSE; - } - } - break; - case GDK_BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - case GDK_MOTION_NOTIFY: - case GDK_ENTER_NOTIFY: - case GDK_LEAVE_NOTIFY: { - gboolean return_val; -#if 0 - GnomeCanvasItem *field; - ArtPoint p; - double inv[6], affine[6]; - - field = e_minicard_label->field; - art_affine_identity (affine); - - if (field->xform != NULL) { - if (field->object.flags & GNOME_CANVAS_ITEM_AFFINE_FULL) { - art_affine_multiply (affine, affine, field->xform); - } else { - affine[4] += field->xform[0]; - affine[5] += field->xform[1]; - } - } - - art_affine_invert (inv, affine); - switch(event->type) { - case GDK_MOTION_NOTIFY: - p.x = event->motion.x; - p.y = event->motion.y; - art_affine_point (&p, &p, inv); - event->motion.x = p.x; - event->motion.y = p.y; - break; - case GDK_BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - p.x = event->button.x; - p.y = event->button.y; - art_affine_point (&p, &p, inv); - event->button.x = p.x; - event->button.y = p.y; - break; - case GDK_ENTER_NOTIFY: - case GDK_LEAVE_NOTIFY: - p.x = event->crossing.x; - p.y = event->crossing.y; - art_affine_point (&p, &p, inv); - event->crossing.x = p.x; - event->crossing.y = p.y; - break; - default: - break; - } -#endif - gtk_signal_emit_by_name(GTK_OBJECT(e_minicard_label->field), "event", event, &return_val); - return return_val; - 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_minicard_label_resize_children(EMinicardLabel *e_minicard_label) -{ - double left_width; - if (e_minicard_label->max_field_name_length != -1 && ((e_minicard_label->width / 2) - 4 > e_minicard_label->max_field_name_length)) - left_width = e_minicard_label->max_field_name_length; - else - left_width = e_minicard_label->width / 2 - 4; - - gnome_canvas_item_set( e_minicard_label->fieldname, - "clip_width", (double) ( left_width ), - NULL ); - gnome_canvas_item_set( e_minicard_label->field, - "clip_width", (double) ( e_minicard_label->width - 8 - left_width ), - NULL ); -} - -static void -e_minicard_label_reflow(GnomeCanvasItem *item, int flags) -{ - EMinicardLabel *e_minicard_label = E_MINICARD_LABEL(item); - - gint old_height; - gdouble text_height; - gdouble left_width; - - old_height = e_minicard_label->height; - - gtk_object_get(GTK_OBJECT(e_minicard_label->fieldname), - "text_height", &text_height, - NULL); - - e_minicard_label->height = text_height; - - - gtk_object_get(GTK_OBJECT(e_minicard_label->field), - "text_height", &text_height, - NULL); - - if (e_minicard_label->height < text_height) - e_minicard_label->height = text_height; - e_minicard_label->height += 3; - - gnome_canvas_item_set( e_minicard_label->rect, - "x2", (double) e_minicard_label->width - 1, - "y2", (double) e_minicard_label->height - 1, - NULL ); - - if (e_minicard_label->max_field_name_length != -1 && ((e_minicard_label->width / 2) - 4 > e_minicard_label->max_field_name_length)) - left_width = e_minicard_label->max_field_name_length; - else - left_width = e_minicard_label->width / 2 - 4; - - e_canvas_item_move_absolute(e_minicard_label->field, left_width + 6, 1); - - if (old_height != e_minicard_label->height) - e_canvas_item_request_parent_reflow(item); -} - -GnomeCanvasItem * -e_minicard_label_new(GnomeCanvasGroup *parent) -{ - GnomeCanvasItem *item = gnome_canvas_item_new(parent, e_minicard_label_get_type(), NULL); - e_minicard_label_construct(item); - return item; -} - diff --git a/addressbook/gui/widgets/e-minicard-label.h b/addressbook/gui/widgets/e-minicard-label.h deleted file mode 100644 index 08eb51ee53..0000000000 --- a/addressbook/gui/widgets/e-minicard-label.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard-label.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_MINICARD_LABEL_H__ -#define __E_MINICARD_LABEL_H__ - -#include <gnome.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EMinicardLabel - A label doing focus with non-marching ants. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * width double RW width of the label - * height double R height of the label - * field string RW text in the field label - * fieldname string RW text in the fieldname label - */ - -#define E_MINICARD_LABEL_TYPE (e_minicard_label_get_type ()) -#define E_MINICARD_LABEL(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_LABEL_TYPE, EMinicardLabel)) -#define E_MINICARD_LABEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_LABEL_TYPE, EMiniCardLabelClass)) -#define E_IS_MINICARD_LABEL(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_LABEL_TYPE)) -#define E_IS_MINICARD_LABEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_LABEL_TYPE)) - - -typedef struct _EMinicardLabel EMinicardLabel; -typedef struct _EMinicardLabelClass EMinicardLabelClass; - -struct _EMinicardLabel -{ - GnomeCanvasGroup parent; - - /* item specific fields */ - double width; - double height; - double max_field_name_length; - GnomeCanvasItem *fieldname; - GnomeCanvasItem *field; - GnomeCanvasItem *rect; - - gboolean has_focus; -}; - -struct _EMinicardLabelClass -{ - GnomeCanvasGroupClass parent_class; -}; - - -GtkType e_minicard_label_get_type (void); -GnomeCanvasItem *e_minicard_label_new(GnomeCanvasGroup *parent); -void e_minicard_label_construct (GnomeCanvasItem *item); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_MINICARD_LABEL_H__ */ diff --git a/addressbook/gui/widgets/e-minicard-view-widget.c b/addressbook/gui/widgets/e-minicard-view-widget.c deleted file mode 100644 index cd1a999f14..0000000000 --- a/addressbook/gui/widgets/e-minicard-view-widget.c +++ /dev/null @@ -1,267 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard-view-widget.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 <e-util/e-canvas.h> -#include "e-minicard-view-widget.h" -static void e_minicard_view_widget_init (EMinicardViewWidget *widget); -static void e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass); -static void e_minicard_view_widget_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_minicard_view_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_minicard_view_widget_destroy (GtkObject *object); -static void e_minicard_view_widget_reflow (ECanvas *canvas); -static void e_minicard_view_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static void e_minicard_view_widget_realize (GtkWidget *widget); - -static ECanvasClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0, - ARG_BOOK, - ARG_QUERY -}; - -GtkType -e_minicard_view_widget_get_type (void) -{ - static GtkType type = 0; - - if (!type) - { - static const GtkTypeInfo info = - { - "EMinicardViewWidget", - sizeof (EMinicardViewWidget), - sizeof (EMinicardViewWidgetClass), - (GtkClassInitFunc) e_minicard_view_widget_class_init, - (GtkObjectInitFunc) e_minicard_view_widget_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (e_canvas_get_type (), &info); - } - - return type; -} - -static void -e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - ECanvasClass *canvas_class; - - object_class = (GtkObjectClass*) klass; - widget_class = GTK_WIDGET_CLASS (klass); - canvas_class = E_CANVAS_CLASS (klass); - - parent_class = gtk_type_class (e_canvas_get_type ()); - - gtk_object_add_arg_type ("EMinicardViewWidget::book", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_BOOK); - gtk_object_add_arg_type ("EMinicardViewWidget::query", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_QUERY); - - object_class->set_arg = e_minicard_view_widget_set_arg; - object_class->get_arg = e_minicard_view_widget_get_arg; - object_class->destroy = e_minicard_view_widget_destroy; - - widget_class->realize = e_minicard_view_widget_realize; - widget_class->size_allocate = e_minicard_view_widget_size_allocate; - - canvas_class->reflow = e_minicard_view_widget_reflow; -} - -static void -e_minicard_view_widget_init (EMinicardViewWidget *view) -{ - view->emv = NULL; - view->rect = NULL; - - view->book = NULL; - view->query = NULL; -} - -GtkWidget * -e_minicard_view_widget_new (void) -{ - return GTK_WIDGET (gtk_type_new (e_minicard_view_widget_get_type ())); -} - -static void -e_minicard_view_widget_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - EMinicardViewWidget *emvw; - - emvw = E_MINICARD_VIEW_WIDGET (o); - - switch (arg_id){ - case ARG_BOOK: - if (emvw->book) - gtk_object_unref(GTK_OBJECT(emvw->book)); - emvw->book = E_BOOK(GTK_VALUE_OBJECT (*arg)); - if (emvw->book) - gtk_object_ref(GTK_OBJECT(emvw->book)); - if (emvw->emv) - gtk_object_set(GTK_OBJECT(emvw->emv), - "book", emvw->book, - NULL); - break; - case ARG_QUERY: - emvw->query = g_strdup(GTK_VALUE_STRING (*arg)); - if (emvw->emv) - gtk_object_set(GTK_OBJECT(emvw->emv), - "query", emvw->query, - NULL); - break; - } -} - -static void -e_minicard_view_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EMinicardViewWidget *emvw; - - emvw = E_MINICARD_VIEW_WIDGET (object); - - switch (arg_id) { - case ARG_BOOK: - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(emvw->book); - break; - case ARG_QUERY: - GTK_VALUE_STRING (*arg) = g_strdup(emvw->query); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_minicard_view_widget_destroy (GtkObject *object) -{ - EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(object); - - if (view->book) - gtk_object_unref(GTK_OBJECT(view->book)); - g_free(view->query); - - GTK_OBJECT_CLASS(parent_class)->destroy (object); -} - -static void -e_minicard_view_widget_realize (GtkWidget *widget) -{ - EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(widget); - - view->rect = gnome_canvas_item_new( - gnome_canvas_root( GNOME_CANVAS(view) ), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - - view->emv = gnome_canvas_item_new( - gnome_canvas_root( GNOME_CANVAS(view) ), - e_minicard_view_get_type(), - "height", (double) 100, - "minimum_width", (double) 100, - NULL ); - gtk_object_set(GTK_OBJECT(view->emv), - "book", view->book, - "query", view->query, - NULL); - - if (GTK_WIDGET_CLASS(parent_class)->realize) - GTK_WIDGET_CLASS(parent_class)->realize (widget); -} - -static void -e_minicard_view_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation) -{ - if (GTK_WIDGET_CLASS(parent_class)->size_allocate) - GTK_WIDGET_CLASS(parent_class)->size_allocate (widget, allocation); - - if (GTK_WIDGET_REALIZED(widget)) { - double width; - EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(widget); - - gnome_canvas_item_set( view->emv, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( view->emv, - "minimum_width", (double) allocation->width, - NULL ); - gtk_object_get(GTK_OBJECT(view->emv), - "width", &width, - NULL); - width = MAX(width, allocation->width); - gnome_canvas_set_scroll_region (GNOME_CANVAS (view), 0, 0, width - 1, allocation->height - 1); - gnome_canvas_item_set( view->rect, - "x2", (double) width, - "y2", (double) allocation->height, - NULL ); - } -} - -static void -e_minicard_view_widget_reflow(ECanvas *canvas) -{ - double width; - EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(canvas); - - if (E_CANVAS_CLASS(parent_class)->reflow) - E_CANVAS_CLASS(parent_class)->reflow (canvas); - - gtk_object_get(GTK_OBJECT(view->emv), - "width", &width, - NULL); - width = MAX(width, GTK_WIDGET(canvas)->allocation.width); - gnome_canvas_set_scroll_region(GNOME_CANVAS(canvas), 0, 0, width - 1, GTK_WIDGET(canvas)->allocation.width - 1); - gnome_canvas_item_set( view->rect, - "x2", (double) width, - "y2", (double) GTK_WIDGET(canvas)->allocation.height, - NULL ); -} - -void -e_minicard_view_widget_remove_selection(EMinicardViewWidget *view, - EBookCallback cb, - gpointer closure) -{ - if (view->emv) - e_minicard_view_remove_selection(E_MINICARD_VIEW(view->emv), cb, closure); -} - -void e_minicard_view_widget_jump_to_letter (EMinicardViewWidget *view, - char letter) -{ - if (view->emv) - e_minicard_view_jump_to_letter(E_MINICARD_VIEW(view->emv), letter); -} diff --git a/addressbook/gui/widgets/e-minicard-view-widget.h b/addressbook/gui/widgets/e-minicard-view-widget.h deleted file mode 100644 index 340fb1e03c..0000000000 --- a/addressbook/gui/widgets/e-minicard-view-widget.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard-view-widget.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_MINICARD_VIEW_WIDGET_H__ -#define __E_MINICARD_VIEW_WIDGET_H__ - -#include <gnome.h> -#include "e-minicard-view.h" -#include "e-util/e-canvas.h" -#include <ebook/e-book.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#define E_MINICARD_VIEW_WIDGET_TYPE (e_minicard_view_widget_get_type ()) -#define E_MINICARD_VIEW_WIDGET(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_VIEW_WIDGET_TYPE, EMinicardViewWidget)) -#define E_MINICARD_VIEW_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_VIEW_WIDGET_TYPE, EMinicardViewWidgetClass)) -#define E_IS_MINICARD_VIEW_WIDGET(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_VIEW_WIDGET_TYPE)) -#define E_IS_MINICARD_VIEW_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_VIEW_WIDGET_TYPE)) - - -typedef struct _EMinicardViewWidget EMinicardViewWidget; -typedef struct _EMinicardViewWidgetClass EMinicardViewWidgetClass; - -struct _EMinicardViewWidget -{ - ECanvas parent; - - GnomeCanvasItem *rect; - GnomeCanvasItem *emv; - - EBook *book; - char *query; -}; - -struct _EMinicardViewWidgetClass -{ - ECanvasClass parent_class; -}; - -GtkType e_minicard_view_widget_get_type (void); -void e_minicard_view_widget_remove_selection (EMinicardViewWidget *view, - EBookCallback cb, - gpointer closure); -void e_minicard_view_widget_jump_to_letter (EMinicardViewWidget *view, - char letter); - -GtkWidget *e_minicard_view_widget_new (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __E_MINICARD_VIEW_WIDGET_H__ */ diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c deleted file mode 100644 index 011ff9158f..0000000000 --- a/addressbook/gui/widgets/e-minicard-view.c +++ /dev/null @@ -1,432 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard-view.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 <e-util/e-canvas.h> -#include "e-minicard-view.h" -#include "e-minicard.h" -#include "e-contact-editor.h" -static void e_minicard_view_init (EMinicardView *reflow); -static void e_minicard_view_class_init (EMinicardViewClass *klass); -static void e_minicard_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_minicard_view_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_minicard_view_destroy (GtkObject *object); -static gboolean e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event); -static void canvas_destroy (GtkObject *object, EMinicardView *view); -static void disconnect_signals (EMinicardView *view); - -static EReflowSortedClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0, - ARG_BOOK, - ARG_QUERY -}; - -GtkType -e_minicard_view_get_type (void) -{ - static GtkType reflow_type = 0; - - if (!reflow_type) - { - static const GtkTypeInfo reflow_info = - { - "EMinicardView", - sizeof (EMinicardView), - sizeof (EMinicardViewClass), - (GtkClassInitFunc) e_minicard_view_class_init, - (GtkObjectInitFunc) e_minicard_view_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - reflow_type = gtk_type_unique (e_reflow_sorted_get_type (), &reflow_info); - } - - return reflow_type; -} - -static void -e_minicard_view_class_init (EMinicardViewClass *klass) -{ - GtkObjectClass *object_class; - GnomeCanvasItemClass *item_class; - - object_class = (GtkObjectClass*) klass; - item_class = (GnomeCanvasItemClass *) klass; - - parent_class = gtk_type_class (e_reflow_sorted_get_type ()); - - gtk_object_add_arg_type ("EMinicardView::book", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_BOOK); - gtk_object_add_arg_type ("EMinicardView::query", GTK_TYPE_STRING, - GTK_ARG_READWRITE, ARG_QUERY); - - object_class->set_arg = e_minicard_view_set_arg; - object_class->get_arg = e_minicard_view_get_arg; - object_class->destroy = e_minicard_view_destroy; - - item_class->event = e_minicard_view_event; - - /* GnomeCanvasItem method overrides */ -} - -static void -e_minicard_view_init (EMinicardView *view) -{ - view->book = NULL; - view->query = g_strdup("(contains \"x-evolution-any-field\" \"\")"); - view->book_view = NULL; - view->get_view_idle = 0; - view->create_card_id = 0; - view->remove_card_id = 0; - view->modify_card_id = 0; - view->canvas_destroy_id = 0; - - gtk_object_set(GTK_OBJECT(view), - "empty_message", _("\n\nThere are no items to show in this view\n\n" - "Double-click here to create a new Contact."), - NULL); - - E_REFLOW_SORTED(view)->compare_func = (GCompareFunc) e_minicard_compare; - E_REFLOW_SORTED(view)->string_func = (EReflowStringFunc) e_minicard_get_card_id; -} - -static void -create_card(EBookView *book_view, const GList *cards, EMinicardView *view) -{ - for (; cards; cards = g_list_next(cards)) { - GnomeCanvasItem *item = gnome_canvas_item_new(GNOME_CANVAS_GROUP(view), - e_minicard_get_type(), - "card", cards->data, - NULL); - e_reflow_add_item(E_REFLOW(view), item); - } -} - -static void -modify_card(EBookView *book_view, const GList *cards, EMinicardView *view) -{ - for (; cards; cards = g_list_next(cards)) { - ECard *card = cards->data; - gchar *id = e_card_get_id(card); - GnomeCanvasItem *item = e_reflow_sorted_get_item(E_REFLOW_SORTED(view), id); - if (item && !GTK_OBJECT_DESTROYED(item)) { - gnome_canvas_item_set(item, - "card", card, - NULL); - e_reflow_sorted_reorder_item(E_REFLOW_SORTED(view), id); - } - } -} - -static void -remove_card(EBookView *book_view, const char *id, EMinicardView *view) -{ - e_reflow_sorted_remove_item(E_REFLOW_SORTED(view), id); -} - -static void -book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointer closure) -{ - EMinicardView *view = closure; - disconnect_signals(view); - if (view->book_view) - gtk_object_unref(GTK_OBJECT(view->book_view)); - - if (!view->canvas_destroy_id) - view->canvas_destroy_id = - gtk_signal_connect(GTK_OBJECT(GNOME_CANVAS_ITEM(view)->canvas), - "destroy", GTK_SIGNAL_FUNC(canvas_destroy), - view); - - view->book_view = book_view; - if (view->book_view) - gtk_object_ref(GTK_OBJECT(view->book_view)); - - - view->create_card_id = gtk_signal_connect(GTK_OBJECT(view->book_view), - "card_added", - GTK_SIGNAL_FUNC(create_card), - view); - view->remove_card_id = gtk_signal_connect(GTK_OBJECT(view->book_view), - "card_removed", - GTK_SIGNAL_FUNC(remove_card), - view); - view->modify_card_id = gtk_signal_connect(GTK_OBJECT(view->book_view), - "card_changed", - GTK_SIGNAL_FUNC(modify_card), - view); - - g_list_foreach(E_REFLOW(view)->items, (GFunc) gtk_object_unref, NULL); - g_list_foreach(E_REFLOW(view)->items, (GFunc) gtk_object_destroy, NULL); - g_list_free(E_REFLOW(view)->items); - E_REFLOW(view)->items = NULL; - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(view)); -} - -static gboolean -get_view(EMinicardView *view) -{ - if (view->book && view->query) - e_book_get_book_view(view->book, view->query, book_view_loaded, view); - - view->get_view_idle = 0; - return FALSE; -} - -static void -e_minicard_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EMinicardView *view; - - item = GNOME_CANVAS_ITEM (o); - view = E_MINICARD_VIEW (o); - - switch (arg_id){ - case ARG_BOOK: - if (view->book) - gtk_object_unref(GTK_OBJECT(view->book)); - if (GTK_VALUE_OBJECT (*arg)) { - view->book = E_BOOK(GTK_VALUE_OBJECT (*arg)); - gtk_object_ref(GTK_OBJECT(view->book)); - if (view->get_view_idle == 0) - view->get_view_idle = g_idle_add((GSourceFunc)get_view, view); - } - else - view->book = NULL; - break; - case ARG_QUERY: - g_free(view->query); - view->query = g_strdup(GTK_VALUE_STRING (*arg)); - if (view->get_view_idle == 0) - view->get_view_idle = g_idle_add((GSourceFunc)get_view, view); - break; - } -} - -static void -e_minicard_view_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EMinicardView *e_minicard_view; - - e_minicard_view = E_MINICARD_VIEW (object); - - switch (arg_id) { - case ARG_BOOK: - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_minicard_view->book); - break; - case ARG_QUERY: - GTK_VALUE_STRING (*arg) = g_strdup(e_minicard_view->query); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_minicard_view_destroy (GtkObject *object) -{ - EMinicardView *view = E_MINICARD_VIEW(object); - - if (view->get_view_idle) - g_source_remove(view->get_view_idle); - if (view->canvas_destroy_id) - gtk_signal_disconnect(GTK_OBJECT (GNOME_CANVAS_ITEM(view)->canvas), - view->canvas_destroy_id); - disconnect_signals(view); - g_free(view->query); - if (view->book) - gtk_object_unref(GTK_OBJECT(view->book)); - if (view->book_view) - gtk_object_unref(GTK_OBJECT(view->book_view)); - - GTK_OBJECT_CLASS(parent_class)->destroy (object); -} - -static void -card_added_cb (EBook* book, EBookStatus status, const char *id, - gpointer user_data) -{ - g_print ("%s: %s(): a card was added\n", __FILE__, __FUNCTION__); -} - -static void -card_changed_cb (EBook* book, EBookStatus status, gpointer user_data) -{ - g_print ("%s: %s(): a card was changed with status %d\n", __FILE__, __FUNCTION__, status); -} - -/* Callback for the add_card signal from the contact editor */ -static void -add_card_cb (EContactEditor *ce, ECard *card, gpointer data) -{ - EBook *book; - - book = E_BOOK (data); - e_book_add_card (book, card, card_added_cb, NULL); -} - -/* Callback for the commit_card signal from the contact editor */ -static void -commit_card_cb (EContactEditor *ce, ECard *card, gpointer data) -{ - EBook *book; - - book = E_BOOK (data); - e_book_commit_card (book, card, card_changed_cb, NULL); -} - -/* Callback used when the contact editor is closed */ -static void -editor_closed_cb (EContactEditor *ce, gpointer data) -{ - gtk_object_unref (GTK_OBJECT (ce)); -} - -static gboolean -e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EMinicardView *view; - - view = E_MINICARD_VIEW (item); - - switch( event->type ) { - case GDK_2BUTTON_PRESS: - if (((GdkEventButton *)event)->button == 1) - { - ECard *card; - EContactEditor *ce; - EBook *book; - - card = e_card_new(""); - - gtk_object_get(GTK_OBJECT(view), "book", &book, NULL); - g_assert (E_IS_BOOK (book)); - - ce = e_contact_editor_new (card, TRUE); - - gtk_signal_connect (GTK_OBJECT (ce), "add_card", - GTK_SIGNAL_FUNC (add_card_cb), book); - gtk_signal_connect (GTK_OBJECT (ce), "commit_card", - GTK_SIGNAL_FUNC (commit_card_cb), book); - gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", - GTK_SIGNAL_FUNC (editor_closed_cb), NULL); - - gtk_object_sink(GTK_OBJECT(card)); - } - return TRUE; - default: - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event) - return GNOME_CANVAS_ITEM_CLASS(parent_class)->event(item, event); - else - return FALSE; - break; - } -} - -static void -disconnect_signals(EMinicardView *view) -{ - if (view->book_view && view->create_card_id) - gtk_signal_disconnect(GTK_OBJECT (view->book_view), - view->create_card_id); - if (view->book_view && view->remove_card_id) - gtk_signal_disconnect(GTK_OBJECT (view->book_view), - view->remove_card_id); - if (view->book_view && view->modify_card_id) - gtk_signal_disconnect(GTK_OBJECT (view->book_view), - view->modify_card_id); - - view->create_card_id = 0; - view->remove_card_id = 0; - view->modify_card_id = 0; -} - -static void -canvas_destroy(GtkObject *object, EMinicardView *view) -{ - disconnect_signals(view); -} - -void -e_minicard_view_remove_selection(EMinicardView *view, - EBookCallback cb, - gpointer closure) -{ - if (view->book) { - EReflow *reflow = E_REFLOW(view); - GList *list; - for (list = reflow->items; list; list = g_list_next(list)) { - GnomeCanvasItem *item = list->data; - gboolean has_focus; - gtk_object_get(GTK_OBJECT(item), - "has_focus", &has_focus, - NULL); - if (has_focus) { - ECard *card; - gtk_object_get(GTK_OBJECT(item), - "card", &card, - NULL); - e_book_remove_card(view->book, card, cb, closure); - return; - } - } - } -} - -static int -compare_to_letter(EMinicard *card, char *letter) -{ - g_return_val_if_fail(card != NULL, 0); - g_return_val_if_fail(E_IS_MINICARD(card), 0); - - if (*letter == '1') - return 1; - - if (card->card) { - char *file_as; - gtk_object_get(GTK_OBJECT(card->card), - "file_as", &file_as, - NULL); - if (file_as) - return strncasecmp(file_as, letter, 1); - else - return 0; - } else { - return 0; - } -} - -void e_minicard_view_jump_to_letter (EMinicardView *view, - char letter) -{ - e_reflow_sorted_jump(E_REFLOW_SORTED(view), - (GCompareFunc) compare_to_letter, - &letter); -} diff --git a/addressbook/gui/widgets/e-minicard-view.h b/addressbook/gui/widgets/e-minicard-view.h deleted file mode 100644 index a166a6ade1..0000000000 --- a/addressbook/gui/widgets/e-minicard-view.h +++ /dev/null @@ -1,95 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard-view.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_MINICARD_VIEW_H__ -#define __E_MINICARD_VIEW_H__ - -#include <gnome.h> -#include "e-reflow-sorted.h" -#include <ebook/e-book.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EMinicardView - A canvas item container. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * book EBook RW book to query - * query string RW query string - * - * From EReflowSorted: (you should really know what you're doing if you set these.) - * compare_func GCompareFunc RW compare function - * string_func EReflowStringFunc RW string function - * - * From EReflow: - * 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_MINICARD_VIEW_TYPE (e_minicard_view_get_type ()) -#define E_MINICARD_VIEW(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_VIEW_TYPE, EMinicardView)) -#define E_MINICARD_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_VIEW_TYPE, EMinicardViewClass)) -#define E_IS_MINICARD_VIEW(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_VIEW_TYPE)) -#define E_IS_MINICARD_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_VIEW_TYPE)) - - -typedef struct _EMinicardView EMinicardView; -typedef struct _EMinicardViewClass EMinicardViewClass; - -struct _EMinicardView -{ - EReflowSorted parent; - - /* item specific fields */ - EBook *book; - char *query; - EBookView *book_view; - - int get_view_idle; - - int canvas_destroy_id; - - int create_card_id, remove_card_id, modify_card_id; -}; - -struct _EMinicardViewClass -{ - EReflowSortedClass parent_class; -}; - -GtkType e_minicard_view_get_type (void); -void e_minicard_view_remove_selection (EMinicardView *view, - EBookCallback cb, - gpointer closure); -void e_minicard_view_jump_to_letter (EMinicardView *view, - char letter); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_MINICARD_VIEW_H__ */ diff --git a/addressbook/gui/widgets/e-minicard-widget-test.c b/addressbook/gui/widgets/e-minicard-widget-test.c deleted file mode 100644 index f6489f2a6a..0000000000 --- a/addressbook/gui/widgets/e-minicard-widget-test.c +++ /dev/null @@ -1,113 +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. - */ - -#define TEST_VCARD \ -"BEGIN:VCARD -" \ -"FN:Nat -" \ -"N:Friedman;Nat;D;Mr. -" \ -"ORG:Helix Code, Inc. -" \ -"TITLE:Head Geek -" \ -"ROLE:Programmer/Executive -" \ -"BDAY:1977-08-06 -" \ -"TEL;WORK:617 679 1984 -" \ -"TEL;CELL:123 456 7890 -" \ -"EMAIL;INTERNET:nat@nat.org -" \ -"EMAIL;INTERNET:nat@helixcode.com -" \ -"ADR;WORK;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234; -" \ -"ADR;HOME;POSTAL;INTL:P.O. Box 202;;;Any Town 2;MI;12344-4321;USA -" \ -"END:VCARD -" \ -" -" - -#include "config.h" - -#include <gnome.h> -#include "e-minicard-widget.h" - -/* This is a horrible thing to do, but it is just a test. */ - -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 Widget Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the minicard widget" ), - NULL); - gtk_widget_show (about); -} -#endif - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *minicard; - ECard *card; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Minicard Widget Test", VERSION, argc, argv); - app = gnome_app_new("Minicard Widget Test", NULL); - - minicard = e_minicard_widget_new(); - card = e_card_new(TEST_VCARD); - gtk_object_set(GTK_OBJECT(minicard), - "card", card, - NULL); - - gnome_app_set_contents( GNOME_APP( app ), minicard ); - - /* 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/addressbook/gui/widgets/e-minicard-widget.c b/addressbook/gui/widgets/e-minicard-widget.c deleted file mode 100644 index 3f765425e4..0000000000 --- a/addressbook/gui/widgets/e-minicard-widget.c +++ /dev/null @@ -1,236 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-table-field-chooser.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 "e-minicard-widget.h" -#include "e-minicard.h" - -static void e_minicard_widget_init (EMinicardWidget *card); -static void e_minicard_widget_class_init (EMinicardWidgetClass *klass); -static void e_minicard_widget_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_minicard_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_minicard_widget_destroy (GtkObject *object); -static void e_minicard_widget_size_request (GtkWidget *widget, GtkRequisition *requisition); -static void e_minicard_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static void e_minicard_widget_reflow (ECanvas *canvas); - -static ECanvasClass *parent_class = NULL; - -/* The arguments we take */ -enum { - ARG_0, - ARG_CARD, -}; - -GtkType -e_minicard_widget_get_type (void) -{ - static GtkType type = 0; - - if (!type) - { - static const GtkTypeInfo info = - { - "EMinicardWidget", - sizeof (EMinicardWidget), - sizeof (EMinicardWidgetClass), - (GtkClassInitFunc) e_minicard_widget_class_init, - (GtkObjectInitFunc) e_minicard_widget_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - type = gtk_type_unique (e_canvas_get_type (), &info); - } - - return type; -} - -static void -e_minicard_widget_class_init (EMinicardWidgetClass *klass) -{ - GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - ECanvasClass *ecanvas_class; - - object_class = GTK_OBJECT_CLASS(klass); - widget_class = GTK_WIDGET_CLASS(klass); - ecanvas_class = E_CANVAS_CLASS(klass); - - parent_class = gtk_type_class (e_canvas_get_type ()); - - object_class->set_arg = e_minicard_widget_set_arg; - object_class->get_arg = e_minicard_widget_get_arg; - object_class->destroy = e_minicard_widget_destroy; - - widget_class->size_request = e_minicard_widget_size_request; - widget_class->size_allocate = e_minicard_widget_size_allocate; - - ecanvas_class->reflow = e_minicard_widget_reflow; - - gtk_object_add_arg_type ("EMinicardWidget::card", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_CARD); -} - -static void -e_minicard_widget_size_request(GtkWidget *widget, GtkRequisition *requisition) -{ - double height; - EMinicardWidget *emw = E_MINICARD_WIDGET(widget); - gtk_object_get(GTK_OBJECT(emw->item), - "height", &height, - NULL); - if (height <= 0) - height = 1; - widget->requisition.height = height; - widget->requisition.width = 200; - requisition->height = height; - requisition->width = 200; -} - -static void -e_minicard_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation) -{ - double height; - EMinicardWidget *emw = E_MINICARD_WIDGET(widget); - gnome_canvas_item_set( emw->item, - "width", (double) allocation->width, - NULL ); - gtk_object_get(GTK_OBJECT(emw->item), - "height", &height, - NULL); - height = MAX(height, allocation->height); - gnome_canvas_set_scroll_region(GNOME_CANVAS( emw ), 0, 0, allocation->width - 1, height - 1); - gnome_canvas_item_set( emw->rect, - "x2", (double) allocation->width, - "y2", (double) height, - NULL ); - if (GTK_WIDGET_CLASS(parent_class)->size_allocate) - GTK_WIDGET_CLASS(parent_class)->size_allocate(widget, allocation); -} - -static void e_minicard_widget_reflow(ECanvas *canvas) -{ - double height; - EMinicardWidget *emw = E_MINICARD_WIDGET(canvas); - gtk_object_get(GTK_OBJECT(emw->item), - "height", &height, - NULL); - - height = MAX(height, GTK_WIDGET(emw)->allocation.height); - - gnome_canvas_set_scroll_region (GNOME_CANVAS(emw), 0, 0, GTK_WIDGET(emw)->allocation.width - 1, height - 1); - gnome_canvas_item_set( emw->rect, - "x2", (double) GTK_WIDGET(emw)->allocation.width, - "y2", (double) height, - NULL ); - - gtk_widget_queue_resize(GTK_WIDGET(canvas)); -} - -static void -e_minicard_widget_init (EMinicardWidget *emw) -{ - emw->rect = gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(emw)), - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) 100, - "y2", (double) 100, - "fill_color", "white", - NULL ); - - emw->item = gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(emw)), - e_minicard_get_type(), - "width", (double) 100, - NULL ); - - gnome_canvas_set_scroll_region ( GNOME_CANVAS( emw ), - 0, 0, - 100, 100 ); - - emw->card = NULL; -} - -static void -e_minicard_widget_destroy (GtkObject *object) -{ - EMinicardWidget *emw = E_MINICARD_WIDGET(object); - - if (emw->card) - gtk_object_unref(GTK_OBJECT(emw->card)); - - if (GTK_OBJECT_CLASS(parent_class)->destroy) - GTK_OBJECT_CLASS(parent_class)->destroy(object); -} - -GtkWidget* -e_minicard_widget_new (void) -{ - GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_minicard_widget_get_type ())); - return widget; -} - -static void -e_minicard_widget_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EMinicardWidget *emw = E_MINICARD_WIDGET(object); - - switch (arg_id){ - case ARG_CARD: - if (emw->card) - gtk_object_unref(GTK_OBJECT(emw->card)); - if (GTK_VALUE_OBJECT(*arg)) { - emw->card = E_CARD(GTK_VALUE_OBJECT(*arg)); - gtk_object_ref(GTK_OBJECT(emw->card)); - } - else - emw->card = NULL; - if (emw->item) - gtk_object_set(GTK_OBJECT(emw->item), - "card", emw->card, - NULL); - break; - default: - break; - } -} - -static void -e_minicard_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EMinicardWidget *emw = E_MINICARD_WIDGET(object); - - switch (arg_id) { - case ARG_CARD: - if (emw->card) - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(emw->card); - else - GTK_VALUE_OBJECT (*arg) = NULL; - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} diff --git a/addressbook/gui/widgets/e-minicard-widget.h b/addressbook/gui/widgets/e-minicard-widget.h deleted file mode 100644 index 8a3ec0ae16..0000000000 --- a/addressbook/gui/widgets/e-minicard-widget.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard-widget.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_MINICARD_WIDGET_H__ -#define __E_MINICARD_WIDGET_H__ - -#include <gnome.h> -#include "addressbook/backend/ebook/e-card.h" -#include "e-util/e-canvas.h" - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EMinicardWidget - A card displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - */ - -#define E_MINICARD_WIDGET_TYPE (e_minicard_widget_get_type ()) -#define E_MINICARD_WIDGET(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_WIDGET_TYPE, EMinicardWidget)) -#define E_MINICARD_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_WIDGET_TYPE, EMinicardWidgetClass)) -#define E_IS_MINICARD_WIDGET(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_WIDGET_TYPE)) -#define E_IS_MINICARD_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_WIDGET_TYPE)) - - -typedef struct _EMinicardWidget EMinicardWidget; -typedef struct _EMinicardWidgetClass EMinicardWidgetClass; - -struct _EMinicardWidget -{ - ECanvas parent; - - /* item specific fields */ - GnomeCanvasItem *item; - - GnomeCanvasItem *rect; - ECard *card; -}; - -struct _EMinicardWidgetClass -{ - ECanvasClass parent_class; -}; - - -GtkWidget *e_minicard_widget_new(void); -GtkType e_minicard_widget_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_MINICARD_WIDGET_H__ */ diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c deleted file mode 100644 index e9bb85c89d..0000000000 --- a/addressbook/gui/widgets/e-minicard.c +++ /dev/null @@ -1,797 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-minicard.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 "e-minicard.h" -#include "e-minicard-label.h" -#include "e-text.h" -#include <ebook/e-book.h> -#include <e-util/e-canvas.h> -#include <e-util/e-util.h> -#include <e-util/e-canvas-utils.h> -#include <e-util/e-popup-menu.h> -#include "addressbook/printing/e-contact-print.h" -#include "e-contact-editor.h" -#include "e-contact-save-as.h" -#include "e-minicard-view.h" - -static void e_minicard_init (EMinicard *card); -static void e_minicard_class_init (EMinicardClass *klass); -static void e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_minicard_destroy (GtkObject *object); -static gboolean e_minicard_event (GnomeCanvasItem *item, GdkEvent *event); -static void e_minicard_realize (GnomeCanvasItem *item); -static void e_minicard_unrealize (GnomeCanvasItem *item); -static void e_minicard_reflow ( GnomeCanvasItem *item, int flags ); - -static void e_minicard_resize_children( EMinicard *e_minicard ); -static void remodel( EMinicard *e_minicard ); - -static GnomeCanvasGroupClass *parent_class = NULL; - -typedef struct _EMinicardField EMinicardField; - -struct _EMinicardField { - ECardSimpleField field; - GnomeCanvasItem *label; -}; - -#define E_MINICARD_FIELD(field) ((EMinicardField *)(field)) - -static void -e_minicard_field_destroy(EMinicardField *field) -{ - gtk_object_destroy(GTK_OBJECT(field->label)); - g_free(field); -} - -/* The arguments we take */ -enum { - ARG_0, - ARG_WIDTH, - ARG_HEIGHT, - ARG_HAS_FOCUS, - ARG_CARD -}; - -GtkType -e_minicard_get_type (void) -{ - static GtkType minicard_type = 0; - - if (!minicard_type) - { - static const GtkTypeInfo minicard_info = - { - "EMinicard", - sizeof (EMinicard), - sizeof (EMinicardClass), - (GtkClassInitFunc) e_minicard_class_init, - (GtkObjectInitFunc) e_minicard_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - minicard_type = gtk_type_unique (gnome_canvas_group_get_type (), &minicard_info); - } - - return minicard_type; -} - -static void -e_minicard_class_init (EMinicardClass *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 ("EMinicard::width", GTK_TYPE_DOUBLE, - GTK_ARG_READWRITE, ARG_WIDTH); - gtk_object_add_arg_type ("EMinicard::height", GTK_TYPE_DOUBLE, - GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("EMinicard::has_focus", GTK_TYPE_ENUM, - GTK_ARG_READWRITE, ARG_HAS_FOCUS); - gtk_object_add_arg_type ("EMinicard::card", GTK_TYPE_OBJECT, - GTK_ARG_READWRITE, ARG_CARD); - - object_class->set_arg = e_minicard_set_arg; - object_class->get_arg = e_minicard_get_arg; - object_class->destroy = e_minicard_destroy; - - /* GnomeCanvasItem method overrides */ - item_class->realize = e_minicard_realize; - item_class->unrealize = e_minicard_unrealize; - item_class->event = e_minicard_event; -} - -static void -e_minicard_init (EMinicard *minicard) -{ - /* minicard->card = NULL;*/ - minicard->rect = NULL; - minicard->fields = NULL; - minicard->width = 10; - minicard->height = 10; - minicard->has_focus = FALSE; - - minicard->card = NULL; - minicard->simple = e_card_simple_new(NULL); - - e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(minicard), e_minicard_reflow); -} - -static void -e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - GnomeCanvasItem *item; - EMinicard *e_minicard; - - item = GNOME_CANVAS_ITEM (o); - e_minicard = E_MINICARD (o); - - switch (arg_id){ - case ARG_WIDTH: - if (e_minicard->width != GTK_VALUE_DOUBLE (*arg)) { - e_minicard->width = GTK_VALUE_DOUBLE (*arg); - e_minicard_resize_children(e_minicard); - if ( GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED ) - e_canvas_item_request_reflow(item); - } - break; - case ARG_HAS_FOCUS: - if (e_minicard->fields) { - if ( GTK_VALUE_ENUM(*arg) == E_FOCUS_START || - GTK_VALUE_ENUM(*arg) == E_FOCUS_CURRENT) { - gnome_canvas_item_set(E_MINICARD_FIELD(e_minicard->fields->data)->label, - "has_focus", GTK_VALUE_ENUM(*arg), - NULL); - } else if ( GTK_VALUE_ENUM(*arg) == E_FOCUS_END ) { - gnome_canvas_item_set(E_MINICARD_FIELD(g_list_last(e_minicard->fields)->data)->label, - "has_focus", GTK_VALUE_ENUM(*arg), - NULL); - } - } - else - e_canvas_item_grab_focus(item); - break; - case ARG_CARD: - if (e_minicard->card) - gtk_object_unref (GTK_OBJECT(e_minicard->card)); - e_minicard->card = E_CARD(GTK_VALUE_OBJECT (*arg)); - if (e_minicard->card) - gtk_object_ref (GTK_OBJECT(e_minicard->card)); - gtk_object_set(GTK_OBJECT(e_minicard->simple), - "card", e_minicard->card, - NULL); - remodel(e_minicard); - e_canvas_item_request_reflow(item); - break; - } -} - -static void -e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EMinicard *e_minicard; - - e_minicard = E_MINICARD (object); - - switch (arg_id) { - case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_minicard->width; - break; - case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = e_minicard->height; - break; - case ARG_HAS_FOCUS: - GTK_VALUE_ENUM (*arg) = e_minicard->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE; - break; - case ARG_CARD: - e_card_simple_sync_card(e_minicard->simple); - GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_minicard->card); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void -e_minicard_destroy (GtkObject *object) -{ - EMinicard *e_minicard; - - g_return_if_fail (object != NULL); - g_return_if_fail (E_IS_MINICARD (object)); - - e_minicard = E_MINICARD (object); - - g_list_foreach(e_minicard->fields, (GFunc) e_minicard_field_destroy, NULL); - g_list_free(e_minicard->fields); - - if (e_minicard->card) - gtk_object_unref (GTK_OBJECT(e_minicard->card)); - if (e_minicard->simple) - gtk_object_unref (GTK_OBJECT(e_minicard->simple)); - - if (GTK_OBJECT_CLASS (parent_class)->destroy) - (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); -} - -static void -e_minicard_realize (GnomeCanvasItem *item) -{ - EMinicard *e_minicard; - GnomeCanvasGroup *group; - GtkWidget *canvas; - - e_minicard = E_MINICARD (item); - group = GNOME_CANVAS_GROUP( item ); - canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (item)->canvas); - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item); - - e_minicard->rect = - gnome_canvas_item_new( group, - gnome_canvas_rect_get_type(), - "x1", (double) 0, - "y1", (double) 0, - "x2", (double) e_minicard->width - 1, - "y2", (double) e_minicard->height - 1, - "outline_color", NULL, - NULL ); - - e_minicard->header_rect = - gnome_canvas_item_new( group, - gnome_canvas_rect_get_type(), - "x1", (double) 2, - "y1", (double) 2, - "x2", (double) e_minicard->width - 3, - "y2", (double) e_minicard->height - 3, - "fill_color_gdk", &canvas->style->bg[GTK_STATE_NORMAL], - NULL ); - - e_minicard->header_text = - gnome_canvas_item_new( group, - e_text_get_type(), - "anchor", GTK_ANCHOR_NW, - "width", (double) ( e_minicard->width - 12 ), - "clip", TRUE, - "use_ellipsis", TRUE, - "font", "lucidasans-bold-10", - "fill_color_gdk", &canvas->style->fg[GTK_STATE_NORMAL], - "text", "", - NULL ); - e_canvas_item_move_absolute(e_minicard->header_text, 6, 6); - - remodel(e_minicard); - e_canvas_item_request_reflow(item); - - if (!item->canvas->aa) { - } -} - -static void -e_minicard_unrealize (GnomeCanvasItem *item) -{ - EMinicard *e_minicard; - - e_minicard = E_MINICARD (item); - - if (!item->canvas->aa) - { - } - - if (GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) - (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item); -} - -static void -card_added_cb (EBook* book, EBookStatus status, const char *id, gpointer user_data) -{ - g_print ("%s: %s(): a card was added\n", __FILE__, __FUNCTION__); -} - -static void -card_changed_cb (EBook* book, EBookStatus status, gpointer user_data) -{ - g_print ("%s: %s(): a card was changed with status %d\n", __FILE__, __FUNCTION__, status); -} - -static void -save_as (GtkWidget *widget, EMinicard *minicard) -{ - e_card_simple_sync_card(minicard->simple); - e_contact_save_as(_("Save as VCard"), minicard->card); -} - -static void -delete (GtkWidget *widget, EMinicard *minicard) -{ - EBook *book; - - if (e_contact_editor_confirm_delete()) { - e_card_simple_sync_card(minicard->simple); - - gtk_object_get(GTK_OBJECT(GNOME_CANVAS_ITEM(minicard)->parent), - "book", &book, - NULL); - - /* Add the card in the contact editor to our ebook */ - e_book_remove_card (book, - minicard->card, - card_changed_cb, - NULL); - } -} - -static void -print (GtkWidget *widget, EMinicard *minicard) -{ - e_card_simple_sync_card(minicard->simple); - - gtk_widget_show(e_contact_print_card_dialog_new(minicard->card)); -} - -/* Callback for the add_card signal from the contact editor */ -static void -add_card_cb (EContactEditor *ce, ECard *card, gpointer data) -{ - EBook *book; - - book = E_BOOK (data); - e_book_add_card (book, card, card_added_cb, NULL); -} - -/* Callback for the commit_card signal from the contact editor */ -static void -commit_card_cb (EContactEditor *ce, ECard *card, gpointer data) -{ - EBook *book; - - book = E_BOOK (data); - e_book_commit_card (book, card, card_changed_cb, NULL); -} - -/* Callback for the commit_card signal from the contact editor */ -static void -delete_card_cb (EContactEditor *ce, ECard *card, gpointer data) -{ - EBook *book; - - book = E_BOOK (data); - e_book_remove_card (book, card, card_changed_cb, NULL); -} - -/* Callback used when the contact editor is closed */ -static void -editor_closed_cb (EContactEditor *ce, gpointer data) -{ - gtk_object_unref (GTK_OBJECT (ce)); -} - -static gboolean -e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) -{ - EMinicard *e_minicard; - GtkWidget *canvas; - - e_minicard = E_MINICARD (item); - canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (item)->canvas); - - switch( event->type ) { - case GDK_FOCUS_CHANGE: - { - GdkEventFocus *focus_event = (GdkEventFocus *) event; - if ( focus_event->in ) { - gnome_canvas_item_set( e_minicard->rect, - "outline_color_gdk", &canvas->style->bg[GTK_STATE_NORMAL], - NULL ); - gnome_canvas_item_set( e_minicard->header_rect, - "fill_color_gdk", &canvas->style->bg[GTK_STATE_SELECTED], - NULL ); - gnome_canvas_item_set( e_minicard->header_text, - "fill_color_gdk", &canvas->style->text[GTK_STATE_SELECTED], - NULL ); - e_minicard->has_focus = TRUE; - } else { - EBook *book = NULL; - - e_card_simple_sync_card(e_minicard->simple); - - if (E_IS_MINICARD_VIEW(GNOME_CANVAS_ITEM(e_minicard)->parent)) { - - gtk_object_get(GTK_OBJECT(GNOME_CANVAS_ITEM(e_minicard)->parent), - "book", &book, - NULL); - - } - - if (book) { - - /* Add the card in the contact editor to our ebook */ - e_book_commit_card (book, - e_minicard->card, - card_changed_cb, - NULL); - } else { - remodel(e_minicard); - e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(e_minicard)); - } - - gnome_canvas_item_set( e_minicard->rect, - "outline_color", NULL, - NULL ); - gnome_canvas_item_set( e_minicard->header_rect, - "fill_color_gdk", - &canvas->style->bg[GTK_STATE_NORMAL], - NULL ); - gnome_canvas_item_set( e_minicard->header_text, - "fill_color_gdk", - &canvas->style->fg[GTK_STATE_NORMAL], - NULL ); - e_minicard->has_focus = FALSE; - } - } - break; - case GDK_BUTTON_PRESS: - if (event->button.button == 1) { - e_canvas_item_grab_focus(item); - } else if (event->button.button == 3) { - if (E_IS_MINICARD_VIEW(item->parent)) { - EPopupMenu menu[] = { {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), 0}, - {"Print", NULL, GTK_SIGNAL_FUNC(print), 0}, - {"Delete", NULL, GTK_SIGNAL_FUNC(delete), 0}, - {NULL, NULL, NULL, 0}}; - e_popup_menu_run (menu, (GdkEventButton *)event, 0, 0, e_minicard); - } else { - EPopupMenu menu[] = { {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), 0}, - {"Print", NULL, GTK_SIGNAL_FUNC(print), 0}, - {NULL, NULL, NULL, 0}}; - e_popup_menu_run (menu, (GdkEventButton *)event, 0, 0, e_minicard); - } - } - break; - - case GDK_2BUTTON_PRESS: - if (event->button.button == 1 && E_IS_MINICARD_VIEW(item->parent)) { - EContactEditor *ce; - EBook *book = NULL; - if (E_IS_MINICARD_VIEW(item->parent)) { - - gtk_object_get(GTK_OBJECT(item->parent), - "book", &book, - NULL); - } - ce = e_contact_editor_new (e_minicard->card, FALSE); - - if (book != NULL) { - gtk_signal_connect (GTK_OBJECT (ce), "add_card", - GTK_SIGNAL_FUNC (add_card_cb), book); - gtk_signal_connect (GTK_OBJECT (ce), "commit_card", - GTK_SIGNAL_FUNC (commit_card_cb), book); - gtk_signal_connect (GTK_OBJECT (ce), "delete_card", - GTK_SIGNAL_FUNC (delete_card_cb), book); - } - - gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", - GTK_SIGNAL_FUNC (editor_closed_cb), NULL); - return TRUE; - } - break; - 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_minicard->fields; list; list = list->next) { - EMinicardField *field = E_MINICARD_FIELD(list->data); - GnomeCanvasItem *item = field->label; - EFocus has_focus; - gtk_object_get(GTK_OBJECT(item), - "has_focus", &has_focus, - NULL); - if (has_focus != E_FOCUS_NONE) { - if (event->key.state & GDK_SHIFT_MASK) - list = list->prev; - else - list = list->next; - if (list) { - EMinicardField *field = E_MINICARD_FIELD(list->data); - GnomeCanvasItem *item = field->label; - 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; - } - } - } - } - 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_minicard_resize_children( EMinicard *e_minicard ) -{ - GList *list; - - if (e_minicard->header_text) { - gnome_canvas_item_set( e_minicard->header_text, - "width", (double) e_minicard->width - 12, - NULL ); - } - for ( list = e_minicard->fields; list; list = g_list_next( list ) ) { - gnome_canvas_item_set( E_MINICARD_FIELD( list->data )->label, - "width", (double) e_minicard->width - 4.0, - NULL ); - } -} - -static void -field_changed (EText *text, EMinicard *e_minicard) -{ - ECardSimpleType type; - char *string; - - type = GPOINTER_TO_INT - (gtk_object_get_data(GTK_OBJECT(text), - "EMinicard:field")); - gtk_object_get(GTK_OBJECT(text), - "text", &string, - NULL); - e_card_simple_set(e_minicard->simple, - type, - string); - g_free(string); -} - -static void -add_field (EMinicard *e_minicard, ECardSimpleField field, gdouble left_width) -{ - GnomeCanvasItem *new_item; - GnomeCanvasGroup *group; - ECardSimpleType type; - EMinicardField *minicard_field; - char *name; - char *string; - - group = GNOME_CANVAS_GROUP( e_minicard ); - - type = e_card_simple_type(e_minicard->simple, field); - name = g_strdup_printf("%s:", e_card_simple_get_name(e_minicard->simple, field)); - string = e_card_simple_get(e_minicard->simple, field); - - new_item = e_minicard_label_new(group); - gnome_canvas_item_set( new_item, - "width", e_minicard->width - 4.0, - "fieldname", name, - "field", string, - "max_field_name_length", left_width, - NULL ); - gtk_signal_connect(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field), - "changed", GTK_SIGNAL_FUNC(field_changed), e_minicard); - gtk_object_set_data(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field), - "EMinicard:field", - GINT_TO_POINTER(field)); - - minicard_field = g_new(EMinicardField, 1); - minicard_field->field = field; - minicard_field->label = new_item; - - e_minicard->fields = g_list_append( e_minicard->fields, minicard_field); - e_canvas_item_move_absolute(new_item, 2, e_minicard->height); - g_free(name); - g_free(string); -} - -static gdouble -get_left_width(EMinicard *e_minicard) -{ - gchar *name; - ECardSimpleField field; - gdouble width = -1; - static GdkFont *font = NULL; - - if (font == NULL) { - font = gdk_font_load("lucidasans-10"); - } - - for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST; field++) { - gdouble this_width; - name = g_strdup_printf("%s:", e_card_simple_get_name(e_minicard->simple, field)); - this_width = gdk_text_width(font, name, strlen(name)); - if (width < this_width) - width = this_width; - g_free(name); - } - return width; -} - -static void -remodel( EMinicard *e_minicard ) -{ - int count = 0; - if (e_minicard->simple) { - ECardSimpleField field; - GList *list; - char *file_as; - gdouble left_width = -1; - - if (e_minicard->header_text) { - file_as = e_card_simple_get(e_minicard->simple, E_CARD_SIMPLE_FIELD_FILE_AS); - gnome_canvas_item_set( e_minicard->header_text, - "text", file_as ? file_as : "", - NULL ); - g_free(file_as); - } - - list = e_minicard->fields; - e_minicard->fields = NULL; - - for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST - 2 && count < 5; field++) { - EMinicardField *minicard_field = NULL; - - if (list) - minicard_field = list->data; - if (minicard_field && minicard_field->field == field) { - GList *this_list = list; - char *string; - - string = e_card_simple_get(e_minicard->simple, field); - if (string && *string) { - e_minicard->fields = g_list_append(e_minicard->fields, minicard_field); - gtk_object_set(GTK_OBJECT(minicard_field->label), - "field", string, - NULL); - count ++; - } else { - e_minicard_field_destroy(minicard_field); - } - list = g_list_remove_link(list, this_list); - g_list_free_1(this_list); - g_free(string); - } else { - char *string; - if (left_width == -1) { - left_width = get_left_width(e_minicard); - } - - string = e_card_simple_get(e_minicard->simple, field); - if (string && *string) { - add_field(e_minicard, field, left_width); - count++; - } - g_free(string); - } - } - - g_list_foreach(list, (GFunc) e_minicard_field_destroy, NULL); - g_list_free(list); - } -} - -static void -e_minicard_reflow( GnomeCanvasItem *item, int flags ) -{ - EMinicard *e_minicard = E_MINICARD(item); - if ( GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED ) { - GList *list; - gdouble text_height; - gint old_height; - - old_height = e_minicard->height; - - gtk_object_get( GTK_OBJECT( e_minicard->header_text ), - "text_height", &text_height, - NULL ); - - e_minicard->height = text_height + 10.0; - - gnome_canvas_item_set( e_minicard->header_rect, - "y2", text_height + 9.0, - NULL ); - - for(list = e_minicard->fields; list; list = g_list_next(list)) { - EMinicardField *field = E_MINICARD_FIELD(list->data); - GnomeCanvasItem *item = field->label; - gtk_object_get (GTK_OBJECT(item), - "height", &text_height, - NULL); - e_canvas_item_move_absolute(item, 2, e_minicard->height); - e_minicard->height += text_height; - } - e_minicard->height += 2; - - gnome_canvas_item_set( e_minicard->rect, - "y2", (double) e_minicard->height - 1, - NULL ); - - gnome_canvas_item_set( e_minicard->rect, - "x2", (double) e_minicard->width - 1.0, - "y2", (double) e_minicard->height - 1.0, - NULL ); - gnome_canvas_item_set( e_minicard->header_rect, - "x2", (double) e_minicard->width - 3.0, - NULL ); - - if (old_height != e_minicard->height) - e_canvas_item_request_parent_reflow(item); - } -} - -char * -e_minicard_get_card_id (EMinicard *minicard) -{ - g_return_val_if_fail(minicard != NULL, NULL); - g_return_val_if_fail(E_IS_MINICARD(minicard), NULL); - - if (minicard->card) { - return e_card_get_id(minicard->card); - } else { - return ""; - } -} - -int -e_minicard_compare (EMinicard *minicard1, EMinicard *minicard2) -{ - g_return_val_if_fail(minicard1 != NULL, 0); - g_return_val_if_fail(E_IS_MINICARD(minicard1), 0); - g_return_val_if_fail(minicard2 != NULL, 0); - g_return_val_if_fail(E_IS_MINICARD(minicard2), 0); - - if (minicard1->card && minicard2->card) { - char *file_as1, *file_as2; - gtk_object_get(GTK_OBJECT(minicard1->card), - "file_as", &file_as1, - NULL); - gtk_object_get(GTK_OBJECT(minicard2->card), - "file_as", &file_as2, - NULL); - if (file_as1 && file_as2) - return strcasecmp(file_as1, file_as2); - if (file_as1) - return -1; - if (file_as2) - return 1; - return strcmp(e_minicard_get_card_id(minicard1), e_minicard_get_card_id(minicard2)); - } else { - return 0; - } -} diff --git a/addressbook/gui/widgets/e-minicard.h b/addressbook/gui/widgets/e-minicard.h deleted file mode 100644 index 47da8110c2..0000000000 --- a/addressbook/gui/widgets/e-minicard.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-minicard.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_MINICARD_H__ -#define __E_MINICARD_H__ - -#include <gnome.h> -#include <ebook/e-card.h> -#include <ebook/e-card-simple.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EMinicard - A small card displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * width double RW width of the card - * height double R height of the card - * card ECard* RW Pointer to the ECard - */ - -#define E_MINICARD_TYPE (e_minicard_get_type ()) -#define E_MINICARD(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_TYPE, EMinicard)) -#define E_MINICARD_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_TYPE, EMinicardClass)) -#define E_IS_MINICARD(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_TYPE)) -#define E_IS_MINICARD_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_TYPE)) - - -typedef struct _EMinicard EMinicard; -typedef struct _EMinicardClass EMinicardClass; -typedef enum _EMinicardFocusType EMinicardFocusType; - -enum _EMinicardFocusType { - E_MINICARD_FOCUS_TYPE_START, - E_MINICARD_FOCUS_TYPE_END -}; - -struct _EMinicard -{ - GnomeCanvasGroup parent; - - /* item specific fields */ - ECard *card; - ECardSimple *simple; - - GnomeCanvasItem *rect; - GnomeCanvasItem *header_rect; - GnomeCanvasItem *header_text; - - GList *fields; /* Of type EMinicardField */ - guint needs_remodeling : 1; - - gboolean has_focus; - - double width; - double height; -}; - -struct _EMinicardClass -{ - GnomeCanvasGroupClass parent_class; - - void (* resize) (EMinicard *minicard); -}; - - -GtkType e_minicard_get_type (void); -char *e_minicard_get_card_id (EMinicard *minicard); -int e_minicard_compare (EMinicard *minicard1, EMinicard *minicard2); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_MINICARD_H__ */ diff --git a/addressbook/gui/widgets/test-minicard-label.c b/addressbook/gui/widgets/test-minicard-label.c deleted file mode 100644 index 57bc69222a..0000000000 --- a/addressbook/gui/widgets/test-minicard-label.c +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-minicard-label.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-minicard-label.h" -#include <e-util/e-canvas.h> - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *label; -GnomeCanvasItem *rect; - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, allocation->height ); - gnome_canvas_item_set( label, - "width", (double) allocation->width, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( rect, - "x2", (double) allocation->width, - "y2", (double) allocation->height, - NULL ); -} - -#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 Label Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the minicard label canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -static void button_press_callback( GtkWidget *widget, gpointer data ) -{ - gnome_canvas_item_grab_focus( label ); -} - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *canvas; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Minicard Label Test", VERSION, argc, argv); - app = gnome_app_new("Minicard Label Test", NULL); - - canvas = e_canvas_new(); - 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 ); - label = e_minicard_label_new(gnome_canvas_root( GNOME_CANVAS( canvas ) )); - gnome_canvas_item_set( label, - "width", (double) 100, - "height", (double) 100, - "fieldname", "Full Name:", - "field", "Christopher James Lahey", - NULL ); - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - gnome_app_set_contents( GNOME_APP( app ), canvas ); - - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate", - GTK_SIGNAL_FUNC( allocate_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "button_press_event", - GTK_SIGNAL_FUNC( button_press_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/gui/widgets/test-minicard-view.c b/addressbook/gui/widgets/test-minicard-view.c deleted file mode 100644 index c03d11d07e..0000000000 --- a/addressbook/gui/widgets/test-minicard-view.c +++ /dev/null @@ -1,206 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-reflow.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 <libgnorba/gnorba.h> -#include <bonobo.h> -#include <e-util/e-canvas.h> -#include "e-minicard-view.h" - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *reflow; -GnomeCanvasItem *rect; -GtkAllocation last_alloc; - -CORBA_Environment ev; -CORBA_ORB orb; - -static void -init_bonobo (int argc, char **argv) -{ - - gnome_CORBA_init_with_popt_table ( - "Reflow Test", VERSION, - &argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev); - - orb = gnome_CORBA_ORB (); - - if (bonobo_init (orb, NULL, NULL) == FALSE) - g_error (_("Could not initialize Bonobo")); - -} - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - double width; - last_alloc = *allocation; - gnome_canvas_item_set( reflow, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( reflow, - "minimum_width", (double) allocation->width, - NULL ); - gtk_object_get(GTK_OBJECT(reflow), - "width", &width, - NULL); - width = MAX(width, allocation->width); - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, width, allocation->height ); - gnome_canvas_item_set( rect, - "x2", (double) width, - "y2", (double) allocation->height, - NULL ); -} - -static void resize(GnomeCanvas *canvas, gpointer data) -{ - double width; - gtk_object_get(GTK_OBJECT(reflow), - "width", &width, - NULL); - width = MAX(width, last_alloc.width); - gnome_canvas_set_scroll_region(canvas , 0, 0, width, last_alloc.height ); - gnome_canvas_item_set( rect, - "x2", (double) width, - "y2", (double) last_alloc.height, - NULL ); -} - -#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 ( _( "Reflow Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the reflow canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -static void -book_open_cb (EBook *book, EBookStatus status, gpointer closure) -{ - if (status == E_BOOK_STATUS_SUCCESS) - gnome_canvas_item_set(reflow, - "book", book, - NULL); -} - -static guint -ebook_create (void) -{ - EBook *book; - - book = e_book_new (); - - if (!book) { - printf ("%s: %s(): Couldn't create EBook, bailing.\n", - __FILE__, - __FUNCTION__); - return FALSE; - } - - - if (! e_book_load_uri (book, "file:/tmp/test.db", book_open_cb, NULL)) { - printf ("error calling load_uri!\n"); - } - - - return FALSE; -} - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *canvas; - GtkWidget *vbox; - GtkWidget *scrollbar; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - CORBA_exception_init (&ev); - init_bonobo (argc, argv); - - app = gnome_app_new("Reflow Test", NULL); - - vbox = gtk_vbox_new(FALSE, 0); - - canvas = e_canvas_new(); - 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 ); - reflow = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - e_minicard_view_get_type(), - "height", (double) 100, - "minimum_width", (double) 100, - NULL ); - gtk_signal_connect( GTK_OBJECT( canvas ), "reflow", - GTK_SIGNAL_FUNC( resize ), - ( gpointer ) app); - - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - gtk_box_pack_start(GTK_BOX(vbox), canvas, TRUE, TRUE, 0); - - scrollbar = gtk_hscrollbar_new(gtk_layout_get_hadjustment(GTK_LAYOUT(canvas))); - - gtk_box_pack_start(GTK_BOX(vbox), scrollbar, FALSE, FALSE, 0); - - gnome_app_set_contents( GNOME_APP( app ), vbox ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate", - GTK_SIGNAL_FUNC( allocate_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - gdk_window_set_back_pixmap( GTK_LAYOUT(canvas)->bin_window, NULL, FALSE); - - gtk_idle_add ((GtkFunction) ebook_create, NULL); - - bonobo_main (); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/gui/widgets/test-minicard.c b/addressbook/gui/widgets/test-minicard.c deleted file mode 100644 index e16ca675b3..0000000000 --- a/addressbook/gui/widgets/test-minicard.c +++ /dev/null @@ -1,115 +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-minicard.h" - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *card; -GnomeCanvasItem *rect; - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, allocation->height ); - gnome_canvas_item_set( card, - "width", (double) allocation->width, - NULL ); - gnome_canvas_item_set( rect, - "x2", (double) allocation->width, - "y2", (double) allocation->height, - NULL ); -} - -#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 *canvas; - int i; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Minicard Test", VERSION, argc, argv); - app = gnome_app_new("Minicard Test", NULL); - - canvas = gnome_canvas_new(); - 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 ); - for ( i = 0; i < 1; i++ ) - { - card = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - e_minicard_get_type(), - "width", (double) 100, - NULL ); - } - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - gnome_app_set_contents( GNOME_APP( app ), canvas ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate", - GTK_SIGNAL_FUNC( allocate_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/gui/widgets/test-reflow.c b/addressbook/gui/widgets/test-reflow.c deleted file mode 100644 index 8013c428d5..0000000000 --- a/addressbook/gui/widgets/test-reflow.c +++ /dev/null @@ -1,194 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* test-reflow.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. - */ - - -#define TEST_VCARD \ -"BEGIN:VCARD -" \ -"FN:Nat -" \ -"N:Friedman;Nat;D;Mr. -" \ -"TITLE:Head Geek -" \ -"BDAY:1977-08-06 -" \ -"TEL;WORK:617 679 1984 -" \ -"TEL;CELL:123 456 7890 -" \ -"EMAIL;INTERNET:nat@nat.org -" \ -"EMAIL;INTERNET:nat@helixcode.com -" \ -"ADR;WORK;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234; -" \ -"ADR;HOME;POSTAL;INTL:P.O. Box 202;;;Any Town 2;MI;12344-4321;USA -" \ -"END:VCARD -" \ -" -" - - -#include "config.h" - -#include <gnome.h> -#include <e-util/e-canvas.h> -#include "e-reflow.h" -#include "e-minicard.h" -#include "e-scroll-frame.h" - -/* This is a horrible thing to do, but it is just a test. */ -GnomeCanvasItem *reflow; -GnomeCanvasItem *rect; -GtkAllocation last_alloc; - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - exit(0); -} - -static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data) -{ - double width; - last_alloc = *allocation; - gnome_canvas_item_set( reflow, - "height", (double) allocation->height, - NULL ); - gnome_canvas_item_set( reflow, - "minimum_width", (double) allocation->width, - NULL ); - gtk_object_get(GTK_OBJECT(reflow), - "width", &width, - NULL); - width = MAX(width, allocation->width); - gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, width - 1, allocation->height - 1); - gnome_canvas_item_set( rect, - "x2", (double) width, - "y2", (double) allocation->height, - NULL ); -} - -static void resize(GnomeCanvas *canvas, gpointer data) -{ - double width; - gtk_object_get(GTK_OBJECT(reflow), - "width", &width, - NULL); - width = MAX(width, last_alloc.width); - gnome_canvas_set_scroll_region(canvas , 0, 0, width - 1, last_alloc.height - 1); - gnome_canvas_item_set( rect, - "x2", (double) width, - "y2", (double) last_alloc.height, - NULL ); -} - -#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 ( _( "Reflow Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the reflow canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - GtkWidget *canvas; - GtkWidget *vbox; - GtkWidget *scrollframe; - int i; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Reflow Test", VERSION, argc, argv); - app = gnome_app_new("Reflow Test", NULL); - - vbox = gtk_vbox_new(FALSE, 0); - - canvas = e_canvas_new(); - 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 ); - reflow = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - e_reflow_get_type(), - "height", (double) 100, - "minimum_width", (double) 100, - NULL ); - gtk_signal_connect( GTK_OBJECT( canvas ), "reflow", - GTK_SIGNAL_FUNC( resize ), - ( gpointer ) app); - for ( i = 0; i < 200; i++ ) - { - GnomeCanvasItem *item; - ECard *card = e_card_new (TEST_VCARD); - item = gnome_canvas_item_new( GNOME_CANVAS_GROUP(reflow), - e_minicard_get_type(), - "card", card, - NULL); - e_reflow_add_item(E_REFLOW(reflow), item); - } - gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), - 0, 0, - 100, 100 ); - - scrollframe = e_scroll_frame_new (gtk_layout_get_hadjustment(GTK_LAYOUT(canvas)), - gtk_layout_get_vadjustment(GTK_LAYOUT(canvas))); - e_scroll_frame_set_policy (E_SCROLL_FRAME (scrollframe), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_NEVER); - - gtk_container_add (GTK_CONTAINER (scrollframe), canvas); - - gnome_app_set_contents( GNOME_APP( app ), scrollframe ); - - /* Connect the signals */ - gtk_signal_connect( GTK_OBJECT( app ), "destroy", - GTK_SIGNAL_FUNC( destroy_callback ), - ( gpointer ) app ); - - gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate", - GTK_SIGNAL_FUNC( allocate_callback ), - ( gpointer ) app ); - - gtk_widget_show_all( app ); - gdk_window_set_back_pixmap( GTK_LAYOUT(canvas)->bin_window, NULL, FALSE); - - gtk_main(); - - /* Not reached. */ - return 0; -} diff --git a/addressbook/printing/.cvsignore b/addressbook/printing/.cvsignore deleted file mode 100644 index 96194f7fd7..0000000000 --- a/addressbook/printing/.cvsignore +++ /dev/null @@ -1,9 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -*.lo -*.la -contact-print-test -contact-print-style-editor-test diff --git a/addressbook/printing/Makefile.am b/addressbook/printing/Makefile.am deleted file mode 100644 index 62a401dc5d..0000000000 --- a/addressbook/printing/Makefile.am +++ /dev/null @@ -1,67 +0,0 @@ -ecpsdir = $(datadir)/evolution/ecps - -ecps_DATA = \ - smallbook.ecps \ - medbook.ecps \ - phonelist.ecps - -gladedir = $(datadir)/evolution/glade - -glade_DATA = \ - e-contact-print.glade \ - e-contact-print.glade.h - -CPPFLAGS = \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_ECPSDIR=\""$(ecpsdir)"\" \ - -DDATADIR=\""$(datadir)"\" \ - $(GNOME_PRINT_CFLAGS) \ - $(BONOBO_GNOME_CFLAGS) - -INCLUDES = \ - $(GNOME_INCLUDEDIR) \ - -DG_LOG_DOMAIN=\"addressbook-printing\" \ - -I$(top_srcdir)/addressbook \ - -I$(top_srcdir) - -noinst_LIBRARIES = \ - libecontactprint.a - -libecontactprint_a_SOURCES = \ - e-contact-print.c \ - e-contact-print.h \ - e-contact-print-style-editor.c \ - e-contact-print-style-editor.h \ - e-contact-print-types.h - -noinst_PROGRAMS = \ - contact-print-test \ - contact-print-style-editor-test - -contact_print_test_SOURCES = \ - test-print.c - -contact_print_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - $(BONOBO_GNOME_LIBS) \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/addressbook/ename/libename.la \ - libecontactprint.a \ - $(GNOME_PRINT_LIBS) - -contact_print_style_editor_test_SOURCES = \ - test-contact-print-style-editor.c - -contact_print_style_editor_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - $(BONOBO_GNOME_LIBS) \ - $(top_builddir)/addressbook/backend/ebook/libebook.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/addressbook/ename/libename.la \ - libecontactprint.a \ - $(GNOME_PRINT_LIBS) - -EXTRA_DIST = $(glade_DATA) $(ecps_DATA) diff --git a/addressbook/printing/e-contact-print-style-editor.c b/addressbook/printing/e-contact-print-style-editor.c deleted file mode 100644 index 5eb5cadacf..0000000000 --- a/addressbook/printing/e-contact-print-style-editor.c +++ /dev/null @@ -1,150 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-print-style-editor.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-contact-print-style-editor.h" -static void e_contact_print_style_editor_init (EContactPrintStyleEditor *card); -static void e_contact_print_style_editor_class_init (EContactPrintStyleEditorClass *klass); -static void e_contact_print_style_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_contact_print_style_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_contact_print_style_editor_destroy (GtkObject *object); - -static GtkVBoxClass *parent_class = NULL; - - -/* The arguments we take */ -enum { - ARG_0, - ARG_CARD -}; - -GtkType -e_contact_print_style_editor_get_type (void) -{ - static GtkType contact_print_style_editor_type = 0; - - if (!contact_print_style_editor_type) - { - static const GtkTypeInfo contact_print_style_editor_info = - { - "EContactPrintStyleEditor", - sizeof (EContactPrintStyleEditor), - sizeof (EContactPrintStyleEditorClass), - (GtkClassInitFunc) e_contact_print_style_editor_class_init, - (GtkObjectInitFunc) e_contact_print_style_editor_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - contact_print_style_editor_type = gtk_type_unique (gtk_vbox_get_type (), &contact_print_style_editor_info); - } - - return contact_print_style_editor_type; -} - -static void -e_contact_print_style_editor_class_init (EContactPrintStyleEditorClass *klass) -{ - GtkObjectClass *object_class; - GtkVBoxClass *vbox_class; - - object_class = (GtkObjectClass*) klass; - vbox_class = (GtkVBoxClass *) klass; - - parent_class = gtk_type_class (gtk_vbox_get_type ()); - - object_class->set_arg = e_contact_print_style_editor_set_arg; - object_class->get_arg = e_contact_print_style_editor_get_arg; - object_class->destroy = e_contact_print_style_editor_destroy; -} - -#if 0 -static void -_add_image(GtkTable *table, gchar *image, int left, int right, int top, int bottom) -{ - gtk_table_attach(table, - gtk_widget_new(gtk_alignment_get_type(), - "child", gnome_pixmap_new_from_file(image), - "xalign", (double) 0, - "yalign", (double) 0, - "xscale", (double) 0, - "yscale", (double) 0, - NULL), - left, right, top, bottom, - GTK_FILL, GTK_FILL, - 0, 0); -} -#endif - -static void -e_contact_print_style_editor_init (EContactPrintStyleEditor *e_contact_print_style_editor) -{ - GladeXML *gui; - - /* e_contact_print_style_editor->card = NULL;*/ - gui = glade_xml_new (EVOLUTION_GLADEDIR "/e-contact-print.glade", NULL); - e_contact_print_style_editor->gui = gui; - gtk_widget_reparent(glade_xml_get_widget(gui, "vbox-contact-print-style-editor"), - GTK_WIDGET(e_contact_print_style_editor)); -} - -void -e_contact_print_style_editor_destroy (GtkObject *object) -{ - EContactPrintStyleEditor *e_contact_print_style_editor = E_CONTACT_PRINT_STYLE_EDITOR(object); - gtk_object_unref(GTK_OBJECT(e_contact_print_style_editor->gui)); -} - -GtkWidget* -e_contact_print_style_editor_new (char *filename) -{ - GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_print_style_editor_get_type ())); - return widget; -} - -static void -e_contact_print_style_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - EContactPrintStyleEditor *e_contact_print_style_editor; - - e_contact_print_style_editor = E_CONTACT_PRINT_STYLE_EDITOR (o); - - switch (arg_id){ - default: - break; - } -} - -static void -e_contact_print_style_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EContactPrintStyleEditor *e_contact_print_style_editor; - - e_contact_print_style_editor = E_CONTACT_PRINT_STYLE_EDITOR (object); - - switch (arg_id) { - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} diff --git a/addressbook/printing/e-contact-print-style-editor.h b/addressbook/printing/e-contact-print-style-editor.h deleted file mode 100644 index cf0f17f889..0000000000 --- a/addressbook/printing/e-contact-print-style-editor.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-print-style-editor.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_CONTACT_PRINT_STYLE_EDITOR_H__ -#define __E_CONTACT_PRINT_STYLE_EDITOR_H__ - -#include <gnome.h> -#include <glade/glade.h> - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -/* EContactPrintStyleEditor - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * card ECard * R The card currently being edited - */ - -#define E_CONTACT_PRINT_STYLE_EDITOR_TYPE (e_contact_print_style_editor_get_type ()) -#define E_CONTACT_PRINT_STYLE_EDITOR(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_PRINT_STYLE_EDITOR_TYPE, EContactPrintStyleEditor)) -#define E_CONTACT_PRINT_STYLE_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_PRINT_STYLE_EDITOR_TYPE, EContactPrintStyleEditorClass)) -#define E_IS_MINICARD(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_PRINT_STYLE_EDITOR_TYPE)) -#define E_IS_MINICARD_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_PRINT_STYLE_EDITOR_TYPE)) - - -typedef struct _EContactPrintStyleEditor EContactPrintStyleEditor; -typedef struct _EContactPrintStyleEditorClass EContactPrintStyleEditorClass; - -struct _EContactPrintStyleEditor -{ - GtkVBox parent; - - /* item specific fields */ - GladeXML *gui; -}; - -struct _EContactPrintStyleEditorClass -{ - GtkVBoxClass parent_class; -}; - - -GtkWidget *e_contact_print_style_editor_new(char *filename); -GtkType e_contact_print_style_editor_get_type (void); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - - -#endif /* __E_CONTACT_PRINT_STYLE_EDITOR_H__ */ diff --git a/addressbook/printing/e-contact-print-types.h b/addressbook/printing/e-contact-print-types.h deleted file mode 100644 index e99cfe6d39..0000000000 --- a/addressbook/printing/e-contact-print-types.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-print-types.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_CONTACT_PRINT_TYPES_H -#define E_CONTACT_PRINT_TYPES_H - -#include <gnome.h> -#include <libgnomeprint/gnome-font.h> - -typedef struct _EContactPrintStyle EContactPrintStyle; -typedef enum _EContactPrintType EContactPrintType; - -enum _EContactPrintType { - E_CONTACT_PRINT_TYPE_CARDS, - E_CONTACT_PRINT_TYPE_MEMO_STYLE, - E_CONTACT_PRINT_TYPE_PHONE_LIST -}; - -struct _EContactPrintStyle -{ - gchar *title; - EContactPrintType type; - gboolean sections_start_new_page; - guint num_columns; - guint blank_forms; - gboolean letter_tabs; - gboolean letter_headings; - GnomeFont *headings_font; - GnomeFont *body_font; - gboolean print_using_grey; - gint paper_type; - gdouble paper_width; - gdouble paper_height; - gint paper_source; - gdouble top_margin; - gdouble left_margin; - gdouble bottom_margin; - gdouble right_margin; - gint page_size; - gdouble page_width; - gdouble page_height; - gboolean orientation_portrait; - GnomeFont *header_font; - gchar *left_header; - gchar *center_header; - gchar *right_header; - GnomeFont *footer_font; - gchar *left_footer; - gchar *center_footer; - gchar *right_footer; - gboolean reverse_on_even_pages; -}; - -#endif /* E_CONTACT_PRINT_TYPES_H */ - diff --git a/addressbook/printing/e-contact-print.c b/addressbook/printing/e-contact-print.c deleted file mode 100644 index 00a32f0d57..0000000000 --- a/addressbook/printing/e-contact-print.c +++ /dev/null @@ -1,1112 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-print.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-contact-print.h" -#include <libgnomeprint/gnome-print.h> -#include <libgnomeprint/gnome-print-dialog.h> -#include <libgnomeprint/gnome-print-master.h> -#include <libgnomeprint/gnome-print-master-preview.h> -#include <libgnomeprint/gnome-print-multipage.h> -#include <gnome-xml/tree.h> -#include <gnome-xml/parser.h> -#include <gnome-xml/xmlmemory.h> -#include <ctype.h> -#include <addressbook/backend/ebook/e-book.h> -#include <addressbook/backend/ebook/e-card.h> -#include <addressbook/backend/ebook/e-card-simple.h> - -#define SCALE 5 -#define HYPHEN_PIXELS 20 -#define HYPHEN_PENALTY ( (SCALE) * (SCALE) * (HYPHEN_PIXELS) * (HYPHEN_PIXELS) ) - -typedef struct _EContactPrintContext EContactPrintContext; - -struct _EContactPrintContext -{ - GnomePrintContext *pc; - GnomePrintMaster *master; - gdouble x; - gdouble y; - gint column; - EContactPrintStyle *style; - gboolean first_section; - gchar first_char_on_page; - gchar last_char_on_page; - GnomeFont *letter_heading_font; - GnomeFont *letter_tab_font; - char *character; - gboolean first_contact; - - gboolean uses_book; - int type; - EBook *book; - gchar *query; - - GList *cards; -}; - -static gint -e_contact_divide_text(GnomePrintContext *pc, GnomeFont *font, double width, const gchar *text, GList **return_val /* Of type char[] */) -{ - if ( width == -1 || gnome_font_get_width_string(font, text) <= width ) { - if ( return_val ) { - *return_val = g_list_append(*return_val, g_strdup(text)); - } - return 1; - } else { -#if 1 - int i, l; - double x = 0; - int lastend = 0; - int linestart = 0; - int firstword = 1; - int linecount = 0; - l = strlen(text); - for ( i = 0; i < l; i++ ) { - if ( text[i] == ' ' ) { - if ( (!firstword) && x + gnome_font_get_width_string_n(font, text + lastend, i - lastend) > width ) { - if (return_val) { - *return_val = g_list_append(*return_val, g_strndup(text + linestart, lastend - linestart)); - } - x = gnome_font_get_width_string(font, " "); - linestart = lastend + 1; - x += gnome_font_get_width_string_n(font, text + linestart, i - linestart); - lastend = i; - linecount ++; - } else { - x += gnome_font_get_width_string_n(font, text + lastend, i - lastend); - lastend = i; - } - firstword = 0; - } else if ( text[i] == '\n' ) { - if ( (!firstword) && x + gnome_font_get_width_string_n(font, text + lastend, i - lastend) > width ) { - if (return_val) { - *return_val = g_list_append(*return_val, g_strndup(text + linestart, lastend - linestart)); - } - linestart = lastend + 1; - lastend = i; - linecount ++; - } - if (return_val) { - *return_val = g_list_append(*return_val, g_strndup(text + linestart, i - linestart)); - } - linestart = i + 1; - lastend = i + 1; - linecount ++; - x = gnome_font_get_width_string(font, " "); - - firstword = 1; - } - } - if ( (!firstword) && x + gnome_font_get_width_string_n(font, text + lastend, i - lastend) > width ) { - if (return_val) { - *return_val = g_list_append(*return_val, g_strndup(text + linestart, lastend - linestart)); - } - linestart = lastend + 1; - lastend = i; - linecount ++; - } - if (return_val) { - *return_val = g_list_append(*return_val, g_strndup(text + linestart, i - linestart)); - } - linecount ++; - return(linecount); -#else - HnjBreak *breaks; - gint *result; - gint *is; - gint n_breaks = 0, n_actual_breaks = 0; - gint i; - gint l; - gchar *hyphenation; - double x = - gnome_font_get_width_string(font, " ") * SCALE; - HnjParams hnjparams; - - hnjparams.set_width = width * SCALE + x; - hnjparams.max_neg_space = 0; - hnjparams.tab_width = 0; - - l = strlen(text); - - /* find possible line breaks. */ - for (i = 0; i < l; i++) { - if (text[i] == '-') - n_breaks++; - else if (text[i] == ' ') - n_breaks++; -#if 0 - else if (hyphenation[i] & 1) - n_breaks++; -#endif - } - - breaks = g_new( HnjBreak, n_breaks + 1 ); - result = g_new( gint, n_breaks + 1 ); - is = g_new( gint, n_breaks + 1 ); - n_breaks = 0; - /* find possible line breaks. */ - - for (i = 0; i < l; i++) { - if ( text[i] == '-' ) { - x += gnome_font_get_width(font, text[i]) * SCALE; - breaks[n_breaks].x0 = x; - breaks[n_breaks].x1 = x; - breaks[n_breaks].penalty = HYPHEN_PENALTY; - breaks[n_breaks].flags = HNJ_JUST_FLAG_ISHYPHEN; - is[n_breaks] = i + 1; - n_breaks++; - } else if ( text[i] == ' ' ) { - breaks[ n_breaks ].x0 = x; - x += gnome_font_get_width(font, text[i]) * SCALE; - breaks[ n_breaks ].x1 = x; - breaks[ n_breaks ].penalty = 0; - breaks[ n_breaks ].flags = HNJ_JUST_FLAG_ISSPACE; - is[ n_breaks ] = i + 1; - n_breaks++; -#if 0 - } else if (word->hyphenation[i] & 1) { - breaks[n_breaks].x0 = x + gnome_font_get_width(font, '-') * SCALE; - breaks[n_breaks].x1 = x; - breaks[n_breaks].penalty = HYPHEN_PENALTY; - breaks[n_breaks].flags = HNJ_JUST_FLAG_ISHYPHEN; - is[n_breaks] = i + 1; - n_breaks++; -#endif - } else - x += gnome_font_get_width(font, text[i]) * SCALE; - - } - is[n_breaks] = i; - breaks[n_breaks].flags = 0; - n_breaks++; - - /* Calculate optimal line breaks. */ - n_actual_breaks = hnj_hs_just (breaks, n_breaks, - &hnjparams, result); - - if ( return_val ) { - gchar *next_val; - if ( breaks[result[0]].flags == HNJ_JUST_FLAG_ISHYPHEN && text[is[result[0]]] != '-' ) { - next_val = g_new(gchar, is[result[0]] + 2); - strncpy(next_val, text, is[result[0]]); - next_val[is[result[0]]] = 0; - strcat(next_val, "-"); - } else { - next_val = g_new(gchar, is[result[0]] + 1); - strncpy(next_val, text, is[result[0]]); - next_val[is[result[0]]] = 0; - } - *return_val = g_list_append(*return_val, next_val); - - for ( i = 1; i < n_actual_breaks; i++ ) { - if ( (breaks[result[i]].flags & HNJ_JUST_FLAG_ISHYPHEN) && (text[is[result[i]]] != '-') ) { - next_val = g_new(gchar, is[result[i]] - is[result[i - 1]] + 2); - strncpy(next_val, text + is[result[i - 1]], is[result[i]] - is[result[i - 1]]); - next_val[is[result[i]] - is[result[i - 1]]] = 0; - strcat(next_val, "-"); - } else { - next_val = g_new(gchar, is[result[i]] - is[result[i - 1]] + 1); - strncpy(next_val, text + is[result[i - 1]], is[result[i]] - is[result[i - 1]]); - next_val[is[result[i]] - is[result[i - 1]]] = 0; - } - *return_val = g_list_append(*return_val, next_val); - } - } - - g_free (breaks); - g_free (result); - g_free (is); - return n_actual_breaks; -#endif - } -} - -static void -e_contact_output(GnomePrintContext *pc, GnomeFont *font, double x, double y, double width, const gchar *text) -{ - GList *list = NULL, *list_start; - int first_line = 1; - gnome_print_gsave(pc); - gnome_print_setfont(pc, font); - e_contact_divide_text(pc, font, width, text, &list); - for ( list_start = list; list; list = g_list_next(list)) { - y -= gnome_font_get_ascender(font); - gnome_print_moveto(pc, x, y); - gnome_print_show(pc, (char *)list->data); - y -= gnome_font_get_descender(font); - y -= .2 * font->size; - if ( first_line ) { - x += gnome_font_get_width_string(font, " "); - first_line = 0; - } - } - g_list_foreach( list_start, (GFunc) g_free, NULL ); - g_list_free( list_start ); - gnome_print_grestore(pc); -} - -static gdouble -e_contact_text_height(GnomePrintContext *pc, GnomeFont *font, double width, gchar *text) -{ - int line_count = e_contact_divide_text(pc, font, width, text, NULL); - return line_count * (gnome_font_get_ascender(font) + gnome_font_get_descender(font)) + - (line_count - 1) * .2 * font->size; -} - -#if 0 -static void -e_contact_output_and_advance(EContactPrintContext *ctxt, GnomeFont *font, double x, double width, gchar *text) -{ - ctxt->y -= .1 * font->size; - e_contact_output(ctxt->pc, font, x, ctxt->y, width, text); - ctxt->y -= e_contact_text_height(ctxt->pc, font, width, text); - ctxt->y -= .1 * font->size; -} -#endif - -static void -e_contact_rectangle(GnomePrintContext *pc, - gdouble x0, - gdouble y0, - gdouble x1, - gdouble y1, - gdouble r, - gdouble g, - gdouble b) -{ - gnome_print_gsave(pc); - gnome_print_setrgbcolor(pc, r, g, b); - gnome_print_moveto(pc, x0, y0); - gnome_print_lineto(pc, x1, y0); - gnome_print_lineto(pc, x1, y1); - gnome_print_lineto(pc, x0, y1); - gnome_print_lineto(pc, x0, y0); - gnome_print_fill(pc); - gnome_print_grestore(pc); -} - -static double -e_contact_get_letter_tab_width (EContactPrintContext *ctxt) -{ - return gnome_font_get_width_string(ctxt->letter_tab_font, "123") + 4 + 18; -} - -static double -e_contact_print_letter_tab (EContactPrintContext *ctxt) -{ - char character; - gdouble x, y; - gdouble page_width = 72 * (ctxt->style->page_width - ctxt->style->left_margin - ctxt->style->right_margin); - gdouble tab_height, tab_width; - gdouble font_size; - tab_height = 72 * (ctxt->style->page_height - ctxt->style->top_margin - ctxt->style->bottom_margin) / 27.0; - font_size = tab_height / 2; - tab_width = e_contact_get_letter_tab_width(ctxt) - 18; - x = page_width + 72 * (ctxt->style->left_margin) - tab_width; - y = 72 * (ctxt->style->page_height - ctxt->style->top_margin); - - - gnome_print_gsave( ctxt->pc ); - if ( ctxt->style->print_using_grey ) - e_contact_rectangle( ctxt->pc, x, 72 * (ctxt->style->page_height - ctxt->style->top_margin), x + tab_width, ctxt->style->bottom_margin * 72, .85, .85, .85 ); - for ( character = 'A' - 1; character <= 'Z'; character ++ ) { - char string[] = "123"; - if ( character >= 'A' ) { - string[0] = tolower(character); - string[1] = 0; - } - if ( character >= ctxt->first_char_on_page && character <= ctxt->last_char_on_page ) { - e_contact_rectangle( ctxt->pc, x + 1, y - 1, x + tab_width - 1, y - (tab_height - 1), 0, 0, 0 ); - gnome_print_setrgbcolor( ctxt->pc, 1, 1, 1 ); - e_contact_output( ctxt->pc, ctxt->letter_tab_font, x + tab_width / 2 - gnome_font_get_width_string(ctxt->letter_tab_font, string) / 2, y - (tab_height - font_size) / 2, -1, string ); - } else { - gnome_print_setrgbcolor( ctxt->pc, 0, 0, 0 ); - e_contact_output( ctxt->pc, ctxt->letter_tab_font, x + tab_width / 2 - gnome_font_get_width_string(ctxt->letter_tab_font, string) / 2, y - (tab_height - font_size) / 2, -1, string ); - } - y -= tab_height; - } - gnome_print_grestore( ctxt->pc ); - return gnome_font_get_width_string(ctxt->style->body_font, "123") + ctxt->style->body_font->size / 5; -} - -static double -e_contact_get_letter_heading_height (EContactPrintContext *ctxt) -{ - gdouble ascender, descender; - ascender = gnome_font_get_ascender(ctxt->letter_heading_font); - descender = gnome_font_get_descender(ctxt->letter_heading_font); - return ascender + descender + 9; -} - -static void -e_contact_print_letter_heading (EContactPrintContext *ctxt, gchar *character) -{ - gdouble ascender, descender; - gdouble width; - - width = gnome_font_get_width_string(ctxt->letter_heading_font, "m") * 1.7; - ascender = gnome_font_get_ascender(ctxt->letter_heading_font); - descender = gnome_font_get_descender(ctxt->letter_heading_font); - gnome_print_gsave( ctxt->pc ); - e_contact_rectangle( ctxt->pc, ctxt->x, ctxt->y, ctxt->x + width, ctxt->y - (ascender + descender + 6), 0, 0, 0); - gnome_print_setrgbcolor(ctxt->pc, 1, 1, 1); - ctxt->y -= 4; - e_contact_output(ctxt->pc, ctxt->letter_heading_font, ctxt->x + (width - gnome_font_get_width_string(ctxt->letter_heading_font, character))/ 2, ctxt->y, -1, character); - ctxt->y -= ascender + descender; - ctxt->y -= 2; - ctxt->y -= 3; - gnome_print_grestore( ctxt->pc ); -} - -static void -e_contact_start_new_page(EContactPrintContext *ctxt) -{ - ctxt->x = ctxt->style->left_margin * 72; - ctxt->y = (ctxt->style->page_height - ctxt->style->top_margin) * 72; - ctxt->column = 0; - if ( ctxt->style->letter_tabs ) - e_contact_print_letter_tab(ctxt); - gnome_print_showpage(ctxt->pc); - - ctxt->first_char_on_page = ctxt->last_char_on_page + 1; -} - -static double -e_contact_get_card_size(ECardSimple *simple, EContactPrintContext *ctxt) -{ - gdouble height = 0; - gdouble page_width = 72 * (ctxt->style->page_width - ctxt->style->left_margin - ctxt->style->right_margin); - gdouble column_width; - char *file_as; - gint field; - if ( ctxt->style->letter_tabs ) - page_width -= e_contact_get_letter_tab_width(ctxt); - column_width = (page_width + 18) / ctxt->style->num_columns - 18; - - height += ctxt->style->headings_font->size * .2; - - height += ctxt->style->headings_font->size * .2; - - gtk_object_get(GTK_OBJECT(simple->card), - "file_as", &file_as, - NULL); - height += e_contact_text_height(ctxt->pc, ctxt->style->headings_font, column_width - 4, file_as); - height += ctxt->style->headings_font->size * .2; - - height += ctxt->style->headings_font->size * .2; - - for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST; field++) { - char *string; - string = e_card_simple_get(simple, field); - if (string && *string) { - double xoff = 0; - xoff += gnome_font_get_width_string(ctxt->style->body_font, e_card_simple_get_name(simple, field)); - xoff += gnome_font_get_width_string(ctxt->style->body_font, ": "); - height += e_contact_text_height(ctxt->pc, ctxt->style->body_font, column_width - xoff, string); - height += .2 * ctxt->style->body_font->size; - } - g_free(string); - } - height += ctxt->style->headings_font->size * .4; - return height; -} - - -static void -e_contact_print_card (ECardSimple *simple, EContactPrintContext *ctxt) -{ - gdouble page_width = 72 * (ctxt->style->page_width - ctxt->style->left_margin - ctxt->style->right_margin); - gdouble column_width; - char *file_as; - int field; - - if ( ctxt->style->letter_tabs ) - page_width -= e_contact_get_letter_tab_width(ctxt); - column_width = (page_width + 18) / ctxt->style->num_columns - 18; - - gnome_print_gsave(ctxt->pc); - - ctxt->y -= ctxt->style->headings_font->size * .2; - - ctxt->y -= ctxt->style->headings_font->size * .2; - - gtk_object_get(GTK_OBJECT(simple->card), - "file_as", &file_as, - NULL); - if (ctxt->style->print_using_grey) - e_contact_rectangle(ctxt->pc, ctxt->x, ctxt->y + ctxt->style->headings_font->size * .3, ctxt->x + column_width, ctxt->y - e_contact_text_height(ctxt->pc, ctxt->style->headings_font, column_width - 4, file_as) - ctxt->style->headings_font->size * .3, .85, .85, .85); - e_contact_output(ctxt->pc, ctxt->style->headings_font, ctxt->x + 2, ctxt->y, column_width - 4, file_as); - ctxt->y -= e_contact_text_height(ctxt->pc, ctxt->style->headings_font, column_width - 4, file_as); - ctxt->y -= ctxt->style->headings_font->size * .2; - - ctxt->y -= ctxt->style->headings_font->size * .2; - - for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST; field++) { - char *string; - string = e_card_simple_get(simple, field); - if (string && *string) { - double xoff = 0; - e_contact_output(ctxt->pc, ctxt->style->body_font, ctxt->x + xoff, ctxt->y, -1, e_card_simple_get_name(simple, field)); - xoff += gnome_font_get_width_string(ctxt->style->body_font, e_card_simple_get_name(simple, field)); - e_contact_output(ctxt->pc, ctxt->style->body_font, ctxt->x + xoff, ctxt->y, -1, ": "); - xoff += gnome_font_get_width_string(ctxt->style->body_font, ": "); - e_contact_output(ctxt->pc, ctxt->style->body_font, ctxt->x + xoff, ctxt->y, column_width - xoff, string); - ctxt->y -= e_contact_text_height(ctxt->pc, ctxt->style->body_font, column_width - xoff, string); - ctxt->y -= .2 * ctxt->style->body_font->size; - } - g_free(string); - } - - ctxt->y -= ctxt->style->headings_font->size * .4; - gnome_print_grestore(ctxt->pc); -} - -static void -e_contact_start_new_column (EContactPrintContext *ctxt) -{ - gdouble page_width = 72 * (ctxt->style->page_width - ctxt->style->left_margin - ctxt->style->right_margin); - gdouble column_offset; - if ( ctxt->style->letter_tabs ) - page_width -= e_contact_get_letter_tab_width(ctxt); - column_offset = (page_width + 18) / ctxt->style->num_columns; - ctxt->column ++; - if (ctxt->column >= ctxt->style->num_columns) { - e_contact_start_new_page(ctxt); - ctxt->column = 0; - } - ctxt->x = (72 * ctxt->style->left_margin) + column_offset * ctxt->column; - ctxt->y = 72 * (ctxt->style->page_height - ctxt->style->top_margin); -} - -static void -complete_sequence(EBookView *book_view, EContactPrintContext *ctxt) -{ - GList *cards = ctxt->cards; - - gdouble page_width = 72 * (ctxt->style->page_width - ctxt->style->left_margin - ctxt->style->right_margin); - - ctxt->first_contact = TRUE; - ctxt->character = NULL; - ctxt->y = (ctxt->style->page_height - ctxt->style->top_margin) * 72; - ctxt->x = (ctxt->style->left_margin) * 72; - if ( ctxt->style->letter_tabs ) - page_width -= e_contact_get_letter_tab_width(ctxt); - - ctxt->first_char_on_page = 'A' - 1; - - for(; cards; cards = cards->next) { - ECard *card = cards->data; - ECardSimple *simple = e_card_simple_new(card); - gchar *file_as; - - gtk_object_get(GTK_OBJECT(card), - "file_as", &file_as, - NULL); - if ( file_as && (!ctxt->character || *ctxt->character != tolower(*file_as)) ) { - if (ctxt->style->sections_start_new_page && ! ctxt->first_contact) { - e_contact_start_new_page(ctxt); - } - else if ((!ctxt->first_contact) && (ctxt->y - e_contact_get_letter_heading_height(ctxt) - e_contact_get_card_size(simple, ctxt) < ctxt->style->bottom_margin * 72)) - e_contact_start_new_column(ctxt); - if (!ctxt->character) - ctxt->character = g_strdup(" "); - *ctxt->character = tolower(*file_as); - if ( ctxt->style->letter_headings ) - e_contact_print_letter_heading(ctxt, ctxt->character); - ctxt->first_section = FALSE; - } - else if ( (!ctxt->first_contact) && (ctxt->y - e_contact_get_card_size(simple, ctxt) < ctxt->style->bottom_margin * 72)) { - e_contact_start_new_column(ctxt); - if ( ctxt->style->letter_headings ) - e_contact_print_letter_heading(ctxt, ctxt->character); - } - ctxt->last_char_on_page = toupper(*file_as); - if ( ctxt->last_char_on_page < ctxt->first_char_on_page ) - ctxt->first_char_on_page = ctxt->last_char_on_page; - e_contact_print_card(simple, ctxt); - ctxt->first_contact = FALSE; - gtk_object_unref(GTK_OBJECT(simple)); - } - ctxt->last_char_on_page = 'Z'; - if ( ctxt->style->letter_tabs ) - e_contact_print_letter_tab(ctxt); - gnome_print_showpage(ctxt->pc); - gnome_print_context_close(ctxt->pc); - g_free(ctxt->character); - if (book_view) - gtk_object_unref(GTK_OBJECT(book_view)); - if (ctxt->type == GNOME_PRINT_PREVIEW) { - GtkWidget *preview; - preview = GTK_WIDGET(gnome_print_master_preview_new(ctxt->master, "Print Preview")); - gtk_widget_show_all(preview); - } else { - gnome_print_master_print(ctxt->master); - } - gtk_object_unref(GTK_OBJECT(ctxt->pc)); - gtk_object_unref(GTK_OBJECT(ctxt->master)); - if (ctxt->book) - gtk_object_unref(GTK_OBJECT(ctxt->book)); - g_free(ctxt->query); - g_list_foreach(ctxt->cards, (GFunc) gtk_object_unref, NULL); - g_list_free(ctxt->cards); - gtk_object_unref(GTK_OBJECT(ctxt->style->headings_font)); - gtk_object_unref(GTK_OBJECT(ctxt->style->body_font)); - gtk_object_unref(GTK_OBJECT(ctxt->style->header_font)); - gtk_object_unref(GTK_OBJECT(ctxt->style->footer_font)); - gtk_object_unref(GTK_OBJECT(ctxt->letter_heading_font)); - gtk_object_unref(GTK_OBJECT(ctxt->letter_tab_font)); - g_free(ctxt->style); - g_free(ctxt); -} - -static int -card_compare (ECard *card1, ECard *card2) { - if (card1 && card2) { - char *file_as1, *file_as2; - gtk_object_get(GTK_OBJECT(card1), - "file_as", &file_as1, - NULL); - gtk_object_get(GTK_OBJECT(card2), - "file_as", &file_as2, - NULL); - if (file_as1 && file_as2) - return strcasecmp(file_as1, file_as2); - if (file_as1) - return -1; - if (file_as2) - return 1; - return strcmp(e_card_get_id(card1), e_card_get_id(card2)); - } else { - return 0; - } -} - -static void -create_card(EBookView *book_view, const GList *cards, EContactPrintContext *ctxt) -{ - for(; cards; cards = cards->next) { - ECard *card = cards->data; - gtk_object_ref(GTK_OBJECT(card)); - ctxt->cards = g_list_insert_sorted(ctxt->cards, card, (GCompareFunc) card_compare); - } -} - -static void -book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, EContactPrintContext *ctxt) -{ - gtk_object_ref(GTK_OBJECT(book_view)); - - gtk_signal_connect(GTK_OBJECT(book_view), - "card_added", - GTK_SIGNAL_FUNC(create_card), - ctxt); - - gtk_signal_connect(GTK_OBJECT(book_view), - "sequence_complete", - GTK_SIGNAL_FUNC(complete_sequence), - ctxt); -} - -static void -e_contact_do_print_cards (EBook *book, char *query, EContactPrintContext *ctxt) -{ - e_book_get_book_view(book, query, (EBookBookViewCallback) book_view_loaded, ctxt); -} - -#if 0 -static double -e_contact_get_phone_list_size(ECardSimple *simple, EContactPrintContext *ctxt) -{ - double height = 0; - int field; - - height += ctxt->style->headings_font->size * .2; - - height += ctxt->style->headings_font->size * .2; - - for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST; field++) { - char *string; - string = e_card_simple_get(simple, field); - if (string && *string) { - if ( 1 ) /* field is a phone field. */ { - gchar *field = string; - height += e_contact_text_height(ctxt->pc, ctxt->style->body_font, 100, field); - height += .2 * ctxt->style->body_font->size; - } - } - g_free(string); - } - height += ctxt->style->headings_font->size * .4; - return height; -} - - -static void -e_contact_print_phone_list (ECard *card, EContactPrintContext *ctxt) -{ - gdouble page_width = 72 * (ctxt->style->page_width - ctxt->style->left_margin - ctxt->style->right_margin); - gdouble column_width; - double xoff, dotwidth; - int dotcount; - char *dots; - int i; - char *file_as; - if ( ctxt->style->letter_tabs ) - page_width -= e_contact_get_letter_tab_width(ctxt); - column_width = (page_width + 18) / ctxt->style->num_columns - 18; - - gnome_print_gsave(ctxt->pc); - - ctxt->y -= ctxt->style->headings_font->size * .2; - - ctxt->y -= ctxt->style->headings_font->size * .2; - - e_contact_output(ctxt->pc, ctxt->style->body_font, ctxt->x, ctxt->y, -1, e_card_get_string_fileas(card)); - - xoff = column_width - 9 * ctxt->style->body_font->size; - dotwidth = xoff - - gnome_font_get_width_string(ctxt->style->body_font, e_card_get_string_fileas(card)) - - gnome_font_get_width_string(ctxt->style->body_font, " "); - dotcount = dotwidth / gnome_font_get_width(ctxt->style->body_font, '.'); - dots = g_new(gchar, dotcount + 1); - for (i = 0; i < dotcount; i++) - dots[i] = '.'; - dots[dotcount] = 0; - e_contact_output(ctxt->pc, ctxt->style->body_font, ctxt->x + xoff - dotcount * gnome_font_get_width(ctxt->style->body_font, '.'), ctxt->y, -1, dots); - g_free(dots); - - for(; shown_fields; shown_fields = g_list_next(shown_fields)) { - if ( 1 ) /* field is a phone field. */ { - gchar *field = e_card_get_string(card, shown_fields->data); - e_contact_output(ctxt->pc, ctxt->style->body_font, ctxt->x + xoff, ctxt->y, -1, shown_fields->data); - e_contact_output(ctxt->pc, ctxt->style->body_font, - ctxt->x + column_width - gnome_font_get_width_string(ctxt->style->body_font, - field), - ctxt->y, - -1, - field); - ctxt->y -= e_contact_text_height(ctxt->pc, ctxt->style->body_font, 100, field); - ctxt->y -= .2 * ctxt->style->body_font->size; - } - } - ctxt->y -= ctxt->style->headings_font->size * .4; - gnome_print_grestore(ctxt->pc); -} - -static void -e_contact_do_print_phone_list (EBook *book, char *query, EContactPrintContext *ctxt) -{ - ECard *card = NULL; - int i; - gdouble page_width = 72 * (ctxt->style->page_width - ctxt->style->left_margin - ctxt->style->right_margin); - gdouble column_width; - ctxt->first_contact = TRUE; - ctxt->character = NULL; - ctxt->y = (ctxt->style->page_height - ctxt->style->top_margin) * 72; - ctxt->x = (ctxt->style->left_margin) * 72; - if ( ctxt->style->letter_tabs ) - page_width -= e_contact_get_letter_tab_width(ctxt); - - ctxt->first_char_on_page = 'A' - 1; - - column_width = (page_width + 18) / ctxt->style->num_columns - 18; - /* - for(card = e_book_get_first(book); card; card = e_book_get_next(book)) { - */ - for (i=0; i < 30; i++) { - gchar *file_as = e_card_get_string_fileas(card); - if ( file_as && (!character || *character != tolower(*file_as)) ) { - if (ctxt->style->sections_start_new_page && ! first_contact) { - e_contact_start_new_page(ctxt); - } - else if ((!first_contact) && (ctxt->y - e_contact_get_letter_heading_height(ctxt) - e_contact_get_phone_list_size(card, ctxt, shown_fields) < ctxt->style->bottom_margin * 72)) - e_contact_start_new_column(ctxt); - if (!character) - character = g_strdup(" "); - *character = tolower(*file_as); - if ( ctxt->style->letter_headings ) - e_contact_print_letter_heading(ctxt, character); - ctxt->first_section = FALSE; - } - else if ( (!first_contact) && (ctxt->y - e_contact_get_card_size(card, ctxt, shown_fields) < ctxt->style->bottom_margin * 72)) { - e_contact_start_new_column(ctxt); - if ( ctxt->style->letter_headings ) - e_contact_print_letter_heading(ctxt, character); - } - ctxt->last_char_on_page = toupper(*file_as); - if ( ctxt->last_char_on_page < ctxt->first_char_on_page ) - ctxt->first_char_on_page = ctxt->last_char_on_page; - e_contact_print_phone_list(card, ctxt, shown_fields); - first_contact = FALSE; - } - ctxt->last_char_on_page = 'Z'; - if ( ctxt->style->letter_tabs ) - e_contact_print_letter_tab(ctxt); - gnome_print_showpage(ctxt->pc); - gnome_print_context_close(ctxt->pc); - g_free(character); -} -#endif - -static void -e_contact_do_print (EBook *book, char *query, EContactPrintContext *ctxt) -{ - switch ( ctxt->style->type ) { - case E_CONTACT_PRINT_TYPE_CARDS: - e_contact_do_print_cards( book, query, ctxt); - break; -#if 0 - case E_CONTACT_PRINT_TYPE_PHONE_LIST: - e_contact_do_print_phone_list( book, query, ctxt ); - break; -#endif - default: - break; - } -} - -static void lowify( char *data ) -{ - for ( ; *data; data++ ) - *data = tolower(*data); -} - -static gboolean get_bool( char *data ) -{ - if ( data ) { - lowify ( data ); - return ! strcmp(data, "true"); - } else - return FALSE; -} - -static void get_string( char *data, char **variable ) -{ - g_free ( *variable ); - if ( data ) - *variable = g_strdup( data ); - else - *variable = g_strdup( "" ); -} - -static int get_integer( char *data ) -{ - if ( data ) - return atoi(data); - else - return 0; -} - -static double get_float( char *data ) -{ - if ( data ) - return atof(data); - else - return 0; -} - -static void get_font( char *data, GnomeFont **variable ) -{ - if ( data ) { - GnomeFont *font = gnome_font_new_from_full_name( data ); - if ( font ) { - gtk_object_unref( GTK_OBJECT(*variable) ); - *variable = font; - } - } -} - - -static void -e_contact_build_style(EContactPrintStyle *style) -{ - xmlDocPtr styledoc; - gchar *filename; - style->title = g_strdup(""); - style->type = E_CONTACT_PRINT_TYPE_CARDS; - style->sections_start_new_page = TRUE; - style->num_columns = 2; - style->blank_forms = 2; - style->letter_tabs = TRUE; - style->letter_headings = FALSE; - style->headings_font = gnome_font_new("Helvetica-Bold", 8); - style->body_font = gnome_font_new("Helvetica", 6); - style->print_using_grey = TRUE; - style->paper_type = 0; - style->paper_width = 8.5; - style->paper_height = 11; - style->paper_source = 0; - style->top_margin = .5; - style->left_margin = .5; - style->bottom_margin = .5; - style->right_margin = .5; - style->page_size = 0; - style->page_width = 2.75; - style->page_height = 4.25; -#if 0 - style->page_width = 4.25; - style->page_height = 5.5; -#endif -#if 0 - style->page_width = 5.5; - style->page_height = 8.5; -#endif - style->orientation_portrait = FALSE; - style->header_font = gnome_font_new("Helvetica", 6); - style->left_header = g_strdup(""); - style->center_header = g_strdup(""); - style->right_header = g_strdup(""); - style->footer_font = gnome_font_new("Helvetica", 6); - style->left_footer = g_strdup(""); - style->center_footer = g_strdup(""); - style->right_footer = g_strdup(""); - style->reverse_on_even_pages = FALSE; - filename = g_concat_dir_and_file(EVOLUTION_ECPSDIR, "medbook.ecps"); - styledoc = xmlParseFile(filename); - g_free(filename); - if (styledoc) { - xmlNodePtr stylenode = xmlDocGetRootElement(styledoc); - xmlNodePtr node; - for (node = stylenode->childs; node; node = node->next) { - char *data = xmlNodeGetContent ( node ); - if ( !strcmp( node->name, "title" ) ) { - get_string(data, &(style->title)); - } else if ( !strcmp( node->name, "type" ) ) { - lowify( data ); - if ( !strcmp( data, "cards" ) ) - style->type = E_CONTACT_PRINT_TYPE_CARDS; - else if ( !strcmp( data, "memo_style" ) ) - style->type = E_CONTACT_PRINT_TYPE_MEMO_STYLE; - else if ( !strcmp( data, "phone_list" ) ) - style->type = E_CONTACT_PRINT_TYPE_PHONE_LIST; - } else if ( !strcmp( node->name, "sections_start_new_page" ) ) { - style->sections_start_new_page = get_bool(data); - } else if ( !strcmp( node->name, "num_columns" ) ) { - style->num_columns = get_integer(data); - } else if ( !strcmp( node->name, "blank_forms" ) ) { - style->blank_forms = get_integer(data); - } else if ( !strcmp( node->name, "letter_tabs" ) ) { - style->letter_tabs = get_bool(data); - } else if ( !strcmp( node->name, "letter_headings" ) ) { - style->letter_headings = get_bool(data); - } else if ( !strcmp( node->name, "headings_font" ) ) { - get_font( data, &(style->headings_font) ); - } else if ( !strcmp( node->name, "body_font" ) ) { - get_font( data, &(style->body_font) ); - } else if ( !strcmp( node->name, "print_using_grey" ) ) { - style->print_using_grey = get_bool(data); - } else if ( !strcmp( node->name, "paper_width" ) ) { - style->paper_width = get_float(data); - } else if ( !strcmp( node->name, "paper_height" ) ) { - style->paper_height = get_float(data); - } else if ( !strcmp( node->name, "top_margin" ) ) { - style->top_margin = get_float(data); - } else if ( !strcmp( node->name, "left_margin" ) ) { - style->left_margin = get_float(data); - } else if ( !strcmp( node->name, "bottom_margin" ) ) { - style->bottom_margin = get_float(data); - } else if ( !strcmp( node->name, "right_margin" ) ) { - style->right_margin = get_float(data); - } else if ( !strcmp( node->name, "page_width" ) ) { - style->page_width = get_float(data); - } else if ( !strcmp( node->name, "page_height" ) ) { - style->page_height = get_float(data); - } else if ( !strcmp( node->name, "orientation" ) ) { - if ( data ) { - lowify(data); - style->orientation_portrait = strcmp(data, "landscape"); - } else { - style->orientation_portrait = TRUE; - } - } else if ( !strcmp( node->name, "header_font" ) ) { - get_font( data, &(style->header_font) ); - } else if ( !strcmp( node->name, "left_header" ) ) { - get_string(data, &(style->left_header)); - } else if ( !strcmp( node->name, "center_header" ) ) { - get_string(data, &(style->center_header)); - } else if ( !strcmp( node->name, "right_header" ) ) { - get_string(data, &(style->right_header)); - } else if ( !strcmp( node->name, "footer_font" ) ) { - get_font( data, &(style->footer_font) ); - } else if ( !strcmp( node->name, "left_footer" ) ) { - get_string(data, &(style->left_footer)); - } else if ( !strcmp( node->name, "center_footer" ) ) { - get_string(data, &(style->center_footer)); - } else if ( !strcmp( node->name, "right_footer" ) ) { - get_string(data, &(style->right_footer)); - } else if ( !strcmp( node->name, "reverse_on_even_pages" ) ) { - style->reverse_on_even_pages = get_bool(data); - } - if ( data ) - xmlFree (data); - } - xmlFreeDoc(styledoc); - } -} - -static gint -e_contact_print_close(GnomeDialog *dialog, gpointer data) -{ - return FALSE; -} - -static void -e_contact_print_button(GnomeDialog *dialog, gint button, gpointer data) -{ - EContactPrintContext *ctxt = g_new(EContactPrintContext, 1); - EContactPrintStyle *style = g_new(EContactPrintStyle, 1); - GnomePrintMaster *master; - GnomePrintContext *pc; - gboolean uses_book = (gint) gtk_object_get_data(GTK_OBJECT(dialog), "uses_book"); - EBook *book = NULL; - char *query = NULL; - ECard *card = NULL; - gdouble font_size; - if (uses_book) { - book = gtk_object_get_data(GTK_OBJECT(dialog), "book"); - query = gtk_object_get_data(GTK_OBJECT(dialog), "query"); - } else { - card = gtk_object_get_data(GTK_OBJECT(dialog), "card"); - } - switch( button ) { - case GNOME_PRINT_PRINT: - master = gnome_print_master_new_from_dialog( GNOME_PRINT_DIALOG(dialog) ); - pc = gnome_print_master_get_context( master ); - e_contact_build_style(style); - - ctxt->x = 0; - ctxt->y = 0; - ctxt->column = 0; - ctxt->style = style; - ctxt->master = master; - ctxt->first_section = TRUE; - ctxt->first_char_on_page = 'A' - 1; - ctxt->type = GNOME_PRINT_PRINT; - - font_size = 72 * ctxt->style->page_height / 27.0 / 2.0; - ctxt->letter_heading_font = gnome_font_new(gnome_font_get_name(ctxt->style->headings_font), ctxt->style->headings_font->size * 1.5); - ctxt->letter_tab_font = gnome_font_new(gnome_font_get_name(ctxt->style->headings_font), font_size); - - ctxt->pc = GNOME_PRINT_CONTEXT(gnome_print_multipage_new_from_sizes(pc, - 72 * style->paper_width, - 72 * style->paper_height, - 72 * style->page_width, - 72 * style->page_height)); - - ctxt->book = book; - ctxt->query = query; - if (uses_book) { - ctxt->cards = NULL; - e_contact_do_print(book, ctxt->query, ctxt); - } else { - ctxt->cards = g_list_append(NULL, card); - complete_sequence(NULL, ctxt); - } - gnome_dialog_close(dialog); - break; - case GNOME_PRINT_PREVIEW: - master = gnome_print_master_new_from_dialog( GNOME_PRINT_DIALOG(dialog) ); - pc = gnome_print_master_get_context( master ); - e_contact_build_style(style); - - ctxt->x = 0; - ctxt->y = 0; - ctxt->column = 0; - ctxt->style = style; - ctxt->master = master; - ctxt->first_section = TRUE; - ctxt->first_char_on_page = 'A' - 1; - ctxt->type = GNOME_PRINT_PREVIEW; - - font_size = 72 * ctxt->style->page_height / 27.0 / 2.0; - ctxt->letter_heading_font = gnome_font_new(gnome_font_get_name(ctxt->style->headings_font), ctxt->style->headings_font->size * 1.5); - ctxt->letter_tab_font = gnome_font_new(gnome_font_get_name(ctxt->style->headings_font), font_size); - - ctxt->pc = GNOME_PRINT_CONTEXT(gnome_print_multipage_new_from_sizes(pc, - 72 * style->paper_width, - 72 * style->paper_height, - 72 * style->page_width, - 72 * style->page_height)); - - ctxt->book = book; - ctxt->query = g_strdup(query); - if (uses_book) { - ctxt->cards = NULL; - gtk_object_ref(GTK_OBJECT(book)); - e_contact_do_print(book, ctxt->query, ctxt); - } else { - ctxt->cards = g_list_append(NULL, card); - gtk_object_ref(GTK_OBJECT(card)); - complete_sequence(NULL, ctxt); - } - break; - case GNOME_PRINT_CANCEL: - if (uses_book) - gtk_object_unref(GTK_OBJECT(book)); - else - gtk_object_unref(GTK_OBJECT(card)); - g_free(query); - gnome_dialog_close(dialog); - g_free(style); - g_free(ctxt); - break; - } -} - -GtkWidget * -e_contact_print_dialog_new(EBook *book, char *query) -{ - GtkWidget *dialog; - - - dialog = gnome_print_dialog_new("Print cards", GNOME_PRINT_DIALOG_RANGE | GNOME_PRINT_DIALOG_COPIES); - gnome_print_dialog_construct_range_any(GNOME_PRINT_DIALOG(dialog), GNOME_PRINT_RANGE_ALL | GNOME_PRINT_RANGE_SELECTION, - NULL, NULL, NULL); - - gtk_object_ref(GTK_OBJECT(book)); - gtk_object_set_data(GTK_OBJECT(dialog), "uses_book", (void *) 1); - gtk_object_set_data(GTK_OBJECT(dialog), "book", book); - gtk_object_set_data(GTK_OBJECT(dialog), "query", g_strdup(query)); - gtk_signal_connect(GTK_OBJECT(dialog), - "clicked", GTK_SIGNAL_FUNC(e_contact_print_button), NULL); - gtk_signal_connect(GTK_OBJECT(dialog), - "close", GTK_SIGNAL_FUNC(e_contact_print_close), NULL); - return dialog; -} - -GtkWidget * -e_contact_print_card_dialog_new(ECard *card) -{ - GtkWidget *dialog; - - dialog = gnome_print_dialog_new("Print card", GNOME_PRINT_DIALOG_COPIES); - - card = e_card_duplicate(card); - gtk_object_set_data(GTK_OBJECT(dialog), "card", card); - gtk_object_set_data(GTK_OBJECT(dialog), "uses_book", (void *) 0); - gtk_signal_connect(GTK_OBJECT(dialog), - "clicked", GTK_SIGNAL_FUNC(e_contact_print_button), NULL); - gtk_signal_connect(GTK_OBJECT(dialog), - "close", GTK_SIGNAL_FUNC(e_contact_print_close), NULL); - return dialog; -} diff --git a/addressbook/printing/e-contact-print.glade b/addressbook/printing/e-contact-print.glade deleted file mode 100644 index be24c9fc60..0000000000 --- a/addressbook/printing/e-contact-print.glade +++ /dev/null @@ -1,2009 +0,0 @@ -<?xml version="1.0"?> -<GTK-Interface> - -<project> - <name>Printing</name> - <program_name>printing</program_name> - <directory></directory> - <source_directory></source_directory> - <pixmaps_directory>pixmaps</pixmaps_directory> - <language>C</language> - <gnome_support>False</gnome_support> - <gettext_support>False</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-contact-print.glade.h</translatable_strings_file> -</project> - -<widget> - <class>GnomeDialog</class> - <name>print-edit-style</name> - <visible>False</visible> - <title>Page Setup:</title> - <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-vbox1</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>4</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vbox-contact-print-style-editor</name> - <homogeneous>False</homogeneous> - <spacing>5</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkHBox</class> - <name>hbox2</name> - <border_width>5</border_width> - <homogeneous>False</homogeneous> - <spacing>16</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label8</name> - <label>Style name:</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>GtkEntry</class> - <name>label-style-name</name> - <can_focus>True</can_focus> - <editable>False</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkNotebook</class> - <name>notebook1</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>vbox2</name> - <border_width>5</border_width> - <homogeneous>False</homogeneous> - <spacing>5</spacing> - - <widget> - <class>GtkAlignment</class> - <name>alignment1</name> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkFrame</class> - <name>frame5</name> - <label>Preview:</label> - <label_xalign>0</label_xalign> - <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox1</name> - <homogeneous>True</homogeneous> - <spacing>7</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkFrame</class> - <name>frame6</name> - <label>Options</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>GtkAlignment</class> - <name>alignment4</name> - <xalign>0</xalign> - <yalign>0</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - - <widget> - <class>GtkTable</class> - <name>table1</name> - <border_width>8</border_width> - <rows>6</rows> - <columns>5</columns> - <homogeneous>False</homogeneous> - <row_spacing>0</row_spacing> - <column_spacing>0</column_spacing> - - <widget> - <class>GtkLabel</class> - <name>label5</name> - <label>Include:</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>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label4</name> - <label>Sections:</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>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment2</name> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <left_attach>1</left_attach> - <right_attach>5</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkRadioButton</class> - <name>radiobutton1</name> - <can_focus>True</can_focus> - <label>Immediately follow each other</label> - <active>True</active> - <draw_indicator>True</draw_indicator> - </widget> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>checkbutton1</name> - <can_focus>True</can_focus> - <label>Letter tabs on side</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <left_attach>1</left_attach> - <right_attach>5</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>GtkCheckButton</class> - <name>checkbutton2</name> - <can_focus>True</can_focus> - <label>Headings for each letter</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - <child> - <left_attach>1</left_attach> - <right_attach>5</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>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment3</name> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <left_attach>1</left_attach> - <right_attach>5</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkRadioButton</class> - <name>radiobutton2</name> - <can_focus>True</can_focus> - <label>Start on a new page</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label6</name> - <label>Number of columns:</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>3</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>2</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label7</name> - <label>Blank forms at end:</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>3</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>2</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>alignment6</name> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <left_attach>3</left_attach> - <right_attach>4</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>2</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkSpinButton</class> - <name>spinbutton2</name> - <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>2</value> - <lower>0</lower> - <upper>100</upper> - <step>1</step> - <page>10</page> - <page_size>10</page_size> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment5</name> - <xalign>0</xalign> - <yalign>0.5</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <left_attach>3</left_attach> - <right_attach>4</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>2</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkSpinButton</class> - <name>spinbutton1</name> - <width>45</width> - <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>1</value> - <lower>0</lower> - <upper>100</upper> - <step>1</step> - <page>10</page> - <page_size>10</page_size> - </widget> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox3</name> - <homogeneous>False</homogeneous> - <spacing>8</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkFrame</class> - <name>frame7</name> - <label>Fonts</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>table2</name> - <border_width>8</border_width> - <rows>2</rows> - <columns>2</columns> - <homogeneous>False</homogeneous> - <row_spacing>13</row_spacing> - <column_spacing>8</column_spacing> - - <widget> - <class>GtkAlignment</class> - <name>alignment7</name> - <xalign>0.5</xalign> - <yalign>1</yalign> - <xscale>1</xscale> - <yscale>0</yscale> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkButton</class> - <name>button6</name> - <can_focus>True</can_focus> - <label>Font...</label> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment8</name> - <xalign>0.5</xalign> - <yalign>1</yalign> - <xscale>1</xscale> - <yscale>0</yscale> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkButton</class> - <name>button5</name> - <width>90</width> - <can_focus>True</can_focus> - <label>Font...</label> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox4</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <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>GtkLabel</class> - <name>label10</name> - <label>Headings</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>GtkEntry</class> - <name>entry3</name> - <width>100</width> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text>10 pt. Tahoma</text> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox5</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <left_attach>0</left_attach> - <right_attach>1</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label9</name> - <label>Body</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>GtkEntry</class> - <name>entry2</name> - <width>100</width> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text>8 pt. Tahoma</text> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame8</name> - <label>Shading</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>GtkCheckButton</class> - <name>checkbutton3</name> - <can_focus>True</can_focus> - <label>Print using gray shading</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - </widget> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>label1</name> - <label>Format</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox3</name> - <homogeneous>True</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkVBox</class> - <name>vbox6</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkFrame</class> - <name>frame9</name> - <label>Paper</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>vbox16</name> - <border_width>10</border_width> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkVBox</class> - <name>vbox17</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label21</name> - <label>Type:</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>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> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <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_IN</shadow_type> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>label26</name> - <label>label26</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>vbox18</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label24</name> - <label>Dimensions:</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>GtkHBox</class> - <name>hbox5</name> - <homogeneous>True</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label27</name> - <label>Width:</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>GtkEntry</class> - <name>entry9</name> - <width>1</width> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label28</name> - <label>Height:</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>GtkEntry</class> - <name>entry10</name> - <width>1</width> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox19</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label25</name> - <label>Paper source:</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>GtkCombo</class> - <name>combo1</name> - <value_in_list>False</value_in_list> - <ok_if_empty>True</ok_if_empty> - <case_sensitive>False</case_sensitive> - <use_arrows>True</use_arrows> - <use_arrows_always>False</use_arrows_always> - <items></items> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - - <widget> - <class>GtkEntry</class> - <child_name>GtkCombo:entry</child_name> - <name>combo-entry1</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> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame10</name> - <label>Margins</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>table4</name> - <border_width>15</border_width> - <rows>2</rows> - <columns>4</columns> - <homogeneous>True</homogeneous> - <row_spacing>6</row_spacing> - <column_spacing>9</column_spacing> - - <widget> - <class>GtkLabel</class> - <name>label29</name> - <label>Top:</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>True</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label30</name> - <label>Bottom:</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>True</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label31</name> - <label>Left:</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>True</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry11</name> - <width>1</width> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>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>entry12</name> - <width>1</width> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>3</left_attach> - <right_attach>4</right_attach> - <top_attach>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>entry13</name> - <width>1</width> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>3</left_attach> - <right_attach>4</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkEntry</class> - <name>entry14</name> - <width>1</width> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>1</top_attach> - <bottom_attach>2</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>False</yfill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label32</name> - <label>Right:</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>True</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - </widget> - </widget> - </widget> - - <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>GtkFrame</class> - <name>frame11</name> - <label>Page</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>vbox8</name> - <border_width>10</border_width> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkVBox</class> - <name>vbox20</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label33</name> - <label>Size:</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>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> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <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_IN</shadow_type> - - <widget> - <class>GtkLabel</class> - <child_name>CList:title</child_name> - <name>label35</name> - <label>label26</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>vbox21</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label34</name> - <label>Dimensions:</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>GtkHBox</class> - <name>hbox6</name> - <homogeneous>True</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkLabel</class> - <name>label36</name> - <label>Width:</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>GtkEntry</class> - <name>entry15</name> - <width>1</width> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - - <widget> - <class>GtkLabel</class> - <name>label37</name> - <label>Height:</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>GtkEntry</class> - <name>entry16</name> - <width>1</width> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - </widget> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkFrame</class> - <name>frame12</name> - <label>Orientation</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>hbox4</name> - <homogeneous>False</homogeneous> - <spacing>10</spacing> - - <widget> - <class>Placeholder</class> - </widget> - - <widget> - <class>GtkVBox</class> - <name>vbox9</name> - <homogeneous>False</homogeneous> - <spacing>5</spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkAlignment</class> - <name>alignment9</name> - <xalign>0</xalign> - <yalign>1</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkRadioButton</class> - <name>radiobutton3</name> - <can_focus>True</can_focus> - <label>Portrait</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment10</name> - <xalign>0</xalign> - <yalign>0</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkRadioButton</class> - <name>radiobutton4</name> - <can_focus>True</can_focus> - <label>Landscape</label> - <active>False</active> - <draw_indicator>True</draw_indicator> - </widget> - </widget> - </widget> - </widget> - </widget> - </widget> - </widget> - - <widget> - <class>GtkLabel</class> - <child_name>Notebook:tab</child_name> - <name>label2</name> - <label>Paper</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>vbox10</name> - <border_width>8</border_width> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkTable</class> - <name>table5</name> - <rows>4</rows> - <columns>3</columns> - <homogeneous>True</homogeneous> - <row_spacing>4</row_spacing> - <column_spacing>4</column_spacing> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkAlignment</class> - <name>alignment15</name> - <xalign>0</xalign> - <yalign>1</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>2</top_attach> - <bottom_attach>3</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkButton</class> - <name>button11</name> - <can_focus>True</can_focus> - <label>Font...</label> - </widget> - </widget> - - <widget> - <class>GtkText</class> - <name>text10</name> - <height>50</height> - <can_focus>True</can_focus> - <editable>False</editable> - <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>False</xexpand> - <yexpand>True</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkText</class> - <name>text11</name> - <height>50</height> - <can_focus>True</can_focus> - <editable>False</editable> - <text></text> - <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>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkText</class> - <name>text12</name> - <height>50</height> - <can_focus>True</can_focus> - <editable>False</editable> - <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>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkText</class> - <name>text13</name> - <height>50</height> - <can_focus>True</can_focus> - <editable>False</editable> - <text></text> - <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> - - <widget> - <class>GtkText</class> - <name>text14</name> - <height>5</height> - <can_focus>True</can_focus> - <editable>False</editable> - <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>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkText</class> - <name>text15</name> - <height>50</height> - <can_focus>True</can_focus> - <editable>False</editable> - <text></text> - <child> - <left_attach>2</left_attach> - <right_attach>3</right_attach> - <top_attach>3</top_attach> - <bottom_attach>4</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment16</name> - <xalign>0.5</xalign> - <yalign>1</yalign> - <xscale>1</xscale> - <yscale>0</yscale> - <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>GtkVBox</class> - <name>vbox14</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkLabel</class> - <name>label14</name> - <label>Header</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>GtkEntry</class> - <name>entry7</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment17</name> - <xalign>0.5</xalign> - <yalign>1</yalign> - <xscale>1</xscale> - <yscale>0</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>True</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkVBox</class> - <name>vbox15</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - - <widget> - <class>GtkLabel</class> - <name>label15</name> - <label>Footer:</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>GtkEntry</class> - <name>entry8</name> - <can_focus>True</can_focus> - <editable>True</editable> - <text_visible>True</text_visible> - <text_max_length>0</text_max_length> - <text></text> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>False</fill> - </child> - </widget> - </widget> - </widget> - - <widget> - <class>GtkAlignment</class> - <name>alignment14</name> - <xalign>0</xalign> - <yalign>1</yalign> - <xscale>0</xscale> - <yscale>0</yscale> - <child> - <left_attach>1</left_attach> - <right_attach>2</right_attach> - <top_attach>0</top_attach> - <bottom_attach>1</bottom_attach> - <xpad>0</xpad> - <ypad>0</ypad> - <xexpand>False</xexpand> - <yexpand>False</yexpand> - <xshrink>False</xshrink> - <yshrink>False</yshrink> - <xfill>True</xfill> - <yfill>True</yfill> - </child> - - <widget> - <class>GtkButton</class> - <name>button10</name> - <can_focus>True</can_focus> - <label>Font...</label> - </widget> - </widget> - </widget> - - <widget> - <class>GtkHBox</class> - <name>hbox7</name> - <homogeneous>False</homogeneous> - <spacing>0</spacing> - <child> - <padding>0</padding> - <expand>False</expand> - <fill>True</fill> - </child> - - <widget> - <class>GtkToolbar</class> - <name>toolbar1</name> - <orientation>GTK_ORIENTATION_HORIZONTAL</orientation> - <type>GTK_TOOLBAR_ICONS</type> - <space_size>5</space_size> - <space_style>GTK_TOOLBAR_SPACE_EMPTY</space_style> - <relief>GTK_RELIEF_NORMAL</relief> - <tooltips>True</tooltips> - <child> - <padding>0</padding> - <expand>True</expand> - <fill>False</fill> - </child> - - <widget> - <class>Placeholder</class> - </widget> - - <widget> - <class>Placeholder</class> - </widget> - - <widget> - <class>Placeholder</class> - </widget> - - <widget> - <class>Placeholder</class> - </widget> - - <widget> - <class>Placeholder</class> - </widget> - </widget> - </widget> - - <widget> - <class>GtkCheckButton</class> - <name>checkbutton4</name> - <can_focus>True</can_focus> - <label>Reverse on even pages</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>label3</name> - <label>Header/Footer</label> - <justify>GTK_JUSTIFY_CENTER</justify> - <wrap>False</wrap> - <xalign>0.5</xalign> - <yalign>0.5</yalign> - <xpad>0</xpad> - <ypad>0</ypad> - </widget> - </widget> - </widget> - - <widget> - <class>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>button2</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>button3</name> - <can_default>True</can_default> - <can_focus>True</can_focus> - <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button> - </widget> - </widget> - </widget> -</widget> - -</GTK-Interface> diff --git a/addressbook/printing/e-contact-print.glade.h b/addressbook/printing/e-contact-print.glade.h deleted file mode 100644 index b3b03d6d68..0000000000 --- a/addressbook/printing/e-contact-print.glade.h +++ /dev/null @@ -1,56 +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_("Page Setup:"); -gchar *s = N_("Style name:"); -gchar *s = N_("Preview:"); -gchar *s = N_("Options"); -gchar *s = N_("Include:"); -gchar *s = N_("Sections:"); -gchar *s = N_("Immediately follow each other"); -gchar *s = N_("Letter tabs on side"); -gchar *s = N_("Headings for each letter"); -gchar *s = N_("Start on a new page"); -gchar *s = N_("Number of columns:"); -gchar *s = N_("Blank forms at end:"); -gchar *s = N_("Fonts"); -gchar *s = N_("Font..."); -gchar *s = N_("Font..."); -gchar *s = N_("Headings"); -gchar *s = N_("10 pt. Tahoma"); -gchar *s = N_("Body"); -gchar *s = N_("8 pt. Tahoma"); -gchar *s = N_("Shading"); -gchar *s = N_("Print using gray shading"); -gchar *s = N_("Format"); -gchar *s = N_("Paper"); -gchar *s = N_("Type:"); -gchar *s = N_("label26"); -gchar *s = N_("Dimensions:"); -gchar *s = N_("Width:"); -gchar *s = N_("Height:"); -gchar *s = N_("Paper source:"); -gchar *s = N_("Margins"); -gchar *s = N_("Top:"); -gchar *s = N_("Bottom:"); -gchar *s = N_("Left:"); -gchar *s = N_("Right:"); -gchar *s = N_("Page"); -gchar *s = N_("Size:"); -gchar *s = N_("label26"); -gchar *s = N_("Dimensions:"); -gchar *s = N_("Width:"); -gchar *s = N_("Height:"); -gchar *s = N_("Orientation"); -gchar *s = N_("Portrait"); -gchar *s = N_("Landscape"); -gchar *s = N_("Paper"); -gchar *s = N_("Font..."); -gchar *s = N_("Header"); -gchar *s = N_("Footer:"); -gchar *s = N_("Font..."); -gchar *s = N_("Reverse on even pages"); -gchar *s = N_("Header/Footer"); diff --git a/addressbook/printing/e-contact-print.h b/addressbook/printing/e-contact-print.h deleted file mode 100644 index fb17271f6b..0000000000 --- a/addressbook/printing/e-contact-print.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-print.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_CONTACT_PRINT_H -#define E_CONTACT_PRINT_H - -#include <gnome.h> -#include <addressbook/backend/ebook/e-book.h> -#include "e-contact-print-types.h" - -GtkWidget *e_contact_print_dialog_new(EBook *book, char *query); -GtkWidget *e_contact_print_card_dialog_new(ECard *card); - -#endif /* E_CONTACT_PRINT_H */ diff --git a/addressbook/printing/medbook.ecps b/addressbook/printing/medbook.ecps deleted file mode 100644 index 72cca146dd..0000000000 --- a/addressbook/printing/medbook.ecps +++ /dev/null @@ -1,30 +0,0 @@ -<style> -<title/> -<type>cards</type> -<sections_start_new_page>FALSE</sections_start_new_page> -<num_columns>2</num_columns> -<blank_forms>2</blank_forms> -<letter_tabs>TRUE</letter_tabs> -<letter_headings>TRUE</letter_headings> -<headings_font>Helvetica-Bold 12</headings_font> -<body_font>Helvetica 8</body_font> -<print_using_grey>TRUE</print_using_grey> -<paper_width>8.5</paper_width> -<paper_height>11</paper_height> -<top_margin>0.5</top_margin> -<left_margin>0.5</left_margin> -<bottom_margin>0.5</bottom_margin> -<right_margin>0.5</right_margin> -<page_width>8.5</page_width> -<page_height>11</page_height> -<orientation>portrait</orientation> -<header_font>Helvetica 8</header_font> -<left_header/> -<center_header/> -<right_header/> -<footer_font>Helvetica 8</footer_font> -<left_footer/> -<center_footer>[Page #]</center_footer> -<right_footer/> -<reverse_on_even_pages>FALSE</reverse_on_even_pages> -</style> diff --git a/addressbook/printing/phonelist.ecps b/addressbook/printing/phonelist.ecps deleted file mode 100644 index 53ca294d36..0000000000 --- a/addressbook/printing/phonelist.ecps +++ /dev/null @@ -1,29 +0,0 @@ -<style> -<title/> -<type>phone_list</type> -<sections_start_new_page>FALSE</sections_start_new_page> -<num_columns>2</num_columns> -<letter_tabs>FALSE</letter_tabs> -<letter_headings>TRUE</letter_headings> -<headings_font>Helvetica-Bold 10</headings_font> -<body_font>Helvetica 8</body_font> -<print_using_grey>TRUE</print_using_grey> -<paper_width>8.5</paper_width> -<paper_height>11</paper_height> -<top_margin>0.5</top_margin> -<left_margin>0.5</left_margin> -<bottom_margin>0.5</bottom_margin> -<right_margin>0.5</right_margin> -<page_width>8.5</page_width> -<page_height>11</page_height> -<orientation>portrait</orientation> -<header_font>Helvetica 8</header_font> -<left_header/> -<center_header/> -<right_header/> -<footer_font>Helvetica 8</footer_font> -<left_footer>[User Name]</left_footer> -<center_footer>[Page #]</center_footer> -<right_footer>[Date Printed]</right_footer> -<reverse_on_even_pages>FALSE</reverse_on_even_pages> -</style> diff --git a/addressbook/printing/smallbook.ecps b/addressbook/printing/smallbook.ecps deleted file mode 100644 index 5844851bfb..0000000000 --- a/addressbook/printing/smallbook.ecps +++ /dev/null @@ -1,30 +0,0 @@ -<style> -<title/> -<type>cards</type> -<sections_start_new_page>FALSE</sections_start_new_page> -<num_columns>1</num_columns> -<blank_forms>2</blank_forms> -<letter_tabs>TRUE</letter_tabs> -<letter_headings>TRUE</letter_headings> -<headings_font>Helvetica-Bold 8</headings_font> -<body_font>Helvetica 6</body_font> -<print_using_grey>TRUE</print_using_grey> -<paper_width>8.5</paper_width> -<paper_height>11</paper_height> -<top_margin>0.5</top_margin> -<left_margin>0.5</left_margin> -<bottom_margin>0.5</bottom_margin> -<right_margin>0.5</right_margin> -<page_width>2.75</page_width> -<page_height>4.25</page_height> -<orientation>portrait</orientation> -<header_font>Helvetica 6</header_font> -<left_header/> -<center_header/> -<right_header/> -<footer_font>Helvetica 6</footer_font> -<left_footer/> -<center_footer>[Page #]</center_footer> -<right_footer/> -<reverse_on_even_pages>FALSE</reverse_on_even_pages> -</style> diff --git a/addressbook/printing/test-contact-print-style-editor.c b/addressbook/printing/test-contact-print-style-editor.c deleted file mode 100644 index d4dccc0b87..0000000000 --- a/addressbook/printing/test-contact-print-style-editor.c +++ /dev/null @@ -1,87 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * test-contact-print-style-editor.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 "e-contact-print-style-editor.h" - -/* This is a horrible thing to do, but it is just a test. */ -GtkWidget *editor; - -static void destroy_callback(GtkWidget *app, gpointer data) -{ - static int count = 2; - count --; - if ( count <= 0 ) - 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 ( _( "Contact Print Style Editor Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the contact print style editor widget" ), - NULL); - gtk_widget_show (about); -} -#endif - -int main( int argc, char *argv[] ) -{ - GtkWidget *app; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Contact Print Style Editor Test", VERSION, argc, argv); - - glade_gnome_init (); - - app = gnome_app_new("Contact Print Style Editor Test", NULL); - - editor = e_contact_print_style_editor_new(""); - - gnome_app_set_contents( GNOME_APP( app ), editor ); - - /* 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/addressbook/printing/test-print.c b/addressbook/printing/test-print.c deleted file mode 100644 index 1b73fda3da..0000000000 --- a/addressbook/printing/test-print.c +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * test-print.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 <glade/glade.h> -#include "e-contact-print.h" - -/* This is a horrible thing to do, but it is just a test. */ -GtkWidget *print; - -static gint test_close(GnomeDialog *dialog, gpointer data) -{ - exit(0); - return 1; -} - -#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 ( _( "Contact Print Test" ), VERSION, - _( "Copyright (C) 2000, Helix Code, Inc." ), - authors, - _( "This should test the contact print code" ), - NULL); - gtk_widget_show (about); -} -#endif - -int main( int argc, char *argv[] ) -{ - GList *shown_fields = NULL; - - /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); - textdomain (PACKAGE);*/ - - gnome_init( "Contact Print Test", VERSION, argc, argv); - - glade_gnome_init (); - - shown_fields = g_list_append(shown_fields, "First field"); - shown_fields = g_list_append(shown_fields, "Second field"); - shown_fields = g_list_append(shown_fields, "Third field"); - shown_fields = g_list_append(shown_fields, "Fourth field"); - - print = e_contact_print_dialog_new(NULL, NULL); - gtk_widget_show_all(print); - gtk_signal_connect(GTK_OBJECT(print), "close", GTK_SIGNAL_FUNC(test_close), NULL); - - gtk_main(); - - /* Not reached. */ - return 0; -} |