From 253ba0c94e1b6515bbba4cf710e2bf6a09ffbbbe Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 23 Oct 2002 15:16:30 +0000 Subject: Set /Addressbook/select_names_uri in the configdb to the selected folder. * gui/component/select-names/e-select-names.c (folder_selected): Set /Addressbook/select_names_uri in the configdb to the selected folder. (e_select_names_init): Look for /Addressbook/select_names_uri before /DefaultFolders/contacts_uri for the initial folder. So the select names dialog now starts up using the same folder you used last time, which is useful when you have an LDAP company directory (which can't be your default contacts folder because it's read-only). svn path=/trunk/; revision=18416 --- addressbook/ChangeLog | 12 ++++++++ .../gui/component/select-names/e-select-names.c | 36 ++++++++++++---------- 2 files changed, 31 insertions(+), 17 deletions(-) (limited to 'addressbook') diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 35b87c3459..3146b5f8f0 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,15 @@ +2002-10-22 Dan Winship + + * gui/component/select-names/e-select-names.c + (folder_selected): Set /Addressbook/select_names_uri in the + configdb to the selected folder. + (e_select_names_init): Look for /Addressbook/select_names_uri + before /DefaultFolders/contacts_uri for the initial folder. So the + select names dialog now starts up using the same folder you used + last time, which is useful when you have an LDAP company directory + (which can't be your default contacts folder because it's + read-only). + 2002-10-21 Dan Winship * gui/component/addressbook-component.c (IS_CONTACT_TYPE): fix the diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c index e1251fe0f6..e592999ef1 100644 --- a/addressbook/gui/component/select-names/e-select-names.c +++ b/addressbook/gui/component/select-names/e-select-names.c @@ -338,7 +338,12 @@ static void folder_selected (EvolutionFolderSelectorButton *button, GNOME_Evolution_Folder *folder, ESelectNames *e_select_names) { + Bonobo_ConfigDatabase db; + addressbook_model_set_uri(e_select_names, e_select_names->model, folder->physicalUri); + + db = addressbook_config_database (NULL); + bonobo_config_set_string (db, "/Addressbook/select_names_uri", folder->physicalUri, NULL); } static void @@ -468,8 +473,7 @@ e_select_names_init (ESelectNames *e_select_names) GtkWidget *widget, *button; const char *selector_types[] = { "contacts/*", NULL }; char *filename; - char *uri; - char *contacts_uri, *contacts_path; + char *contacts_uri; Bonobo_ConfigDatabase db; db = addressbook_config_database (NULL); @@ -541,25 +545,24 @@ e_select_names_init (ESelectNames *e_select_names) gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(update_query), e_select_names); - contacts_path = bonobo_config_get_string_with_default (db, "/DefaultFolders/contacts_path", - "evolution:/local/Contacts", - NULL); - - filename = gnome_util_prepend_user_home("evolution/local/Contacts"); - uri = g_strdup_printf("file://%s", filename); - - contacts_uri = bonobo_config_get_string_with_default (db, "/DefaultFolders/contacts_uri", - uri, - NULL); - - g_free (filename); - g_free (uri); + contacts_uri = bonobo_config_get_string_with_default (db, "/Addressbook/select_names_uri", + NULL, NULL); + if (!contacts_uri) { + contacts_uri = bonobo_config_get_string_with_default (db, "/DefaultFolders/contacts_uri", + NULL, + NULL); + } + if (!contacts_uri) { + filename = gnome_util_prepend_user_home("evolution/local/Contacts"); + contacts_uri = g_strdup_printf("file://%s", filename); + g_free (filename); + } button = glade_xml_get_widget (gui, "folder-selector"); evolution_folder_selector_button_construct (EVOLUTION_FOLDER_SELECTOR_BUTTON (button), global_shell_client, _("Find contact in"), - contacts_path, + contacts_uri, selector_types); if (button && EVOLUTION_IS_FOLDER_SELECTOR_BUTTON (button)) gtk_signal_connect(GTK_OBJECT(button), "selected", @@ -574,7 +577,6 @@ e_select_names_init (ESelectNames *e_select_names) addressbook_model_set_uri(e_select_names, e_select_names->model, contacts_uri); g_free (contacts_uri); - g_free (contacts_path); } static void e_select_names_child_free(char *key, ESelectNamesChild *child, ESelectNames *e_select_names) -- cgit