diff options
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/ChangeLog | 254 | ||||
-rw-r--r-- | addressbook/backend/pas/pas-backend-ldap.c | 38 | ||||
-rw-r--r-- | addressbook/conduit/address-conduit-config.h | 128 | ||||
-rw-r--r-- | addressbook/conduit/address-conduit.c | 319 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook.c | 53 | ||||
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names-bonobo.c | 52 | ||||
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names-completion.c | 21 | ||||
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names-manager.c | 839 | ||||
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names.c | 92 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor-address.c | 286 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.c | 28 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/fulladdr.glade | 236 |
12 files changed, 948 insertions, 1398 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 4ae0f80939..6c6c0fc77d 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,14 +1,3 @@ -2002-01-23 Ettore Perazzoli <ettore@ximian.com> - - * gui/component/addressbook-component.c (create_component): Pass a - NULL @icon to - `evolution_shell_component_add_user_creatable_item()'. - -2002-01-23 Ettore Perazzoli <ettore@ximian.com> - - * gui/contact-editor/e-contact-editor-address.c: #include - <locale.h>. - 2002-01-22 Chris Toshok <toshok@ximian.com> [ fixes bug # 16864 ] @@ -16,225 +5,12 @@ return a GString here, instead of writing to a fixed size buffer. (parseLine): use a GString here instead of a fixed size buffer. -2002-01-21 Christopher James Lahey <clahey@ximian.com> - - * backend/pas/pas-backend-ldap.c (ldap_search_handler): Set the - number of cards to return to the value specified in the ldap uri, - leaving the default at 100. Fixes Ximian bug #13953. - - * gui/component/addressbook-config.c (addressbook_source_dialog), - gui/component/addressbook-config.glade: Added a limit entry here - to edit the limit field of the source. - - * gui/component/addressbook-storage.c, - gui/component/addressbook-storage.h - (addressbook_storage_init_source_uri): Added a limit field to this - class and pass that value through in the uri that's generated. - -2002-01-18 Christopher James Lahey <clahey@ximian.com> - - * backend/ebook/e-card-compare.c: Made username match with no - domain match be vague instead of partial. Fixes Ximian bug - #13612. - -2002-01-18 Christopher James Lahey <clahey@ximian.com> - - * gui/component/addressbook.c (view_contact_cb): New verb to open - a bunch of cards. - - * gui/widgets/e-addressbook-reflow-adapter.c (open_card): Call - e_addressbook_show_multiple_cards instead of doing this ourselves. - - * gui/widgets/e-addressbook-util.c, - gui/widgets/e-addressbook-util.h - (e_addressbook_show_multiple_cards): Added this function to show a - bunch of cards, including a dialog if lots of windows are going to - appear. - - * gui/widgets/e-addressbook-view.c (e_addressbook_view_view, - e_addressbook_view_can_view): e_addressbook_view_view calls - e_addressbook_show_multiple_cards on the appropriate list of - cards. - -2002-01-18 Christopher James Lahey <clahey@ximian.com> - - * gui/contact-editor/e-contact-editor-address.c - (fill_in_countries), gui/contact-editor/fulladdr.glade: Sort - country list. Country list moves from fulladdr.glade to - e-contact-editor-address.c, but only a few country names have - actually changed. Fixes Ximian bug #16545. - 2001-12-20 Zbigniew Chyla <cyba@gnome.pl> - Fixes #17725 - * evolution/addressbook/printing/e-contact-print.c (complete_sequence): Do not assume that the first byte of file_as is the first letter, use utf8 functions instead. -2002-01-16 JP Rosevear <jpr@ximian.com> - - * conduit/address-conduit.c: move all functions here, get rid of - header files, use e-pilot-settings to display gui - -2002-01-15 JP Rosevear <jpr@ximian.com> - - * gui/component/select-names/select-names.glade: remove misleading - title and fix spacing - -2002-01-11 Christopher James Lahey <clahey@ximian.com> - - * gui/component/addressbook.c (alphabet_state_changed): Handle - setting the search bar to "Advanced..." when the alphabet buttons - are pushed and back when they're cleared. Fixes Ximian bug - #12904. - (addressbook_menu_activated): When the user calls Search->clear, - set the search to ESB_ANY and "", don't just set the text. This - is especially useful when it's set to ESB_ADVANCED. - - * gui/widgets/e-addressbook-view.c, - gui/widgets/e-addressbook-view.h (alphabet_state_change): Added - this signal which gets emitted when the alphabet buttons are - pushed. - (command_state_change): Removed the ref pair here. It's not - necessary. gtk_signal_emit refs the object itself. - -2002-01-11 Christopher James Lahey <clahey@ximian.com> - - * backend/ebook/e-card-compare.c (name_synonyms): Added a couple - of names here. - - * gui/component/select-names/e-select-names-text-model.c - (e_select_names_text_model_get_nth_obj): Removed an unused - variable. - -2002-01-11 Christopher James Lahey <clahey@ximian.com> - - * gui/widgets/e-addressbook-view.c, - gui/widgets/e-addressbook-view.h (create_alphabet): Use toggle - buttons here. Fixes Ximian bug #10734. - -2002-01-09 Christopher James Lahey <clahey@ximian.com> - - * gui/contact-editor/e-contact-editor.c (set_fields): Choose the - first filled in address field here. Fixes Ximian bug #2222. - -2002-01-03 Joe Shaw <joe@ximian.com> - - * backend/ebook/test-card.c: Add a test for getting arbitrary - fields. - - * backend/pas/pas-backend-card-sexp.c (compare_arbitrary): Added. - (prop_info_table): Add a LIST_PROP for arbitrary fields. - -2002-01-03 Nat Friedman <nat@ximian.com> - - * backend/ebook/e-book.c (activate_factories_for_uri): Free the - query if the oaf response is of zero length. - -2001-12-27 Jon Trowbridge <trow@ximian.com> - - * gui/component/select-names/e-select-names.c - (real_add_address_cb): When we clean, don't clean the model's last - element. This helps keep things working properly when we have - signal-character separators. - (section_right_click_cb): Changed to work properly with our - EText-emitted popup signal. - (e_select_names_add_section): Use ETexts for the recipient - sections, rather than tables. This lets us make them directly - editable. (Bug #1721) - - * gui/component/select-names/e-select-names-popup.c - (popup_info_new): Pass in a ESelectNamesTextModel, not a - ESelectNamesModel. - (e_select_names_popup): Adjust for the new signature for - e_select_names_model_text_pos. - - * gui/component/select-names/e-select-names-manager.c - (focus_out_cb): Schedule a cleaning when we focus out. - (focus_in_cb): Cancel pending cleaning when we get focus. This - helps us avoid bad things happening during the fast focus out/ins - that happen when the completion dropdown appears. - (completion_handler): Adjust for new signatures of - e_select_names_model_text_pos and e_select_names_model_name_pos. - (e_select_names_manager_entry_new): Pass in our - ESelectNamesTextModel when constructing the - ESelectNamesCompletion. - (e_select_names_manager_entry_free): Cancel any pending clean-ups. - - * gui/component/select-names/e-select-names-bonobo.c - (entry_get_property_fn): Get the text off of the text model. - Which is the only way that really makes sense when you think about - it. - - * gui/component/select-names/e-select-names-completion.c: Added a - copy of the associated ESelectNamesTextModel to - ESelectNamesCompletionPrivate. This replaces the - ESelectNamesModel. - (e_select_names_completion_destroy): Unref ->text_model. - (e_select_names_completion_handle_request): Pass in our text - model's separator info when calling e_select_names_model_text_pos. - (e_select_names_completion_new): Pass in the text model as an arg - instead of the model, and ref it as needed. - - * gui/component/select-names/e-select-names-text-model.c - (e_select_names_text_model_init): Set separator as either ", " or - ",", depending on the value of the EVOLUTION_DISABLE_MAGIC_COMMA - environment variable. - (e_select_names_text_model_destroy): Free the separator. - (changed_cb): Flush our cached text on changed. - (e_select_names_text_model_set_source): Use our own changed_cb - callback on changed, rather than just connecting up - e_text_model_changed. - (e_select_names_text_model_set_separator): Added. Lets the - separator between recipients be specified. - (e_select_names_text_model_get_text): Cache the text we get from - calling e_select_names_model_get_textification. - (e_select_names_text_model_insert_length): A bunch of small - changes to properly support generic separators, rather than - (implicit and explicitly) assuming ", ". - (e_select_names_text_model_delete): More small tweaks to handle - generic separators. - (e_select_names_text_model_get_nth_obj): Use new signature when - calling e_select_names_model_name_pos, and use our cached text. - - * gui/component/select-names/e-select-names-model.c - (e_select_names_model_destroy): We don't cache the text or - addr_text anymore, so no need to free them here. - (e_select_names_model_changed): ...and no need to reset our text - and addr_text caches here. - (e_select_names_model_get_textification): Take a separator as an - arg, rather than just using ", ". Also, no caching. - (e_select_names_model_get_address_text): Take a separator as an - arg, rather than just using ", ". And no caching here either. - (e_select_names_model_clean): Add arg that give us control over - whether or not the last entry should get cleaned. We need this - when using a one-character separator, so that new destinations - that get tacked onto the end don't get immediately cleaned away - for being empty. - (e_select_names_model_name_pos): Take the separator length as an - argument, remove implicit assumption of length 2. - (e_select_names_model_text_pos): Take the separator length as an - argument, remove implicit assumption of length 2. - -2001-12-20 Ettore Perazzoli <ettore@ximian.com> - - [Fix #17377, Evolution doesn't work on multi-depth displays.] - - * gui/component/addressbook-factory.c (main): Push GdkRGB visual - and colormap. - -2001-12-19 Jon Trowbridge <trow@ximian.com> - - * gui/widgets/e-addressbook-reflow-adapter.c - (e_addressbook_reflow_adapter_right_click): Add cut/copy/paste to - right-click menu. - - * gui/widgets/e-addressbook-view.c (table_right_click): Add - cut/copy/paste to right-click menu. (Fixes bug #14528.) Also, - disable some right-click options if our addressbook isn't - editable. - 2001-12-18 JP Rosevear <jpr@ximian.com> * conduit/address-conduit.c (check_for_slow_setting): go slow and @@ -265,7 +41,7 @@ * conduit/address-conduit.c (start_addressbook_server): use e_book_load_default_book here. - + 2001-12-17 Chris Toshok <toshok@ximian.com> [ fixes bug 17355 ] @@ -285,6 +61,13 @@ (e_minicard_view_widget_realize): Use an #ECanvasBackground here instead of a #GnomeCanvasRect. +2001-12-17 Ettore Perazzoli <ettore@ximian.com> + + [Fixes #17377, Evolution doesn't work on multi-depth displays.] + + * gui/component/addressbook-factory.c (main): Push GdkRGB visual + and colormap. + 2001-12-16 Jon Trowbridge <trow@ximian.com> * gui/component/select-names/e-select-names-completion.c: Added @@ -296,6 +79,12 @@ (e_select_names_completion_do_query): Only reuse cached cards if cache_complete is TRUE. (Fixes bug #10241) + * gui/component/select-names/e-select-names-bonobo.c + (impl_destroy): Disconnect from manager's 'changed' and 'ok' + signals. + (init): Store the handles when we connect to the 'changed' and + 'ok' signals. (Fixed bug #16852) + 2001-12-15 JP Rosevear <jpr@ximian.com> * conduit/address-conduit.c (e_addr_context_destroy): don't free @@ -316,21 +105,6 @@ g_strdup_printf to dup a string. Doh! Changed to g_strdup. (Bug #17126) -2001-12-07 Jon Trowbridge <trow@ximian.com> - - * gui/component/select-names/e-select-names-manager.c - (e_select_names_manager_entry_new): Remove a reference to code - I don't want to commit yet. :-) - - * gui/component/select-names/e-select-names-manager.c: Extensively - refactored -- this code had gotten _really_ ugly. Untangle things - to the point where our reference counting problems are fixable. - - * gui/component/select-names/e-select-names-bonobo.c - (impl_destroy): Remove all of the ugly hacks to work around our - memory management problems, and just unref the manager. - (Fixes #14412) - 2001-12-05 Chris Toshok <toshok@ximian.com> * backend/pas/pas-backend-ldap.c diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c index ff5c29168b..1432133fd3 100644 --- a/addressbook/backend/pas/pas-backend-ldap.c +++ b/addressbook/backend/pas/pas-backend-ldap.c @@ -44,8 +44,6 @@ #include "pas-book.h" #include "pas-card-cursor.h" -#include <stdlib.h> - #define LDAP_MAX_SEARCH_RESPONSES 100 @@ -71,7 +69,6 @@ struct _PASBackendLDAPPrivate { gchar *ldap_rootdn; int ldap_port; int ldap_scope; - int ldap_limit; GList *book_views; LDAP *ldap; @@ -2288,7 +2285,7 @@ ldap_search_handler (PASBackend *backend, LDAPOp *op) NULL, /* XXX */ NULL, /* XXX */ NULL, - bl->priv->ldap_limit, &view->search_msgid); + LDAP_MAX_SEARCH_RESPONSES, &view->search_msgid); if (ldap_err != LDAP_SUCCESS) { pas_book_view_notify_status_message (view->book_view, ldap_err2string(ldap_err)); @@ -2541,39 +2538,10 @@ pas_backend_ldap_load_uri (PASBackend *backend, PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend); LDAPURLDesc *lud; int ldap_error; - char **attributes; - int i; - int limit = 100; g_assert (bl->priv->connected == FALSE); - attributes = g_strsplit (uri, ";", 0); - - if (attributes[0] == NULL) - return FALSE; - - for (i = 1; attributes[i]; i++) { - char *equals; - char *value; - int key_length; - equals = strchr (attributes[i], '='); - if (equals) { - key_length = equals - attributes[i]; - value = equals + 1; - } else { - key_length = strlen (attributes[i]); - value = NULL; - } - - if (key_length == strlen("limit") && !strncmp (attributes[i], "limit", key_length)) { - if (value) - limit = atoi(value); - } - } - - ldap_error = ldap_url_parse ((char*)attributes[0], &lud); - g_strfreev (attributes); - + ldap_error = ldap_url_parse ((char*)uri, &lud); if (ldap_error == LDAP_SUCCESS) { g_free(bl->priv->uri); bl->priv->uri = g_strdup (uri); @@ -2583,7 +2551,6 @@ pas_backend_ldap_load_uri (PASBackend *backend, if (bl->priv->ldap_port == 0) bl->priv->ldap_port = LDAP_PORT; bl->priv->ldap_rootdn = g_strdup(lud->lud_dn); - bl->priv->ldap_limit = limit; bl->priv->ldap_scope = lud->lud_scope; ldap_free_urldesc(lud); @@ -2779,7 +2746,6 @@ pas_backend_ldap_init (PASBackendLDAP *backend) priv = g_new0 (PASBackendLDAPPrivate, 1); priv->supported_fields = e_list_new ((EListCopyFunc)g_strdup, (EListFreeFunc)g_free, NULL); - priv->ldap_limit = 100; backend->priv = priv; } diff --git a/addressbook/conduit/address-conduit-config.h b/addressbook/conduit/address-conduit-config.h new file mode 100644 index 0000000000..2387f67ef3 --- /dev/null +++ b/addressbook/conduit/address-conduit-config.h @@ -0,0 +1,128 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* Evolution addressbook - Addressbook Conduit Configuration + * + * Copyright (C) 1998 Free Software Foundation + * Copyright (C) 2000 Ximian, Inc. + * + * Authors: Eskil Heyn Olsen <deity@eskil.dk> + * JP Rosevear <jpr@ximian.com> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef __ADDR_CONDUIT_CONFIG_H__ +#define __ADDR_CONDUIT_CONFIG_H__ + +#include <gnome.h> +#include <libgpilotdCM/gnome-pilot-conduit-management.h> +#include <gpilotd/gnome-pilot-conduit.h> +#include <libgpilotdCM/gnome-pilot-conduit-config.h> + +/* Configuration info */ +typedef struct _EAddrConduitCfg EAddrConduitCfg; +struct _EAddrConduitCfg { + guint32 pilot_id; + GnomePilotConduitSyncType sync_type; + + gboolean open_secret; + gchar *last_uri; +}; + +#ifdef ADDR_CONFIG_LOAD +/* Loads the configuration data */ +static void +addrconduit_load_configuration (EAddrConduitCfg **c, guint32 pilot_id) +{ + GnomePilotConduitManagement *management; + GnomePilotConduitConfig *config; + gchar prefix[256]; + g_snprintf (prefix, 255, "/gnome-pilot.d/e-address-conduit/Pilot_%u/", + pilot_id); + + *c = g_new0 (EAddrConduitCfg,1); + g_assert (*c != NULL); + + (*c)->pilot_id = pilot_id; + management = gnome_pilot_conduit_management_new ("e_address_conduit", GNOME_PILOT_CONDUIT_MGMT_ID); + config = gnome_pilot_conduit_config_new (management, pilot_id); + if (!gnome_pilot_conduit_config_is_enabled (config, &(*c)->sync_type)) + (*c)->sync_type = GnomePilotConduitSyncTypeNotSet; + gtk_object_unref (GTK_OBJECT (config)); + gtk_object_unref (GTK_OBJECT (management)); + + /* Custom settings */ + gnome_config_push_prefix (prefix); + + (*c)->open_secret = gnome_config_get_bool ("open_secret=FALSE"); + (*c)->last_uri = gnome_config_get_string ("last_uri"); + + gnome_config_pop_prefix (); +} +#endif + +#ifdef ADDR_CONFIG_SAVE +/* Saves the configuration data. */ +static void +addrconduit_save_configuration (EAddrConduitCfg *c) +{ + gchar prefix[256]; + + g_snprintf (prefix, 255, "/gnome-pilot.d/e-address-conduit/Pilot_%u/", + c->pilot_id); + + gnome_config_push_prefix (prefix); + gnome_config_set_bool ("open_secret", c->open_secret); + gnome_config_set_string ("last_uri", c->last_uri); + gnome_config_pop_prefix (); + + gnome_config_sync (); + gnome_config_drop_all (); +} +#endif + +#ifdef ADDR_CONFIG_DUPE +/* Creates a duplicate of the configuration data */ +static EAddrConduitCfg* +addrconduit_dupe_configuration (EAddrConduitCfg *c) +{ + EAddrConduitCfg *retval; + + g_return_val_if_fail (c != NULL, NULL); + + retval = g_new0 (EAddrConduitCfg, 1); + retval->sync_type = c->sync_type; + retval->open_secret = c->open_secret; + + retval->pilot_id = c->pilot_id; + retval->last_uri = g_strdup (c->last_uri); + + return retval; +} +#endif + +#ifdef ADDR_CONFIG_DESTROY +/* Destroy a configuration */ +static void +addrconduit_destroy_configuration (EAddrConduitCfg **c) +{ + g_return_if_fail (c != NULL); + g_return_if_fail (*c != NULL); + + g_free ((*c)->last_uri); + g_free (*c); + *c = NULL; +} +#endif + +#endif /* __ADDR_CONDUIT_CONFIG_H__ */ diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c index cd7cb9918b..3d6e3eca1f 100644 --- a/addressbook/conduit/address-conduit.c +++ b/addressbook/conduit/address-conduit.c @@ -28,22 +28,27 @@ #include <gnome-xml/parser.h> #include <pi-source.h> #include <pi-socket.h> +#include <pi-file.h> #include <pi-dlp.h> -#include <pi-address.h> #include <ebook/e-book.h> #include <ebook/e-book-util.h> #include <ebook/e-card-types.h> #include <ebook/e-card-cursor.h> #include <ebook/e-card.h> #include <ebook/e-card-simple.h> -#include <gpilotd/gnome-pilot-conduit.h> -#include <gpilotd/gnome-pilot-conduit-sync-abs.h> -#include <libgpilotdCM/gnome-pilot-conduit-management.h> -#include <libgpilotdCM/gnome-pilot-conduit-config.h> -#include <e-pilot-map.h> -#include <e-pilot-settings.h> #include <e-pilot-util.h> +#define ADDR_CONFIG_LOAD 1 +#define ADDR_CONFIG_SAVE 1 +#define ADDR_CONFIG_DESTROY 1 +#include "address-conduit-config.h" +#undef ADDR_CONFIG_LOAD +#undef ADDR_CONFIG_SAVE +#undef ADDR_CONFIG_DESTROY + +#include "address-conduit.h" + +static void free_local (EAddrLocalRecord *local); GnomePilotConduit * conduit_get_gpilot_conduit (guint32); void conduit_destroy_gpilot_conduit (GnomePilotConduit*); @@ -129,149 +134,65 @@ static int priority_label [] = { -1 }; -typedef struct _EAddrLocalRecord EAddrLocalRecord; -typedef struct _EAddrConduitCfg EAddrConduitCfg; -typedef struct _EAddrConduitContext EAddrConduitContext; - -/* Local Record */ -struct _EAddrLocalRecord { - /* 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. - */ - GnomePilotDesktopRecord local; - - /* The corresponding ECard object */ - ECard *ecard; - - /* pilot-link address structure, used for implementing Transmit. */ - struct Address *addr; -}; - - -static void -addrconduit_destroy_record (EAddrLocalRecord *local) -{ - gtk_object_unref (GTK_OBJECT (local->ecard)); - free_Address (local->addr); - g_free (local->addr); - g_free (local); -} - -/* Configuration */ -struct _EAddrConduitCfg { - guint32 pilot_id; - GnomePilotConduitSyncType sync_type; - - gboolean secret; - gchar *last_uri; -}; - -static EAddrConduitCfg * -addrconduit_load_configuration (guint32 pilot_id) -{ - EAddrConduitCfg *c; - GnomePilotConduitManagement *management; - GnomePilotConduitConfig *config; - gchar prefix[256]; - g_snprintf (prefix, 255, "/gnome-pilot.d/e-address-conduit/Pilot_%u/", - pilot_id); - - c = g_new0 (EAddrConduitCfg,1); - g_assert (c != NULL); - - c->pilot_id = pilot_id; - management = gnome_pilot_conduit_management_new ("e_address_conduit", GNOME_PILOT_CONDUIT_MGMT_ID); - config = gnome_pilot_conduit_config_new (management, pilot_id); - if (!gnome_pilot_conduit_config_is_enabled (config, &c->sync_type)) - c->sync_type = GnomePilotConduitSyncTypeNotSet; - gtk_object_unref (GTK_OBJECT (config)); - gtk_object_unref (GTK_OBJECT (management)); - - /* Custom settings */ - gnome_config_push_prefix (prefix); - - c->secret = gnome_config_get_bool ("secret=FALSE"); - c->last_uri = gnome_config_get_string ("last_uri"); - - gnome_config_pop_prefix (); - - return c; -} - -static void -addrconduit_save_configuration (EAddrConduitCfg *c) +/* Debug routines */ +static char * +print_local (EAddrLocalRecord *local) { - gchar prefix[256]; + static char buff[ 4096 ]; - g_snprintf (prefix, 255, "/gnome-pilot.d/e-address-conduit/Pilot_%u/", - c->pilot_id); + if (local == NULL) { + sprintf (buff, "[NULL]"); + return buff; + } - gnome_config_push_prefix (prefix); - gnome_config_set_bool ("secret", c->secret); - gnome_config_set_string ("last_uri", c->last_uri); - gnome_config_pop_prefix (); + if (local->addr) { + g_snprintf (buff, 4096, "['%s' '%s' '%s']", + local->addr->entry[entryLastname] ? + local->addr->entry[entryLastname] : "", + local->addr->entry[entryFirstname] ? + local->addr->entry[entryFirstname] : "", + local->addr->entry[entryCompany] ? + local->addr->entry[entryCompany] : ""); + return buff; + } - gnome_config_sync (); - gnome_config_drop_all (); + return ""; } -static EAddrConduitCfg* -addrconduit_dupe_configuration (EAddrConduitCfg *c) +static char *print_remote (GnomePilotRecord *remote) { - EAddrConduitCfg *retval; - - g_return_val_if_fail (c != NULL, NULL); + static char buff[ 4096 ]; + struct Address addr; - retval = g_new0 (EAddrConduitCfg, 1); - retval->sync_type = c->sync_type; - retval->secret = c->secret; + if (remote == NULL) { + sprintf (buff, "[NULL]"); + return buff; + } - retval->pilot_id = c->pilot_id; - retval->last_uri = g_strdup (c->last_uri); + memset (&addr, 0, sizeof (struct Address)); + unpack_Address (&addr, remote->record, remote->length); - return retval; -} + g_snprintf (buff, 4096, "['%s' '%s' '%s']", + addr.entry[entryLastname] ? + addr.entry[entryLastname] : "", + addr.entry[entryFirstname] ? + addr.entry[entryFirstname] : "", + addr.entry[entryCompany] ? + addr.entry[entryCompany] : ""); -static void -addrconduit_destroy_configuration (EAddrConduitCfg *c) -{ - g_return_if_fail (c != NULL); + free_Address (&addr); - g_free (c->last_uri); - g_free (c); + return buff; } -/* Context */ -struct _EAddrConduitContext { - EAddrConduitCfg *cfg; - GnomePilotDBInfo *dbi; - - EAddrConduitCfg *new_cfg; - GtkWidget *ps; - - struct AddressAppInfo ai; - - EBook *ebook; - GList *cards; - GList *changed; - GHashTable *changed_hash; - GList *locals; - - gboolean address_load_tried; - gboolean address_load_success; - - EPilotMap *map; -}; - +/* Context Routines */ static EAddrConduitContext * e_addr_context_new (guint32 pilot_id) { EAddrConduitContext *ctxt = g_new0 (EAddrConduitContext, 1); - ctxt->cfg = addrconduit_load_configuration (pilot_id); - ctxt->new_cfg = addrconduit_dupe_configuration (ctxt->cfg); - ctxt->ps = NULL; + addrconduit_load_configuration (&ctxt->cfg, pilot_id); + ctxt->ebook = NULL; ctxt->cards = NULL; ctxt->changed_hash = NULL; @@ -290,7 +211,7 @@ e_addr_context_destroy (EAddrConduitContext *ctxt) g_return_if_fail (ctxt != NULL); if (ctxt->cfg != NULL) - addrconduit_destroy_configuration (ctxt->cfg); + addrconduit_destroy_configuration (&ctxt->cfg); if (ctxt->ebook != NULL) gtk_object_unref (GTK_OBJECT (ctxt->ebook)); @@ -318,7 +239,7 @@ e_addr_context_destroy (EAddrConduitContext *ctxt) if (ctxt->locals != NULL) { for (l = ctxt->locals; l != NULL; l = l->next) - addrconduit_destroy_record (l->data); + free_local (l->data); g_list_free (ctxt->locals); } @@ -328,57 +249,6 @@ e_addr_context_destroy (EAddrConduitContext *ctxt) g_free (ctxt); } -/* Debug routines */ -static char * -print_local (EAddrLocalRecord *local) -{ - static char buff[ 4096 ]; - - if (local == NULL) { - sprintf (buff, "[NULL]"); - return buff; - } - - if (local->addr) { - g_snprintf (buff, 4096, "['%s' '%s' '%s']", - local->addr->entry[entryLastname] ? - local->addr->entry[entryLastname] : "", - local->addr->entry[entryFirstname] ? - local->addr->entry[entryFirstname] : "", - local->addr->entry[entryCompany] ? - local->addr->entry[entryCompany] : ""); - return buff; - } - - return ""; -} - -static char *print_remote (GnomePilotRecord *remote) -{ - static char buff[ 4096 ]; - struct Address addr; - - if (remote == NULL) { - sprintf (buff, "[NULL]"); - return buff; - } - - memset (&addr, 0, sizeof (struct Address)); - unpack_Address (&addr, remote->record, remote->length); - - g_snprintf (buff, 4096, "['%s' '%s' '%s']", - addr.entry[entryLastname] ? - addr.entry[entryLastname] : "", - addr.entry[entryFirstname] ? - addr.entry[entryFirstname] : "", - addr.entry[entryCompany] ? - addr.entry[entryCompany] : ""); - - free_Address (&addr); - - return buff; -} - /* Addressbok Server routines */ static void add_card_cb (EBook *ebook, EBookStatus status, const char *id, gpointer closure) @@ -747,6 +617,15 @@ compute_status (EAddrConduitContext *ctxt, EAddrLocalRecord *local, const char * } } +static void +free_local (EAddrLocalRecord *local) +{ + gtk_object_unref (GTK_OBJECT (local->ecard)); + free_Address (local->addr); + g_free (local->addr); + g_free (local); +} + static GnomePilotRecord local_record_to_pilot_record (EAddrLocalRecord *local, EAddrConduitContext *ctxt) @@ -810,16 +689,16 @@ local_record_from_ecard (EAddrLocalRecord *local, ECard *ecard, EAddrConduitCont memset (&addr, 0, sizeof (struct Address)); unpack_Address (&addr, record, 0xffff); for (i = 0; i < 5; i++) { -// if (addr.entry[entryPhone1 + i]) -// local->addr->entry[entryPhone1 + i] = -// strdup (addr.entry[entryPhone1 + i]); + if (addr.entry[entryPhone1 + i]) + local->addr->entry[entryPhone1 + i] = + strdup (addr.entry[entryPhone1 + i]); local->addr->phoneLabel[i] = addr.phoneLabel[i]; } local->addr->showPhone = addr.showPhone; for (i = 0; i < 4; i++) { -// if (addr.entry[entryCustom1 + i]) -// local->addr->entry[entryCustom1 + i] = -// strdup (addr.entry[entryCustom1 + i]); + if (addr.entry[entryCustom1 + i]) + local->addr->entry[entryCustom1 + i] = + strdup (addr.entry[entryCustom1 + i]); } free_Address (&addr); } @@ -1620,7 +1499,7 @@ free_match (GnomePilotConduitSyncAbs *conduit, g_return_val_if_fail (local != NULL, -1); - addrconduit_destroy_record (local); + free_local (local); return 0; } @@ -1638,58 +1517,6 @@ prepare (GnomePilotConduitSyncAbs *conduit, return 0; } -/* Pilot Settings Callbacks */ -static void -fill_widgets (EAddrConduitContext *ctxt) -{ - e_pilot_settings_set_secret (E_PILOT_SETTINGS (ctxt->ps), - ctxt->cfg->secret); -} - -static gint -create_settings_window (GnomePilotConduit *conduit, - GtkWidget *parent, - EAddrConduitContext *ctxt) -{ - LOG ("create_settings_window"); - - ctxt->ps = e_pilot_settings_new (); - gtk_container_add (GTK_CONTAINER (parent), ctxt->ps); - gtk_widget_show (ctxt->ps); - - fill_widgets (ctxt); - - return 0; -} -static void -display_settings (GnomePilotConduit *conduit, EAddrConduitContext *ctxt) -{ - LOG ("display_settings"); - - fill_widgets (ctxt); -} - -static void -save_settings (GnomePilotConduit *conduit, EAddrConduitContext *ctxt) -{ - LOG ("save_settings"); - - ctxt->new_cfg->secret = - e_pilot_settings_get_secret (E_PILOT_SETTINGS (ctxt->ps)); - - addrconduit_save_configuration (ctxt->new_cfg); -} - -static void -revert_settings (GnomePilotConduit *conduit, EAddrConduitContext *ctxt) -{ - LOG ("revert_settings"); - - addrconduit_save_configuration (ctxt->cfg); - addrconduit_destroy_configuration (ctxt->new_cfg); - ctxt->new_cfg = addrconduit_dupe_configuration (ctxt->cfg); -} - static ORBit_MessageValidationResult accept_all_cookies (CORBA_unsigned_long request_id, CORBA_Principal *principal, @@ -1749,12 +1576,6 @@ conduit_get_gpilot_conduit (guint32 pilot_id) gtk_signal_connect (retval, "prepare", (GtkSignalFunc) prepare, ctxt); - /* Gui Settings */ - gtk_signal_connect (retval, "create_settings_window", (GtkSignalFunc) create_settings_window, ctxt); - gtk_signal_connect (retval, "display_settings", (GtkSignalFunc) display_settings, ctxt); - gtk_signal_connect (retval, "save_settings", (GtkSignalFunc) save_settings, ctxt); - gtk_signal_connect (retval, "revert_settings", (GtkSignalFunc) revert_settings, ctxt); - return GNOME_PILOT_CONDUIT (retval); } diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index 93c3bdf246..619a89cdd5 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -66,7 +66,6 @@ typedef struct { BonoboPropertyBag *properties; char *uri; char *passwd; - gboolean ignore_search_changes; } AddressbookView; static void addressbook_view_ref (AddressbookView *); @@ -115,14 +114,6 @@ save_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path) } static void -view_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path) -{ - AddressbookView *view = (AddressbookView *) user_data; - if (view->view) - e_addressbook_view_view(view->view); -} - -static void config_cb (BonoboUIComponent *uih, void *user_data, const char *path) { addressbook_config (NULL /* XXX */); @@ -251,10 +242,6 @@ update_command_state (EAddressbookView *eav, AddressbookView *view) "/commands/ContactsSaveAsVCard", "sensitive", e_addressbook_view_can_save_as (view->view) ? "1" : "0", NULL); - bonobo_ui_component_set_prop (uic, - "/commands/ContactsView", - "sensitive", - e_addressbook_view_can_view (view->view) ? "1" : "0", NULL); /* Print Contact */ bonobo_ui_component_set_prop (uic, @@ -323,7 +310,6 @@ static BonoboUIVerb verbs [] = { BONOBO_UI_UNSAFE_VERB ("ContactsPrint", print_cb), BONOBO_UI_UNSAFE_VERB ("ContactsPrintPreview", print_preview_cb), BONOBO_UI_UNSAFE_VERB ("ContactsSaveAsVCard", save_contact_cb), - BONOBO_UI_UNSAFE_VERB ("ContactsView", view_contact_cb), BONOBO_UI_UNSAFE_VERB ("ToolSearch", search_cb), BONOBO_UI_UNSAFE_VERB ("AddressbookConfig", config_cb), @@ -828,28 +814,23 @@ static ESearchBarItem addressbook_search_option_items[] = { }; static void -alphabet_state_changed (EAddressbookView *eav, gunichar letter, AddressbookView *view) -{ - view->ignore_search_changes = TRUE; - if (letter == 0) { - e_search_bar_set_item_id (view->search, ESB_ANY); - e_search_bar_set_text (view->search, ""); - } else { - e_search_bar_set_item_id (view->search, ESB_ADVANCED); - } - view->ignore_search_changes = FALSE; -} - -static void addressbook_menu_activated (ESearchBar *esb, int id, AddressbookView *view) { switch (id) { case E_FILTERBAR_RESET_ID: /* e_addressbook_view_show_all(view->view); */ - view->ignore_search_changes = TRUE; - e_search_bar_set_item_id (view->search, ESB_ANY); - view->ignore_search_changes = FALSE; - e_search_bar_set_text (esb, ""); + + /* Fix option menu if we are using "Category is" */ + if (e_search_bar_get_item_id (esb) == ESB_CATEGORY) { + + e_search_bar_set_subitem_id (esb, G_MAXINT); + + } else { + + e_search_bar_set_text (esb, ""); + + } + break; } } @@ -862,10 +843,6 @@ addressbook_query_changed (ESearchBar *esb, AddressbookView *view) const char *category_name; int search_type, subid; - if (view->ignore_search_changes) { - return; - } - gtk_object_get(GTK_OBJECT(esb), "text", &search_word, "item_id", &search_type, @@ -1093,7 +1070,6 @@ addressbook_factory_new_control (void) view = g_new0 (AddressbookView, 1); view->refs = 1; - view->ignore_search_changes = FALSE; view->vbox = gtk_vbox_new (FALSE, 0); @@ -1153,11 +1129,6 @@ addressbook_factory_new_control (void) GTK_SIGNAL_FUNC(update_command_state), view); - gtk_signal_connect (GTK_OBJECT (view->view), - "alphabet_state_change", - GTK_SIGNAL_FUNC(alphabet_state_changed), - view); - view->uri = NULL; gtk_signal_connect (GTK_OBJECT (view->control), "activate", diff --git a/addressbook/gui/component/select-names/e-select-names-bonobo.c b/addressbook/gui/component/select-names/e-select-names-bonobo.c index b2c791f259..3398882181 100644 --- a/addressbook/gui/component/select-names/e-select-names-bonobo.c +++ b/addressbook/gui/component/select-names/e-select-names-bonobo.c @@ -48,6 +48,8 @@ static BonoboObjectClass *parent_class = NULL; struct _ESelectNamesBonoboPrivate { ESelectNamesManager *manager; BonoboEventSource *event_source; + guint manager_changed_tag; + guint manager_ok_tag; }; enum _EntryPropertyID { @@ -75,11 +77,11 @@ entry_get_property_fn (BonoboPropertyBag *bag, switch (arg_id) { case ENTRY_PROPERTY_ID_TEXT: { - ETextModel *text_model; - text_model = E_TEXT_MODEL (gtk_object_get_data (GTK_OBJECT (w), "select_names_text_model")); - g_assert (text_model != NULL); + ESelectNamesModel *model; + model = E_SELECT_NAMES_MODEL (gtk_object_get_data (GTK_OBJECT (w), "select_names_model")); + g_assert (model != NULL); - BONOBO_ARG_SET_STRING (arg, e_text_model_get_text (text_model)); + BONOBO_ARG_SET_STRING (arg, e_select_names_model_get_textification (model)); break; } @@ -348,21 +350,41 @@ impl_SelectNames_activate_dialog (PortableServer_Servant servant, /* GtkObject methods. */ +/* ACK! */ +typedef struct { + char *id; + EEntry *entry; +} ESelectNamesManagerEntry; + static void impl_destroy (GtkObject *object) { ESelectNamesBonobo *select_names; ESelectNamesBonoboPrivate *priv; + EIterator *iterator; select_names = E_SELECT_NAMES_BONOBO (object); priv = select_names->priv; + gtk_signal_disconnect (GTK_OBJECT (priv->manager), priv->manager_changed_tag); + gtk_signal_disconnect (GTK_OBJECT (priv->manager), priv->manager_ok_tag); + if (priv->manager->names) { gtk_widget_destroy (GTK_WIDGET (priv->manager->names)); priv->manager->names = NULL; } - gtk_object_unref (GTK_OBJECT (priv->manager)); + /* More suckage */ + iterator = e_list_get_iterator (priv->manager->entries); + for (e_iterator_reset (iterator); e_iterator_is_valid (iterator); e_iterator_next (iterator)) { + ESelectNamesManagerEntry *entry = (ESelectNamesManagerEntry *)e_iterator_get (iterator); + if (entry && entry->entry) + gtk_widget_destroy (GTK_WIDGET (entry->entry)); + } + gtk_object_unref (GTK_OBJECT (iterator)); + + /* FIXME: We leak on purpose. This sucks. */ + /* gtk_object_unref (GTK_OBJECT (priv->manager)); */ g_free (priv); } @@ -414,15 +436,17 @@ init (ESelectNamesBonobo *select_names) priv->manager = e_select_names_manager_new (); priv->event_source = NULL; - gtk_signal_connect (GTK_OBJECT (priv->manager), - "changed", - GTK_SIGNAL_FUNC (manager_changed_cb), - select_names); - - gtk_signal_connect (GTK_OBJECT (priv->manager), - "ok", - GTK_SIGNAL_FUNC (manager_ok_cb), - select_names); + priv->manager_changed_tag = + gtk_signal_connect (GTK_OBJECT (priv->manager), + "changed", + GTK_SIGNAL_FUNC (manager_changed_cb), + select_names); + + priv->manager_ok_tag = + gtk_signal_connect (GTK_OBJECT (priv->manager), + "ok", + GTK_SIGNAL_FUNC (manager_ok_cb), + select_names); select_names->priv = priv; } diff --git a/addressbook/gui/component/select-names/e-select-names-completion.c b/addressbook/gui/component/select-names/e-select-names-completion.c index cbfc1d56c6..eb15c4f232 100644 --- a/addressbook/gui/component/select-names/e-select-names-completion.c +++ b/addressbook/gui/component/select-names/e-select-names-completion.c @@ -55,7 +55,7 @@ typedef struct { struct _ESelectNamesCompletionPrivate { - ESelectNamesTextModel *text_model; + ESelectNamesModel *model; GList *book_data; gint books_not_ready; @@ -739,8 +739,8 @@ e_select_names_completion_destroy (GtkObject *object) ESelectNamesCompletion *comp = E_SELECT_NAMES_COMPLETION (object); GList *l; - if (comp->priv->text_model) - gtk_object_unref (GTK_OBJECT (comp->priv->text_model)); + if (comp->priv->model) + gtk_object_unref (GTK_OBJECT (comp->priv->model)); for (l = comp->priv->book_data; l; l = l->next) { ESelectNamesCompletionBookData *book_data = l->data; @@ -1142,10 +1142,8 @@ e_select_names_completion_handle_request (ECompletion *comp, const gchar *text, fprintf (out, "text=\"%s\" pos=%d limit=%d\n", text, pos, limit); } - e_select_names_model_text_pos (selcomp->priv->text_model->source, - selcomp->priv->text_model->seplen, - pos, &index, NULL, NULL); - str = index >= 0 ? e_select_names_model_get_string (selcomp->priv->text_model->source, index) : NULL; + e_select_names_model_text_pos (selcomp->priv->model, pos, &index, NULL, NULL); + str = index >= 0 ? e_select_names_model_get_string (selcomp->priv->model, index) : NULL; if (out) fprintf (out, "index=%d str=\"%s\"\n", index, str); @@ -1227,12 +1225,13 @@ e_select_names_completion_book_ready (EBook *book, EBookStatus status, ESelectNa */ ECompletion * -e_select_names_completion_new (EBook *book, ESelectNamesTextModel *text_model) +e_select_names_completion_new (EBook *book, ESelectNamesModel *model) { ESelectNamesCompletion *comp; g_return_val_if_fail (book == NULL || E_IS_BOOK (book), NULL); - g_return_val_if_fail (E_IS_SELECT_NAMES_TEXT_MODEL (text_model), NULL); + g_return_val_if_fail (model, NULL); + g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), NULL); comp = (ESelectNamesCompletion *) gtk_type_new (e_select_names_completion_get_type ()); @@ -1254,8 +1253,8 @@ e_select_names_completion_new (EBook *book, ESelectNamesTextModel *text_model) e_select_names_completion_add_book (comp, book); } - comp->priv->text_model = text_model; - gtk_object_ref (GTK_OBJECT (text_model)); + comp->priv->model = model; + gtk_object_ref (GTK_OBJECT (model)); return E_COMPLETION (comp); } diff --git a/addressbook/gui/component/select-names/e-select-names-manager.c b/addressbook/gui/component/select-names/e-select-names-manager.c index 53978ac502..e2b0238123 100644 --- a/addressbook/gui/component/select-names/e-select-names-manager.c +++ b/addressbook/gui/component/select-names/e-select-names-manager.c @@ -2,9 +2,8 @@ /* * Authors: * Chris Lahey <clahey@ximian.com> - * Jon Trowbridge <trow@ximian.com. * - * Copyright (C) 2000, 2001 Ximian, Inc. + * Copyright (C) 2000 Ximian, Inc. */ #include <config.h> @@ -27,10 +26,15 @@ #include <bonobo/bonobo-object.h> #include <bonobo/bonobo-moniker-util.h> +/* Object argument IDs */ +enum { + ARG_0, + ARG_CARD, +}; + enum { CHANGED, OK, - CANCEL, LAST_SIGNAL }; @@ -43,442 +47,489 @@ typedef struct { ESelectNamesModel *model; ESelectNamesModel *original_model; ESelectNamesManager *manager; - guint changed_tag; + guint changed_handler; } ESelectNamesManagerSection; typedef struct { char *id; EEntry *entry; - ESelectNamesManager *manager; - ESelectNamesModel *model; - guint cleaning_tag; } 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; -/* ESelectNamesManagerSection routines */ + 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; +} static void -section_model_changed_cb (ESelectNamesModel *model, gpointer closure) +open_book_cb (EBook *book, EBookStatus status, ESelectNamesManager *manager) { - ESelectNamesManagerSection *section = closure; - gtk_signal_emit (GTK_OBJECT (section->manager), - e_select_names_manager_signals[CHANGED], - section->id, - FALSE); + if (status != E_BOOK_STATUS_SUCCESS) { + gtk_object_unref (GTK_OBJECT (book)); + manager->completion_book = NULL; + } + + gtk_object_unref (GTK_OBJECT (manager)); /* unref ourself (matches ref before the load_uri call below) */ } -static ESelectNamesManagerSection * -e_select_names_manager_section_new (ESelectNamesManager *manager, - const gchar *id, - const gchar *title, - ESelectNamesModel *model) +/** + * 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) { - ESelectNamesManagerSection *section; + ESelectNamesManager *manager = E_SELECT_NAMES_MANAGER(gtk_type_new(e_select_names_manager_get_type())); + Bonobo_ConfigDatabase db; + CORBA_Environment ev; + char *val; - g_return_val_if_fail (E_IS_SELECT_NAMES_MANAGER (manager), NULL); - g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), NULL); + CORBA_exception_init (&ev); - section = g_new0 (ESelectNamesManagerSection, 1); + db = addressbook_config_database (&ev); - section->id = g_strdup (id); - section->title = g_strdup (title); + val = bonobo_config_get_string (db, "/Addressbook/Completion/uri", &ev); - section->manager = manager; + CORBA_exception_free (&ev); - section->model = model; - gtk_object_ref (GTK_OBJECT (section->model)); - section->changed_tag = - gtk_signal_connect (GTK_OBJECT (section->model), - "changed", - GTK_SIGNAL_FUNC (section_model_changed_cb), - section); + if (val) { + manager->completion_book = e_book_new (); + gtk_object_ref (GTK_OBJECT (manager)); /* ref ourself before our async call */ + addressbook_load_uri (manager->completion_book, val, (EBookCallback)open_book_cb, manager); + g_free (val); + } + else + manager->completion_book = NULL; - return section; + return manager; } static void -e_select_names_manager_section_free (ESelectNamesManagerSection *section) +e_select_names_manager_class_init (ESelectNamesManagerClass *klass) { - if (section == NULL) - return; - - g_free (section->id); - g_free (section->title); + GtkObjectClass *object_class; - if (section->model) { - gtk_signal_disconnect (GTK_OBJECT (section->model), section->changed_tag); - gtk_object_unref (GTK_OBJECT (section->model)); - } + object_class = GTK_OBJECT_CLASS(klass); - if (section->original_model) { - gtk_object_unref (GTK_OBJECT (section->original_model)); - } + gtk_object_add_arg_type ("ESelectNamesManager::card", + GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CARD); - g_free (section); -} + 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; -/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */ + e_select_names_manager_signals[CHANGED] = + gtk_signal_new ("changed", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (ESelectNamesManagerClass, changed), + gtk_marshal_NONE__POINTER_INT, + GTK_TYPE_NONE, 2, + GTK_TYPE_POINTER, + GTK_TYPE_INT); -/* ESelectNamesManagerEntry routines */ + e_select_names_manager_signals[OK] = + gtk_signal_new ("ok", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (ESelectNamesManagerClass, ok), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); -static ESelectNamesManagerEntry * -get_entry_info (EEntry *entry) -{ - g_return_val_if_fail (E_IS_ENTRY (entry), NULL); - return (ESelectNamesManagerEntry *) gtk_object_get_data (GTK_OBJECT (entry), "entry_info"); + gtk_object_class_add_signals (object_class, e_select_names_manager_signals, LAST_SIGNAL); } +/* + * ESelectNamesManager lifecycle management and vcard loading/saving. + */ + static void -popup_cb (EEntry *eentry, GdkEventButton *ev, gint pos, gpointer user_data) +e_select_names_manager_destroy (GtkObject *object) { - ESelectNamesTextModel *text_model; + ESelectNamesManager *manager; + + manager = E_SELECT_NAMES_MANAGER (object); - gtk_object_get (GTK_OBJECT (eentry), - "model", &text_model, - NULL); - g_assert (E_IS_SELECT_NAMES_TEXT_MODEL (text_model)); + gtk_object_unref(GTK_OBJECT(manager->sections)); + gtk_object_unref(GTK_OBJECT(manager->entries)); - e_select_names_popup (text_model, ev, pos); + if (manager->names) { + gtk_widget_destroy (GTK_WIDGET (manager->names)); + manager->names = NULL; + } } -static gboolean -clean_cb (gpointer ptr) -{ - ESelectNamesManagerEntry *entry = ptr; - - e_select_names_model_clean (entry->model, TRUE); - entry->cleaning_tag = 0; - return FALSE; -} -static gint -focus_in_cb (GtkWidget *w, GdkEventFocus *ev, gpointer user_data) +/* Set_arg handler for the manager */ +static void +e_select_names_manager_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) { - ESelectNamesManagerEntry *entry = user_data; + ESelectNamesManager *manager; + + manager = E_SELECT_NAMES_MANAGER (object); - if (entry->cleaning_tag) { - gtk_timeout_remove (entry->cleaning_tag); - entry->cleaning_tag = 0; + switch (arg_id) { + case ARG_CARD: + break; + default: + return; } - - e_select_names_model_cancel_cardify_all (entry->model); - - return FALSE; } -static gint -focus_out_cb (GtkWidget *w, GdkEventFocus *ev, gpointer user_data) +/* Get_arg handler for the manager */ +static void +e_select_names_manager_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) { - ESelectNamesManagerEntry *entry = user_data; - gboolean visible = e_entry_completion_popup_is_visible (entry->entry); + ESelectNamesManager *manager; - if (! visible) { - e_select_names_model_cardify_all (entry->model, entry->manager->completion_book, 100); - if (entry->cleaning_tag == 0) - entry->cleaning_tag = gtk_timeout_add (100, clean_cb, entry); - } + manager = E_SELECT_NAMES_MANAGER (object); - return FALSE; + switch (arg_id) { + case ARG_CARD: + break; + default: + arg->type = GTK_TYPE_INVALID; + break; + } } -static void -completion_popup_cb (EEntry *w, gint visible, gpointer user_data) +static void * +section_copy(const void *sec, void *data) { - ESelectNamesManagerEntry *entry = user_data; - - if (!visible && !GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (entry->entry->canvas))) - e_select_names_model_cardify_all (entry->model, entry->manager->completion_book, 0); + const ESelectNamesManagerSection *section = sec; + ESelectNamesManagerSection *newsec; + + static void section_model_changed_cb (ESelectNamesModel *, gpointer); + + newsec = g_new(ESelectNamesManagerSection, 1); + newsec->id = g_strdup(section->id); + newsec->title = g_strdup(section->title); + newsec->model = section->model; + newsec->original_model = section->original_model; + newsec->manager = section->manager; + newsec->changed_handler = gtk_signal_connect (GTK_OBJECT (newsec->model), + "changed", + GTK_SIGNAL_FUNC (section_model_changed_cb), + newsec); + + if (newsec->model) + gtk_object_ref(GTK_OBJECT(newsec->model)); + if (newsec->original_model) + gtk_object_ref(GTK_OBJECT(newsec->original_model)); + + return newsec; } static void -completion_handler (EEntry *entry, ECompletionMatch *match) +section_free(void *sec, void *data) { - ESelectNamesManagerEntry *mgr_entry; - ESelectNamesTextModel *text_model; - EDestination *dest; - gint i, pos, start_pos, len; - - if (match == NULL || match->user_data == NULL) - return; - - mgr_entry = get_entry_info (entry); - dest = E_DESTINATION (match->user_data); - - /* Sometimes I really long for garbage collection. Reference - counting makes you feel 31337, but sometimes it is just a - bitch. */ - gtk_object_ref (GTK_OBJECT (dest)); - - gtk_object_get (GTK_OBJECT (entry), - "model", &text_model, - NULL); - g_assert (E_IS_SELECT_NAMES_TEXT_MODEL (text_model)); + ESelectNamesManagerSection *section = sec; + if (section->manager && section->changed_handler) { + gtk_signal_disconnect (GTK_OBJECT (section->model), section->changed_handler); + } + g_free(section->id); + g_free(section->title); + if (section->model) + gtk_object_unref (GTK_OBJECT(section->model)); + if (section->original_model) + gtk_object_unref (GTK_OBJECT (section->original_model)); - pos = e_entry_get_position (entry); - e_select_names_model_text_pos (mgr_entry->model, text_model->seplen, pos, &i, NULL, NULL); - e_select_names_model_replace (mgr_entry->model, i, dest); - e_select_names_model_name_pos (mgr_entry->model, text_model->seplen, i, &start_pos, &len); - e_entry_set_position (entry, start_pos+len); + g_free(section); } -static ESelectNamesManagerEntry * -e_select_names_manager_entry_new (ESelectNamesManager *manager, ESelectNamesModel *model, const gchar *id) +static void * +entry_copy(const void *ent, void *data) { - ESelectNamesManagerEntry *entry; - ETextModel *text_model; - ECompletion *comp; - - g_return_val_if_fail (E_IS_SELECT_NAMES_MANAGER (manager), NULL); - g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), NULL); - - entry = g_new0 (ESelectNamesManagerEntry, 1); - - entry->id = g_strdup (id); - - entry->entry = E_ENTRY (e_entry_new ()); - text_model = e_select_names_text_model_new (model); - gtk_object_set(GTK_OBJECT(entry->entry), - "model", text_model, /* The entry takes ownership of the text model */ - "editable", TRUE, - "use_ellipsis", TRUE, - "allow_newlines", FALSE, - NULL); - - gtk_object_ref (GTK_OBJECT (entry->entry)); - - comp = e_select_names_completion_new (NULL, E_SELECT_NAMES_TEXT_MODEL (text_model)); - if (manager->completion_book) - e_select_names_completion_add_book (E_SELECT_NAMES_COMPLETION (comp), - manager->completion_book); - - e_entry_enable_completion_full (entry->entry, comp, 50, completion_handler); - - entry->manager = manager; - - entry->model = model; - gtk_object_ref (GTK_OBJECT (model)); - - gtk_signal_connect (GTK_OBJECT (entry->entry), - "popup", - GTK_SIGNAL_FUNC (popup_cb), - entry); - - gtk_signal_connect (GTK_OBJECT (entry->entry->canvas), - "focus_in_event", - GTK_SIGNAL_FUNC (focus_in_cb), - entry); + const ESelectNamesManagerEntry *entry = ent; + ESelectNamesManagerEntry *newent; - gtk_signal_connect (GTK_OBJECT (entry->entry->canvas), - "focus_out_event", - GTK_SIGNAL_FUNC (focus_out_cb), - entry); - - gtk_signal_connect (GTK_OBJECT (entry->entry), - "completion_popup", - GTK_SIGNAL_FUNC (completion_popup_cb), - entry); - - gtk_object_set_data (GTK_OBJECT (entry->entry), "entry_info", entry); - gtk_object_set_data (GTK_OBJECT (entry->entry), "select_names_model", model); - gtk_object_set_data (GTK_OBJECT (entry->entry), "select_names_text_model", text_model); - gtk_object_set_data (GTK_OBJECT (entry->entry), "completion_handler", comp); - - return entry; + 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 -e_select_names_manager_entry_free (ESelectNamesManagerEntry *entry) +entry_free(void *ent, void *data) { - if (entry == NULL) - return; + ESelectNamesManagerEntry *entry = ent; + g_free(entry->id); + if (entry->entry) + gtk_object_unref(GTK_OBJECT(entry->entry)); + g_free(entry); +} - g_free (entry->id); - gtk_object_unref (GTK_OBJECT (entry->model)); - gtk_object_unref (GTK_OBJECT (entry->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); +} - if (entry->cleaning_tag) - gtk_timeout_remove (entry->cleaning_tag); +static void +section_model_changed_cb (ESelectNamesModel *model, gpointer closure) +{ + ESelectNamesManagerSection *section = closure; + gtk_signal_emit (GTK_OBJECT (section->manager), + e_select_names_manager_signals[CHANGED], + section->id, + FALSE); +} - g_free (entry); +static void +section_model_working_copy_changed_cb (ESelectNamesModel *model, gpointer closure) +{ + ESelectNamesManagerSection *section = closure; + gtk_signal_emit (GTK_OBJECT (section->manager), + e_select_names_manager_signals[CHANGED], + section->id, + TRUE); } -/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */ +void +e_select_names_manager_add_section (ESelectNamesManager *manager, + const char *id, + const char *title) +{ + e_select_names_manager_add_section_with_limit (manager, id, title, -1); +} -static void -e_select_names_manager_save_models (ESelectNamesManager *manager) +void +e_select_names_manager_add_section_with_limit (ESelectNamesManager *manager, + const char *id, + const char *title, + gint limit) { - GList *iter; + ESelectNamesManagerSection *section; - for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) { - ESelectNamesManagerSection *section = iter->data; + section = g_new(ESelectNamesManagerSection, 1); + section->id = g_strdup(id); + section->title = g_strdup(title); - if (section->original_model == NULL && section->model != NULL) - section->original_model = e_select_names_model_duplicate (section->model); + section->model = e_select_names_model_new(); + e_select_names_model_set_limit (section->model, limit); - } -} + section->original_model = NULL; -static void -e_select_names_manager_revert_to_saved_models (ESelectNamesManager *manager) -{ - GList *iter; + section->manager = manager; - for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) { - ESelectNamesManagerSection *section = iter->data; - if (section->model && section->original_model) { - e_select_names_model_overwrite_copy (section->model, section->original_model); - gtk_object_unref (GTK_OBJECT (section->original_model)); - section->original_model = NULL; - } - } + section->changed_handler = gtk_signal_connect (GTK_OBJECT (section->model), + "changed", + GTK_SIGNAL_FUNC (section_model_changed_cb), + section); + + e_list_append(manager->sections, section); + section_free(section, manager); } -static void -e_select_names_manager_discard_saved_models (ESelectNamesManager *manager) +ESelectNamesModel * +e_select_names_manager_get_source (ESelectNamesManager *manager, const char *id) { - GList *iter; + EIterator *iterator; - for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) { - ESelectNamesManagerSection *section = iter->data; - if (section->original_model) { - gtk_object_unref (GTK_OBJECT (section->original_model)); - section->original_model = NULL; + g_return_val_if_fail (manager && E_IS_SELECT_NAMES_MANAGER (manager), NULL); + g_return_val_if_fail (id, NULL); + + 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 section->model; } } -} - -/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */ + return NULL; +} static void -open_book_cb (EBook *book, EBookStatus status, ESelectNamesManager *manager) +entry_destroyed(EEntry *entry, ESelectNamesManager *manager) { - if (status != E_BOOK_STATUS_SUCCESS) { - gtk_object_unref (GTK_OBJECT (book)); - manager->completion_book = NULL; + 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)); /* unref ourself (matches ref before the load_uri call below) */ } -/** - * 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) +static void +completion_handler (EEntry *entry, ECompletionMatch *match) { - ESelectNamesManager *manager = E_SELECT_NAMES_MANAGER(gtk_type_new(e_select_names_manager_get_type())); - Bonobo_ConfigDatabase db; - CORBA_Environment ev; - char *val; - - CORBA_exception_init (&ev); + ESelectNamesModel *snm; + EDestination *dest; + gint i, pos, start_pos, len; - db = addressbook_config_database (&ev); + if (match == NULL || match->user_data == NULL) + return; - val = bonobo_config_get_string (db, "/Addressbook/Completion/uri", &ev); - CORBA_exception_free (&ev); + snm = E_SELECT_NAMES_MODEL (gtk_object_get_data (GTK_OBJECT (entry), "select_names_model")); + dest = E_DESTINATION (match->user_data); - if (val) { - manager->completion_book = e_book_new (); - gtk_object_ref (GTK_OBJECT (manager)); /* ref ourself before our async call */ - addressbook_load_uri (manager->completion_book, val, (EBookCallback)open_book_cb, manager); - g_free (val); - } - else - manager->completion_book = NULL; + /* Sometimes I really long for garbage collection. Reference + counting makes you feel 31337, but sometimes it is just a + bitch. */ + gtk_object_ref (GTK_OBJECT (dest)); - return manager; + pos = e_entry_get_position (entry); + e_select_names_model_text_pos (snm, pos, &i, NULL, NULL); + e_select_names_model_replace (snm, i, dest); + e_select_names_model_name_pos (snm, i, &start_pos, &len); + e_entry_set_position (entry, start_pos+len); } +static void +popup_cb (EEntry *entry, GdkEventButton *ev, gint pos, ESelectNamesModel *model) +{ + e_select_names_popup (model, ev, pos); +} -/* - * ESelectNamesManager lifecycle management and vcard loading/saving. - */ +static gint +focus_in_cb (GtkWidget *w, GdkEventFocus *ev, gpointer user_data) +{ + EEntry *entry = E_ENTRY (user_data); + ESelectNamesModel *model = E_SELECT_NAMES_MODEL (gtk_object_get_data (GTK_OBJECT (entry), "select_names_model")); + e_select_names_model_cancel_cardify_all (model); -void -e_select_names_manager_add_section (ESelectNamesManager *manager, - const char *id, - const char *title) -{ - g_return_if_fail (E_IS_SELECT_NAMES_MANAGER (manager)); - g_return_if_fail (id != NULL); - g_return_if_fail (title != NULL); - - e_select_names_manager_add_section_with_limit (manager, id, title, -1); + return FALSE; } -void -e_select_names_manager_add_section_with_limit (ESelectNamesManager *manager, - const char *id, - const char *title, - gint limit) +static gint +focus_out_cb (GtkWidget *w, GdkEventFocus *ev, gpointer user_data) { - ESelectNamesManagerSection *section; - ESelectNamesModel *model; + EEntry *entry = E_ENTRY (user_data); + ESelectNamesModel *model = E_SELECT_NAMES_MODEL (gtk_object_get_data (GTK_OBJECT (entry), "select_names_model")); + ESelectNamesManager *manager = E_SELECT_NAMES_MANAGER (gtk_object_get_data (GTK_OBJECT (entry), "select_names_manager")); - g_return_if_fail (E_IS_SELECT_NAMES_MANAGER (manager)); - g_return_if_fail (id != NULL); - g_return_if_fail (title != NULL); - - model = e_select_names_model_new (); - e_select_names_model_set_limit (model, limit); - - section = e_select_names_manager_section_new (manager, id, title, model); + e_select_names_model_clean (model); - manager->sections = g_list_append (manager->sections, section); + if (!e_entry_completion_popup_is_visible (entry)) + e_select_names_model_cardify_all (model, manager->completion_book, 100); - gtk_object_unref (GTK_OBJECT (model)); + return FALSE; } -ESelectNamesModel * -e_select_names_manager_get_source (ESelectNamesManager *manager, - const char *id) +static void +completion_popup_cb (EEntry *entry, gint visible, gpointer user_data) { - GList *iter; + ESelectNamesModel *model = E_SELECT_NAMES_MODEL (gtk_object_get_data (GTK_OBJECT (entry), "select_names_model")); + ESelectNamesManager *manager = E_SELECT_NAMES_MANAGER (gtk_object_get_data (GTK_OBJECT (entry), "select_names_manager")); - g_return_val_if_fail (E_IS_SELECT_NAMES_MANAGER (manager), NULL); - g_return_val_if_fail (id != NULL, NULL); - - for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) { - ESelectNamesManagerSection *section = iter->data; - if (!strcmp (section->id, id)) - return section->model; - } - return NULL; + if (!visible && !GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (entry->canvas))) + e_select_names_model_cardify_all (model, manager->completion_book, 0); } GtkWidget * e_select_names_manager_create_entry (ESelectNamesManager *manager, const char *id) { - GList *iter; - - g_return_val_if_fail (E_IS_SELECT_NAMES_MANAGER (manager), NULL); - g_return_val_if_fail (id != NULL, NULL); - - for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) { - ESelectNamesManagerSection *section = iter->data; + 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; + ECompletion *comp; - entry = e_select_names_manager_entry_new (manager, section->model, section->id); - manager->entries = g_list_append (manager->entries, entry); + eentry = E_ENTRY (e_entry_new ()); + gtk_object_set_data (GTK_OBJECT (eentry), "select_names_model", section->model); + gtk_object_set_data (GTK_OBJECT (eentry), "select_names_manager", manager); - return GTK_WIDGET(entry->entry); + gtk_signal_connect (GTK_OBJECT (eentry), + "popup", + GTK_SIGNAL_FUNC (popup_cb), + section->model); + + gtk_signal_connect (GTK_OBJECT (eentry->canvas), + "focus_in_event", + GTK_SIGNAL_FUNC (focus_in_cb), + eentry); + gtk_signal_connect (GTK_OBJECT (eentry->canvas), + "focus_out_event", + GTK_SIGNAL_FUNC (focus_out_cb), + eentry); + gtk_signal_connect (GTK_OBJECT (eentry), + "completion_popup", + GTK_SIGNAL_FUNC (completion_popup_cb), + NULL); + + entry = g_new (ESelectNamesManagerEntry, 1); + entry->entry = eentry; + entry->id = (char *)id; + + gtk_object_ref (GTK_OBJECT (entry->entry)); + + model = e_select_names_text_model_new (section->model); + e_list_append (manager->entries, entry); + g_free(entry); + + comp = e_select_names_completion_new (NULL, section->model); + if (manager->completion_book) + e_select_names_completion_add_book (E_SELECT_NAMES_COMPLETION (comp), + manager->completion_book); + e_entry_enable_completion_full (eentry, comp, 50, completion_handler); + + gtk_object_set_data (GTK_OBJECT (eentry), "completion_handler", comp); + + gtk_object_set(GTK_OBJECT(eentry), + "model", model, + "editable", TRUE, + "use_ellipsis", TRUE, + "allow_newlines", FALSE, + NULL); + + gtk_signal_connect(GTK_OBJECT(eentry), "destroy", + GTK_SIGNAL_FUNC(entry_destroyed), manager); + + return GTK_WIDGET(eentry); } } - return NULL; } @@ -489,159 +540,59 @@ e_select_names_clicked(ESelectNames *dialog, gint button, ESelectNamesManager *m switch(button) { case 0: - e_select_names_manager_discard_saved_models (manager); + /* We don't need to do much if they click on OK */ + gtk_signal_emit (GTK_OBJECT (manager), e_select_names_manager_signals[OK]); break; - case 1: - e_select_names_manager_revert_to_saved_models (manager); - gtk_signal_emit (GTK_OBJECT (manager), e_select_names_manager_signals[CANCEL]); + case 1: { + 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); + e_select_names_model_overwrite_copy (section->model, section->original_model); + } + + gtk_object_unref(GTK_OBJECT(iterator)); break; } + } } void e_select_names_manager_activate_dialog (ESelectNamesManager *manager, const char *id) { - g_return_if_fail (E_IS_SELECT_NAMES_MANAGER (manager)); - g_return_if_fail (id != NULL); - + EIterator *iterator; + if (manager->names) { - g_assert (GTK_WIDGET_REALIZED (GTK_WIDGET (manager->names))); - e_select_names_set_default (manager->names, id); + e_select_names_set_default(manager->names, id); gdk_window_show (GTK_WIDGET (manager->names)->window); gdk_window_raise (GTK_WIDGET (manager->names)->window); - } else { - - GList *iter; - manager->names = E_SELECT_NAMES (e_select_names_new ()); - for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) { - ESelectNamesManagerSection *section = iter->data; + iterator = e_list_get_iterator(manager->sections); + for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) { + ESelectNamesManagerSection *section = (ESelectNamesManagerSection *) e_iterator_get(iterator); + if (section->original_model != NULL) + gtk_object_unref (GTK_OBJECT (section->original_model)); + section->original_model = e_select_names_model_duplicate (section->model); e_select_names_add_section (manager->names, section->id, section->title, section->model); + gtk_signal_connect (GTK_OBJECT (section->model), + "changed", + GTK_SIGNAL_FUNC (section_model_working_copy_changed_cb), + (gpointer)section); /* casting out const to avoid compiler warning */ } - - e_select_names_set_default (manager->names, id); - - gtk_signal_connect(GTK_OBJECT(manager->names), - "clicked", - GTK_SIGNAL_FUNC(e_select_names_clicked), - manager); - - gtk_signal_connect(GTK_OBJECT(manager->names), - "destroy", + e_select_names_set_default(manager->names, id); + gtk_signal_connect(GTK_OBJECT(manager->names), "clicked", + GTK_SIGNAL_FUNC(e_select_names_clicked), manager); + gtk_signal_connect(GTK_OBJECT(manager->names), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &manager->names); - gtk_widget_show(GTK_WIDGET(manager->names)); } - - e_select_names_manager_save_models (manager); -} - -/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */ - -static void -e_select_names_manager_init (ESelectNamesManager *manager) -{ - manager->sections = NULL; - manager->entries = NULL; } -static void -e_select_names_manager_destroy (GtkObject *object) -{ - ESelectNamesManager *manager; - - manager = E_SELECT_NAMES_MANAGER (object); - - if (manager->names) { - gtk_widget_destroy (GTK_WIDGET (manager->names)); - manager->names = NULL; - } - - g_list_foreach (manager->sections, (GFunc) e_select_names_manager_section_free, NULL); - g_list_free (manager->sections); - manager->sections = NULL; - - g_list_foreach (manager->entries, (GFunc) e_select_names_manager_entry_free, NULL); - g_list_free (manager->entries); - manager->entries = NULL; -} - -static void -e_select_names_manager_class_init (ESelectNamesManagerClass *klass) -{ - GtkObjectClass *object_class; - - object_class = GTK_OBJECT_CLASS(klass); - - object_class->destroy = e_select_names_manager_destroy; - - e_select_names_manager_signals[CHANGED] = - gtk_signal_new ("changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ESelectNamesManagerClass, changed), - gtk_marshal_NONE__POINTER_INT, - GTK_TYPE_NONE, 2, - GTK_TYPE_POINTER, - GTK_TYPE_INT); - - e_select_names_manager_signals[OK] = - gtk_signal_new ("ok", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ESelectNamesManagerClass, ok), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - e_select_names_manager_signals[CANCEL] = - gtk_signal_new ("cancel", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (ESelectNamesManagerClass, cancel), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, e_select_names_manager_signals, LAST_SIGNAL); -} - -/** - * 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; -} - - - diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c index 095d928a41..680dd62a34 100644 --- a/addressbook/gui/component/select-names/e-select-names.c +++ b/addressbook/gui/component/select-names/e-select-names.c @@ -42,7 +42,7 @@ #include "e-select-names.h" #include <addressbook/backend/ebook/e-card-simple.h> -#include "e-select-names-text-model.h" +#include "e-select-names-table-model.h" #include <gal/widgets/e-categories-master-list-combo.h> #include <gal/widgets/e-unicode.h> #include <gal/e-text/e-entry.h> @@ -63,12 +63,11 @@ enum { }; typedef struct { - char *title; - ETableModel *model; - ESelectNamesModel *source; - ESelectNamesTextModel *text_model; - ESelectNames *names; - GtkWidget *label; + char *title; + ETableModel *model; + ESelectNamesModel *source; + ESelectNames *names; + GtkWidget *label; } ESelectNamesChild; GtkType @@ -216,7 +215,7 @@ real_add_address_cb (int model_row, gpointer closure) e_destination_set_card (dest, card, 0); e_select_names_model_append (child->source, dest); - e_select_names_model_clean (child->source, FALSE); + e_select_names_model_clean (child->source); gtk_object_unref(GTK_OBJECT(card)); } @@ -514,11 +513,10 @@ add_additional_select_names_uris (ESelectNames *e_select_names, CORBA_Environmen Bonobo_ConfigDatabase config_db; guint32 num_additional_uris; int i; - gboolean flag; config_db = addressbook_config_database (ev); - num_additional_uris = bonobo_config_get_ulong_with_default (config_db, "/Addressbook/additional_select_names_folders/num", 0, &flag); + num_additional_uris = bonobo_config_get_ulong_with_default (config_db, "/Addressbook/additional_select_names_folders/num", 0, ev); for (i = 0; i < num_additional_uris; i ++) { ESelectNamesFolder *e_folder; char *config_path; @@ -777,21 +775,18 @@ button_clicked(GtkWidget *button, ESelectNamesChild *child) real_add_address(child->names, child); } -#if 0 static void remove_address(ETable *table, int row, int col, GdkEvent *event, ESelectNamesChild *child) { e_select_names_model_delete (child->source, row); } -#endif struct _RightClickData { + ETable *table; ESelectNamesChild *child; - int index; }; typedef struct _RightClickData RightClickData; -#if 0 static GSList *selected_rows = NULL; static void @@ -810,38 +805,47 @@ selected_rows_foreach_cb (void *row, void *data) remove_address (NULL, GPOINTER_TO_INT (row), 0, NULL, child); } -#endif static void remove_cb (GtkWidget *widget, void *data) { RightClickData *rcdata = (RightClickData *)data; - e_select_names_model_delete (rcdata->child->source, rcdata->index); + e_select_names_model_freeze (rcdata->child->source); + + /* Build a list of selected rows */ + e_table_selected_row_foreach (rcdata->table, + etable_selection_foreach_cb, + rcdata->child); + + /* Now process the list we made, removing each selected row */ + g_slist_foreach (selected_rows, + (GFunc)selected_rows_foreach_cb, + rcdata->child); + + e_select_names_model_thaw (rcdata->child->source); /* Free everything we've created */ g_free (rcdata); + g_slist_free (selected_rows); + selected_rows = NULL; } static void -section_right_click_cb (EText *text, GdkEventButton *ev, gint pos, ESelectNamesChild *child) +section_right_click_cb (ETable *table, gint row, gint col, GdkEvent *event, ESelectNamesChild *child) { EPopupMenu right_click_menu[] = { { N_("Remove"), NULL, GTK_SIGNAL_FUNC (remove_cb), NULL, 0 }, { NULL, NULL, NULL, 0 } }; - gint index; - - e_select_names_model_text_pos (child->source, child->text_model->seplen, pos, &index, NULL, NULL); - if (index != -1) { - RightClickData *rcdata = g_new0 (RightClickData, 1); - rcdata->index = index; - rcdata->child = child; + RightClickData *rcdata = g_new0 (RightClickData, 1); + rcdata->table = table; + rcdata->child = child; - e_popup_menu_run (right_click_menu, (GdkEvent *)ev, 0, 0, rcdata); - } + e_popup_menu_run (right_click_menu, event, 0, 0, + rcdata); } void @@ -854,8 +858,8 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E GtkTable *table; char *label_text; - GtkWidget *sw; - GtkWidget *recipient_table; + ETableModel *model; + GtkWidget *etable; if (g_hash_table_lookup(e_select_names->children, id)) { return; @@ -868,12 +872,6 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E child->names = e_select_names; child->title = e_utf8_from_locale_string(_(name)); - child->text_model = (ESelectNamesTextModel *) e_select_names_text_model_new (source); - e_select_names_text_model_set_separator (child->text_model, "\n"); - - child->source = source; - gtk_object_ref(GTK_OBJECT(child->source)); - e_select_names->child_count++; alignment = gtk_alignment_new(0, 0, 1, 0); @@ -910,38 +908,28 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E e_select_names->child_count + 1, GTK_FILL, GTK_FILL, 0, 0); - - sw = gtk_scrolled_window_new (NULL, NULL); - recipient_table = e_entry_new (); - gtk_object_set (GTK_OBJECT (recipient_table), - "model", child->text_model, - "allow_newlines", TRUE, - NULL); - - gtk_signal_connect (GTK_OBJECT (recipient_table), - "popup", - GTK_SIGNAL_FUNC (section_right_click_cb), - child); + model = e_select_names_table_model_new(source); + etable = e_table_scrolled_new (model, NULL, SPEC2, NULL); - gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), recipient_table); - -#if 0 gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(etable))), "right_click", GTK_SIGNAL_FUNC(section_right_click_cb), child); gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(etable))), "double_click", GTK_SIGNAL_FUNC(remove_address), child); -#endif + child->model = model; + child->source = source; + gtk_object_ref(GTK_OBJECT(child->model)); + gtk_object_ref(GTK_OBJECT(child->source)); gtk_signal_connect (GTK_OBJECT (child->source), "changed", GTK_SIGNAL_FUNC (sync_table_and_models), e_select_names); - gtk_widget_show_all (sw); + gtk_widget_show(etable); - gtk_table_attach(table, sw, + gtk_table_attach(table, etable, 1, 2, e_select_names->child_count, e_select_names->child_count + 1, diff --git a/addressbook/gui/contact-editor/e-contact-editor-address.c b/addressbook/gui/contact-editor/e-contact-editor-address.c index dfd89fc75d..a826849f2f 100644 --- a/addressbook/gui/contact-editor/e-contact-editor-address.c +++ b/addressbook/gui/contact-editor/e-contact-editor-address.c @@ -20,19 +20,11 @@ */ #include <config.h> - -#include <e-contact-editor-address.h> - -#include <glib.h> -#include <libgnome/gnome-defs.h> -#include <libgnome/gnome-i18n.h> #include <libgnomeui/gnome-stock.h> #include <gal/widgets/e-unicode.h> #include <gal/widgets/e-gui-utils.h> +#include <e-contact-editor-address.h> #include <gtk/gtkcombo.h> -#include <string.h> -#include <stdlib.h> -#include <locale.h> static void e_contact_editor_address_init (EContactEditorAddress *card); static void e_contact_editor_address_class_init (EContactEditorAddressClass *klass); @@ -124,281 +116,6 @@ setup_tab_order(GladeXML *gui) } } -static char * countries [] = { - N_("United States"), - N_("Afghanistan"), - N_("Albania"), - N_("Algeria"), - N_("American Samoa"), - N_("Andorra"), - N_("Angola"), - N_("Anguilla"), - N_("Antarctica"), - N_("Antigua And Barbuda"), - N_("Argentina"), - N_("Armenia"), - N_("Aruba"), - N_("Australia"), - N_("Austria"), - N_("Azerbaijan"), - N_("Bahamas"), - N_("Bahrain"), - N_("Bangladesh"), - N_("Barbados"), - N_("Belarus"), - N_("Belgium"), - N_("Belize"), - N_("Benin"), - N_("Bermuda"), - N_("Bhutan"), - N_("Bolivia"), - N_("Bosnia And Herzegowina"), - N_("Botswana"), - N_("Bouvet Island"), - N_("Brazil"), - N_("British Indian Ocean Territory"), - N_("Brunei Darussalam"), - N_("Bulgaria"), - N_("Burkina Faso"), - N_("Burundi"), - N_("Cambodia"), - N_("Cameroon"), - N_("Canada"), - N_("Cape Verde"), - N_("Cayman Islands"), - N_("Central African Republic"), - N_("Chad"), - N_("Chile"), - N_("China"), - N_("Christmas Island"), - N_("Cocos (Keeling) Islands"), - N_("Colombia"), - N_("Comoros"), - N_("Congo"), - N_("Congo"), - N_("Cook Islands"), - N_("Costa Rica"), - N_("Cote d'Ivoire"), - N_("Croatia"), - N_("Cuba"), - N_("Cyprus"), - N_("Czech Republic"), - N_("Denmark"), - N_("Djibouti"), - N_("Dominica"), - N_("Dominican Republic"), - N_("East Timor"), - N_("Ecuador"), - N_("Egypt"), - N_("El Salvador"), - N_("Equatorial Guinea"), - N_("Eritrea"), - N_("Estonia"), - N_("Ethiopia"), - N_("Falkland Islands"), - N_("Faroe Islands"), - N_("Fiji"), - N_("Finland"), - N_("France"), - N_("French Guiana"), - N_("French Polynesia"), - N_("French Southern Territories"), - N_("Gabon"), - N_("Gambia"), - N_("Georgia"), - N_("Germany"), - N_("Ghana"), - N_("Gibraltar"), - N_("Greece"), - N_("Greenland"), - N_("Grenada"), - N_("Guadeloupe"), - N_("Guam"), - N_("Guatemala"), - N_("Guinea"), - N_("Guinea-bissau"), - N_("Guyana"), - N_("Haiti"), - N_("Heard And McDonald Islands"), - N_("Holy See"), - N_("Honduras"), - N_("Hong Kong"), - N_("Hungary"), - N_("Iceland"), - N_("India"), - N_("Indonesia"), - N_("Ireland"), - N_("Israel"), - N_("Italy"), - N_("Jamaica"), - N_("Japan"), - N_("Jordan"), - N_("Kazakhstan"), - N_("Kenya"), - N_("Kiribati"), - N_("Korea, Republic Of"), - N_("Kuwait"), - N_("Kyrgyzstan"), - N_("Laos"), - N_("Latvia"), - N_("Lebanon"), - N_("Lesotho"), - N_("Liberia"), - N_("Liechtenstein"), - N_("Lithuania"), - N_("Luxembourg"), - N_("Macau"), - N_("Macedonia"), - N_("Madagascar"), - N_("Malawi"), - N_("Malaysia"), - N_("Maldives"), - N_("Mali"), - N_("Malta"), - N_("Marshall Islands"), - N_("Martinique"), - N_("Mauritania"), - N_("Mauritius"), - N_("Mayotte"), - N_("Mexico"), - N_("Micronesia"), - N_("Moldova, Republic Of"), - N_("Monaco"), - N_("Mongolia"), - N_("Montserrat"), - N_("Morocco"), - N_("Mozambique"), - N_("Myanmar"), - N_("Namibia"), - N_("Nauru"), - N_("Nepal"), - N_("Netherlands"), - N_("Netherlands Antilles"), - N_("New Caledonia"), - N_("New Zealand"), - N_("Nicaragua"), - N_("Niger"), - N_("Nigeria"), - N_("Niue"), - N_("Norfolk Island"), - N_("Northern Mariana Islands"), - N_("Norway"), - N_("Oman"), - N_("Pakistan"), - N_("Palau"), - N_("Palestinian Territory"), - N_("Panama"), - N_("Papua New Guinea"), - N_("Paraguay"), - N_("Peru"), - N_("Philippines"), - N_("Pitcairn"), - N_("Poland"), - N_("Portugal"), - N_("Puerto Rico"), - N_("Qatar"), - N_("Reunion"), - N_("Romania"), - N_("Russian Federation"), - N_("Rwanda"), - N_("Saint Kitts And Nevis"), - N_("Saint Lucia"), - N_("Saint Vincent And The Grena-dines"), - N_("Samoa"), - N_("San Marino"), - N_("Sao Tome And Principe"), - N_("Saudi Arabia"), - N_("Senegal"), - N_("Seychelles"), - N_("Sierra Leone"), - N_("Singapore"), - N_("Slovakia"), - N_("Slovenia"), - N_("Solomon Islands"), - N_("Somalia"), - N_("South Africa"), - N_("South Georgia And The South Sandwich Islands"), - N_("Spain"), - N_("Sri Lanka"), - N_("St. Helena"), - N_("St. Pierre And Miquelon"), - N_("Sudan"), - N_("Suriname"), - N_("Svalbard And Jan Mayen Islands"), - N_("Swaziland"), - N_("Sweden"), - N_("Switzerland"), - N_("Taiwan"), - N_("Tajikistan"), - N_("Tanzania, United Republic Of"), - N_("Thailand"), - N_("Togo"), - N_("Tokelau"), - N_("Tonga"), - N_("Trinidad And Tobago"), - N_("Tunisia"), - N_("Turkey"), - N_("Turkmenistan"), - N_("Turks And Caicos Islands"), - N_("Tuvalu"), - N_("Uganda"), - N_("Ukraine"), - N_("United Arab Emirates"), - N_("United Kingdom"), - N_("United States Minor Outlying Islands"), - N_("Uruguay"), - N_("Uzbekistan"), - N_("Vanuatu"), - N_("Venezuela"), - N_("Viet Nam"), - N_("Virgin Islands, British"), - N_("Virgin Islands, U.S."), - N_("Wallis And Futuna Islands"), - N_("Western Sahara"), - N_("Yemen"), - N_("Yugoslavia"), - N_("Zambia"), - N_("Zimbabwe"), - NULL -}; - -static int -compare_func (const void *voida, const void *voidb) -{ - char * const *stringa = voida, * const *stringb = voidb; - - return strcoll (*stringa, *stringb); -} - -static void -fill_in_countries (GladeXML *gui) -{ - GtkCombo *combo; - combo = (GtkCombo *) glade_xml_get_widget(gui, "combo-country"); - if (combo && GTK_IS_COMBO (combo)) { - static gboolean sorted = FALSE; - static GList *country_list; - if (!sorted) { - int i; - char *locale; - - for (i = 0; countries[i]; i++) { - countries[i] = _(countries[i]); - } - - locale = setlocale (LC_COLLATE, NULL); - qsort (countries + 1, i - 1, sizeof (countries[0]), compare_func); - country_list = NULL; - for (i = 0; countries[i]; i++) { - country_list = g_list_prepend (country_list, countries[i]); - } - country_list = g_list_reverse (country_list); - sorted = TRUE; - } - gtk_combo_set_popdown_strings (combo, country_list); - } -} - static void e_contact_editor_address_init (EContactEditorAddress *e_contact_editor_address) { @@ -419,7 +136,6 @@ e_contact_editor_address_init (EContactEditorAddress *e_contact_editor_address) e_contact_editor_address->gui = gui; setup_tab_order (gui); - fill_in_countries (gui); widget = glade_xml_get_widget(gui, "table-checkaddress"); gtk_widget_ref(widget); diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index bfd78ebe2d..ea28563cc1 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -1908,7 +1908,7 @@ _address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEdito 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) { @@ -1941,8 +1941,6 @@ static void set_fields(EContactEditor *editor) { GtkWidget *entry; - GtkWidget *label_widget; - int i; entry = glade_xml_get_widget(editor->gui, "entry-phone1"); if (entry && GTK_IS_ENTRY(entry)) @@ -1963,28 +1961,8 @@ set_fields(EContactEditor *editor) 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)); - - - - e_contact_editor_build_address_ui (editor); - - for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) { - const ECardAddrLabel *address = e_card_simple_get_address(editor->simple, i); - - if (address && address->data && *address->data) - break; - } - if (i == E_CARD_SIMPLE_ADDRESS_ID_LAST) - i = 0; - - label_widget = glade_xml_get_widget(editor->gui, "label-address"); - if (label_widget && GTK_IS_LABEL(label_widget)) { - gtk_object_set(GTK_OBJECT(label_widget), - "label", _(g_list_nth_data(editor->address_list, i)), - NULL); - } - - set_address_field(editor, i); + + set_address_field(editor, -1); } static void diff --git a/addressbook/gui/contact-editor/fulladdr.glade b/addressbook/gui/contact-editor/fulladdr.glade index d66b9163e8..432e081c60 100644 --- a/addressbook/gui/contact-editor/fulladdr.glade +++ b/addressbook/gui/contact-editor/fulladdr.glade @@ -360,7 +360,241 @@ <case_sensitive>False</case_sensitive> <use_arrows>True</use_arrows> <use_arrows_always>False</use_arrows_always> - <items></items> + <items>United States +Afghanistan +Albania +Algeria +American Samoa +Andorra +Angola +Anguilla +Antarctica +Antigua And Barbuda +Argentina +Armenia +Aruba +Australia +Austria +Azerbaijan +Bahamas +Bahrain +Bangladesh +Barbados +Belarus +Belgium +Belize +Benin +Bermuda +Bhutan +Bolivia +Bosnia And Herzegowina +Botswana +Bouvet Island +Brazil +British Indian Ocean Territory +Brunei Darussalam +Bulgaria +Burkina Faso +Burundi +Cambodia +Cameroon +Canada +Cape Verde +Cayman Islands +Central African Republic +Chad +Chile +China +Christmas Island +Cocos (Keeling) Islands +Colombia +Comoros +Congo +Congo +Cook Islands +Costa Rica +Cote d'Ivoire +Croatia +Cuba +Cyprus +Czech Republic +Denmark +Djibouti +Dominica +Dominican Republic +East Timor +Ecuador +Egypt +El Salvador +Equatorial Guinea +Eritrea +Estonia +Ethiopia +Falkland Islands +Faroe Islands +Fiji +Finland +France +French Guiana +French Polynesia +French Southern Territories +Gabon +Gambia +Georgia +Germany +Ghana +Gibraltar +Greece +Greenland +Grenada +Guadeloupe +Guam +Guatemala +Guinea +Guinea-bissau +Guyana +Haiti +Heard And McDonald Islands +Holy See +Honduras +Hong Kong +Hungary +Iceland +India +Indonesia +Ireland +Israel +Italy +Jamaica +Japan +Jordan +Kazakhstan +Kenya +Kiribati +Republic Of Korea +Kuwait +Kyrgyzstan +Laos +Latvia +Lebanon +Lesotho +Liberia +Liechtenstein +Lithuania +Luxembourg +Macau +Macedonia +Madagascar +Malawi +Malaysia +Maldives +Mali +Malta +Marshall Islands +Martinique +Mauritania +Mauritius +Mayotte +Mexico +Micronesia +Republic Of Moldova +Monaco +Mongolia +Montserrat +Morocco +Mozambique +Myanmar +Namibia +Nauru +Nepal +Netherlands +Netherlands Antilles +New Caledonia +New Zealand +Nicaragua +Niger +Nigeria +Niue +Norfolk Island +Northern Mariana Islands +Norway +Oman +Pakistan +Palau +Palestinian Territory +Panama +Papua New Guinea +Paraguay +Peru +Philippines +Pitcairn +Poland +Portugal +Puerto Rico +Qatar +Reunion +Romania +Russian Federation +Rwanda +Saint Kitts And Nevis +Saint Lucia +Saint Vincent And The Grena-dines +Samoa +San Marino +Sao Tome And Principe +Saudi Arabia +Senegal +Seychelles +Sierra Leone +Singapore +Slovakia +Slovenia +Solomon Islands +Somalia +South Africa +South Georgia And The South Sandwich Islands +Spain +Sri Lanka +St. Helena +St. Pierre And Miquelon +Sudan +Suriname +Svalbard And Jan Mayen Islands +Swaziland +Sweden +Switzerland +Taiwan +Tajikistan +United Republic Of Tanzania +Thailand +Togo +Tokelau +Tonga +Trinidad And Tobago +Tunisia +Turkey +Turkmenistan +Turks And Caicos Islands +Tuvalu +Uganda +Ukraine +United Arab Emirates +United Kingdom +United States Minor Outlying Islands +Uruguay +Uzbekistan +Vanuatu +Venezuela +Viet Nam +British Virgin Islands +U.S. Virgin Islands +Wallis And Futuna Islands +Western Sahara +Yemen +Yugoslavia +Zambia +Zimbabwe +</items> <child> <left_attach>3</left_attach> <right_attach>4</right_attach> |