From ebf505d16dda2946441e05b2bdb15c4055d448a2 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 11 Aug 2000 00:03:08 +0000 Subject: Update for changed prototype, pass evolution_homedir arg to * gui/component/addressbook-component.c (owner_set_cb): Update for changed prototype, pass evolution_homedir arg to setup_ldap_storage. * gui/component/e-ldap-storage.c (setup_ldap_storage): Now takes an evolution_homedir arg, uses that to generate the path to the ldapservers.xml file, and stores the result in a static variable. (e_ldap_storage_add_server, e_ldap_storage_remove_server): Use that static variable rather than hardcoding the path to the file. svn path=/trunk/; revision=4713 --- addressbook/ChangeLog | 12 ++++++++++++ addressbook/gui/component/addressbook-component.c | 3 ++- addressbook/gui/component/e-ldap-storage.c | 20 +++++++++----------- addressbook/gui/component/e-ldap-storage.h | 3 ++- 4 files changed, 25 insertions(+), 13 deletions(-) (limited to 'addressbook') diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 86bae311de..60bd8dbdaa 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,15 @@ +2000-08-10 Dan Winship + + * gui/component/addressbook-component.c (owner_set_cb): Update for + changed prototype, pass evolution_homedir arg to + setup_ldap_storage. + + * gui/component/e-ldap-storage.c (setup_ldap_storage): Now takes + an evolution_homedir arg, uses that to generate the path to the + ldapservers.xml file, and stores the result in a static variable. + (e_ldap_storage_add_server, e_ldap_storage_remove_server): Use that + static variable rather than hardcoding the path to the file. + 2000-08-10 Christopher James Lahey * backend/pas/pas-backend-file.c: Fixed any search to not crash on diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c index 665e77b78f..eeb9569a1b 100644 --- a/addressbook/gui/component/addressbook-component.c +++ b/addressbook/gui/component/addressbook-component.c @@ -80,11 +80,12 @@ static int owner_count = 0; static void owner_set_cb (EvolutionShellComponent *shell_component, EvolutionShellClient *shell_client, + const char *evolution_homedir, gpointer user_data) { owner_count ++; - setup_ldap_storage (shell_component); + setup_ldap_storage (shell_component, evolution_homedir); } static void diff --git a/addressbook/gui/component/e-ldap-storage.c b/addressbook/gui/component/e-ldap-storage.c index ff86953e08..aa1e153a2a 100644 --- a/addressbook/gui/component/e-ldap-storage.c +++ b/addressbook/gui/component/e-ldap-storage.c @@ -68,13 +68,14 @@ static gboolean save_ldap_data (const char *file_path); GHashTable *servers; EvolutionStorage *storage; +static char *ldapservers; void -setup_ldap_storage (EvolutionShellComponent *shell_component) +setup_ldap_storage (EvolutionShellComponent *shell_component, + const char *evolution_homedir) { EvolutionShellClient *shell_client; Evolution_Shell corba_shell; - char *path; shell_client = evolution_shell_component_get_owner (shell_component); if (shell_client == CORBA_OBJECT_NIL) { @@ -95,9 +96,10 @@ setup_ldap_storage (EvolutionShellComponent *shell_component) gtk_object_set_data (GTK_OBJECT (shell_component), "e-storage", storage); - path = g_strdup_printf ("%s/evolution/" LDAPSERVER_XML, g_get_home_dir()); - load_ldap_data (storage, path); - g_free (path); + if (ldapservers) + g_free (ldapservers); + ldapservers = g_strdup_printf ("%s/" LDAPSERVER_XML, evolution_homedir); + load_ldap_data (storage, ldapservers); } static char * @@ -279,9 +281,7 @@ e_ldap_storage_add_server (ELDAPServer *server) g_free (path); - path = g_strdup_printf ("%s/evolution/" LDAPSERVER_XML, g_get_home_dir()); - save_ldap_data (path); - g_free (path); + save_ldap_data (ldapservers); } void @@ -310,7 +310,5 @@ e_ldap_storage_remove_server (char *name) g_free (path); - path = g_strdup_printf ("%s/evolution/" LDAPSERVER_XML, g_get_home_dir()); - save_ldap_data (path); - g_free (path); + save_ldap_data (ldapservers); } diff --git a/addressbook/gui/component/e-ldap-storage.h b/addressbook/gui/component/e-ldap-storage.h index d9870ae69f..9d3e35b4db 100644 --- a/addressbook/gui/component/e-ldap-storage.h +++ b/addressbook/gui/component/e-ldap-storage.h @@ -36,7 +36,8 @@ typedef struct { char *uri; /* filled in from the above */ } ELDAPServer; -void setup_ldap_storage (EvolutionShellComponent *shell_component); +void setup_ldap_storage (EvolutionShellComponent *shell_component, + const char *evolution_homedir); void e_ldap_storage_add_server (ELDAPServer *server); void e_ldap_storage_remove_server (char *name); -- cgit v1.2.3