2007-10-07 [colin] 3.0.2cvs31
[claws.git] / src / addressbook.c
index 22920dd9a2a1d26d1c0d0aafdd24f60b9d8eecf7..2eaadfdf84e36ac9e81f0fd880d3237d90d40e61 100644 (file)
@@ -69,6 +69,7 @@
 #include "addrbook.h"
 #include "addrindex.h"
 #include "addressadd.h"
+#include "addrduplicates.h"
 #include "addressbook_foldersel.h"
 #include "vcard.h"
 #include "editvcard.h"
@@ -366,6 +367,7 @@ static void addressbook_list_select_add             ( AddrItemObject    *aio,
 static void addressbook_list_select_remove     ( AddrItemObject    *aio );
 
 static void addressbook_import_ldif_cb         ( void );
+static void addressbook_find_duplicates_cb     ( void );
 static void addressbook_import_mutt_cb         ( void );
 static void addressbook_import_pine_cb         ( void );
 static void addressbook_export_html_cb         ( void );
@@ -461,6 +463,8 @@ static GtkItemFactoryEntry addressbook_entries[] =
        {N_("/_Tools/---"),             NULL,           NULL, 0, "<Separator>", NULL},
        {N_("/_Tools/Export _HTML..."), NULL,           addressbook_export_html_cb,     0, NULL, NULL},
        {N_("/_Tools/Export LDI_F..."), NULL,           addressbook_export_ldif_cb,     0, NULL, NULL},
+       {N_("/_Tools/---"),             NULL,           NULL, 0, "<Separator>", NULL},
+       {N_("/_Tools/Find duplicates..."), NULL, addressbook_find_duplicates_cb,        0, NULL, NULL},
        {N_("/_Help"),                  NULL,           NULL, 0, "<Branch>", NULL},
        {N_("/_Help/_About"),           NULL,           about_show, 0, NULL, NULL}
 };
@@ -686,7 +690,7 @@ Compose *addressbook_get_target_compose(void)
 /**
  * Refresh addressbook and save to file(s).
  */
-static void addressbook_refresh( void )
+void addressbook_refresh( void )
 {
        if (addrbook.window) {
                if (addrbook.treeSelected) {
@@ -3404,7 +3408,9 @@ static void addressbook_folder_load_one_person(
        gchar *text[N_LIST_COLS];
        gboolean flgFirst = TRUE, haveAddr = FALSE;
        GList *node;
+#ifdef USE_LDAP
        AddressBookFile *abf = addressbook_get_book_file();
+#endif
 
        if( person == NULL ) return;
 
@@ -5282,6 +5288,11 @@ static void addressbook_export_ldif_cb( void ) {
        addressbook_exp_ldif( cache );
 }
 
+static void addressbook_find_duplicates_cb(void)
+{
+       addrduplicates_find(GTK_WINDOW(addrbook.window));       
+}
+
 static void addressbook_start_drag(GtkWidget *widget, gint button, 
                                   GdkEvent *event,
                                   void *data)
@@ -5366,12 +5377,14 @@ static gboolean addressbook_drag_motion_cb(GtkWidget      *widget,
        if (gtk_clist_get_selection_info
                (GTK_CLIST(widget), x - 24, y - 24, &row, &column)) {
 
-               if (y > height - 24 && height + vpos < total_height)
+               if (y > height - 24 && height + vpos < total_height) {
                        gtk_adjustment_set_value(pos, (vpos+5 > height ? height : vpos+5));
-
-               if (y < 24 && y > 0)
+                       gtk_adjustment_changed(pos);
+               }
+               if (y < 24 && y > 0) {
                        gtk_adjustment_set_value(pos, (vpos-5 < 0 ? 0 : vpos-5));
-
+                       gtk_adjustment_changed(pos);
+               }
                node = gtk_ctree_node_nth(GTK_CTREE(widget), row);
 
                if (node != NULL) {