JP pointed out that the dirname call was leaking memory. Here's a new patch. -- dobey On Mar , 2004-03-09 at 09:21, Rodney Dawes wrote: > Doh. Forgot to cc: toshok. Dude? :) > > On Hën , 2004-03-08 at 18:01, Rodney Dawes wrote: > > In testing 1.4.6, it was discovered that the select names dialog doesn't > > correctly load the default folder, if no other folder was opened > > previously using the folder selector button. The following patch fixes > > the issue, by checking that the URI is not an empty string, as well as > > not being NULL. It also passes the correct version of the URI to the > > folder selector button, so the label and icon are set correctly (it > > strips off the /addressbook.db). It also switches to using the standard > > e_config_listener_get_string () instead of _with_default (), since we > > are just passing NULL as the default anyway. > > > > -- dobey > >
Index: gui/component/select-names/e-select-names.c =================================================================== RCS file: /cvs/gnome/evolution/addressbook/gui/component/select-names/e-select-names.c,v retrieving revision 1.119 diff -u -r1.119 e-select-names.c --- gui/component/select-names/e-select-names.c 11 May 2003 20:48:15 -0000 1.119 +++ gui/component/select-names/e-select-names.c 9 Mar 2004 15:10:30 -0000 @@ -632,24 +632,26 @@ ESelectNames *e_select_names; const char *selector_types[] = { "contacts/*", NULL }; char *contacts_uri; + char *contacts_path; GtkWidget *button; EConfigListener *db; e_select_names = g_object_new (E_TYPE_SELECT_NAMES, NULL); db = e_book_get_config_database (); - contacts_uri = e_config_listener_get_string_with_default ( - db, "/apps/evolution/addressbook/select_names/last_used_uri", - NULL, NULL); - if (!contacts_uri) + contacts_uri = e_config_listener_get_string ( + db, "/apps/evolution/addressbook/select_names/last_used_uri"); + if (!contacts_uri || !strcmp (contacts_uri, "")) contacts_uri = g_strdup (e_book_get_default_book_uri ()); + contacts_path = strcmp (strrchr (contacts_uri, '/') + 1, "addressbook.db") == 0 ? g_dirname (contacts_uri) : g_strdup (contacts_uri); button = glade_xml_get_widget (e_select_names->gui, "folder-selector"); evolution_folder_selector_button_construct (EVOLUTION_FOLDER_SELECTOR_BUTTON (button), shell_client, _("Find contact in"), - contacts_uri, + contacts_path, selector_types); + g_print (contacts_path); addressbook_model_set_uri(e_select_names, e_select_names->model, contacts_uri);
Attachment:
signature.asc
Description: This is a digitally signed message part