[Commits] .cvsignore 1.11.2.2 1.11.2.3 Makefile.am 1.155.2.98 1.155.2.99 addr_compl.c 1.27.2.60 1.27.2.61 addressadd.c 1.9.2.34 1.9.2.35 addressadd.h 1.2.16.8 1.2.16.9 addressbook-dbus.c NONE 1.1.4.2 addressbook-dbus.h NONE 1.1.4.2 addrgather.c 1.5.10.36 1.5.10.37 addrgather.h 1.3.12.7 1.3.12.8 addrharvest.c 1.6.10.25 1.6.10.26 addrharvest.h 1.4.12.8 1.4.12.9 claws-contacts.xml NONE 1.1.4.2 compose.c 1.382.2.598 1.382.2.599 compose.h 1.50.2.65 1.50.2.66 filtering.c 1.60.2.61 1.60.2.62 headerview.c 1.8.2.34 1.8.2.35 main.c 1.115.2.247 1.115.2.248 mainwindow.c 1.274.2.343 1.274.2.344 messageview.c 1.94.2.230 1.94.2.231 prefs_common.c 1.204.2.208 1.204.2.209 prefs_filtering_action.c 1.1.4.73 1.1.4.74 prefs_matcher.c 1.43.2.91 1.43.2.92 summaryview.c 1.395.2.445 1.395.2.446 textview.c 1.96.2.239 1.96.2.240 toolbar.c 1.43.2.126 1.43.2.127
colin at claws-mail.org
colin at claws-mail.org
Sun Apr 1 20:45:29 CEST 2012
Update of /home/claws-mail/claws/src
In directory srv:/tmp/cvs-serv11566/src
Modified Files:
Tag: gtk2
.cvsignore Makefile.am addr_compl.c addressadd.c addressadd.h
addrgather.c addrgather.h addrharvest.c addrharvest.h
compose.c compose.h filtering.c headerview.c main.c
mainwindow.c messageview.c prefs_common.c
prefs_filtering_action.c prefs_matcher.c summaryview.c
textview.c toolbar.c
Added Files:
Tag: gtk2
addressbook-dbus.c addressbook-dbus.h claws-contacts.xml
Log Message:
2012-04-01 [colin] 3.8.0cvs36
* configure.ac
* src/.cvsignore
* src/Makefile.am
* src/addr_compl.c
* src/addressadd.c
* src/addressadd.h
* src/addressbook-dbus.c
* src/addressbook-dbus.h
* src/addrgather.c
* src/addrgather.h
* src/addrharvest.c
* src/addrharvest.h
* src/claws-contacts.xml
* src/compose.c
* src/compose.h
* src/filtering.c
* src/headerview.c
* src/main.c
* src/mainwindow.c
* src/messageview.c
* src/prefs_common.c
* src/prefs_filtering_action.c
* src/prefs_matcher.c
* src/summaryview.c
* src/textview.c
* src/toolbar.c
* src/plugins/bogofilter/bogofilter_gtk.c
* src/plugins/dillo_viewer/dillo_prefs.c
* src/plugins/spamassassin/spamassassin_gtk.c
* src/plugins/trayicon/trayicon.c
Import new addressbook code from the new-contacts branch
Index: prefs_common.c
===================================================================
RCS file: /home/claws-mail/claws/src/prefs_common.c,v
retrieving revision 1.204.2.208
retrieving revision 1.204.2.209
diff -u -d -r1.204.2.208 -r1.204.2.209
--- prefs_common.c 5 Feb 2012 20:00:35 -0000 1.204.2.208
+++ prefs_common.c 1 Apr 2012 18:45:26 -0000 1.204.2.209
@@ -59,7 +59,9 @@
#include "stock_pixmap.h"
#include "prefswindow.h"
#include "colorlabel.h"
-#include "addrcustomattr.h"
+#ifndef USE_NEW_ADDRBOOK
+ #include "addrcustomattr.h"
+#endif
enum {
DATEFMT_FMT,
@@ -1261,9 +1263,9 @@
prefs_common_read_history(MESSAGE_SEARCH_HISTORY);
prefs_common.compose_save_to_history =
prefs_common_read_history(COMPOSE_SAVE_TO_HISTORY);
-
+#ifndef USE_NEW_ADDRBOOK
prefs_common.addressbook_custom_attributes = addressbook_update_custom_attr_from_prefs();
-
+#endif
colorlabel_update_colortable_from_prefs();
}
@@ -1360,9 +1362,11 @@
prefs_common_save_history(COMPOSE_SAVE_TO_HISTORY,
prefs_common.compose_save_to_history);
- prefs_common_save_history_to_dir(ADDRBOOK_DIR,
+#ifndef USE_NEW_ADDRBOOK
+ prefs_common_save_history_to_dir(ADDRBOOK_DIR,
ADDRESSBOOK_CUSTOM_ATTRIBUTES,
prefs_common.addressbook_custom_attributes);
+#endif
}
/* make a copy of string 'in' into buffer 'out'. un-escape \ sequences.
Index: summaryview.c
===================================================================
RCS file: /home/claws-mail/claws/src/summaryview.c,v
retrieving revision 1.395.2.445
retrieving revision 1.395.2.446
diff -u -d -r1.395.2.445 -r1.395.2.446
--- summaryview.c 14 Mar 2012 23:00:55 -0000 1.395.2.445
+++ summaryview.c 1 Apr 2012 18:45:27 -0000 1.395.2.446
@@ -57,7 +57,12 @@
#include "colorlabel.h"
#include "inc.h"
#include "imap.h"
-#include "addressbook.h"
+#ifndef USE_NEW_ADDRBOOK
+ #include "addressbook.h"
+#else
+ #include "addressbook-dbus.h"
+ #include "addressadd.h"
+#endif
#include "addr_compl.h"
#include "folder_item_prefs.h"
#include "filtering.h"
@@ -4626,8 +4631,13 @@
if (image)
picture = gtk_image_get_pixbuf(GTK_IMAGE(image));
+#ifndef USE_NEW_ADDRBOOK
addressbook_add_contact(msginfo->fromname, from, NULL, picture);
-
+#else
+ if (addressadd_selection(msginfo->fromname, from, NULL, picture)) {
+ debug_print( "addressbook_add_contact - added\n" );
+ }
+#endif
if (image)
gtk_widget_destroy(image);
}
@@ -7856,7 +7866,9 @@
continue;
msgList = g_list_append( msgList, GUINT_TO_POINTER( msginfo->msgnum ) );
}
+
addressbook_harvest( summaryview->folder_item, TRUE, msgList );
+
g_list_free( msgList );
}
--- NEW FILE: addressbook-dbus.h ---
(This appears to be a binary file; contents omitted.)
Index: messageview.c
===================================================================
RCS file: /home/claws-mail/claws/src/messageview.c,v
retrieving revision 1.94.2.230
retrieving revision 1.94.2.231
diff -u -d -r1.94.2.230 -r1.94.2.231
--- messageview.c 15 Mar 2012 15:33:11 -0000 1.94.2.230
+++ messageview.c 1 Apr 2012 18:45:26 -0000 1.94.2.231
@@ -39,7 +39,6 @@
#include "filesel.h"
#include "foldersel.h"
#include "sourcewindow.h"
-#include "addressbook.h"
#include "alertpanel.h"
#include "inputdialog.h"
#include "mainwindow.h"
@@ -66,7 +65,12 @@
#include "quoted-printable.h"
#include "version.h"
#include "statusbar.h"
-
+#ifndef USE_NEW_ADDRBOOK
+ #include "addressbook.h"
+#else
+ #include "addressadd.h"
+ #include "addressbook-dbus.h"
+#endif
static GList *messageview_list = NULL;
static gint messageview_delete_cb (GtkWidget *widget,
@@ -2779,7 +2783,18 @@
static void addressbook_open_cb(GtkAction *action, gpointer data)
{
+#ifndef USE_NEW_ADDRBOOK
addressbook_open(NULL);
+#else
+ GError* error = NULL;
+
+ addressbook_dbus_open(FALSE, &error);
+ if (error) {
+ g_warning("Failed to open address book");
+ g_warning("%s", error->message);
+ g_error_free(error);
+ }
+#endif
}
static void add_address_cb(GtkAction *action, gpointer data)
@@ -2817,8 +2832,13 @@
if (image)
picture = gtk_image_get_pixbuf(GTK_IMAGE(image));
+#ifndef USE_NEW_ADDRBOOK
addressbook_add_contact(msginfo->fromname, from, NULL, picture);
-
+#else
+ if (addressadd_selection(msginfo->fromname, from, NULL, picture)) {
+ debug_print( "addressbook_add_contact - added\n" );
+ }
+#endif
if (image)
gtk_widget_destroy(image);
}
--- NEW FILE: addressbook-dbus.c ---
(This appears to be a binary file; contents omitted.)
Index: compose.h
===================================================================
RCS file: /home/claws-mail/claws/src/compose.h,v
retrieving revision 1.50.2.65
retrieving revision 1.50.2.66
diff -u -d -r1.50.2.65 -r1.50.2.66
--- compose.h 29 Dec 2011 23:16:22 -0000 1.50.2.65
+++ compose.h 1 Apr 2012 18:45:26 -0000 1.50.2.66
@@ -28,7 +28,9 @@
#include "procmsg.h"
#include "procmime.h"
+#ifndef USE_NEW_ADDRBOOK
#include "addressbook.h"
+#endif
#include "prefs_account.h"
#include "undo.h"
#include "toolbar.h"
Index: compose.c
===================================================================
RCS file: /home/claws-mail/claws/src/compose.c,v
retrieving revision 1.382.2.598
retrieving revision 1.382.2.599
diff -u -d -r1.382.2.598 -r1.382.2.599
--- compose.c 29 Dec 2011 23:16:21 -0000 1.382.2.598
+++ compose.c 1 Apr 2012 18:45:26 -0000 1.382.2.599
@@ -60,7 +60,12 @@
#include "main.h"
#include "mainwindow.h"
#include "compose.h"
-#include "addressbook.h"
+#ifndef USE_NEW_ADDRBOOK
+ #include "addressbook.h"
+#else
+ #include "addressbook-dbus.h"
+ #include "addressadd.h"
+#endif
#include "folderview.h"
#include "procmsg.h"
#include "menu.h"
@@ -5010,7 +5015,7 @@
compose_allow_user_actions (compose, FALSE);
compose->sending = TRUE;
- if (compose_check_entries(compose, TRUE) == FALSE) {
+ if ((compose, TRUE) == FALSE) {
if (compose->batch) {
gtk_widget_show_all(compose->window);
}
@@ -6571,7 +6576,14 @@
if (*address != '\0') {
gchar *name = procheader_get_fromname(address);
extract_address(address);
+#ifndef USE_NEW_ADDRBOOK
addressbook_add_contact(name, address, NULL, NULL);
+#else
+ debug_print("%s: %s\n", name, address);
+ if (addressadd_selection(name, address, NULL, NULL)) {
+ debug_print( "addressbook_add_contact - added\n" );
+ }
+#endif
}
g_free(address);
}
@@ -7796,8 +7808,9 @@
gtk_entry_set_text(GTK_ENTRY(gtk_bin_get_child(GTK_BIN((compose->header_last->combo)))),
prefs_common_translated_header_name("Newsgroups:"));
+#ifndef USE_NEW_ADDRBOOK
addressbook_set_target_compose(compose);
-
+#endif
if (mode != COMPOSE_REDIRECT)
compose_set_template_menu(compose);
else {
@@ -8528,9 +8541,10 @@
g_free(compose->privacy_system);
+#ifndef USE_NEW_ADDRBOOK
if (addressbook_get_target_compose() == compose)
addressbook_set_target_compose(NULL);
-
+#endif
#if USE_ENCHANT
if (compose->gtkaspell) {
gtkaspell_delete(compose->gtkaspell);
@@ -9979,7 +9993,17 @@
{
Compose *compose = (Compose *)data;
+#ifndef USE_NEW_ADDRBOOK
addressbook_open(compose);
+#else
+ GError* error = NULL;
+ addressbook_connect_signals(compose);
+ addressbook_dbus_open(TRUE, &error);
+ if (error) {
+ g_warning("%s", error->message);
+ g_error_free(error);
+ }
+#endif
}
static void about_show_cb(GtkAction *action, gpointer data)
Index: Makefile.am
===================================================================
RCS file: /home/claws-mail/claws/src/Makefile.am,v
retrieving revision 1.155.2.98
retrieving revision 1.155.2.99
diff -u -d -r1.155.2.98 -r1.155.2.99
--- Makefile.am 16 Dec 2011 18:16:43 -0000 1.155.2.98
+++ Makefile.am 1 Apr 2012 18:45:25 -0000 1.155.2.99
@@ -29,32 +29,61 @@
claws_mail_deps =
endif
-claws_mail_SOURCES = \
- account.c \
- action.c \
+if BUILD_NEWADDRBOOK
+abook_headers = \
+ addressbook-dbus.h
+abook_source = \
+ addressbook-dbus.c
+else
+abook_headers = \
+ addrbook.h \
+ addrclip.h \
+ addrcustomattr.h \
+ addressbook.h \
+ addressbook_foldersel.h \
+ addrindex.h \
+ addrquery.h \
+ addrselect.h \
+ addrduplicates.h \
+ browseldap.h \
+ editaddress.h \
+ editaddress_other_attributes_ldap.h \
+ editbook.h \
+ editgroup.h \
+ editjpilot.h \
+ editldap_basedn.h \
+ editldap.h \
+ editvcard.h \
+ exphtmldlg.h \
+ expldifdlg.h \
+ exporthtml.h \
+ exportldif.h \
+ importldif.h \
+ importmutt.h \
+ importpine.h \
+ jpilot.h \
+ ldapctrl.h \
+ ldaplocate.h \
+ ldapquery.h \
+ ldapserver.h \
+ ldapupdate.h \
+ ldaputil.h \
+ ldif.h \
+ mutt.h \
+ pine.h \
+ vcard.h
+
+abook_source = \
addrbook.c \
- addrcache.c \
addrclip.c \
- addr_compl.c \
addrcustomattr.c \
- addressadd.c \
addressbook.c \
addressbook_foldersel.c \
- addrgather.c \
- addrharvest.c \
addrindex.c \
- addritem.c \
addrquery.c \
addrselect.c \
addrduplicates.c \
- alertpanel.c \
- autofaces.c \
browseldap.c \
- codeconv.c \
- compose.c \
- crash.c \
- customheader.c \
- displayheader.c \
editaddress.c \
editaddress_other_attributes_ldap.c \
editbook.c \
@@ -62,14 +91,46 @@
editjpilot.c \
editldap_basedn.c \
editldap.c \
- edittags.c \
editvcard.c \
- enriched.c \
exphtmldlg.c \
expldifdlg.c \
- export.c \
exporthtml.c \
exportldif.c \
+ importldif.c \
+ importmutt.c \
+ importpine.c \
+ jpilot.c \
+ ldapctrl.c \
+ ldaplocate.c \
+ ldapquery.c \
+ ldapserver.c \
+ ldapupdate.c \
+ ldaputil.c \
+ ldif.c \
+ mutt.c \
+ pine.c \
+ vcard.c
+endif
+
+claws_mail_SOURCES = \
+ account.c \
+ action.c \
+ addrcache.c \
+ addr_compl.c \
+ addressadd.c \
+ addrgather.c \
+ addrharvest.c \
+ addritem.c \
+ alertpanel.c \
+ autofaces.c \
+ codeconv.c \
+ compose.c \
+ crash.c \
+ customheader.c \
+ displayheader.c \
+ edittags.c \
+ enriched.c \
+ export.c \
filtering.c \
folder.c \
folder_item_prefs.c \
@@ -83,18 +144,7 @@
imap.c \
imap_gtk.c \
import.c \
- importldif.c \
- importmutt.c \
- importpine.c \
inc.c \
- jpilot.c \
- ldapctrl.c \
- ldaplocate.c \
- ldapquery.c \
- ldapserver.c \
- ldapupdate.c \
- ldaputil.c \
- ldif.c \
localfolder.c \
main.c \
mainwindow.c \
@@ -109,12 +159,10 @@
mh_gtk.c \
mimeview.c \
msgcache.c \
- mutt.c \
news.c \
news_gtk.c \
noticeview.c \
partial_download.c \
- pine.c \
pop.c \
prefs_account.c \
prefs_actions.c \
@@ -170,54 +218,31 @@
undo.c \
unmime.c \
uri_opener.c \
- vcard.c \
- wizard.c
+ wizard.c \
+ $(abook_source)
claws_mailincludedir = $(pkgincludedir)
claws_mailinclude_HEADERS = \
account.h \
action.h \
- adbookbase.h \
- addrbook.h \
addrcache.h \
- addrclip.h \
addr_compl.h \
addrdefs.h \
- addrcustomattr.h \
addressadd.h \
- addressbook.h \
- addressbook_foldersel.h \
+ addritem.h \
addressitem.h \
addrgather.h \
addrharvest.h \
- addrindex.h \
- addritem.h \
- addrquery.h \
- addrselect.h \
- addrduplicates.h \
alertpanel.h \
autofaces.h \
- browseldap.h \
codeconv.h \
compose.h \
crash.h \
customheader.h \
displayheader.h \
- editaddress.h \
- editaddress_other_attributes_ldap.h \
- editbook.h \
- editgroup.h \
- editjpilot.h \
- editldap_basedn.h \
- editldap.h \
edittags.h \
- editvcard.h \
enriched.h \
- exphtmldlg.h \
- expldifdlg.h \
export.h \
- exporthtml.h \
- exportldif.h \
filtering.h \
folder.h \
folder_item_prefs.h \
@@ -231,18 +256,7 @@
imap.h \
imap_gtk.h \
import.h \
- importldif.h \
- importmutt.h \
- importpine.h \
inc.h \
- jpilot.h \
- ldapctrl.h \
- ldaplocate.h \
- ldapquery.h \
- ldapserver.h \
- ldapupdate.h \
- ldaputil.h \
- ldif.h \
localfolder.h \
main.h \
mainwindow.h \
@@ -258,12 +272,10 @@
mh_gtk.h \
mimeview.h \
msgcache.h \
- mutt.h \
news.h \
news_gtk.h \
noticeview.h \
partial_download.h \
- pine.h \
pop.h \
prefs_account.h \
prefs_actions.h \
@@ -318,12 +330,21 @@
undo.h \
unmime.h \
uri_opener.h \
- vcard.h \
- wizard.h
+ wizard.h \
+ $(abook_headers)
BUILT_SOURCES = \
matcher_parser_parse.h \
- quote_fmt_parse.h
+ quote_fmt_parse.h \
+ client-bindings.h
+
+client-bindings.h: claws-contacts.xml
+if BUILD_NEWADDRBOOK
+ dbus-binding-tool --prefix=abook --mode=glib-client --output=$@ claws-contacts.xml
+
+CLEANFILES = \
+ client-bindings.h
+endif
EXTRA_DIST = \
w32-logo.ico w32-resource.rc \
@@ -488,7 +509,8 @@
pixmaps/tray_unreadmarkedmail.offline.xpm \
pixmaps/tray_unreadmarkedmail.xpm \
pixmaps/empty.xpm \
- pixmaps/replied_and_forwarded.xpm
+ pixmaps/replied_and_forwarded.xpm \
+ claws-contacts.xml
INCLUDES = \
@@ -528,7 +550,8 @@
$(LIBETPAN_LIBS) \
$(MAEMO_LIBS) \
$(CONIC_LIBS) \
- $(DBUS_LIBS)
+ $(DBUS_LIBS) \
+ $(CONTACTS_LIBS)
pixmapdir=$(datadir)/icons/hicolor/48x48/apps
@@ -550,7 +573,8 @@
$(CONIC_CFLAGS) \
$(DBUS_CFLAGS) \
$(NETWORKMANAGER_SUPPORT_CFLAGS) \
- $(VALGRIND_CFLAGS)
+ $(VALGRIND_CFLAGS) \
+ $(CONTACTS_CFLAGS)
#no-unused-function is there because of bison stuff
#no-deprecated-declarations because of gpgme_data_rewind, which we have
--- NEW FILE: claws-contacts.xml ---
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE node PUBLIC
"-//freedesktop//DTD D-Bus Object Introspection 1.0//EN"
"http://standards.freedesktop.org/dbus/1.0/introspect.dtd">
<!--
# $Id: claws-contacts.xml,v 1.1.4.2 2012-04-01 18:45:26 colin Exp $
-->
<node name="/org/clawsmail/contacts/service">
<interface name="org.clawsmail.Contacts">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="abook"/>
<method name="ShowAddressbook">
<arg type="b" name="compose" direction="in" />
</method>
<method name="Ping">
<arg type="s" name="reply" direction="out" />
</method>
<method name="Commit">
<arg type="s" name="addressbook" direction="in" />
<arg type="b" name="succes" direction="out" />
</method>
<method name="BookList">
<arg type="as" name="books" direction="out" />
</method>
<method name="SearchAddressbook">
<arg type="s" name="token" direction="in" />
<!-- if addressbook is NULL search all available books -->
<arg type="s" name="addressbook" direction="in" />
<arg type="as" name="emails" direction="out" />
</method>
<method name="AddContact">
<arg type="s" name="addressbook" direction="in" />
<arg type="a{ss}" name="contact_data" direction="in" />
<arg type="a(sss)" name="contact_emails" direction="in" />
</method>
<method name="AddVCard">
<!-- if addressbook is NULL add to default address book -->
<arg type="s" name="addressbook" direction="in" />
<arg type="s" name="vcard" direction="in" />
</method>
<method name="GetVCard">
<arg type="s" name="acount" direction="in" />
<arg type="s" name="vcard" direction="out" />
</method>
<signal name="ContactMailTo">
<arg type="s" name="contact_add_to" direction="out" />
</signal>
<signal name="ContactMailCc">
<arg type="s" name="contact_add_cc" direction="out" />
</signal>
<signal name="ContactMailBcc">
<arg type="s" name="contact_add_bcc" direction="out" />
</signal>
</interface>
</node>
Index: prefs_filtering_action.c
===================================================================
RCS file: /home/claws-mail/claws/src/prefs_filtering_action.c,v
retrieving revision 1.1.4.73
retrieving revision 1.1.4.74
diff -u -d -r1.1.4.73 -r1.1.4.74
--- prefs_filtering_action.c 7 Oct 2011 16:06:53 -0000 1.1.4.73
+++ prefs_filtering_action.c 1 Apr 2012 18:45:26 -0000 1.1.4.74
@@ -76,7 +76,9 @@
static void prefs_filtering_action_type_selection_changed(GtkWidget *widget,
gpointer user_data);
static void prefs_filtering_action_select_dest(void);
+#ifndef USE_NEW_ADDRBOOK
static void prefs_filtering_action_select_addressbook(void);
+#endif
static void prefs_filtering_action_up(void);
static void prefs_filtering_action_down(void);
static void prefs_filtering_action_set_dialog(GSList *action_list);
@@ -550,10 +552,13 @@
addressbook_btn = gtk_button_new_with_label (_("Select ..."));
gtk_box_pack_start (GTK_BOX (hbox1), addressbook_btn, FALSE, FALSE, 0);
+#ifndef USE_NEW_ADDRBOOK
g_signal_connect (G_OBJECT (addressbook_btn), "clicked",
G_CALLBACK(prefs_filtering_action_select_addressbook),
NULL);
-
+#else
+ gtk_widget_set_sensitive(GTK_WIDGET(addressbook_btn), FALSE);
+#endif
exec_btn = gtk_button_new_from_stock(GTK_STOCK_INFO);
gtk_box_pack_start (GTK_BOX (hbox1), exec_btn, FALSE, FALSE, 0);
g_signal_connect (G_OBJECT (exec_btn), "clicked",
@@ -645,7 +650,9 @@
filtering_action.score_entry = score_entry;
filtering_action.header_combo = header_combo;
filtering_action.header_entry = header_entry;
+#ifndef USE_NEW_ADDRBOOK
filtering_action.addressbook_btn = addressbook_btn;
+#endif
filtering_action.ok_btn = ok_btn;
filtering_action.action_list_view = action_list_view;
@@ -1263,6 +1270,7 @@
g_free(path);
}
+#ifndef USE_NEW_ADDRBOOK
static void prefs_filtering_action_select_addressbook(void)
{
const gchar *folderpath = NULL;
@@ -1275,6 +1283,7 @@
g_free(new_path);
}
}
+#endif
static void prefs_filtering_action_enable_widget(GtkWidget* widget, const gboolean enable)
{
Index: .cvsignore
===================================================================
RCS file: /home/claws-mail/claws/src/.cvsignore,v
retrieving revision 1.11.2.2
retrieving revision 1.11.2.3
diff -u -d -r1.11.2.2 -r1.11.2.3
--- .cvsignore 7 Nov 2006 10:38:30 -0000 1.11.2.2
+++ .cvsignore 1 Apr 2012 18:45:25 -0000 1.11.2.3
@@ -13,3 +13,4 @@
matcher_parser_parse.c
matcher_parser_parse.h
ylwrap
+client-bindings.h
Index: addressadd.h
===================================================================
RCS file: /home/claws-mail/claws/src/addressadd.h,v
retrieving revision 1.2.16.8
retrieving revision 1.2.16.9
diff -u -d -r1.2.16.8 -r1.2.16.9
--- addressadd.h 16 Feb 2011 07:15:55 -0000 1.2.16.8
+++ addressadd.h 1 Apr 2012 18:45:25 -0000 1.2.16.9
@@ -24,10 +24,17 @@
#ifndef __ADDRESS_ADD_H__
#define __ADDRESS_ADD_H__
-#include "addrindex.h"
+#ifndef USE_NEW_ADDRBOOK
+ #include "addrindex.h"
+#endif
#include "gtk/gtk.h"
+#ifndef USE_NEW_ADDRBOOK
gboolean addressadd_selection( AddressIndex *addrIndex, const gchar *name, const gchar *address, const gchar *remarks,
GdkPixbuf *picture );
+#else
+gboolean addressadd_selection(const gchar *name, const gchar *address, const gchar *remarks,
+ GdkPixbuf *picture );
+#endif
#endif /* __ADDRESS_ADD_H__ */
Index: addressadd.c
===================================================================
RCS file: /home/claws-mail/claws/src/addressadd.c,v
retrieving revision 1.9.2.34
retrieving revision 1.9.2.35
diff -u -d -r1.9.2.34 -r1.9.2.35
--- addressadd.c 23 Oct 2011 20:50:47 -0000 1.9.2.34
+++ addressadd.c 1 Apr 2012 18:45:25 -0000 1.9.2.35
@@ -37,18 +37,28 @@
#include "prefs_common.h"
#include "prefs_gtk.h"
#include "addressadd.h"
-#include "addritem.h"
-#include "addrbook.h"
-#include "addrindex.h"
+#ifndef USE_NEW_ADDRBOOK
+ #include "addritem.h"
+ #include "addrbook.h"
+ #include "addrindex.h"
+ #include "ldapserver.h"
+ #include "ldapupdate.h"
+#else
+ #include "addressbook-dbus.h"
+#endif
#include "manage_window.h"
-#include "ldapserver.h"
-#include "ldapupdate.h"
#include "alertpanel.h"
+#ifndef USE_NEW_ADDRBOOK
typedef struct {
AddressBookFile *book;
ItemFolder *folder;
} FolderInfo;
+#else
+typedef struct {
+ gchar* book;
+} FolderInfo;
+#endif
static struct _AddressAdd_dlg {
GtkWidget *window;
@@ -67,6 +77,7 @@
static gboolean addressadd_cancelled;
+#ifndef USE_NEW_ADDRBOOK
static FolderInfo *addressadd_create_folderinfo( AddressBookFile *abf, ItemFolder *folder )
{
FolderInfo *fi = g_new0( FolderInfo, 1 );
@@ -74,12 +85,26 @@
fi->folder = folder;
return fi;
}
+#else
+static FolderInfo *addressadd_create_folderinfo(gchar* book) {
+ FolderInfo *fi = g_new0( FolderInfo, 1 );
+ fi->book = book;
+ return fi;
+}
+#endif
+#ifndef USE_NEW_ADDRBOOK
static void addressadd_free_folderinfo( FolderInfo *fi ) {
fi->book = NULL;
fi->folder = NULL;
g_free( fi );
}
+#else
+static void addressadd_free_folderinfo( FolderInfo *fi ) {
+ fi->book = NULL;
+ g_free( fi );
+}
+#endif
static gint addressadd_delete_event( GtkWidget *widget, GdkEventAny *event, gboolean *cancelled ) {
addressadd_cancelled = TRUE;
@@ -284,6 +309,7 @@
&folderXpm );
}
+#ifndef USE_NEW_ADDRBOOK
static void addressadd_load_folder( GtkCMCTreeNode *parentNode, ItemFolder *parentFolder,
FolderInfo *fiParent )
{
@@ -361,18 +387,51 @@
list = g_list_next( list );
}
}
+#else
+static void addressadd_load_data() {
+ GSList *list;
+ gchar *name;
+ GtkCMCTree *tree = GTK_CMCTREE(addressadd_dlg.tree_folder);
+ GtkCMCTreeNode *node;
+ FolderInfo *fi = NULL;
+ GError* error = NULL;
+
+ gtk_cmclist_clear(GTK_CMCLIST(tree));
+ list = addressbook_dbus_get_books(&error);
+ for (; list; list = g_slist_next(list)) {
+ name = (gchar *) list->data;
+ node = gtk_cmctree_insert_node(tree, NULL, NULL,
+ &name, FOLDER_SPACING, bookXpm,
+ bookXpm, FALSE, TRUE);
+ fi = addressadd_create_folderinfo(name);
+ gtk_cmctree_node_set_row_data_full(tree, node, fi,
+ ( GDestroyNotify ) addressadd_free_folderinfo );
+ }
+}
+#endif
+#ifndef USE_NEW_ADDRBOOK
gboolean addressadd_selection( AddressIndex *addrIndex, const gchar *name,
const gchar *address, const gchar *remarks, GdkPixbuf *picture ) {
+#else
+gboolean addressadd_selection(const gchar *name, const gchar *address,
+ const gchar *remarks, GdkPixbuf *picture ) {
+#endif
gboolean retVal = FALSE;
+#ifndef USE_NEW_ADDRBOOK
ItemPerson *person = NULL;
+#endif
FolderInfo *fi = NULL;
addressadd_cancelled = FALSE;
if( ! addressadd_dlg.window ) addressadd_create();
addressadd_dlg.fiSelected = NULL;
+#ifndef USE_NEW_ADDRBOOK
addressadd_load_data( addrIndex );
+#else
+ addressadd_load_data();
+#endif
gtk_cmclist_select_row( GTK_CMCLIST( addressadd_dlg.tree_folder ), 0, 0 );
gtk_widget_show(addressadd_dlg.window);
gtk_window_set_modal(GTK_WINDOW(addressadd_dlg.window), TRUE);
@@ -407,6 +466,7 @@
fi = addressadd_dlg.fiSelected;
+#ifndef USE_NEW_ADDRBOOK
person = addrbook_add_contact( fi->book, fi->folder,
returned_name,
address,
@@ -426,6 +486,42 @@
addritem_person_set_picture( person, ADDRITEM_ID(person) ) ;
g_free( name );
}
+#else
+ ContactData* contact = g_new0(ContactData, 1);
+ GError* error = NULL;
+
+ if (returned_name)
+ contact->cn = g_strdup(returned_name);
+ else
+ contact->cn = g_strdup(address);
+
+ contact->name = g_strdup(returned_name);
+ contact->email = g_strdup(address);
+ contact->remarks = g_strdup(returned_remarks);
+ contact->book = g_strdup(fi->book);
+ contact->picture = picture;
+
+ if (addressbook_dbus_add_contact(contact, &error) == 0) {
+ debug_print("Added to addressbook:\n%s\n%s\n%s\n%s\n",
+ returned_name, address, returned_remarks, fi->book);
+ retVal = TRUE;
+ }
+ else {
+ retVal = FALSE;
+ if (error) {
+ GtkWidget* dialog = gtk_message_dialog_new (
+ GTK_WINDOW(addressadd_dlg.window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "%s", error->message);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ g_error_free(error);
+ }
+ }
+ contact_data_free(&contact);
+#endif
#ifdef USE_LDAP
if (fi->book->type == ADBOOKTYPE_LDAP) {
LdapServer *server = (LdapServer *) fi->book;
@@ -441,7 +537,9 @@
#endif
g_free(returned_name);
g_free(returned_remarks);
+#ifndef USE_NEW_ADDRBOOK
if( person ) retVal = TRUE;
+#endif
}
}
Index: textview.c
===================================================================
RCS file: /home/claws-mail/claws/src/textview.c,v
retrieving revision 1.96.2.239
retrieving revision 1.96.2.240
diff -u -d -r1.96.2.239 -r1.96.2.240
--- textview.c 15 Mar 2012 15:33:11 -0000 1.96.2.239
+++ textview.c 1 Apr 2012 18:45:27 -0000 1.96.2.240
@@ -55,7 +55,13 @@
#include "html.h"
#include "enriched.h"
#include "compose.h"
-#include "addressbook.h"
+#ifndef USE_NEW_ADDRBOOK
+ #include "addressbook.h"
+ #include "addrindex.h"
+#else
+ #include "addressbook-dbus.h"
+ #include "addressadd.h"
+#endif
#include "displayheader.h"
#include "account.h"
#include "mimeview.h"
@@ -67,7 +73,6 @@
#include "inputdialog.h"
#include "timing.h"
#include "tags.h"
-#include "addrindex.h"
static GdkColor quote_colors[3] = {
{(gulong)0, (gushort)0, (gushort)0, (gushort)0},
@@ -1938,6 +1943,7 @@
#if HAVE_LIBCOMPFACE
static void textview_show_xface(TextView *textview)
{
+ GtkAllocation allocation;
MsgInfo *msginfo = textview->messageview->msginfo;
GtkTextView *text = GTK_TEXT_VIEW(textview->text);
int x = 0;
@@ -1970,7 +1976,8 @@
gtk_widget_show(textview->image);
- x = textview->text->allocation.width - WIDTH -5;
+ gtk_widget_get_allocation(textview->text, &allocation);
+ x = allocation.width - WIDTH -5;
gtk_text_view_add_child_in_window(text, textview->image,
GTK_TEXT_WINDOW_TEXT, x, 5);
@@ -1988,6 +1995,7 @@
static void textview_save_contact_pic(TextView *textview)
{
+#ifndef USE_NEW_ADDRBOOK
MsgInfo *msginfo = textview->messageview->msginfo;
gchar *filename = NULL;
GError *error = NULL;
@@ -2011,11 +2019,14 @@
}
}
g_free(filename);
+#else
+ /* new address book */
+#endif
}
static void textview_show_contact_pic(TextView *textview)
{
- GtkAllocation allocation;
+#ifndef USE_NEW_ADDRBOOK
MsgInfo *msginfo = textview->messageview->msginfo;
GtkTextView *text = GTK_TEXT_VIEW(textview->text);
int x = 0;
@@ -2067,8 +2078,7 @@
gtk_widget_show(textview->image);
- gtk_widget_get_allocation(textview->text, &allocation);
- x = allocation.width - WIDTH -5;
+ x = textview->text->allocation.width - WIDTH -5;
gtk_text_view_add_child_in_window(text, textview->image,
GTK_TEXT_WINDOW_TEXT, x, 5);
@@ -2080,7 +2090,9 @@
if (textview->image)
gtk_widget_destroy(textview->image);
textview->image = NULL;
-
+#else
+ /* new address book */
+#endif
}
static gint textview_tag_cmp_list(gconstpointer a, gconstpointer b)
@@ -3064,6 +3076,7 @@
GtkWidget *image = NULL;
GdkPixbuf *picture = NULL;
gboolean use_picture = FALSE;
+
if (uri == NULL)
return;
@@ -3096,7 +3109,13 @@
if (image)
picture = gtk_image_get_pixbuf(GTK_IMAGE(image));
+#ifndef USE_NEW_ADDRBOOK
addressbook_add_contact( fromname, fromaddress, NULL, picture);
+#else
+ if (addressadd_selection(fromname, fromaddress, NULL, picture)) {
+ debug_print( "addressbook_add_contact - added\n" );
+ }
+#endif
g_free(fromaddress);
g_free(fromname);
Index: prefs_matcher.c
===================================================================
RCS file: /home/claws-mail/claws/src/prefs_matcher.c,v
retrieving revision 1.43.2.91
retrieving revision 1.43.2.92
diff -u -d -r1.43.2.91 -r1.43.2.92
--- prefs_matcher.c 7 Oct 2011 09:40:15 -0000 1.43.2.91
+++ prefs_matcher.c 1 Apr 2012 18:45:26 -0000 1.43.2.92
@@ -55,7 +55,9 @@
#include "colorlabel.h"
#include "tags.h"
+#ifndef USE_NEW_ADDRBOOK
static void prefs_matcher_addressbook_select(void);
+#endif
static void prefs_matcher_test_info(GtkWidget *widget, GtkWidget *parent);
enum {
@@ -528,10 +530,7 @@
GtkWidget *test_btn;
GtkWidget *addressbook_select_btn;
-
-#if !GTK_CHECK_VERSION(3, 0, 0)
GtkWidget *color_optmenu;
-#endif
static GdkGeometry geometry;
GtkSizeGroup *size_group;
@@ -657,10 +656,13 @@
addressbook_select_btn = gtk_button_new_with_label(_("Select ..."));
gtk_box_pack_start(GTK_BOX(upper_hbox), addressbook_select_btn, FALSE, FALSE, 0);
+#ifndef USE_NEW_ADDRBOOK
g_signal_connect(G_OBJECT (addressbook_select_btn), "clicked",
G_CALLBACK(prefs_matcher_addressbook_select),
NULL);
-
+#else
+ gtk_widget_set_sensitive(GTK_WIDGET(addressbook_select_btn), FALSE);
+#endif
match_label = gtk_label_new("");
gtk_misc_set_alignment(GTK_MISC(match_label), 1, 0.5);
gtk_table_attach(GTK_TABLE(table), match_label, 0, 1, 1, 2,
@@ -833,10 +835,10 @@
#endif
matcher.bool_op_combo = bool_op_combo;
matcher.test_btn = test_btn;
+#ifndef USE_NEW_ADDRBOOK
matcher.addressbook_select_btn = addressbook_select_btn;
-#if !GTK_CHECK_VERSION(3, 0, 0)
- matcher.color_optmenu = color_optmenu;
#endif
+ matcher.color_optmenu = color_optmenu;
matcher.match_label = match_label;
matcher.criteria_label2 = criteria_label2;
matcher.headers_combo = headers_combo;
@@ -2145,6 +2147,7 @@
description_window_create(&test_desc_win);
}
+#ifndef USE_NEW_ADDRBOOK
static void prefs_matcher_addressbook_select(void)
{
const gchar *folderpath = NULL;
@@ -2157,7 +2160,7 @@
g_free(new_path);
}
}
-
+#endif
/*
* list view
Index: addr_compl.c
===================================================================
RCS file: /home/claws-mail/claws/src/addr_compl.c,v
retrieving revision 1.27.2.60
retrieving revision 1.27.2.61
diff -u -d -r1.27.2.60 -r1.27.2.61
--- addr_compl.c 25 Jan 2012 08:43:23 -0000 1.27.2.60
+++ addr_compl.c 1 Apr 2012 18:45:25 -0000 1.27.2.61
@@ -35,8 +35,8 @@
# include <wctype.h>
#endif
-#include "addrindex.h"
#include "addr_compl.h"
+#include "addritem.h"
#include "utils.h"
#include "prefs_common.h"
#include "claws.h"
@@ -44,6 +44,12 @@
#include "gtkutils.h"
#include <pthread.h>
+#ifndef USE_NEW_ADDRBOOK
+ #include "addrindex.h"
+#else
+ #include "addressbook-dbus.h"
+#endif
+
/*!
*\brief For the GtkListStore
*/
@@ -286,8 +292,18 @@
free_all_addresses();
free_completion_list();
+#ifndef USE_NEW_ADDRBOOK
addrindex_load_completion( add_address, folderpath );
-
+#else
+ GError* error = NULL;
+
+ addrcompl_initialize();
+ if (! addrindex_dbus_load_completion(add_address, &error)) {
+ g_warning("Failed to populate address completion list");
+ g_error_free(error);
+ return;
+ }
+#endif
/* plugins may hook in here to modify/extend the completion list */
hooks_invoke(ADDDRESS_COMPLETION_BUILD_ADDRESS_LIST_HOOKLIST, &g_address_list);
@@ -753,8 +769,9 @@
*/
static void addrcompl_destroy_window( CompletionWindow *cw ) {
/* Stop all searches currently in progress */
+#ifndef USE_NEW_ADDRBOOK
addrindex_stop_search( _queryID_ );
-
+#endif
/* Remove idler function... or application may not terminate */
if( _completionIdleID_ != 0 ) {
g_source_remove( _completionIdleID_ );
@@ -975,6 +992,7 @@
* criteria.
* \param data Query data.
*/
+#ifndef USE_NEW_ADDRBOOK
static gint addrcompl_callback_entry(
gpointer sender, gint queryID, GList *listEMail, gpointer data )
{
@@ -1000,6 +1018,7 @@
return 0;
}
+#endif
/**
* Clear the display queue.
@@ -1045,6 +1064,7 @@
* Start the search.
*/
static void addrcompl_start_search( void ) {
+#ifndef USE_NEW_ADDRBOOK
gchar *searchTerm;
searchTerm = g_strdup( _compWindow_->searchTerm );
@@ -1053,6 +1073,7 @@
_queryID_ = addrindex_setup_search(
searchTerm, NULL, addrcompl_callback_entry );
g_free( searchTerm );
+#endif
/* g_print( "addrcompl_start_search::queryID=%d\n", _queryID_ ); */
/* Load local stuff */
@@ -1063,7 +1084,11 @@
g_idle_add( (GSourceFunc) addrcompl_idle, NULL );
/* g_print( "addrindex_start_search::queryID=%d\n", _queryID_ ); */
+#ifndef USE_NEW_ADDRBOOK
addrindex_start_search( _queryID_ );
+#else
+
+#endif
}
/**
Index: main.c
===================================================================
RCS file: /home/claws-mail/claws/src/main.c,v
retrieving revision 1.115.2.247
retrieving revision 1.115.2.248
diff -u -d -r1.115.2.247 -r1.115.2.248
--- main.c 5 Feb 2012 20:00:35 -0000 1.115.2.247
+++ main.c 1 Apr 2012 18:45:26 -0000 1.115.2.248
@@ -93,7 +93,11 @@
#include "manage_window.h"
#include "alertpanel.h"
#include "statusbar.h"
-#include "addressbook.h"
+#ifndef USE_NEW_ADDRBOOK
+ #include "addressbook.h"
+#else
+ #include "addressbook-dbus.h"
+#endif
#include "compose.h"
#include "folder.h"
#include "setup.h"
@@ -1315,8 +1319,18 @@
prefs_actions_read_config();
prefs_display_header_read_config();
/* prefs_filtering_read_config(); */
+#ifndef USE_NEW_ADDRBOOK
addressbook_read_file();
-
+#else
+ g_clear_error(&error);
+ if (! addressbook_start_service(&error)) {
+ g_warning("%s", error->message);
+ g_clear_error(&error);
+ }
+ else {
+ addressbook_install_hooks(&error);
+ }
+#endif
gtkut_widget_init();
stock_pixbuf_gdk(NULL, STOCK_PIXMAP_CLAWS_MAIL_ICON, &icon);
gtk_window_set_default_icon(icon);
@@ -1719,8 +1733,9 @@
prefs_common_write_config();
account_write_config_all();
+#ifndef USE_NEW_ADDRBOOK
addressbook_export_to_file();
-
+#endif
filename = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, MENU_RC, NULL);
gtk_accel_map_save(filename);
g_free(filename);
@@ -1759,8 +1774,9 @@
prefs_toolbar_done();
+#ifndef USE_NEW_ADDRBOOK
addressbook_destroy();
-
+#endif
prefs_themes_done();
prefs_fonts_done();
prefs_ext_prog_done();
Index: addrharvest.c
===================================================================
RCS file: /home/claws-mail/claws/src/addrharvest.c,v
retrieving revision 1.6.10.25
retrieving revision 1.6.10.26
diff -u -d -r1.6.10.25 -r1.6.10.26
--- addrharvest.c 16 Feb 2011 07:15:56 -0000 1.6.10.25
+++ addrharvest.c 1 Apr 2012 18:45:25 -0000 1.6.10.26
@@ -31,6 +31,9 @@
#include "addrharvest.h"
#include "codeconv.h"
#include "addritem.h"
+#ifdef USE_NEW_ADDRBOOK
+ #include "addressbook-dbus.h"
+#endif
/* Mail header names of interest */
static gchar *_headerFrom_ = HEADER_FROM;
@@ -63,6 +66,14 @@
gint count;
};
+#ifdef USE_NEW_ADDRBOOK
+typedef enum {
+ FIRST = 0,
+ LAST,
+} Namepart;
+
+#endif
+
/*
* Build header table entry.
* Enter: harvester Harvester object.
@@ -269,6 +280,32 @@
g_free( harvester );
}
+#ifdef USE_NEW_ADDRBOOK
+static gchar* get_namepart(const gchar* name, Namepart namepart) {
+ gchar *pos, *part = NULL;
+ gchar *token = g_strdup(name);
+
+ pos = g_strrstr(token, " ");
+ if (namepart == FIRST) {
+ if (pos) {
+ *pos = '\0';
+ part = g_strdup(token);
+ *pos = ' ';
+ }
+ }
+ else {
+ if (! pos)
+ part = g_strdup(token);
+ else {
+ pos +=1;
+ part = g_strdup(pos);
+ }
+ }
+ g_free(token);
+ return part;
+}
+#endif
+
/*
* Insert address into cache.
* Enter: harvester Harvester object.
@@ -282,6 +319,7 @@
AddressCache *cache, const gchar *name,
const gchar *address )
{
+#ifndef USE_NEW_ADDRBOOK
ItemPerson *person;
ItemFolder *folder;
gchar *folderName;
@@ -297,10 +335,15 @@
if( entry->count % harvester->folderSize == 0 ) {
newFolder = TRUE; /* Folder is full */
}
+#else
+ ContactEntry* person;
+ gchar* key;
+#endif
/* Insert address */
key = g_utf8_strdown( address, -1 );
person = g_hash_table_lookup( harvester->dupTable, key );
+#ifndef USE_NEW_ADDRBOOK
if( person ) {
/* Update existing person to use longest name */
value = ADDRITEM_NAME(person);
@@ -331,6 +374,16 @@
entry->count++;
}
addritem_parse_first_last( person );
+#else
+ if (! person) {
+ person = g_new0(ContactEntry, 1);
+ person->first_name = get_namepart(name, FIRST);
+ person->last_name = get_namepart(name, LAST);
+ person->email = g_strdup(address);
+ g_hash_table_insert(harvester->dupTable, key, person);
+ entry->count++;
+ }
+#endif
}
/*
@@ -533,8 +586,13 @@
}
/* Insert into address book */
+#ifndef USE_NEW_ADDRBOOK
addrharvest_insert_cache(
harvester, entry, cache, name, email );
+#else
+ addrharvest_insert_cache(
+ harvester, entry, NULL, name, email);
+#endif
g_free( email );
g_free( name );
}
@@ -791,13 +849,16 @@
retVal = MGU_BAD_ARGS;
cm_return_val_if_fail( harvester != NULL, retVal );
+#ifndef USE_NEW_ADDRBOOK
cm_return_val_if_fail( cache != NULL, retVal );
+#endif
cm_return_val_if_fail( harvester->path != NULL, retVal );
+#ifndef USE_NEW_ADDRBOOK
/* Clear cache */
addrcache_clear( cache );
cache->dataRead = FALSE;
-
+#endif
/* Build list of headers of interest */
listHdr = NULL;
node = harvester->headerTable;
@@ -823,10 +884,11 @@
}
mgu_free_dlist( listHdr );
+#ifndef USE_NEW_ADDRBOOK
/* Mark cache */
cache->modified = FALSE;
cache->dataRead = TRUE;
-
+#endif
return retVal;
}
Index: headerview.c
===================================================================
RCS file: /home/claws-mail/claws/src/headerview.c,v
retrieving revision 1.8.2.34
retrieving revision 1.8.2.35
diff -u -d -r1.8.2.34 -r1.8.2.35
--- headerview.c 22 Oct 2011 17:09:03 -0000 1.8.2.34
+++ headerview.c 1 Apr 2012 18:45:26 -0000 1.8.2.35
@@ -327,6 +327,7 @@
static void headerview_save_contact_pic (HeaderView *headerview, MsgInfo *msginfo)
{
+#ifndef USE_NEW_ADDRBOOK
gchar *filename = NULL;
GError *error = NULL;
GdkPixbuf *picture = NULL;
@@ -349,10 +350,14 @@
}
}
g_free(filename);
+#else
+ /* new address book */
+#endif
}
static gint headerview_show_contact_pic (HeaderView *headerview, MsgInfo *msginfo)
{
+#ifndef USE_NEW_ADDRBOOK
GtkWidget *hbox = headerview->hbox;
GtkWidget *image;
gchar *filename = NULL;
@@ -406,6 +411,10 @@
return -1;
else
return 0;
+#else
+ /* new address book */
+ return -1;
+#endif
}
void headerview_clear(HeaderView *headerview)
Index: mainwindow.c
===================================================================
RCS file: /home/claws-mail/claws/src/mainwindow.c,v
retrieving revision 1.274.2.343
retrieving revision 1.274.2.344
diff -u -d -r1.274.2.343 -r1.274.2.344
--- mainwindow.c 5 Feb 2012 20:00:35 -0000 1.274.2.343
+++ mainwindow.c 1 Apr 2012 18:45:26 -0000 1.274.2.344
@@ -52,7 +52,11 @@
#include "prefs_template.h"
#include "action.h"
#include "account.h"
-#include "addressbook.h"
+#ifndef USE_NEW_ADDRBOOK
+ #include "addressbook.h"
+#else
+ #include "addressbook-dbus.h"
+#endif
#include "logwindow.h"
#include "manage_window.h"
#include "alertpanel.h"
@@ -2432,7 +2436,9 @@
folderview_reinit_fonts(mainwin->folderview);
summary_reflect_prefs_pixmap_theme(mainwin->summaryview);
foldersel_reflect_prefs_pixmap_theme();
+#ifndef USE_NEW_ADDRBOOK
addressbook_reflect_prefs_pixmap_theme();
+#endif
#ifndef GENERIC_UMPC
pixmap = stock_pixmap_widget(mainwin->hbox_stat, STOCK_PIXMAP_ONLINE);
gtk_container_remove(GTK_CONTAINER(mainwin->online_switch),
@@ -4315,7 +4321,18 @@
static void addressbook_open_cb(GtkAction *action, gpointer data)
{
+#ifndef USE_NEW_ADDRBOOK
addressbook_open(NULL);
+#else
+ GError* error = NULL;
+
+ addressbook_dbus_open(FALSE, &error);
+ if (error) {
+ g_warning("Failed to open address book");
+ g_warning("%s", error->message);
+ g_error_free(error);
+ }
+#endif
}
static void log_window_show_cb(GtkAction *action, gpointer data)
@@ -5235,6 +5252,7 @@
static void addr_harvest_cb( GtkAction *action, gpointer data)
{
MainWindow *mainwin = (MainWindow *)data;
+
addressbook_harvest( mainwin->summaryview->folder_item, FALSE, NULL );
}
Index: addrharvest.h
===================================================================
RCS file: /home/claws-mail/claws/src/addrharvest.h,v
retrieving revision 1.4.12.8
retrieving revision 1.4.12.9
diff -u -d -r1.4.12.8 -r1.4.12.9
--- addrharvest.h 16 Feb 2011 07:15:56 -0000 1.4.12.8
+++ addrharvest.h 1 Apr 2012 18:45:26 -0000 1.4.12.9
@@ -47,6 +47,14 @@
gboolean folderRecurse;
};
+#ifdef USE_NEW_ADDRBOOK
+typedef struct {
+ gchar* first_name;
+ gchar* last_name;
+ gchar* email;
+} ContactEntry;
+#endif
+
/* Function prototypes */
AddressHarvester *addrharvest_create ( void );
void addrharvest_free ( AddressHarvester *harvester );
Index: toolbar.c
===================================================================
RCS file: /home/claws-mail/claws/src/toolbar.c,v
retrieving revision 1.43.2.126
retrieving revision 1.43.2.127
diff -u -d -r1.43.2.126 -r1.43.2.127
--- toolbar.c 8 Feb 2012 18:46:53 -0000 1.43.2.126
+++ toolbar.c 1 Apr 2012 18:45:27 -0000 1.43.2.127
@@ -57,6 +57,9 @@
#include "prefs_toolbar.h"
#include "alertpanel.h"
#include "imap.h"
+#ifdef USE_NEW_ADDRBOOK
+ #include "addressbook-dbus.h"
+#endif
/* elements */
#define TOOLBAR_TAG_INDEX "toolbar"
@@ -1315,7 +1318,17 @@
default:
return;
}
+#ifndef USE_NEW_ADDRBOOK
addressbook_open(compose);
+#else
+ GError* error = NULL;
+ addressbook_connect_signals(compose);
+ addressbook_dbus_open(TRUE, &error);
+ if (error) {
+ g_warning("%s", error->message);
+ g_error_free(error);
+ }
+#endif
}
Index: addrgather.c
===================================================================
RCS file: /home/claws-mail/claws/src/addrgather.c,v
retrieving revision 1.5.10.36
retrieving revision 1.5.10.37
diff -u -d -r1.5.10.36 -r1.5.10.37
--- addrgather.c 22 Oct 2011 17:09:02 -0000 1.5.10.36
+++ addrgather.c 1 Apr 2012 18:45:25 -0000 1.5.10.37
@@ -45,9 +45,12 @@
#include "prefs_common.h"
#include "addrharvest.h"
-#include "addrindex.h"
-#include "addrbook.h"
-
+#ifndef USE_NEW_ADDRBOOK
+ #include "addrindex.h"
+ #include "addrbook.h"
+#else
+ #include "addressbook-dbus.h"
+#endif
#define PAGE_FIELDS 0
#define PAGE_FINISH 1
@@ -74,7 +77,9 @@
GtkWidget *labelFolder;
GtkWidget *entryBook;
GtkWidget *checkHeader[ NUM_FIELDS ];
+#ifndef USE_NEW_ADDRBOOK
GtkWidget *spinbtnFolder;
+#endif
GtkWidget *checkRecurse;
GtkWidget *btnOk;
GtkWidget *btnCancel;
@@ -86,8 +91,10 @@
GtkWidget *clistCount;
} addrgather_dlg;
+#ifndef USE_NEW_ADDRBOOK
static AddressIndex *_harv_addressIndex_;
static AddressBookFile *_harv_addressBook_;
+#endif
static gchar *_harv_headerNames_[] = {
HEADER_FROM,
HEADER_REPLY_TO,
@@ -143,12 +150,19 @@
GtkCMCList *clist;
gchar *text[ FIELDS_N_COLS ];
AddressHarvester *harvester;
- AddressBookFile *abf;
gchar *name;
+#ifndef USE_NEW_ADDRBOOK
+ AddressBookFile *abf;
gchar *newFile;
+#else
+ GList* list;
+ ContactData* contact;
+ GError* error = NULL;
+#endif
gchar str[ FMT_BUFSIZE ];
gint cnt;
gint i;
+#ifndef USE_NEW_ADDRBOOK
gint sz;
name = gtk_editable_get_chars( GTK_EDITABLE(addrgather_dlg.entryBook), 0, -1 );
@@ -157,6 +171,14 @@
_( "Please specify name for address book." ) );
g_free( name );
return FALSE;
+#else
+ name = gtk_combo_box_get_active_text(GTK_COMBO_BOX(addrgather_dlg.entryBook));
+ if( name == NULL || strlen( name ) < 1 ) {
+ addrgather_dlg_status_show(
+ _("No available address book."));
+ g_free( name );
+ return FALSE;
+#endif
}
/* Create harvest helper */
@@ -183,10 +205,13 @@
/* Go fer it */
addrgather_dlg_status_show( _( "Collecting addresses..." ) );
GTK_EVENTS_FLUSH();
+#ifndef USE_NEW_ADDRBOOK
sz = gtk_spin_button_get_value_as_int(
GTK_SPIN_BUTTON( addrgather_dlg.spinbtnFolder ) );
addrharvest_set_folder_size( harvester, sz );
+#endif
+#ifndef USE_NEW_ADDRBOOK
/* Create address book */
abf = addrbook_create_book();
addrbook_set_path( abf, _harv_addressIndex_->filePath );
@@ -195,12 +220,38 @@
addrbook_set_name( abf, name );
g_free( newFile );
g_free( name );
+#endif
/* Harvest addresses */
+#ifndef USE_NEW_ADDRBOOK
addrharvest_harvest(
harvester, abf->addressCache, _harv_messageList_ );
+ /* save address book */
addrbook_save_data( abf );
_harv_addressBook_ = abf;
+#else
+ addrharvest_harvest(
+ harvester, NULL, _harv_messageList_ );
+ list = g_hash_table_get_values(harvester->dupTable);
+ for (; list; list = g_list_next(list)) {
+ contact = g_new0(ContactData, 1);
+ ContactEntry* person = (ContactEntry *) list->data;
+ if (person->first_name)
+ contact->name = g_strconcat(
+ person->first_name, " ", person->last_name, NULL);
+ else
+ contact->name = g_strdup(person->last_name);
+ if (! contact->name || strlen(contact->name) < 1)
+ contact->name = g_strdup(person->email);
+ contact->remarks = g_strdup(N_("address added by claws-mail"));
+ contact->email = g_strdup(person->email);
+ contact->book = g_strdup(name);
+ addressbook_dbus_add_contact(contact, &error);
+ contact_data_free(&contact);
+ }
+ g_list_free(list);
+ g_free(name);
+#endif
/* Update summary count */
clist = GTK_CMCLIST(addrgather_dlg.clistCount);
@@ -263,18 +314,24 @@
{
GtkWidget *vbox;
GtkWidget *vboxf;
- GtkWidget *hboxs;
GtkWidget *table;
GtkWidget *label;
GtkWidget *labelFolder;
GtkWidget *entryBook;
GtkWidget *frameHeader;
GtkWidget *checkHeader[NUM_FIELDS];
+#ifndef USE_NEW_ADDRBOOK
+ GtkWidget *hboxs;
GtkWidget *spinbtnFolder;
- GtkAdjustment *adjFolder;
+ GtkObject *adjFolder;
+#endif
GtkWidget *checkRecurse;
gint top;
gint i;
+#ifdef USE_NEW_ADDRBOOK
+ GError* error = NULL;
+ GSList *books, *cur;
+#endif
/* Container */
vbox = gtk_vbox_new(FALSE, 6);
@@ -311,10 +368,27 @@
gtk_table_attach( GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0 );
gtk_misc_set_alignment( GTK_MISC(label), 1.0, 0.5 );
+#ifndef USE_NEW_ADDRBOOK
entryBook = gtk_entry_new();
+#else
+ books = addressbook_dbus_get_books(&error);
+ entryBook = gtk_combo_box_new_text();
+ if (books) {
+ for (cur = books; cur; cur = g_slist_next(cur)) {
+ gchar* book = (gchar *) cur->data;
+ gtk_combo_box_prepend_text(GTK_COMBO_BOX(entryBook), book);
+ g_free(book);
+ }
+ g_slist_free(books);
+ }
+ else
+ gtk_combo_box_prepend_text(GTK_COMBO_BOX(entryBook), "");
+ gtk_combo_box_set_active(GTK_COMBO_BOX(entryBook), 0);
+#endif
gtk_table_attach( GTK_TABLE(table), entryBook, 1, 2, top, (top + 1),
GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0 );
+#ifndef USE_NEW_ADDRBOOK
/* Third row */
top = 2;
label = gtk_label_new(_("Address book folder size:"));
@@ -332,7 +406,7 @@
gtk_table_attach(GTK_TABLE(table), hboxs, 1, 2, top, (top + 1), GTK_FILL, 0, 0, 0);
CLAWS_SET_TIP(spinbtnFolder,
_("Maximum amount of entries per folder within the newly created address book"));
-
+#endif
/* Fourth row */
top = 3;
frameHeader = gtk_frame_new(_("Process these mail header fields"));
@@ -360,7 +434,9 @@
addrgather_dlg.labelFolder = labelFolder;
addrgather_dlg.entryBook = entryBook;
+#ifndef USE_NEW_ADDRBOOK
addrgather_dlg.spinbtnFolder = spinbtnFolder;
+#endif
addrgather_dlg.checkRecurse = checkRecurse;
}
@@ -376,7 +452,6 @@
GtkWidget *clistCount;
gchar *titles[ FIELDS_N_COLS ];
gint i;
-
titles[ FIELD_COL_HEADER ] = _("Header Name");
titles[ FIELD_COL_COUNT ] = _("Address Count");
@@ -501,13 +576,19 @@
* msgList List of message numbers, or NULL to process folder.
* Return: Populated address book file, or NULL if none created.
*/
+#ifndef USE_NEW_ADDRBOOK
AddressBookFile *addrgather_dlg_execute(FolderItem *folderItem, AddressIndex *addrIndex,
gboolean sourceInd, GList *msgList)
+#else
+void addrgather_dlg_execute(FolderItem *folderItem, gboolean sourceInd, GList *msgList)
+#endif
{
gint i;
+#ifndef USE_NEW_ADDRBOOK
_harv_addressIndex_ = addrIndex;
_harv_addressBook_ = NULL;
+#endif
_harv_messageList_ = msgList;
/* Create dialog */
@@ -520,8 +601,11 @@
addrgather_dlg.folderPath = folder_item_get_path(folderItem);
/* Setup some default values */
+
gtk_label_set_text(GTK_LABEL(addrgather_dlg.labelFolder), folderItem->path);
+#ifndef USE_NEW_ADDRBOOK
gtk_entry_set_text(GTK_ENTRY(addrgather_dlg.entryBook), folderItem->path);
+#endif
for (i = 0; i < NUM_FIELDS; i++) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(addrgather_dlg.checkHeader[i]),
@@ -558,14 +642,15 @@
addrgather_dlg.folderPath = NULL;
gtk_widget_hide(addrgather_dlg.window);
gtk_window_set_modal(GTK_WINDOW(addrgather_dlg.window), FALSE);
+#ifndef USE_NEW_ADDRBOOK
_harv_addressIndex_ = NULL;
if (addrgather_dlg.cancelled == TRUE)
return NULL;
return _harv_addressBook_;
+#endif
}
-
/*
* End of Source.
*/
Index: filtering.c
===================================================================
RCS file: /home/claws-mail/claws/src/filtering.c,v
retrieving revision 1.60.2.61
retrieving revision 1.60.2.62
diff -u -d -r1.60.2.61 -r1.60.2.62
--- filtering.c 10 Feb 2012 21:37:55 -0000 1.60.2.61
+++ filtering.c 1 Apr 2012 18:45:26 -0000 1.60.2.62
@@ -34,7 +34,13 @@
#include "prefs_gtk.h"
#include "compose.h"
#include "prefs_common.h"
-#include "addrbook.h"
+#include "addritem.h"
+#ifndef USE_NEW_ADDRBOOK
+ #include "addrbook.h"
+#else
+ #include "addressbook-dbus.h"
+ #include "addressadd.h"
+#endif
#include "addr_compl.h"
#include "tags.h"
#include "log.h"
@@ -476,13 +482,16 @@
case MATCHACTION_ADD_TO_ADDRESSBOOK:
{
+#ifndef USE_NEW_ADDRBOOK
AddressDataSource *book = NULL;
AddressBookFile *abf = NULL;
ItemFolder *folder = NULL;
+#endif
gchar buf[BUFFSIZE];
Header *header;
gint errors = 0;
+#ifndef USE_NEW_ADDRBOOK
if (!addressbook_peek_folder_exists(action->destination, &book, &folder)) {
g_warning("addressbook folder not found '%s'\n", action->destination?action->destination:"(null)");
return FALSE;
@@ -493,7 +502,7 @@
}
abf = book->rawDataSource;
-
+#endif
/* get the header */
procheader_get_header_from_msginfo(info, buf, sizeof(buf), action->header);
header = procheader_parse_header(buf);
@@ -520,7 +529,11 @@
if (complete_matches_found(walk->data) == 0) {
debug_print("adding address '%s' to addressbook '%s'\n",
stripped_addr, action->destination);
+#ifndef USE_NEW_ADDRBOOK
if (!addrbook_add_contact(abf, folder, stripped_addr, stripped_addr, NULL)) {
+#else
+ if (!addressadd_selection(NULL, stripped_addr, NULL, NULL)) {
+#endif
g_warning("contact could not been added\n");
errors++;
}
@@ -538,7 +551,6 @@
}
return (errors == 0);
}
-
default:
break;
}
Index: addrgather.h
===================================================================
RCS file: /home/claws-mail/claws/src/addrgather.h,v
retrieving revision 1.3.12.7
retrieving revision 1.3.12.8
diff -u -d -r1.3.12.7 -r1.3.12.8
--- addrgather.h 16 Feb 2011 07:15:56 -0000 1.3.12.7
+++ addrgather.h 1 Apr 2012 18:45:25 -0000 1.3.12.8
@@ -25,11 +25,20 @@
#define __ADDR_GATHER_H__
/* Function prototypes */
+#include "folder.h"
+
+#ifndef USE_NEW_ADDRBOOK
+#include "addrbook.h"
+
AddressBookFile *addrgather_dlg_execute( FolderItem *folderItem,
AddressIndex *addrIndex,
gboolean sourceInd,
GList *msgList );
-
+#else
+void addrgather_dlg_execute( FolderItem *folderItem,
+ gboolean sourceInd,
+ GList *msgList );
+#endif
#endif /* __ADDR_GATHER_H__ */
/*
More information about the Commits
mailing list