diff options
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/ChangeLog | 20 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook-component.c | 11 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook-storage.c | 51 |
3 files changed, 64 insertions, 18 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 9688f1a1fb..fc26c4b592 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,25 @@ 2001-09-06 Chris Toshok <toshok@ximian.com> + * gui/component/addressbook-storage.c (notify_listener): new + function, notify the bonobo listener. + (remove_ldap_folder): track change to EvolutionStorage signal. + (create_ldap_folder): same, and make sure the type is + "ldap-contacts". + (load_source_data): folders that we create should have + "ldap-contacts" as their type. + (addressbook_storage_add_source): same. + + * gui/component/addressbook-component.c: (folder_types): add + "ldap-contacts", for display of ldap servers (they get their own + icon, and their own name in the Create New Folder dialog. + (create_view): use IS_CONTACT_TYPE since we support two folder + types now. + (create_folder): same. + (remove_folder): same. + (xfer_folder): same. + +2001-09-06 Chris Toshok <toshok@ximian.com> + * gui/contact-editor/e-contact-editor.c: (pixmaps): change /Toolbar/ContactEditorSave to /Toolbar/ContactEditorSaveClose. diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c index 961f706620..0e304e2604 100644 --- a/addressbook/gui/component/addressbook-component.c +++ b/addressbook/gui/component/addressbook-component.c @@ -67,9 +67,12 @@ static char *accepted_dnd_types[] = { static const EvolutionShellComponentFolderType folder_types[] = { { "contacts", "evolution-contacts.png", N_("Contacts"), N_("Folder containing contact information"), TRUE, accepted_dnd_types, NULL }, + { "ldap-contacts", "ldap-16.png", N_("LDAP Server"), N_("LDAP server containing contact information"), + TRUE, accepted_dnd_types, NULL }, { NULL } }; +#define IS_CONTACT_TYPE(x) (g_strcasecmp((x), "contacts") == 0 || g_strcasecmp ((x), "ldap-contacts") == 0) /* EvolutionShellComponent methods and signals. */ @@ -82,7 +85,7 @@ create_view (EvolutionShellComponent *shell_component, { BonoboControl *control; - if (g_strcasecmp (type, "contacts") != 0) + if (!IS_CONTACT_TYPE (type)) return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE; control = addressbook_factory_new_control (); @@ -103,7 +106,7 @@ create_folder (EvolutionShellComponent *shell_component, CORBA_Environment ev; GNOME_Evolution_ShellComponentListener_Result result; - if (g_strcasecmp (type, "contacts") != 0) + if (!IS_CONTACT_TYPE (type)) result = GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE; else result = GNOME_Evolution_ShellComponentListener_OK; @@ -127,7 +130,7 @@ remove_folder (EvolutionShellComponent *shell_component, CORBA_exception_init(&ev); - if (strcmp (type, "contacts") != 0) { + if (!IS_CONTACT_TYPE (type)) { GNOME_Evolution_ShellComponentListener_notifyResult (listener, GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, &ev); @@ -195,7 +198,7 @@ xfer_folder (EvolutionShellComponent *shell_component, char *source_path; char *destination_path; - if (strcmp (type, "contacts") != 0) { + if (!IS_CONTACT_TYPE (type)) { GNOME_Evolution_ShellComponentListener_notifyResult (listener, GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE, &ev); diff --git a/addressbook/gui/component/addressbook-storage.c b/addressbook/gui/component/addressbook-storage.c index efff59a732..6154969b14 100644 --- a/addressbook/gui/component/addressbook-storage.c +++ b/addressbook/gui/component/addressbook-storage.c @@ -102,30 +102,53 @@ addressbook_storage_setup (EvolutionShellComponent *shell_component, } #ifdef HAVE_LDAP -static int -remove_ldap_folder (EvolutionStorage *storage, +static void +notify_listener (const Bonobo_Listener listener, + GNOME_Evolution_Storage_Result corba_result) +{ + CORBA_any any; + CORBA_Environment ev; + + CORBA_exception_init (&ev); + + any._type = TC_GNOME_Evolution_Storage_Result; + any._value = &corba_result; + + Bonobo_Listener_event (listener, "result", &any, &ev); + + CORBA_exception_free (&ev); +} + +static void +remove_ldap_folder (EvolutionStorage *storage, const Bonobo_Listener listener, const CORBA_char *path, const CORBA_char *physical_uri, gpointer data) { + addressbook_storage_remove_source (path + 1); addressbook_storage_write_sources(); - return GNOME_Evolution_Storage_OK; + + notify_listener (listener, GNOME_Evolution_Storage_OK); } -static int -create_ldap_folder (EvolutionStorage *storage, + +static void +create_ldap_folder (EvolutionStorage *storage, const Bonobo_Listener listener, const CORBA_char *path, const CORBA_char *type, const CORBA_char *description, const CORBA_char *parent_physical_uri, - int *result, gpointer data) + gpointer data) { - if (strcmp (type, "contacts")) - return GNOME_Evolution_Storage_UNSUPPORTED_TYPE; - - if (strcmp (parent_physical_uri, "")) /* ldap servers can't have subfolders */ - return GNOME_Evolution_Storage_INVALID_URI; + if (strcmp (type, "ldap-contacts")) { + notify_listener (listener, GNOME_Evolution_Storage_UNSUPPORTED_TYPE); + return; + } + if (strcmp (parent_physical_uri, "")) {/* ldap servers can't have subfolders */ + notify_listener (listener, GNOME_Evolution_Storage_INVALID_URI); + return; + } addressbook_create_new_source (path + 1, NULL); - return GNOME_Evolution_Storage_OK; + notify_listener (listener, GNOME_Evolution_Storage_OK); } #endif @@ -341,7 +364,7 @@ load_source_data (const char *file_path) path = g_strdup_printf ("/%s", source->name); evolution_storage_new_folder (storage, path, source->name, - "contacts", source->uri, + "ldap-contacts", source->uri, source->description, 0); sources = g_list_append (sources, source); @@ -443,7 +466,7 @@ addressbook_storage_add_source (AddressbookSource *source) /* And then to the ui */ addressbook_get_other_contact_storage(); path = g_strdup_printf ("/%s", source->name); - evolution_storage_new_folder (storage, path, source->name, "contacts", + evolution_storage_new_folder (storage, path, source->name, "ldap-contacts", source->uri, source->description, 0); g_free (path); |