commit 40530d5a39793ad04ef35d54b40191957077e5f3
parent 934a97c5ee69d2da9983956ba1404c27283d64f2
Author: Paweł Pękala <c0rn@gazeta.pl>
Date: Mon, 28 Nov 2011 21:47:34 +0000
2011-11-28 [pawel] 3.7.10cvs106
* src/addrbook.c
* src/addrbook.h
* src/addressbook.c
Fix bug #2177 'addrbook/addrbook-00000?.xml is not deleted
after removing the address book in the GUI'
Diffstat:
6 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,11 @@
+2011-11-28 [pawel] 3.7.10cvs106
+
+ * src/addrbook.c
+ * src/addrbook.h
+ * src/addressbook.c
+ Fix bug #2177 'addrbook/addrbook-00000?.xml is not deleted
+ after removing the address book in the GUI'
+
2011-11-26 [pawel] 3.7.10cvs105
* src/folder.c
diff --git a/PATCHSETS b/PATCHSETS
@@ -4309,3 +4309,4 @@
( cvs diff -u -r 1.59.2.87 -r 1.59.2.88 src/prefs_filtering.c; ) > 3.7.10cvs103.patchset
( cvs diff -u -r 1.1.2.68 -r 1.1.2.69 src/imap_gtk.c; cvs diff -u -r 1.2.2.40 -r 1.2.2.41 src/mh_gtk.c; ) > 3.7.10cvs104.patchset
( cvs diff -u -r 1.213.2.203 -r 1.213.2.204 src/folder.c; ) > 3.7.10cvs105.patchset
+( cvs diff -u -r 1.22.2.25 -r 1.22.2.26 src/addrbook.c; cvs diff -u -r 1.7.2.4 -r 1.7.2.5 src/addrbook.h; cvs diff -u -r 1.60.2.146 -r 1.60.2.147 src/addressbook.c; ) > 3.7.10cvs106.patchset
diff --git a/configure.ac b/configure.ac
@@ -12,7 +12,7 @@ MINOR_VERSION=7
MICRO_VERSION=10
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=105
+EXTRA_VERSION=106
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
diff --git a/src/addrbook.c b/src/addrbook.c
@@ -2235,6 +2235,19 @@ gchar *addrbook_guess_next_file(AddressBookFile *book)
return newFile;
}
+void addrbook_delete_book_file(AddressBookFile *book)
+{
+ gchar *book_path;
+
+ if (!book->path || !book->fileName)
+ return;
+
+ book_path = g_strconcat(book->path, G_DIR_SEPARATOR_S,
+ book->fileName, NULL);
+ claws_unlink(book_path);
+ g_free(book_path);
+}
+
/*
* End of Source.
*/
diff --git a/src/addrbook.h b/src/addrbook.h
@@ -104,5 +104,6 @@ ItemPerson *addrbook_add_contact ( AddressBookFile *book, ItemFolder *folder,
const gchar *remarks );
gchar *addrbook_guess_next_file ( AddressBookFile *book );
+void addrbook_delete_book_file ( AddressBookFile *book );
#endif /* __ADDRBOOK_H__ */
diff --git a/src/addressbook.c b/src/addressbook.c
@@ -2948,7 +2948,11 @@ static void addressbook_treenode_delete_cb(GtkAction *action, gpointer data)
if( obj->type == ADDR_DATASOURCE ) {
/* Remove node from tree */
gtk_cmctree_remove_node( ctree, node );
-
+
+ if (delType == ADDRTREE_DEL_DATA &&
+ ds->interface && ds->interface->type == ADDR_IF_BOOK)
+ addrbook_delete_book_file((AddressBookFile *) ds->rawDataSource);
+
/* Remove data source. */
if( addrindex_index_remove_datasource( _addressIndex_, ds ) ) {
addrindex_free_datasource( ds );