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
This commit is contained in:
Dan Winship
2002-10-23 15:16:30 +00:00
parent a668b29488
commit 253ba0c94e
2 changed files with 31 additions and 17 deletions

View File

@ -1,3 +1,15 @@
2002-10-22 Dan Winship <danw@ximian.com>
* 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 <danw@ximian.com>
* gui/component/addressbook-component.c (IS_CONTACT_TYPE): fix the

View File

@ -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)