3b748badc9e2cdaca97b29212619b9796dc6a63e
[claws.git] / src / addrgather.c
1 /*
2  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 2002-2011 Match Grun and the Claws Mail team
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  * 
18  */
19
20 /*
21 * Dialog for gathering EMail addresses from mail folder.
22 */
23
24 #ifdef HAVE_CONFIG_H
25 #  include "config.h"
26 #endif
27
28 #include "defs.h"
29
30 #include <glib.h>
31 #include <glib/gi18n.h>
32 #include <gdk/gdkkeysyms.h>
33 #include <gtk/gtk.h>
34
35 #include "main.h"
36 #include "inc.h"
37 #include "mbox.h"
38 #include "filesel.h"
39 #include "foldersel.h"
40 #include "gtkutils.h"
41 #include "alertpanel.h"
42 #include "manage_window.h"
43 #include "folder.h"
44 #include "utils.h"
45 #include "prefs_common.h"
46
47 #include "addrharvest.h"
48 #include "addrindex.h"
49 #include "addrbook.h"
50
51 #define PAGE_FIELDS     0
52 #define PAGE_FINISH     1
53
54 #define NUM_FIELDS      6
55
56 #define FIELDS_N_COLS              2
57 #define FIELDS_COL_WIDTH_HEADER    100
58 #define FIELDS_COL_WIDTH_COUNT     140
59
60 #define MIN_FOLDER_SIZE 20
61 #define DFL_FOLDER_SIZE 50
62
63 typedef enum {
64         FIELD_COL_HEADER = 0,
65         FIELD_COL_COUNT  = 1
66 } AddrHarvest;
67
68 /*
69 * The dialog.
70 */
71 static struct _AddrHarvest {
72         GtkWidget *window;
73         GtkWidget *notebook;
74         GtkWidget *labelFolder;
75         GtkWidget *entryBook;
76         GtkWidget *checkHeader[ NUM_FIELDS ];
77         GtkWidget *spinbtnFolder;
78         GtkWidget *checkRecurse;
79         GtkWidget *btnOk;
80         GtkWidget *btnCancel;
81         GtkWidget *statusbar;
82         gint      status_cid;
83         gboolean  cancelled;
84         gboolean  done;
85         gchar     *folderPath;
86         GtkWidget *clistCount;
87 } addrgather_dlg;
88
89 static AddressIndex *_harv_addressIndex_;
90 static AddressBookFile *_harv_addressBook_;
91 static gchar *_harv_headerNames_[] = {
92         HEADER_FROM,
93         HEADER_REPLY_TO,
94         HEADER_SENDER,
95         HEADER_TO,
96         HEADER_CC,
97         HEADER_ERRORS_TO
98 };
99 static GList *_harv_messageList_;
100
101 static void addrgather_dlg_status_show( gchar *msg ) {
102         if( addrgather_dlg.statusbar != NULL ) {
103                 gtk_statusbar_pop( GTK_STATUSBAR(addrgather_dlg.statusbar),
104                         addrgather_dlg.status_cid );
105                 if( msg ) {
106                         gtk_statusbar_push(
107                                 GTK_STATUSBAR(addrgather_dlg.statusbar),
108                                 addrgather_dlg.status_cid, msg );
109                 }
110         }
111 }
112
113 static gint addrgather_dlg_delete_event(
114         GtkWidget *widget, GdkEventAny *event, gpointer data )
115 {
116         addrgather_dlg.cancelled = TRUE;
117         gtk_main_quit();
118         return TRUE;
119 }
120
121 static gboolean addrgather_dlg_key_pressed(
122         GtkWidget *widget, GdkEventKey *event, gpointer data )
123 {
124         if( event && event->keyval == GDK_KEY_Escape ) {
125                 addrgather_dlg.cancelled = TRUE;
126                 gtk_main_quit();
127         }
128         return FALSE;
129 }
130
131 static void addrgather_size_allocate(
132         GtkWidget *widget, GtkAllocation *allocation )
133 {
134         cm_return_if_fail( allocation != NULL );
135         
136         prefs_common.addrgather_width   = allocation->width;
137         prefs_common.addrgather_height  = allocation->height;
138 }
139
140 #define FMT_BUFSIZE 32
141
142 static gboolean addrgather_dlg_harvest() {
143         GtkCMCList *clist;
144         gchar *text[ FIELDS_N_COLS ];
145         AddressHarvester *harvester;
146         AddressBookFile *abf;
147         gchar *name;
148         gchar *newFile;
149         gchar str[ FMT_BUFSIZE ];
150         gint cnt;
151         gint i;
152         gint sz;
153
154         name = gtk_editable_get_chars( GTK_EDITABLE(addrgather_dlg.entryBook), 0, -1 );
155         if( name == NULL || strlen( name ) < 1 ) {
156                 addrgather_dlg_status_show(
157                         _( "Please specify name for address book." ) );
158                 g_free( name );
159                 return FALSE;
160         }
161
162         /* Create harvest helper */
163         harvester = addrharvest_create();
164         addrharvest_set_path( harvester, addrgather_dlg.folderPath );
165
166         for( i = 0; i < NUM_FIELDS; i++ ) {
167                 addrharvest_set_header( harvester, _harv_headerNames_[i],
168                 gtk_toggle_button_get_active(
169                         GTK_TOGGLE_BUTTON(addrgather_dlg.checkHeader[i]) ) );
170         }
171         addrharvest_set_recurse( harvester,
172                 gtk_toggle_button_get_active(
173                         GTK_TOGGLE_BUTTON( addrgather_dlg.checkRecurse ) ) );
174
175         if( addrharvest_check_header( harvester ) == FALSE ) {
176                 addrgather_dlg_status_show(
177                         _( "Please select the mail headers to search." ) );
178                 addrharvest_free( harvester );
179                 g_free( name );
180                 return FALSE;
181         }
182
183         /* Go fer it */
184         addrgather_dlg_status_show( _( "Collecting addresses..." ) );
185         GTK_EVENTS_FLUSH();
186         sz = gtk_spin_button_get_value_as_int(
187                 GTK_SPIN_BUTTON( addrgather_dlg.spinbtnFolder ) );
188         addrharvest_set_folder_size( harvester, sz );
189
190         /* Create address book */
191         abf = addrbook_create_book();
192         addrbook_set_path( abf, _harv_addressIndex_->filePath );
193         newFile = addrbook_guess_next_file( abf );
194         addrbook_set_file( abf, newFile );
195         addrbook_set_name( abf, name );
196         g_free( newFile );
197         g_free( name );
198
199         /* Harvest addresses */
200         addrharvest_harvest(
201                 harvester, abf->addressCache, _harv_messageList_ );
202         addrbook_save_data( abf );
203         _harv_addressBook_ = abf;
204
205         /* Update summary count */
206         clist = GTK_CMCLIST(addrgather_dlg.clistCount);
207         gtk_cmclist_clear( clist );
208         for( i = 0; i < NUM_FIELDS; i++ ) {
209                 cnt = addrharvest_get_count( harvester, _harv_headerNames_[i] );
210                 if( cnt < 1 ) {
211                         strcpy( str, "-" );
212                 }
213                 else {
214                         sprintf( str, "%d", cnt );
215                 }
216                 text[ FIELD_COL_HEADER ] = _harv_headerNames_[i];
217                 text[ FIELD_COL_COUNT  ] = str;
218                 gtk_cmclist_append( clist, text );
219         }
220
221         addrharvest_free( harvester );
222
223         addrgather_dlg_status_show(_("Addresses collected successfully."));
224
225         /* Display summary page */
226         gtk_notebook_set_current_page(
227                 GTK_NOTEBOOK(addrgather_dlg.notebook), PAGE_FINISH );
228         addrgather_dlg.done = TRUE;
229         gtk_widget_set_sensitive( addrgather_dlg.btnCancel, FALSE );
230         gtk_widget_grab_default( addrgather_dlg.btnOk );
231
232         return TRUE;
233 }
234
235 static void addrgather_dlg_ok( GtkWidget *widget, gpointer data ) {
236         if(addrgather_dlg.done) {
237                 addrgather_dlg.done = FALSE;
238                 gtk_main_quit();
239                 return;
240         }
241         if( addrgather_dlg_harvest() ) {
242                 addrgather_dlg.cancelled = FALSE;
243         }
244 }
245
246 static void addrgather_dlg_cancel( GtkWidget *widget, gpointer data ) {
247         gtk_main_quit();
248 }
249
250 #define PACK_CHECK_BUTTON(box, checkbtn, label) \
251 { \
252         checkbtn = gtk_check_button_new_with_label(label); \
253         gtk_widget_show(checkbtn); \
254         gtk_box_pack_start(GTK_BOX(box), checkbtn, FALSE, TRUE, 0); \
255 }
256
257 /*
258  * Create notebook page for mail headers.
259  * Enter: pageNum Page number.
260  *        pageLbl Page label.
261  */
262 static void addrgather_page_fields(gint pageNum, gchar *pageLbl)
263 {
264         GtkWidget *vbox;
265         GtkWidget *vboxf;
266         GtkWidget *hboxs;
267         GtkWidget *table;
268         GtkWidget *label;
269         GtkWidget *labelFolder;
270         GtkWidget *entryBook;
271         GtkWidget *frameHeader;
272         GtkWidget *checkHeader[NUM_FIELDS];
273         GtkWidget *spinbtnFolder;
274         GtkAdjustment *adjFolder;
275         GtkWidget *checkRecurse;
276         gint top;
277         gint i;
278
279         /* Container */
280         vbox = gtk_vbox_new(FALSE, 6);
281         gtk_container_add(GTK_CONTAINER(addrgather_dlg.notebook), vbox);
282         gtk_container_set_border_width(GTK_CONTAINER(vbox), 4);
283
284         /* Notebook page */
285         label = gtk_label_new(pageLbl);
286         gtk_widget_show(label);
287         gtk_notebook_set_tab_label(GTK_NOTEBOOK(addrgather_dlg.notebook),
288                                    gtk_notebook_get_nth_page(GTK_NOTEBOOK(addrgather_dlg.notebook),
289                                                              pageNum), label);
290
291         /* Upper area - Field list */
292         table = gtk_table_new(4, 2, FALSE);
293         gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
294         gtk_table_set_row_spacings(GTK_TABLE(table), 4);
295         gtk_table_set_col_spacings(GTK_TABLE(table), 4);
296
297         /* First row */
298         top = 0;
299         label = gtk_label_new(_("Current folder:"));
300         gtk_table_attach( GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0 );
301         gtk_misc_set_alignment( GTK_MISC(label), 1.0, 0.5 );
302
303         labelFolder = gtk_label_new("");
304         gtk_table_attach( GTK_TABLE(table), labelFolder, 1, 2, top, (top + 1),
305                 GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0 );
306         gtk_misc_set_alignment( GTK_MISC(labelFolder), 0, 0.5 );
307
308         /* Second row */
309         top = 1;
310         label = gtk_label_new(_("Address book name:"));
311         gtk_table_attach( GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0 );
312         gtk_misc_set_alignment( GTK_MISC(label), 1.0, 0.5 );
313
314         entryBook = gtk_entry_new();
315         gtk_table_attach( GTK_TABLE(table), entryBook, 1, 2, top, (top + 1),
316                 GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0 );
317
318         /* Third row */
319         top = 2;
320         label = gtk_label_new(_("Address book folder size:"));
321         gtk_table_attach( GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0 );
322         gtk_misc_set_alignment( GTK_MISC(label), 1.0, 0.5 );
323         CLAWS_SET_TIP(label,
324                         _("Maximum amount of entries per folder within the newly created address book"));
325
326         hboxs = gtk_hbox_new(FALSE, 8);
327         adjFolder = gtk_adjustment_new(DFL_FOLDER_SIZE, MIN_FOLDER_SIZE, G_MAXINT, 1, 10, 0);
328         spinbtnFolder = gtk_spin_button_new(GTK_ADJUSTMENT(adjFolder), 1, 0);
329         gtk_box_pack_start(GTK_BOX(hboxs), spinbtnFolder, FALSE, FALSE, 0);
330         gtk_widget_set_size_request(spinbtnFolder, 100, -1);
331         gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(spinbtnFolder), TRUE);
332         gtk_table_attach(GTK_TABLE(table), hboxs, 1, 2, top, (top + 1), GTK_FILL, 0, 0, 0);
333         CLAWS_SET_TIP(spinbtnFolder,
334                         _("Maximum amount of entries per folder within the newly created address book"));
335
336         /* Fourth row */
337         top = 3;
338         frameHeader = gtk_frame_new(_("Process these mail header fields"));
339         gtk_widget_show(frameHeader);
340         gtk_table_attach(GTK_TABLE(table), frameHeader, 0, 2, top, (top + 4), GTK_FILL, 0, 0, 0);
341         gtk_frame_set_label_align(GTK_FRAME(frameHeader), 0.01, 0.5);
342
343         /* Check boxes */
344         vboxf = gtk_vbox_new(FALSE, 0);
345         gtk_widget_show(vboxf);
346         gtk_container_add(GTK_CONTAINER(frameHeader), vboxf);
347         gtk_container_set_border_width(GTK_CONTAINER(vboxf), 8);
348
349         for (i = 0; i < NUM_FIELDS; i++) {
350                 PACK_CHECK_BUTTON(vboxf, checkHeader[i],
351                         prefs_common_translated_header_name(_harv_headerNames_[i]));
352                 addrgather_dlg.checkHeader[i] = checkHeader[i];
353         }
354
355         /* Recurse folders */
356         top += 4;
357         checkRecurse = gtk_check_button_new_with_label( _("Include subfolders" ) );
358         gtk_table_attach( GTK_TABLE(table), checkRecurse, 0, 2, top, (top + 1),
359                         GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0 );
360
361         addrgather_dlg.labelFolder   = labelFolder;
362         addrgather_dlg.entryBook     = entryBook;
363         addrgather_dlg.spinbtnFolder = spinbtnFolder;
364         addrgather_dlg.checkRecurse  = checkRecurse;
365 }
366
367 /*
368  * Create notebook page for summary counts.
369  * Enter: pageNum Page number.
370  *        pageLbl Page label.
371  */
372 static void addrgather_page_finish( gint pageNum, gchar *pageLbl ) {
373         GtkWidget *label;
374         GtkWidget *vbox;
375         GtkWidget *clistSWin;
376         GtkWidget *clistCount;
377         gchar *titles[ FIELDS_N_COLS ];
378         gint i;
379
380         titles[ FIELD_COL_HEADER ] = _("Header Name");
381         titles[ FIELD_COL_COUNT  ] = _("Address Count");
382
383         vbox = gtk_vbox_new(FALSE, 8);
384         gtk_container_add( GTK_CONTAINER( addrgather_dlg.notebook ), vbox );
385         gtk_container_set_border_width( GTK_CONTAINER (vbox), 8 );
386
387         label = gtk_label_new( pageLbl );
388         gtk_widget_show( label );
389         gtk_notebook_set_tab_label(
390                 GTK_NOTEBOOK( addrgather_dlg.notebook ),
391                 gtk_notebook_get_nth_page( GTK_NOTEBOOK( addrgather_dlg.notebook ), pageNum ),
392                 label );
393
394         /* Summary count */
395         clistSWin = gtk_scrolled_window_new( NULL, NULL );
396         gtk_container_add( GTK_CONTAINER(vbox), clistSWin );
397         gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(clistSWin),
398                                        GTK_POLICY_AUTOMATIC,
399                                        GTK_POLICY_AUTOMATIC);
400
401         clistCount = gtk_cmclist_new_with_titles( FIELDS_N_COLS, titles );
402         gtk_container_add( GTK_CONTAINER(clistSWin), clistCount );
403         gtk_cmclist_set_selection_mode( GTK_CMCLIST(clistCount), GTK_SELECTION_BROWSE );
404         gtk_cmclist_set_column_width(
405                         GTK_CMCLIST(clistCount), FIELD_COL_HEADER, FIELDS_COL_WIDTH_HEADER );
406         gtk_cmclist_set_column_width(
407                         GTK_CMCLIST(clistCount), FIELD_COL_COUNT, FIELDS_COL_WIDTH_COUNT );
408
409         for( i = 0; i < FIELDS_N_COLS; i++ )
410                 gtkut_widget_set_can_focus(GTK_CMCLIST(clistCount)->column[i].button, FALSE);
411
412         addrgather_dlg.clistCount = clistCount;
413 }
414
415 /*
416  * Create notebook page for warning message.
417  * Enter: pageNum Page number.
418  *        pageLbl Page label.
419  */
420 static void addrgather_dlg_create(void)
421 {
422         GtkWidget *window;
423         GtkWidget *notebook;
424         GtkWidget *btnOk;
425         GtkWidget *btnCancel;
426         GtkWidget *statusbar;
427         GtkWidget *vbox;
428         GtkWidget *hbbox;
429         GtkWidget *hsbox;
430         static GdkGeometry geometry;
431         
432         window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "addrgather");
433         gtk_container_set_border_width(GTK_CONTAINER(window), 4);
434         gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
435         gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
436         
437         g_signal_connect(G_OBJECT(window), "delete_event",
438                          G_CALLBACK(addrgather_dlg_delete_event), NULL);
439         g_signal_connect(G_OBJECT(window), "key_press_event",
440                          G_CALLBACK(addrgather_dlg_key_pressed), NULL);
441         g_signal_connect(G_OBJECT(window), "size_allocate",
442                          G_CALLBACK(addrgather_size_allocate), NULL);
443
444         vbox = gtk_vbox_new(FALSE, 6);
445         gtk_container_add(GTK_CONTAINER(window), vbox);
446
447         /* Notebook */
448         notebook = gtk_notebook_new();
449         gtk_notebook_set_show_tabs(GTK_NOTEBOOK(notebook), FALSE);
450         gtk_widget_show(notebook);
451         gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0);
452         gtk_container_set_border_width(GTK_CONTAINER(notebook), 6);
453
454         /* Status line */
455         hsbox = gtk_hbox_new(FALSE, 0);
456         gtk_box_pack_end(GTK_BOX(vbox), hsbox, FALSE, FALSE, 0);
457         statusbar = gtk_statusbar_new();
458         gtk_box_pack_start(GTK_BOX(hsbox), statusbar, TRUE, TRUE, 0);
459
460         /* Button panel */
461         gtkut_stock_button_set_create(&hbbox, &btnCancel, GTK_STOCK_CANCEL,
462                                       &btnOk, GTK_STOCK_OK,
463                                       NULL, NULL);
464         gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0);
465
466         /* Signal handlers */
467         g_signal_connect(G_OBJECT(btnOk), "clicked",
468                          G_CALLBACK(addrgather_dlg_ok), NULL);
469         g_signal_connect(G_OBJECT(btnCancel), "clicked",
470                          G_CALLBACK(addrgather_dlg_cancel), NULL);
471
472         if (!geometry.min_width) {
473                 geometry.min_width = 450;
474                 geometry.min_height = -1;
475         }
476
477         gtk_window_set_geometry_hints(GTK_WINDOW(window), NULL, &geometry,
478                                       GDK_HINT_MIN_SIZE);
479         gtk_window_set_default_size(GTK_WINDOW(window), prefs_common.addrgather_width,
480                                     prefs_common.addrgather_height);
481
482         addrgather_dlg.window     = window;
483         addrgather_dlg.notebook   = notebook;
484         addrgather_dlg.btnOk      = btnOk;
485         addrgather_dlg.btnCancel  = btnCancel;
486         addrgather_dlg.statusbar  = statusbar;
487         addrgather_dlg.status_cid = gtk_statusbar_get_context_id(GTK_STATUSBAR(statusbar),
488                                                                  "Collect Email Address Dialog");
489
490         /* Create notebook pages */
491         addrgather_page_fields(PAGE_FIELDS, _("Header Fields"));
492         addrgather_page_finish(PAGE_FINISH, _("Finish"));
493         gtk_widget_show_all(addrgather_dlg.window);
494 }
495
496 /*
497  * Harvest addresses main window.
498  * Enter: folderItem Source folder.
499  *        addrIndex  Address index.
500  *        sourceInd  Source indicator: FALSE - Folder, TRUE - Messages.
501  *        msgList    List of message numbers, or NULL to process folder.
502  * Return: Populated address book file, or NULL if none created.
503  */
504 AddressBookFile *addrgather_dlg_execute(FolderItem *folderItem, AddressIndex *addrIndex,
505                                         gboolean sourceInd, GList *msgList)
506 {
507         gint i;
508
509         _harv_addressIndex_ = addrIndex;
510         _harv_addressBook_ = NULL;
511         _harv_messageList_ = msgList;
512
513         /* Create dialog */
514         if (!addrgather_dlg.window)
515                 addrgather_dlg_create();
516         
517         addrgather_dlg.done = FALSE;
518
519         gtk_notebook_set_current_page(GTK_NOTEBOOK(addrgather_dlg.notebook), PAGE_FIELDS);
520         addrgather_dlg.folderPath = folder_item_get_path(folderItem);
521
522         /* Setup some default values */
523         gtk_label_set_text(GTK_LABEL(addrgather_dlg.labelFolder), folderItem->path);
524         gtk_entry_set_text(GTK_ENTRY(addrgather_dlg.entryBook), folderItem->path);
525
526         for (i = 0; i < NUM_FIELDS; i++) {
527                 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(addrgather_dlg.checkHeader[i]),
528                                              FALSE);
529                 if (g_utf8_collate(_harv_headerNames_[i], HEADER_FROM) == 0)
530                         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(addrgather_dlg.checkHeader[i]),
531                                                     TRUE);
532         }
533
534         gtk_widget_set_sensitive(addrgather_dlg.btnOk, TRUE);
535         gtk_widget_set_sensitive(addrgather_dlg.btnCancel, TRUE);
536         gtk_widget_grab_default(addrgather_dlg.btnOk);
537
538         /* Apply window title */
539         if (sourceInd) {
540                 gtk_window_set_title(GTK_WINDOW(addrgather_dlg.window),
541                                      _("Collect email addresses from selected messages"));
542                 gtk_widget_set_sensitive(addrgather_dlg.checkRecurse, FALSE);
543         } else {
544                 gtk_window_set_title(GTK_WINDOW(addrgather_dlg.window),
545                                      _("Collect email addresses from folder"));
546                 gtk_widget_set_sensitive(addrgather_dlg.checkRecurse, TRUE);
547         }
548         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(addrgather_dlg.checkRecurse), FALSE);
549
550         addrgather_dlg_status_show("");
551         gtk_widget_show(addrgather_dlg.window);
552         gtk_window_set_modal(GTK_WINDOW(addrgather_dlg.window), TRUE);
553         gtk_widget_grab_focus(addrgather_dlg.entryBook);
554         manage_window_set_transient(GTK_WINDOW(addrgather_dlg.window));
555         gtk_main();
556
557         g_free(addrgather_dlg.folderPath);
558         addrgather_dlg.folderPath = NULL;
559         gtk_widget_hide(addrgather_dlg.window);
560         gtk_window_set_modal(GTK_WINDOW(addrgather_dlg.window), FALSE);
561         _harv_addressIndex_ = NULL;
562
563         if (addrgather_dlg.cancelled == TRUE)
564                 return NULL;
565
566         return _harv_addressBook_;
567 }
568
569 /*
570 * End of Source.
571 */
572
573