Statistics
| Revision:

root / src / editaddress.c @ 778

History | View | Annotate | Download (36.9 kB)

1 1 hiro
/*
2 1 hiro
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 237 hiro
 * Copyright (C) 1999-2005 Hiroyuki Yamamoto
4 1 hiro
 *
5 1 hiro
 * This program is free software; you can redistribute it and/or modify
6 1 hiro
 * it under the terms of the GNU General Public License as published by
7 1 hiro
 * the Free Software Foundation; either version 2 of the License, or
8 1 hiro
 * (at your option) any later version.
9 1 hiro
 *
10 1 hiro
 * This program is distributed in the hope that it will be useful,
11 1 hiro
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 1 hiro
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 1 hiro
 * GNU General Public License for more details.
14 1 hiro
 *
15 1 hiro
 * You should have received a copy of the GNU General Public License
16 1 hiro
 * along with this program; if not, write to the Free Software
17 1 hiro
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 1 hiro
 */
19 1 hiro
20 1 hiro
#ifdef HAVE_CONFIG_H
21 1 hiro
#  include "config.h"
22 1 hiro
#endif
23 1 hiro
24 1 hiro
#include "defs.h"
25 1 hiro
26 1 hiro
#include <glib.h>
27 92 hiro
#include <glib/gi18n.h>
28 1 hiro
#include <gdk/gdkkeysyms.h>
29 1 hiro
#include <gtk/gtkwindow.h>
30 1 hiro
#include <gtk/gtksignal.h>
31 1 hiro
#include <gtk/gtklabel.h>
32 1 hiro
#include <gtk/gtkvbox.h>
33 1 hiro
#include <gtk/gtkentry.h>
34 1 hiro
#include <gtk/gtktable.h>
35 237 hiro
#include <gtk/gtkstatusbar.h>
36 237 hiro
#include <gtk/gtknotebook.h>
37 237 hiro
#include <gtk/gtkvbbox.h>
38 237 hiro
#include <gtk/gtkstock.h>
39 1 hiro
40 1 hiro
#include "mgutils.h"
41 1 hiro
#include "addressbook.h"
42 1 hiro
#include "addressitem.h"
43 1 hiro
#include "addritem.h"
44 1 hiro
#include "addrbook.h"
45 1 hiro
#include "manage_window.h"
46 1 hiro
#include "gtkutils.h"
47 1 hiro
#include "codeconv.h"
48 1 hiro
49 1 hiro
#include "prefs_common.h"
50 1 hiro
51 1 hiro
/*
52 1 hiro
static struct _AddressEdit_dlg {
53 1 hiro
        GtkWidget *window;
54 1 hiro
        GtkWidget *name_entry;
55 1 hiro
        GtkWidget *addr_entry;
56 1 hiro
        GtkWidget *rem_entry;
57 1 hiro
        GtkWidget *ok_btn;
58 1 hiro
        GtkWidget *cancel_btn;
59 1 hiro
} addredit;
60 1 hiro
*/
61 1 hiro
62 1 hiro
static struct _PersonEdit_dlg {
63 1 hiro
        GtkWidget *window;
64 1 hiro
        GtkWidget *notebook;
65 405 hiro
        GtkWidget *hbbox;
66 1 hiro
        GtkWidget *ok_btn;
67 1 hiro
        GtkWidget *cancel_btn;
68 1 hiro
        GtkWidget *statusbar;
69 1 hiro
        gint status_cid;
70 1 hiro
71 1 hiro
        /* Basic data tab */
72 1 hiro
        GtkWidget *entry_name;
73 1 hiro
        GtkWidget *entry_first;
74 1 hiro
        GtkWidget *entry_last;
75 1 hiro
        GtkWidget *entry_nick;
76 1 hiro
77 1 hiro
        /* EMail data tab */
78 1 hiro
        GtkWidget *entry_email;
79 1 hiro
        GtkWidget *entry_alias;
80 1 hiro
        GtkWidget *entry_remarks;
81 1 hiro
        GtkWidget *clist_email;
82 1 hiro
83 1 hiro
        /* Attribute data tab */
84 1 hiro
        GtkWidget *entry_atname;
85 1 hiro
        GtkWidget *entry_atvalue;
86 1 hiro
        GtkWidget *clist_attrib;
87 1 hiro
88 1 hiro
        gint rowIndEMail;
89 1 hiro
        gint rowIndAttrib;
90 1 hiro
        gboolean editNew;
91 1 hiro
92 1 hiro
} personeditdlg;
93 1 hiro
94 1 hiro
typedef enum {
95 1 hiro
        EMAIL_COL_EMAIL   = 0,
96 1 hiro
        EMAIL_COL_ALIAS   = 1,
97 1 hiro
        EMAIL_COL_REMARKS = 2
98 1 hiro
} PersonEditEMailColumnPos;
99 1 hiro
100 1 hiro
typedef enum {
101 1 hiro
        ATTRIB_COL_NAME    = 0,
102 1 hiro
        ATTRIB_COL_VALUE   = 1
103 1 hiro
} PersonEditAttribColumnPos;
104 1 hiro
105 1 hiro
#define EDITPERSON_WIDTH      520
106 1 hiro
#define EDITPERSON_HEIGHT     340
107 1 hiro
108 1 hiro
#define EMAIL_N_COLS          3
109 1 hiro
#define EMAIL_COL_WIDTH_EMAIL 180
110 1 hiro
#define EMAIL_COL_WIDTH_ALIAS 80
111 1 hiro
112 1 hiro
#define ATTRIB_N_COLS          2
113 1 hiro
#define ATTRIB_COL_WIDTH_NAME  120
114 1 hiro
#define ATTRIB_COL_WIDTH_VALUE 180
115 1 hiro
116 1 hiro
#define PAGE_BASIC             0
117 1 hiro
#define PAGE_EMAIL             1
118 1 hiro
#define PAGE_ATTRIBUTES        2
119 1 hiro
120 1 hiro
#if 0
121 1 hiro
#define SET_LABEL_AND_ENTRY(str, entry, top) \
122 1 hiro
{ \
123 1 hiro
        label = gtk_label_new(str); \
124 1 hiro
        gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), \
125 1 hiro
                         GTK_FILL, 0, 0, 0); \
126 1 hiro
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); \
127 1 hiro
 \
128 1 hiro
        entry = gtk_entry_new(); \
129 1 hiro
        gtk_table_attach(GTK_TABLE(table), entry, 1, 2, top, (top + 1), \
130 1 hiro
                         GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); \
131 1 hiro
}
132 1 hiro
133 1 hiro
static void edit_address_ok(GtkWidget *widget, gboolean *cancelled)
134 1 hiro
{
135 1 hiro
        *cancelled = FALSE;
136 1 hiro
        gtk_main_quit();
137 1 hiro
}
138 1 hiro
139 1 hiro
static void edit_address_cancel(GtkWidget *widget, gboolean *cancelled)
140 1 hiro
{
141 1 hiro
        *cancelled = TRUE;
142 1 hiro
        gtk_main_quit();
143 1 hiro
}
144 1 hiro
145 1 hiro
static gint edit_address_delete_event(GtkWidget *widget, GdkEventAny *event,
146 1 hiro
                                      gboolean *cancelled)
147 1 hiro
{
148 1 hiro
        *cancelled = TRUE;
149 1 hiro
        gtk_main_quit();
150 1 hiro
151 1 hiro
        return TRUE;
152 1 hiro
}
153 1 hiro
154 1 hiro
static gboolean edit_address_key_pressed(GtkWidget *widget, GdkEventKey *event,
155 1 hiro
                                         gboolean *cancelled)
156 1 hiro
{
157 1 hiro
        if (event && event->keyval == GDK_Escape) {
158 1 hiro
                *cancelled = TRUE;
159 1 hiro
                gtk_main_quit();
160 1 hiro
        }
161 1 hiro
        return FALSE;
162 1 hiro
}
163 1 hiro
164 1 hiro
static void addressbook_edit_address_create(gboolean *cancelled)
165 1 hiro
{
166 1 hiro
        GtkWidget *window;
167 1 hiro
        GtkWidget *vbox;
168 1 hiro
        GtkWidget *table;
169 1 hiro
        GtkWidget *label;
170 1 hiro
        GtkWidget *name_entry;
171 1 hiro
        GtkWidget *addr_entry;
172 1 hiro
        GtkWidget *rem_entry;
173 1 hiro
        GtkWidget *hbbox;
174 1 hiro
        GtkWidget *ok_btn;
175 1 hiro
        GtkWidget *cancel_btn;
176 1 hiro
177 1 hiro
        debug_print("Creating edit_address window...\n");
178 1 hiro
179 1 hiro
        window = gtk_window_new(GTK_WINDOW_DIALOG);
180 1 hiro
        gtk_widget_set_size_request(window, 400, -1);
181 1 hiro
        /* gtk_container_set_border_width(GTK_CONTAINER(window), 8); */
182 1 hiro
        gtk_window_set_title(GTK_WINDOW(window), _("Edit address"));
183 1 hiro
        gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
184 1 hiro
        gtk_window_set_modal(GTK_WINDOW(window), TRUE);
185 1 hiro
        g_signal_connect(G_OBJECT(window), "delete_event",
186 1 hiro
                         G_CALLBACK(edit_address_delete_event),
187 1 hiro
                         cancelled);
188 1 hiro
        g_signal_connect(G_OBJECT(window), "key_press_event",
189 1 hiro
                         G_CALLBACK(edit_address_key_pressed),
190 1 hiro
                         cancelled);
191 1 hiro
192 1 hiro
        vbox = gtk_vbox_new(FALSE, 8);
193 1 hiro
        gtk_container_add(GTK_CONTAINER(window), vbox);
194 1 hiro
195 1 hiro
        table = gtk_table_new(3, 2, FALSE);
196 1 hiro
        gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
197 1 hiro
        gtk_table_set_row_spacings(GTK_TABLE(table), 8);
198 1 hiro
        gtk_table_set_col_spacings(GTK_TABLE(table), 8);
199 1 hiro
200 1 hiro
        SET_LABEL_AND_ENTRY(_("Name"),    name_entry, 0);
201 1 hiro
        SET_LABEL_AND_ENTRY(_("Address"), addr_entry, 1);
202 1 hiro
        SET_LABEL_AND_ENTRY(_("Remarks"), rem_entry,  2);
203 1 hiro
204 31 hiro
        gtkut_stock_button_set_create(&hbbox, &ok_btn, GTK_STOCK_OK,
205 31 hiro
                                      &cancel_btn, GTK_STOCK_CANCEL,
206 31 hiro
                                      NULL, NULL);
207 1 hiro
        gtk_box_pack_end(GTK_BOX(vbox), hbbox, FALSE, FALSE, 0);
208 1 hiro
        gtk_widget_grab_default(ok_btn);
209 1 hiro
210 1 hiro
        g_signal_connect(G_OBJECT(ok_btn), "clicked",
211 1 hiro
                         G_CALLBACK(edit_address_ok), cancelled);
212 1 hiro
        g_signal_connect(G_OBJECT(cancel_btn), "clicked",
213 1 hiro
                         G_CALLBACK(edit_address_cancel), cancelled);
214 1 hiro
215 1 hiro
        gtk_widget_show_all(vbox);
216 1 hiro
217 1 hiro
        addredit.window     = window;
218 1 hiro
        addredit.name_entry = name_entry;
219 1 hiro
        addredit.addr_entry = addr_entry;
220 1 hiro
        addredit.rem_entry  = rem_entry;
221 1 hiro
        addredit.ok_btn     = ok_btn;
222 1 hiro
        addredit.cancel_btn = cancel_btn;
223 1 hiro
}
224 1 hiro
225 1 hiro
AddressItem *addressbook_edit_address(AddressItem *item)
226 1 hiro
{
227 1 hiro
        static gboolean cancelled;
228 1 hiro
        const gchar *str;
229 1 hiro
230 1 hiro
        if (!addredit.window)
231 1 hiro
                addressbook_edit_address_create(&cancelled);
232 1 hiro
        gtk_widget_grab_focus(addredit.ok_btn);
233 1 hiro
        gtk_widget_grab_focus(addredit.name_entry);
234 1 hiro
        gtk_widget_show(addredit.window);
235 1 hiro
        manage_window_set_transient(GTK_WINDOW(addredit.window));
236 1 hiro
237 1 hiro
        gtk_entry_set_text(GTK_ENTRY(addredit.name_entry), "");
238 1 hiro
        gtk_entry_set_text(GTK_ENTRY(addredit.addr_entry), "");
239 1 hiro
        gtk_entry_set_text(GTK_ENTRY(addredit.rem_entry),  "");
240 1 hiro
241 1 hiro
        if (item) {
242 1 hiro
                if (ADDRESS_OBJECT_NAME(item))
243 1 hiro
                        gtk_entry_set_text(GTK_ENTRY(addredit.name_entry),
244 1 hiro
                                           ADDRESS_OBJECT_NAME(item));
245 1 hiro
                if (item->address)
246 1 hiro
                        gtk_entry_set_text(GTK_ENTRY(addredit.addr_entry),
247 1 hiro
                                           item->address);
248 1 hiro
                if (item->remarks)
249 1 hiro
                        gtk_entry_set_text(GTK_ENTRY(addredit.rem_entry),
250 1 hiro
                                           item->remarks);
251 1 hiro
        }
252 1 hiro
253 1 hiro
        gtk_main();
254 1 hiro
        gtk_widget_hide(addredit.window);
255 1 hiro
        if (cancelled == TRUE) return NULL;
256 1 hiro
257 1 hiro
        str = gtk_entry_get_text(GTK_ENTRY(addredit.name_entry));
258 1 hiro
        if (*str == '\0') return NULL;
259 1 hiro
260 1 hiro
        if (!item) {
261 1 hiro
                item = mgu_create_address();
262 1 hiro
                ADDRESS_OBJECT_TYPE(item) = ADDR_ITEM;
263 1 hiro
        }
264 1 hiro
265 1 hiro
        g_free(ADDRESS_OBJECT_NAME(item));
266 1 hiro
        ADDRESS_OBJECT_NAME(item) = g_strdup(str);
267 1 hiro
268 1 hiro
        str = gtk_entry_get_text(GTK_ENTRY(addredit.addr_entry));
269 1 hiro
        g_free(item->address);
270 1 hiro
        if (*str == '\0')
271 1 hiro
                item->address = NULL;
272 1 hiro
        else
273 1 hiro
                item->address = g_strdup(str);
274 1 hiro
275 1 hiro
        str = gtk_entry_get_text(GTK_ENTRY(addredit.rem_entry));
276 1 hiro
        g_free(item->remarks);
277 1 hiro
        if (*str == '\0')
278 1 hiro
                item->remarks = NULL;
279 1 hiro
        else
280 1 hiro
                item->remarks = g_strdup(str);
281 1 hiro
282 1 hiro
        return item;
283 1 hiro
}
284 1 hiro
#endif /* 0 */
285 1 hiro
286 1 hiro
static void edit_person_status_show( gchar *msg ) {
287 1 hiro
        if( personeditdlg.statusbar != NULL ) {
288 1 hiro
                gtk_statusbar_pop( GTK_STATUSBAR(personeditdlg.statusbar), personeditdlg.status_cid );
289 1 hiro
                if( msg ) {
290 1 hiro
                        gtk_statusbar_push( GTK_STATUSBAR(personeditdlg.statusbar), personeditdlg.status_cid, msg );
291 1 hiro
                }
292 1 hiro
        }
293 1 hiro
}
294 1 hiro
295 1 hiro
static void edit_person_ok(GtkWidget *widget, gboolean *cancelled) {
296 1 hiro
        *cancelled = FALSE;
297 1 hiro
        gtk_main_quit();
298 1 hiro
}
299 1 hiro
300 1 hiro
static void edit_person_cancel(GtkWidget *widget, gboolean *cancelled) {
301 1 hiro
        *cancelled = TRUE;
302 1 hiro
        gtk_main_quit();
303 1 hiro
}
304 1 hiro
305 1 hiro
static gint edit_person_delete_event(GtkWidget *widget, GdkEventAny *event, gboolean *cancelled) {
306 1 hiro
        *cancelled = TRUE;
307 1 hiro
        gtk_main_quit();
308 1 hiro
        return TRUE;
309 1 hiro
}
310 1 hiro
311 1 hiro
static gboolean edit_person_key_pressed(GtkWidget *widget, GdkEventKey *event, gboolean *cancelled) {
312 1 hiro
        if (event && event->keyval == GDK_Escape) {
313 1 hiro
                *cancelled = TRUE;
314 1 hiro
                gtk_main_quit();
315 1 hiro
        }
316 1 hiro
        return FALSE;
317 1 hiro
}
318 1 hiro
319 1 hiro
static gchar *_title_new_ = NULL;
320 1 hiro
static gchar *_title_edit_ = NULL;
321 1 hiro
322 1 hiro
static void edit_person_set_window_title( gint pageNum ) {
323 1 hiro
        gchar *sTitle;
324 1 hiro
325 1 hiro
        if( _title_new_ == NULL ) {
326 1 hiro
                _title_new_ = g_strdup( _("Add New Person") );
327 1 hiro
                _title_edit_ = g_strdup( _("Edit Person Details") );
328 1 hiro
        }
329 1 hiro
330 1 hiro
        if( pageNum == PAGE_BASIC ) {
331 1 hiro
                if( personeditdlg.editNew ) {
332 1 hiro
                        gtk_window_set_title( GTK_WINDOW(personeditdlg.window), _title_new_ );
333 1 hiro
                }
334 1 hiro
                else {
335 1 hiro
                        gtk_window_set_title( GTK_WINDOW(personeditdlg.window), _title_edit_ );
336 1 hiro
                }
337 1 hiro
        }
338 1 hiro
        else {
339 1 hiro
                if( personeditdlg.entry_name == NULL ) {
340 1 hiro
                        sTitle = g_strdup( _title_edit_ );
341 1 hiro
                }
342 1 hiro
                else {
343 1 hiro
                        gchar *name;
344 1 hiro
                        name = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_name), 0, -1 );
345 1 hiro
                        sTitle = g_strdup_printf( "%s - %s", _title_edit_, name );
346 1 hiro
                        g_free( name );
347 1 hiro
                }
348 1 hiro
                gtk_window_set_title( GTK_WINDOW(personeditdlg.window), sTitle );
349 1 hiro
                g_free( sTitle );
350 1 hiro
        }
351 1 hiro
}
352 1 hiro
353 1 hiro
static void edit_person_email_clear( gpointer data ) {
354 1 hiro
        gtk_entry_set_text( GTK_ENTRY(personeditdlg.entry_email), "" );
355 1 hiro
        gtk_entry_set_text( GTK_ENTRY(personeditdlg.entry_alias), "" );
356 1 hiro
        gtk_entry_set_text( GTK_ENTRY(personeditdlg.entry_remarks), "" );
357 1 hiro
}
358 1 hiro
359 1 hiro
static void edit_person_attrib_clear( gpointer data ) {
360 1 hiro
        gtk_entry_set_text( GTK_ENTRY(personeditdlg.entry_atname), "" );
361 1 hiro
        gtk_entry_set_text( GTK_ENTRY(personeditdlg.entry_atvalue), "" );
362 1 hiro
}
363 1 hiro
364 1 hiro
static void edit_person_switch_page( GtkNotebook *notebook, GtkNotebookPage *page,
365 1 hiro
                                        gint pageNum, gpointer user_data)
366 1 hiro
{
367 1 hiro
        edit_person_set_window_title( pageNum );
368 1 hiro
        edit_person_status_show( "" );
369 1 hiro
}
370 1 hiro
371 1 hiro
/*
372 1 hiro
* Load clist with a copy of person's email addresses.
373 1 hiro
*/
374 1 hiro
void edit_person_load_email( ItemPerson *person ) {
375 1 hiro
        GList *node = person->listEMail;
376 1 hiro
        GtkCList *clist = GTK_CLIST(personeditdlg.clist_email);
377 1 hiro
        gchar *text[ EMAIL_N_COLS ];
378 1 hiro
        while( node ) {
379 1 hiro
                ItemEMail *emorig = ( ItemEMail * ) node->data;
380 1 hiro
                ItemEMail *email = addritem_copy_item_email( emorig );
381 1 hiro
                gint row;
382 1 hiro
                text[ EMAIL_COL_EMAIL   ] = email->address;
383 1 hiro
                text[ EMAIL_COL_ALIAS   ] = email->obj.name;
384 1 hiro
                text[ EMAIL_COL_REMARKS ] = email->remarks;
385 1 hiro
386 1 hiro
                row = gtk_clist_append( clist, text );
387 1 hiro
                gtk_clist_set_row_data( clist, row, email );
388 1 hiro
                node = g_list_next( node );
389 1 hiro
        }
390 1 hiro
}
391 1 hiro
392 1 hiro
static void edit_person_email_list_selected( GtkCList *clist, gint row, gint column, GdkEvent *event, gpointer data ) {
393 1 hiro
        ItemEMail *email = gtk_clist_get_row_data( clist, row );
394 1 hiro
        if( email ) {
395 1 hiro
                if( email->address )
396 1 hiro
                        gtk_entry_set_text( GTK_ENTRY(personeditdlg.entry_email), email->address );
397 1 hiro
                if( ADDRITEM_NAME(email) )
398 1 hiro
                        gtk_entry_set_text( GTK_ENTRY(personeditdlg.entry_alias), ADDRITEM_NAME(email) );
399 1 hiro
                if( email->remarks )
400 1 hiro
                        gtk_entry_set_text( GTK_ENTRY(personeditdlg.entry_remarks), email->remarks );
401 1 hiro
        }
402 1 hiro
        personeditdlg.rowIndEMail = row;
403 1 hiro
        edit_person_status_show( NULL );
404 1 hiro
}
405 1 hiro
406 1 hiro
static void edit_person_email_move( gint dir ) {
407 1 hiro
        GtkCList *clist = GTK_CLIST(personeditdlg.clist_email);
408 1 hiro
        gint row = personeditdlg.rowIndEMail + dir;
409 1 hiro
        ItemEMail *email = gtk_clist_get_row_data( clist, row );
410 1 hiro
        if( email ) {
411 1 hiro
                gtk_clist_row_move( clist, personeditdlg.rowIndEMail, row );
412 1 hiro
                personeditdlg.rowIndEMail = row;
413 1 hiro
        }
414 1 hiro
        edit_person_email_clear( NULL );
415 1 hiro
        edit_person_status_show( NULL );
416 1 hiro
}
417 1 hiro
418 1 hiro
static void edit_person_email_move_up( gpointer data ) {
419 1 hiro
        edit_person_email_move( -1 );
420 1 hiro
}
421 1 hiro
422 1 hiro
static void edit_person_email_move_down( gpointer data ) {
423 1 hiro
        edit_person_email_move( +1 );
424 1 hiro
}
425 1 hiro
426 1 hiro
static void edit_person_email_delete( gpointer data ) {
427 1 hiro
        GtkCList *clist = GTK_CLIST(personeditdlg.clist_email);
428 1 hiro
        gint row = personeditdlg.rowIndEMail;
429 1 hiro
        ItemEMail *email = gtk_clist_get_row_data( clist, row );
430 1 hiro
        edit_person_email_clear( NULL );
431 1 hiro
        if( email ) {
432 1 hiro
                /* Remove list entry */
433 1 hiro
                gtk_clist_remove( clist, row );
434 1 hiro
                addritem_free_item_email( email );
435 1 hiro
                email = NULL;
436 1 hiro
        }
437 1 hiro
438 1 hiro
        /* Position hilite bar */
439 1 hiro
        email = gtk_clist_get_row_data( clist, row );
440 1 hiro
        if( ! email ) {
441 1 hiro
                personeditdlg.rowIndEMail = -1 + row;
442 1 hiro
        }
443 1 hiro
        edit_person_status_show( NULL );
444 1 hiro
}
445 1 hiro
446 1 hiro
static ItemEMail *edit_person_email_edit( gboolean *error, ItemEMail *email ) {
447 1 hiro
        ItemEMail *retVal = NULL;
448 1 hiro
        gchar *sEmail, *sAlias, *sRemarks, *sEmail_;
449 1 hiro
450 1 hiro
        *error = TRUE;
451 1 hiro
        sEmail_ = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_email), 0, -1 );
452 1 hiro
        sAlias = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_alias), 0, -1 );
453 1 hiro
        sRemarks = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_remarks), 0, -1 );
454 1 hiro
        sEmail = mgu_email_check_empty( sEmail_ );
455 1 hiro
        g_free( sEmail_ );
456 1 hiro
457 1 hiro
        if( sEmail ) {
458 1 hiro
                if( email == NULL ) {
459 1 hiro
                        email = addritem_create_item_email();
460 1 hiro
                }
461 1 hiro
                addritem_email_set_address( email, sEmail );
462 1 hiro
                addritem_email_set_alias( email, sAlias );
463 1 hiro
                addritem_email_set_remarks( email, sRemarks );
464 1 hiro
                retVal = email;
465 1 hiro
                *error = FALSE;
466 1 hiro
        }
467 1 hiro
        else {
468 1 hiro
                edit_person_status_show( _( "An E-Mail address must be supplied." ) );
469 1 hiro
        }
470 1 hiro
471 1 hiro
        g_free( sEmail );
472 1 hiro
        g_free( sAlias );
473 1 hiro
        g_free( sRemarks );
474 1 hiro
475 1 hiro
        return retVal;
476 1 hiro
}
477 1 hiro
478 1 hiro
static void edit_person_email_modify( gpointer data ) {
479 1 hiro
        gboolean errFlg = FALSE;
480 1 hiro
        GtkCList *clist = GTK_CLIST(personeditdlg.clist_email);
481 1 hiro
        gint row = personeditdlg.rowIndEMail;
482 1 hiro
        ItemEMail *email = gtk_clist_get_row_data( clist, row );
483 1 hiro
        if( email ) {
484 1 hiro
                edit_person_email_edit( &errFlg, email );
485 1 hiro
                if( ! errFlg ) {
486 1 hiro
                        gtk_clist_set_text( clist, row, EMAIL_COL_EMAIL, email->address );
487 1 hiro
                        gtk_clist_set_text( clist, row, EMAIL_COL_ALIAS, email->obj.name );
488 1 hiro
                        gtk_clist_set_text( clist, row, EMAIL_COL_REMARKS, email->remarks );
489 1 hiro
                        edit_person_email_clear( NULL );
490 1 hiro
                }
491 1 hiro
        }
492 1 hiro
}
493 1 hiro
494 1 hiro
static void edit_person_email_add( gpointer data ) {
495 1 hiro
        GtkCList *clist = GTK_CLIST(personeditdlg.clist_email);
496 1 hiro
        gboolean errFlg = FALSE;
497 1 hiro
        ItemEMail *email = NULL;
498 1 hiro
        gint row = personeditdlg.rowIndEMail;
499 1 hiro
        if( gtk_clist_get_row_data( clist, row ) == NULL ) row = 0;
500 1 hiro
501 1 hiro
        email = edit_person_email_edit( &errFlg, NULL );
502 1 hiro
        if( ! errFlg ) {
503 1 hiro
                gchar *text[ EMAIL_N_COLS ];
504 1 hiro
                text[ EMAIL_COL_EMAIL   ] = email->address;
505 1 hiro
                text[ EMAIL_COL_ALIAS   ] = email->obj.name;
506 1 hiro
                text[ EMAIL_COL_REMARKS ] = email->remarks;
507 1 hiro
508 1 hiro
                row = gtk_clist_insert( clist, 1 + row, text );
509 1 hiro
                gtk_clist_set_row_data( clist, row, email );
510 1 hiro
                gtk_clist_select_row( clist, row, 0 );
511 1 hiro
                edit_person_email_clear( NULL );
512 1 hiro
        }
513 1 hiro
}
514 1 hiro
515 1 hiro
/*
516 1 hiro
* Load clist with a copy of person's email addresses.
517 1 hiro
*/
518 1 hiro
void edit_person_load_attrib( ItemPerson *person ) {
519 1 hiro
        GList *node = person->listAttrib;
520 1 hiro
        GtkCList *clist = GTK_CLIST(personeditdlg.clist_attrib);
521 1 hiro
        gchar *text[ ATTRIB_N_COLS ];
522 1 hiro
        while( node ) {
523 1 hiro
                UserAttribute *atorig = ( UserAttribute * ) node->data;
524 1 hiro
                UserAttribute *attrib = addritem_copy_attribute( atorig );
525 1 hiro
                gint row;
526 1 hiro
                text[ ATTRIB_COL_NAME  ] = attrib->name;
527 1 hiro
                text[ ATTRIB_COL_VALUE ] = attrib->value;
528 1 hiro
529 1 hiro
                row = gtk_clist_append( clist, text );
530 1 hiro
                gtk_clist_set_row_data( clist, row, attrib );
531 1 hiro
                node = g_list_next( node );
532 1 hiro
        }
533 1 hiro
}
534 1 hiro
535 1 hiro
static void edit_person_attrib_list_selected( GtkCList *clist, gint row, gint column, GdkEvent *event, gpointer data ) {
536 1 hiro
        UserAttribute *attrib = gtk_clist_get_row_data( clist, row );
537 1 hiro
        if( attrib ) {
538 1 hiro
                gtk_entry_set_text( GTK_ENTRY(personeditdlg.entry_atname), attrib->name );
539 1 hiro
                gtk_entry_set_text( GTK_ENTRY(personeditdlg.entry_atvalue), attrib->value );
540 1 hiro
        }
541 1 hiro
        personeditdlg.rowIndAttrib = row;
542 1 hiro
        edit_person_status_show( NULL );
543 1 hiro
}
544 1 hiro
545 1 hiro
static void edit_person_attrib_delete( gpointer data ) {
546 1 hiro
        GtkCList *clist = GTK_CLIST(personeditdlg.clist_attrib);
547 1 hiro
        gint row = personeditdlg.rowIndAttrib;
548 1 hiro
        UserAttribute *attrib = gtk_clist_get_row_data( clist, row );
549 1 hiro
        edit_person_attrib_clear( NULL );
550 1 hiro
        if( attrib ) {
551 1 hiro
                /* Remove list entry */
552 1 hiro
                gtk_clist_remove( clist, row );
553 1 hiro
                addritem_free_attribute( attrib );
554 1 hiro
                attrib = NULL;
555 1 hiro
        }
556 1 hiro
557 1 hiro
        /* Position hilite bar */
558 1 hiro
        attrib = gtk_clist_get_row_data( clist, row );
559 1 hiro
        if( ! attrib ) {
560 1 hiro
                personeditdlg.rowIndAttrib = -1 + row;
561 1 hiro
        }
562 1 hiro
        edit_person_status_show( NULL );
563 1 hiro
}
564 1 hiro
565 1 hiro
static UserAttribute *edit_person_attrib_edit( gboolean *error, UserAttribute *attrib ) {
566 1 hiro
        UserAttribute *retVal = NULL;
567 1 hiro
        gchar *sName, *sValue, *sName_, *sValue_;
568 1 hiro
569 1 hiro
        *error = TRUE;
570 1 hiro
        sName_ = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_atname), 0, -1 );
571 1 hiro
        sValue_ = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_atvalue), 0, -1 );
572 1 hiro
        sName = mgu_email_check_empty( sName_ );
573 1 hiro
        sValue = mgu_email_check_empty( sValue_ );
574 1 hiro
        g_free( sName_ );
575 1 hiro
        g_free( sValue_ );
576 1 hiro
577 1 hiro
        if( sName && sValue ) {
578 1 hiro
                if( attrib == NULL ) {
579 1 hiro
                        attrib = addritem_create_attribute();
580 1 hiro
                }
581 1 hiro
                addritem_attrib_set_name( attrib, sName );
582 1 hiro
                addritem_attrib_set_value( attrib, sValue );
583 1 hiro
                retVal = attrib;
584 1 hiro
                *error = FALSE;
585 1 hiro
        }
586 1 hiro
        else {
587 1 hiro
                edit_person_status_show( _( "A Name and Value must be supplied." ) );
588 1 hiro
        }
589 1 hiro
590 1 hiro
        g_free( sName );
591 1 hiro
        g_free( sValue );
592 1 hiro
593 1 hiro
        return retVal;
594 1 hiro
}
595 1 hiro
596 1 hiro
static void edit_person_attrib_modify( gpointer data ) {
597 1 hiro
        gboolean errFlg = FALSE;
598 1 hiro
        GtkCList *clist = GTK_CLIST(personeditdlg.clist_attrib);
599 1 hiro
        gint row = personeditdlg.rowIndAttrib;
600 1 hiro
        UserAttribute *attrib = gtk_clist_get_row_data( clist, row );
601 1 hiro
        if( attrib ) {
602 1 hiro
                edit_person_attrib_edit( &errFlg, attrib );
603 1 hiro
                if( ! errFlg ) {
604 1 hiro
                        gtk_clist_set_text( clist, row, ATTRIB_COL_NAME, attrib->name );
605 1 hiro
                        gtk_clist_set_text( clist, row, ATTRIB_COL_VALUE, attrib->value );
606 1 hiro
                        edit_person_attrib_clear( NULL );
607 1 hiro
                }
608 1 hiro
        }
609 1 hiro
}
610 1 hiro
611 1 hiro
static void edit_person_attrib_add( gpointer data ) {
612 1 hiro
        GtkCList *clist = GTK_CLIST(personeditdlg.clist_attrib);
613 1 hiro
        gboolean errFlg = FALSE;
614 1 hiro
        UserAttribute *attrib = NULL;
615 1 hiro
        gint row = personeditdlg.rowIndAttrib;
616 1 hiro
        if( gtk_clist_get_row_data( clist, row ) == NULL ) row = 0;
617 1 hiro
618 1 hiro
        attrib = edit_person_attrib_edit( &errFlg, NULL );
619 1 hiro
        if( ! errFlg ) {
620 1 hiro
                gchar *text[ EMAIL_N_COLS ];
621 1 hiro
                text[ ATTRIB_COL_NAME  ] = attrib->name;
622 1 hiro
                text[ ATTRIB_COL_VALUE ] = attrib->value;
623 1 hiro
624 1 hiro
                row = gtk_clist_insert( clist, 1 + row, text );
625 1 hiro
                gtk_clist_set_row_data( clist, row, attrib );
626 1 hiro
                gtk_clist_select_row( clist, row, 0 );
627 1 hiro
                edit_person_attrib_clear( NULL );
628 1 hiro
        }
629 1 hiro
}
630 1 hiro
631 1 hiro
static void addressbook_edit_person_dialog_create( gboolean *cancelled ) {
632 1 hiro
        GtkWidget *window;
633 1 hiro
        GtkWidget *vbox;
634 1 hiro
        GtkWidget *vnbox;
635 1 hiro
        GtkWidget *notebook;
636 1 hiro
        GtkWidget *hbbox;
637 1 hiro
        GtkWidget *ok_btn;
638 1 hiro
        GtkWidget *cancel_btn;
639 1 hiro
        GtkWidget *hsbox;
640 1 hiro
        GtkWidget *statusbar;
641 1 hiro
642 1 hiro
        window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
643 1 hiro
        gtk_widget_set_size_request(window, EDITPERSON_WIDTH, EDITPERSON_HEIGHT );
644 1 hiro
        /* gtk_container_set_border_width(GTK_CONTAINER(window), 0); */
645 1 hiro
        gtk_window_set_title(GTK_WINDOW(window), _("Edit Person Data"));
646 1 hiro
        gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
647 1 hiro
        gtk_window_set_modal(GTK_WINDOW(window), TRUE);
648 1 hiro
        g_signal_connect(G_OBJECT(window), "delete_event",
649 1 hiro
                         G_CALLBACK(edit_person_delete_event),
650 1 hiro
                         cancelled);
651 1 hiro
        g_signal_connect(G_OBJECT(window), "key_press_event",
652 1 hiro
                         G_CALLBACK(edit_person_key_pressed),
653 1 hiro
                         cancelled);
654 1 hiro
655 1 hiro
        vbox = gtk_vbox_new(FALSE, 4);
656 1 hiro
        /* gtk_container_set_border_width(GTK_CONTAINER(vbox), BORDER_WIDTH); */
657 1 hiro
        gtk_widget_show(vbox);
658 1 hiro
        gtk_container_add(GTK_CONTAINER(window), vbox);
659 1 hiro
660 1 hiro
        vnbox = gtk_vbox_new(FALSE, 4);
661 1 hiro
        gtk_container_set_border_width(GTK_CONTAINER(vnbox), 4);
662 1 hiro
        gtk_widget_show(vnbox);
663 1 hiro
        gtk_box_pack_start(GTK_BOX(vbox), vnbox, TRUE, TRUE, 0);
664 1 hiro
665 1 hiro
        /* Notebook */
666 1 hiro
        notebook = gtk_notebook_new();
667 1 hiro
        gtk_widget_show(notebook);
668 1 hiro
        gtk_box_pack_start(GTK_BOX(vnbox), notebook, TRUE, TRUE, 0);
669 1 hiro
        gtk_container_set_border_width(GTK_CONTAINER(notebook), 6);
670 1 hiro
671 1 hiro
        /* Status line */
672 1 hiro
        hsbox = gtk_hbox_new(FALSE, 0);
673 1 hiro
        gtk_box_pack_end(GTK_BOX(vbox), hsbox, FALSE, FALSE, BORDER_WIDTH);
674 1 hiro
        statusbar = gtk_statusbar_new();
675 1 hiro
        gtk_box_pack_start(GTK_BOX(hsbox), statusbar, TRUE, TRUE, BORDER_WIDTH);
676 1 hiro
677 1 hiro
        /* Button panel */
678 31 hiro
        gtkut_stock_button_set_create(&hbbox, &ok_btn, GTK_STOCK_OK,
679 31 hiro
                                      &cancel_btn, GTK_STOCK_CANCEL,
680 31 hiro
                                      NULL, NULL);
681 1 hiro
        gtk_box_pack_end(GTK_BOX(vnbox), hbbox, FALSE, FALSE, 0);
682 1 hiro
        gtk_widget_grab_default(ok_btn);
683 1 hiro
684 1 hiro
        g_signal_connect(G_OBJECT(ok_btn), "clicked",
685 1 hiro
                         G_CALLBACK(edit_person_ok), cancelled);
686 1 hiro
        g_signal_connect(G_OBJECT(cancel_btn), "clicked",
687 1 hiro
                         G_CALLBACK(edit_person_cancel), cancelled);
688 1 hiro
        g_signal_connect(G_OBJECT(notebook), "switch_page",
689 1 hiro
                         G_CALLBACK(edit_person_switch_page), NULL);
690 1 hiro
691 1 hiro
        gtk_widget_show_all(vbox);
692 1 hiro
693 1 hiro
        personeditdlg.window     = window;
694 1 hiro
        personeditdlg.notebook   = notebook;
695 405 hiro
        personeditdlg.hbbox      = hbbox;
696 1 hiro
        personeditdlg.ok_btn     = ok_btn;
697 1 hiro
        personeditdlg.cancel_btn = cancel_btn;
698 1 hiro
        personeditdlg.statusbar  = statusbar;
699 1 hiro
        personeditdlg.status_cid = gtk_statusbar_get_context_id( GTK_STATUSBAR(statusbar), "Edit Person Dialog" );
700 1 hiro
701 1 hiro
}
702 1 hiro
703 1 hiro
void addressbook_edit_person_page_basic( gint pageNum, gchar *pageLbl ) {
704 1 hiro
        GtkWidget *vbox;
705 1 hiro
        GtkWidget *table;
706 1 hiro
        GtkWidget *label;
707 1 hiro
        GtkWidget *entry_name;
708 1 hiro
        GtkWidget *entry_fn;
709 1 hiro
        GtkWidget *entry_ln;
710 1 hiro
        GtkWidget *entry_nn;
711 1 hiro
        const gchar *locale;
712 1 hiro
        gint top = 0;
713 1 hiro
714 1 hiro
        vbox = gtk_vbox_new( FALSE, 8 );
715 1 hiro
        gtk_widget_show( vbox );
716 1 hiro
        gtk_container_add( GTK_CONTAINER( personeditdlg.notebook ), vbox );
717 1 hiro
        gtk_container_set_border_width( GTK_CONTAINER (vbox), BORDER_WIDTH );
718 1 hiro
719 1 hiro
        label = gtk_label_new( pageLbl );
720 1 hiro
        gtk_widget_show( label );
721 1 hiro
        gtk_notebook_set_tab_label(
722 1 hiro
                GTK_NOTEBOOK( personeditdlg.notebook ),
723 1 hiro
                gtk_notebook_get_nth_page( GTK_NOTEBOOK( personeditdlg.notebook ), pageNum ), label );
724 1 hiro
725 1 hiro
        table = gtk_table_new( 4, 3, FALSE);
726 1 hiro
        gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
727 1 hiro
        gtk_container_set_border_width( GTK_CONTAINER(table), 8 );
728 1 hiro
        gtk_table_set_row_spacings(GTK_TABLE(table), 8);
729 1 hiro
        gtk_table_set_col_spacings(GTK_TABLE(table), 8);
730 1 hiro
731 1 hiro
#define ATTACH_ROW(text, entry) \
732 1 hiro
{ \
733 1 hiro
        label = gtk_label_new(text); \
734 1 hiro
        gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), \
735 1 hiro
                         GTK_FILL, 0, 0, 0); \
736 1 hiro
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); \
737 1 hiro
 \
738 1 hiro
        entry = gtk_entry_new(); \
739 1 hiro
        gtk_table_attach(GTK_TABLE(table), entry, 1, 2, top, (top + 1), \
740 1 hiro
                         GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0); \
741 1 hiro
        top++; \
742 1 hiro
}
743 1 hiro
744 1 hiro
        ATTACH_ROW(_("Display Name"), entry_name);
745 1 hiro
        locale = conv_get_current_locale();
746 1 hiro
        if (locale &&
747 333 hiro
            (!g_ascii_strncasecmp(locale, "ja", 2) ||
748 333 hiro
             !g_ascii_strncasecmp(locale, "ko", 2) ||
749 333 hiro
             !g_ascii_strncasecmp(locale, "zh", 2))) {
750 1 hiro
                ATTACH_ROW(_("Last Name"), entry_ln);
751 1 hiro
                ATTACH_ROW(_("First Name"), entry_fn);
752 1 hiro
        } else {
753 1 hiro
                ATTACH_ROW(_("First Name"), entry_fn);
754 1 hiro
                ATTACH_ROW(_("Last Name"), entry_ln);
755 1 hiro
        }
756 1 hiro
        ATTACH_ROW(_("Nick Name"), entry_nn);
757 1 hiro
758 1 hiro
#undef ATTACH_ROW
759 1 hiro
760 1 hiro
        gtk_widget_show_all(vbox);
761 1 hiro
762 1 hiro
        personeditdlg.entry_name  = entry_name;
763 1 hiro
        personeditdlg.entry_first = entry_fn;
764 1 hiro
        personeditdlg.entry_last  = entry_ln;
765 1 hiro
        personeditdlg.entry_nick  = entry_nn;
766 1 hiro
}
767 1 hiro
768 1 hiro
void addressbook_edit_person_page_email( gint pageNum, gchar *pageLbl ) {
769 1 hiro
        GtkWidget *vbox;
770 1 hiro
        GtkWidget *hbox;
771 1 hiro
        GtkWidget *vboxl;
772 1 hiro
        GtkWidget *vboxb;
773 1 hiro
        GtkWidget *vbuttonbox;
774 1 hiro
        GtkWidget *buttonUp;
775 1 hiro
        GtkWidget *buttonDown;
776 1 hiro
        GtkWidget *buttonDel;
777 1 hiro
        GtkWidget *buttonMod;
778 1 hiro
        GtkWidget *buttonAdd;
779 1 hiro
        GtkWidget *buttonClr;
780 1 hiro
781 1 hiro
        GtkWidget *table;
782 1 hiro
        GtkWidget *label;
783 1 hiro
        GtkWidget *clist_swin;
784 1 hiro
        GtkWidget *clist;
785 1 hiro
        GtkWidget *entry_email;
786 1 hiro
        GtkWidget *entry_alias;
787 1 hiro
        GtkWidget *entry_remarks;
788 1 hiro
        gint top;
789 1 hiro
790 1 hiro
        gchar *titles[ EMAIL_N_COLS ];
791 1 hiro
        gint i;
792 1 hiro
793 1 hiro
        titles[ EMAIL_COL_EMAIL   ] = _("E-Mail Address");
794 1 hiro
        titles[ EMAIL_COL_ALIAS   ] = _("Alias");
795 1 hiro
        titles[ EMAIL_COL_REMARKS ] = _("Remarks");
796 1 hiro
797 1 hiro
        vbox = gtk_vbox_new( FALSE, 8 );
798 1 hiro
        gtk_widget_show( vbox );
799 1 hiro
        gtk_container_add( GTK_CONTAINER( personeditdlg.notebook ), vbox );
800 1 hiro
        gtk_container_set_border_width( GTK_CONTAINER (vbox), BORDER_WIDTH );
801 1 hiro
802 1 hiro
        label = gtk_label_new( pageLbl );
803 1 hiro
        gtk_widget_show( label );
804 1 hiro
        gtk_notebook_set_tab_label(
805 1 hiro
                GTK_NOTEBOOK( personeditdlg.notebook ),
806 1 hiro
                gtk_notebook_get_nth_page( GTK_NOTEBOOK( personeditdlg.notebook ), pageNum ), label );
807 1 hiro
808 1 hiro
        /* Split into two areas */
809 1 hiro
        hbox = gtk_hbox_new( FALSE, 0 );
810 1 hiro
        gtk_container_add( GTK_CONTAINER( vbox ), hbox );
811 1 hiro
812 1 hiro
        /* EMail list */
813 1 hiro
        vboxl = gtk_vbox_new( FALSE, 4 );
814 1 hiro
        gtk_container_add( GTK_CONTAINER( hbox ), vboxl );
815 1 hiro
        gtk_container_set_border_width( GTK_CONTAINER(vboxl), 4 );
816 1 hiro
817 1 hiro
        /* Address list */
818 1 hiro
        clist_swin = gtk_scrolled_window_new( NULL, NULL );
819 1 hiro
        gtk_container_add( GTK_CONTAINER(vboxl), clist_swin );
820 1 hiro
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(clist_swin),
821 1 hiro
                                       GTK_POLICY_AUTOMATIC,
822 1 hiro
                                       GTK_POLICY_ALWAYS);
823 1 hiro
824 1 hiro
        clist = gtk_clist_new_with_titles( EMAIL_N_COLS, titles );
825 1 hiro
        gtk_container_add( GTK_CONTAINER(clist_swin), clist );
826 1 hiro
        gtk_clist_set_selection_mode( GTK_CLIST(clist), GTK_SELECTION_BROWSE );
827 1 hiro
        gtk_clist_set_column_width( GTK_CLIST(clist), EMAIL_COL_EMAIL, EMAIL_COL_WIDTH_EMAIL );
828 1 hiro
        gtk_clist_set_column_width( GTK_CLIST(clist), EMAIL_COL_ALIAS, EMAIL_COL_WIDTH_ALIAS );
829 1 hiro
830 1 hiro
        for( i = 0; i < EMAIL_N_COLS; i++ )
831 1 hiro
                GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(clist)->column[i].button, GTK_CAN_FOCUS);
832 1 hiro
833 1 hiro
        /* Data entry area */
834 1 hiro
        table = gtk_table_new( 4, 2, FALSE);
835 1 hiro
        gtk_box_pack_start(GTK_BOX(vboxl), table, FALSE, FALSE, 0);
836 1 hiro
        gtk_container_set_border_width( GTK_CONTAINER(table), 4 );
837 1 hiro
        gtk_table_set_row_spacings(GTK_TABLE(table), 4);
838 1 hiro
        gtk_table_set_col_spacings(GTK_TABLE(table), 4);
839 1 hiro
840 1 hiro
        /* First row */
841 1 hiro
        top = 0;
842 1 hiro
        label = gtk_label_new(_("E-Mail Address"));
843 1 hiro
        gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0);
844 1 hiro
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
845 1 hiro
846 1 hiro
        entry_email = gtk_entry_new();
847 1 hiro
        gtk_table_attach(GTK_TABLE(table), entry_email, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
848 1 hiro
849 1 hiro
        /* Next row */
850 1 hiro
        ++top;
851 1 hiro
        label = gtk_label_new(_("Alias"));
852 1 hiro
        gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0);
853 1 hiro
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
854 1 hiro
855 1 hiro
        entry_alias = gtk_entry_new();
856 1 hiro
        gtk_table_attach(GTK_TABLE(table), entry_alias, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
857 1 hiro
858 1 hiro
        /* Next row */
859 1 hiro
        ++top;
860 1 hiro
        label = gtk_label_new(_("Remarks"));
861 1 hiro
        gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0);
862 1 hiro
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
863 1 hiro
864 1 hiro
        entry_remarks = gtk_entry_new();
865 1 hiro
        gtk_table_attach(GTK_TABLE(table), entry_remarks, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
866 1 hiro
867 1 hiro
        /* Button box */
868 1 hiro
        vboxb = gtk_vbox_new( FALSE, 4 );
869 1 hiro
        gtk_box_pack_start(GTK_BOX(hbox), vboxb, FALSE, FALSE, 2);
870 1 hiro
871 1 hiro
        vbuttonbox = gtk_vbutton_box_new();
872 1 hiro
        gtk_button_box_set_layout( GTK_BUTTON_BOX(vbuttonbox), GTK_BUTTONBOX_START );
873 1 hiro
        gtk_box_set_spacing( GTK_BOX(vbuttonbox), 8 );
874 1 hiro
        gtk_container_set_border_width( GTK_CONTAINER(vbuttonbox), 4 );
875 1 hiro
        gtk_container_add( GTK_CONTAINER(vboxb), vbuttonbox );
876 1 hiro
877 1 hiro
        /* Buttons */
878 1 hiro
        buttonUp = gtk_button_new_with_label( _( "Move Up" ) );
879 1 hiro
        gtk_container_add( GTK_CONTAINER(vbuttonbox), buttonUp );
880 1 hiro
881 1 hiro
        buttonDown = gtk_button_new_with_label( _( "Move Down" ) );
882 1 hiro
        gtk_container_add( GTK_CONTAINER(vbuttonbox), buttonDown );
883 1 hiro
884 1 hiro
        buttonDel = gtk_button_new_with_label( _( "Delete" ) );
885 1 hiro
        gtk_container_add( GTK_CONTAINER(vbuttonbox), buttonDel );
886 1 hiro
887 1 hiro
        buttonMod = gtk_button_new_with_label( _( "Modify" ) );
888 1 hiro
        gtk_container_add( GTK_CONTAINER(vbuttonbox), buttonMod );
889 1 hiro
890 1 hiro
        buttonAdd = gtk_button_new_with_label( _( "Add" ) );
891 1 hiro
        gtk_container_add( GTK_CONTAINER(vbuttonbox), buttonAdd );
892 1 hiro
893 1 hiro
        buttonClr = gtk_button_new_with_label( _( "Clear" ) );
894 1 hiro
        gtk_container_add( GTK_CONTAINER(vbuttonbox), buttonClr );
895 1 hiro
896 1 hiro
        gtk_widget_show_all(vbox);
897 1 hiro
898 1 hiro
        /* Event handlers */
899 1 hiro
        g_signal_connect( G_OBJECT(clist), "select_row",
900 1 hiro
                          G_CALLBACK( edit_person_email_list_selected), NULL );
901 1 hiro
        g_signal_connect( G_OBJECT(buttonUp), "clicked",
902 1 hiro
                          G_CALLBACK( edit_person_email_move_up ), NULL );
903 1 hiro
        g_signal_connect( G_OBJECT(buttonDown), "clicked",
904 1 hiro
                          G_CALLBACK( edit_person_email_move_down ), NULL );
905 1 hiro
        g_signal_connect( G_OBJECT(buttonDel), "clicked",
906 1 hiro
                          G_CALLBACK( edit_person_email_delete ), NULL );
907 1 hiro
        g_signal_connect( G_OBJECT(buttonMod), "clicked",
908 1 hiro
                          G_CALLBACK( edit_person_email_modify ), NULL );
909 1 hiro
        g_signal_connect( G_OBJECT(buttonAdd), "clicked",
910 1 hiro
                          G_CALLBACK( edit_person_email_add ), NULL );
911 1 hiro
        g_signal_connect( G_OBJECT(buttonClr), "clicked",
912 1 hiro
                          G_CALLBACK( edit_person_email_clear ), NULL );
913 1 hiro
914 1 hiro
        personeditdlg.clist_email   = clist;
915 1 hiro
        personeditdlg.entry_email   = entry_email;
916 1 hiro
        personeditdlg.entry_alias   = entry_alias;
917 1 hiro
        personeditdlg.entry_remarks = entry_remarks;
918 1 hiro
}
919 1 hiro
920 1 hiro
void addressbook_edit_person_page_attrib( gint pageNum, gchar *pageLbl ) {
921 1 hiro
        GtkWidget *vbox;
922 1 hiro
        GtkWidget *hbox;
923 1 hiro
        GtkWidget *vboxl;
924 1 hiro
        GtkWidget *vboxb;
925 1 hiro
        GtkWidget *vbuttonbox;
926 1 hiro
        GtkWidget *buttonDel;
927 1 hiro
        GtkWidget *buttonMod;
928 1 hiro
        GtkWidget *buttonAdd;
929 1 hiro
        GtkWidget *buttonClr;
930 1 hiro
931 1 hiro
        GtkWidget *table;
932 1 hiro
        GtkWidget *label;
933 1 hiro
        GtkWidget *clist_swin;
934 1 hiro
        GtkWidget *clist;
935 1 hiro
        GtkWidget *entry_name;
936 1 hiro
        GtkWidget *entry_value;
937 1 hiro
        gint top;
938 1 hiro
939 1 hiro
        gchar *titles[ ATTRIB_N_COLS ];
940 1 hiro
        gint i;
941 1 hiro
942 1 hiro
        titles[ ATTRIB_COL_NAME  ] = _("Name");
943 1 hiro
        titles[ ATTRIB_COL_VALUE ] = _("Value");
944 1 hiro
945 1 hiro
        vbox = gtk_vbox_new( FALSE, 8 );
946 1 hiro
        gtk_widget_show( vbox );
947 1 hiro
        gtk_container_add( GTK_CONTAINER( personeditdlg.notebook ), vbox );
948 1 hiro
        gtk_container_set_border_width( GTK_CONTAINER (vbox), BORDER_WIDTH );
949 1 hiro
950 1 hiro
        label = gtk_label_new( pageLbl );
951 1 hiro
        gtk_widget_show( label );
952 1 hiro
        gtk_notebook_set_tab_label(
953 1 hiro
                GTK_NOTEBOOK( personeditdlg.notebook ),
954 1 hiro
                gtk_notebook_get_nth_page( GTK_NOTEBOOK( personeditdlg.notebook ), pageNum ), label );
955 1 hiro
956 1 hiro
        /* Split into two areas */
957 1 hiro
        hbox = gtk_hbox_new( FALSE, 0 );
958 1 hiro
        gtk_container_add( GTK_CONTAINER( vbox ), hbox );
959 1 hiro
960 1 hiro
        /* Attribute list */
961 1 hiro
        vboxl = gtk_vbox_new( FALSE, 4 );
962 1 hiro
        gtk_container_add( GTK_CONTAINER( hbox ), vboxl );
963 1 hiro
        gtk_container_set_border_width( GTK_CONTAINER(vboxl), 4 );
964 1 hiro
965 1 hiro
        /* Address list */
966 1 hiro
        clist_swin = gtk_scrolled_window_new( NULL, NULL );
967 1 hiro
        gtk_container_add( GTK_CONTAINER(vboxl), clist_swin );
968 1 hiro
        gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(clist_swin),
969 1 hiro
                                       GTK_POLICY_AUTOMATIC,
970 1 hiro
                                       GTK_POLICY_ALWAYS);
971 1 hiro
972 1 hiro
        clist = gtk_clist_new_with_titles( ATTRIB_N_COLS, titles );
973 1 hiro
        gtk_container_add( GTK_CONTAINER(clist_swin), clist );
974 1 hiro
        gtk_clist_set_selection_mode( GTK_CLIST(clist), GTK_SELECTION_BROWSE );
975 1 hiro
        gtk_clist_set_column_width( GTK_CLIST(clist), ATTRIB_COL_NAME, ATTRIB_COL_WIDTH_NAME );
976 1 hiro
        gtk_clist_set_column_width( GTK_CLIST(clist), ATTRIB_COL_VALUE, ATTRIB_COL_WIDTH_VALUE );
977 1 hiro
978 1 hiro
        for( i = 0; i < ATTRIB_N_COLS; i++ )
979 1 hiro
                GTK_WIDGET_UNSET_FLAGS(GTK_CLIST(clist)->column[i].button, GTK_CAN_FOCUS);
980 1 hiro
981 1 hiro
        /* Data entry area */
982 1 hiro
        table = gtk_table_new( 4, 2, FALSE);
983 1 hiro
        gtk_box_pack_start(GTK_BOX(vboxl), table, FALSE, FALSE, 0);
984 1 hiro
        gtk_container_set_border_width( GTK_CONTAINER(table), 4 );
985 1 hiro
        gtk_table_set_row_spacings(GTK_TABLE(table), 4);
986 1 hiro
        gtk_table_set_col_spacings(GTK_TABLE(table), 4);
987 1 hiro
988 1 hiro
        /* First row */
989 1 hiro
        top = 0;
990 1 hiro
        label = gtk_label_new(_("Name"));
991 1 hiro
        gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0);
992 1 hiro
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
993 1 hiro
994 1 hiro
        entry_name = gtk_entry_new();
995 1 hiro
        gtk_table_attach(GTK_TABLE(table), entry_name, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
996 1 hiro
997 1 hiro
        /* Next row */
998 1 hiro
        ++top;
999 1 hiro
        label = gtk_label_new(_("Value"));
1000 1 hiro
        gtk_table_attach(GTK_TABLE(table), label, 0, 1, top, (top + 1), GTK_FILL, 0, 0, 0);
1001 1 hiro
        gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
1002 1 hiro
1003 1 hiro
        entry_value = gtk_entry_new();
1004 1 hiro
        gtk_table_attach(GTK_TABLE(table), entry_value, 1, 2, top, (top + 1), GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
1005 1 hiro
1006 1 hiro
        /* Button box */
1007 1 hiro
        vboxb = gtk_vbox_new( FALSE, 4 );
1008 1 hiro
        gtk_box_pack_start(GTK_BOX(hbox), vboxb, FALSE, FALSE, 2);
1009 1 hiro
1010 1 hiro
        vbuttonbox = gtk_vbutton_box_new();
1011 1 hiro
        gtk_button_box_set_layout( GTK_BUTTON_BOX(vbuttonbox), GTK_BUTTONBOX_START );
1012 1 hiro
        gtk_box_set_spacing( GTK_BOX(vbuttonbox), 8 );
1013 1 hiro
        gtk_container_set_border_width( GTK_CONTAINER(vbuttonbox), 4 );
1014 1 hiro
        gtk_container_add( GTK_CONTAINER(vboxb), vbuttonbox );
1015 1 hiro
1016 1 hiro
        /* Buttons */
1017 1 hiro
        buttonDel = gtk_button_new_with_label( _( "Delete" ) );
1018 1 hiro
        gtk_container_add( GTK_CONTAINER(vbuttonbox), buttonDel );
1019 1 hiro
1020 1 hiro
        buttonMod = gtk_button_new_with_label( _( "Modify" ) );
1021 1 hiro
        gtk_container_add( GTK_CONTAINER(vbuttonbox), buttonMod );
1022 1 hiro
1023 1 hiro
        buttonAdd = gtk_button_new_with_label( _( "Add" ) );
1024 1 hiro
        gtk_container_add( GTK_CONTAINER(vbuttonbox), buttonAdd );
1025 1 hiro
1026 1 hiro
        buttonClr = gtk_button_new_with_label( _( "Clear" ) );
1027 1 hiro
        gtk_container_add( GTK_CONTAINER(vbuttonbox), buttonClr );
1028 1 hiro
1029 1 hiro
        gtk_widget_show_all(vbox);
1030 1 hiro
1031 1 hiro
        /* Event handlers */
1032 1 hiro
        g_signal_connect( G_OBJECT(clist), "select_row",
1033 1 hiro
                          G_CALLBACK( edit_person_attrib_list_selected), NULL );
1034 1 hiro
        g_signal_connect( G_OBJECT(buttonDel), "clicked",
1035 1 hiro
                          G_CALLBACK( edit_person_attrib_delete ), NULL );
1036 1 hiro
        g_signal_connect( G_OBJECT(buttonMod), "clicked",
1037 1 hiro
                          G_CALLBACK( edit_person_attrib_modify ), NULL );
1038 1 hiro
        g_signal_connect( G_OBJECT(buttonAdd), "clicked",
1039 1 hiro
                          G_CALLBACK( edit_person_attrib_add ), NULL );
1040 1 hiro
        g_signal_connect( G_OBJECT(buttonClr), "clicked",
1041 1 hiro
                          G_CALLBACK( edit_person_attrib_clear ), NULL );
1042 1 hiro
1043 1 hiro
        personeditdlg.clist_attrib  = clist;
1044 1 hiro
        personeditdlg.entry_atname  = entry_name;
1045 1 hiro
        personeditdlg.entry_atvalue = entry_value;
1046 1 hiro
}
1047 1 hiro
1048 1 hiro
static void addressbook_edit_person_create( gboolean *cancelled ) {
1049 1 hiro
        addressbook_edit_person_dialog_create( cancelled );
1050 1 hiro
        addressbook_edit_person_page_basic( PAGE_BASIC, _( "Basic Data" ) );
1051 1 hiro
        addressbook_edit_person_page_email( PAGE_EMAIL, _( "E-Mail Address" ) );
1052 1 hiro
        addressbook_edit_person_page_attrib( PAGE_ATTRIBUTES, _( "User Attributes" ) );
1053 1 hiro
        gtk_widget_show_all( personeditdlg.window );
1054 1 hiro
}
1055 1 hiro
1056 1 hiro
/*
1057 1 hiro
* Return list of email items.
1058 1 hiro
*/
1059 1 hiro
static GList *edit_person_build_email_list() {
1060 1 hiro
        GtkCList *clist = GTK_CLIST(personeditdlg.clist_email);
1061 1 hiro
        GList *listEMail = NULL;
1062 1 hiro
        ItemEMail *email;
1063 1 hiro
        gint row = 0;
1064 1 hiro
        while( (email = gtk_clist_get_row_data( clist, row )) ) {
1065 1 hiro
                listEMail = g_list_append( listEMail, email );
1066 1 hiro
                row++;
1067 1 hiro
        }
1068 1 hiro
        return listEMail;
1069 1 hiro
}
1070 1 hiro
1071 1 hiro
/*
1072 1 hiro
* Return list of attributes.
1073 1 hiro
*/
1074 1 hiro
static GList *edit_person_build_attrib_list() {
1075 1 hiro
        GtkCList *clist = GTK_CLIST(personeditdlg.clist_attrib);
1076 1 hiro
        GList *listAttrib = NULL;
1077 1 hiro
        UserAttribute *attrib;
1078 1 hiro
        gint row = 0;
1079 1 hiro
        while( (attrib = gtk_clist_get_row_data( clist, row )) ) {
1080 1 hiro
                listAttrib = g_list_append( listAttrib, attrib );
1081 1 hiro
                row++;
1082 1 hiro
        }
1083 1 hiro
        return listAttrib;
1084 1 hiro
}
1085 1 hiro
1086 1 hiro
/*
1087 1 hiro
* Edit person.
1088 1 hiro
* Enter: abf    Address book.
1089 1 hiro
*        parent Parent folder for person (or NULL if adding to root folder). Argument is
1090 1 hiro
*               only required for new objects).
1091 1 hiro
*        person Person to edit, or NULL for a new person object.
1092 1 hiro
*        pgMail If TRUE, E-Mail page will be activated.
1093 1 hiro
* Return: Edited object, or NULL if cancelled.
1094 1 hiro
*/
1095 1 hiro
ItemPerson *addressbook_edit_person( AddressBookFile *abf, ItemFolder *parent, ItemPerson *person, gboolean pgMail ) {
1096 1 hiro
        static gboolean cancelled;
1097 1 hiro
        GList *listEMail = NULL;
1098 1 hiro
        GList *listAttrib = NULL;
1099 1 hiro
        gchar *cn = NULL;
1100 1 hiro
1101 1 hiro
        if (!personeditdlg.window)
1102 1 hiro
                addressbook_edit_person_create(&cancelled);
1103 405 hiro
        gtkut_box_set_reverse_order(GTK_BOX(personeditdlg.hbbox),
1104 405 hiro
                                    !prefs_common.comply_gnome_hig);
1105 1 hiro
        gtk_widget_grab_focus(personeditdlg.ok_btn);
1106 1 hiro
        gtk_widget_grab_focus(personeditdlg.entry_name);
1107 1 hiro
        gtk_widget_show(personeditdlg.window);
1108 1 hiro
        manage_window_set_transient(GTK_WINDOW(personeditdlg.window));
1109 1 hiro
1110 1 hiro
        /* Clear all fields */
1111 1 hiro
        personeditdlg.rowIndEMail = -1;
1112 1 hiro
        personeditdlg.rowIndAttrib = -1;
1113 1 hiro
        edit_person_status_show( "" );
1114 1 hiro
        gtk_clist_clear( GTK_CLIST(personeditdlg.clist_email) );
1115 1 hiro
        gtk_clist_clear( GTK_CLIST(personeditdlg.clist_attrib) );
1116 1 hiro
        gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_name), "" );
1117 1 hiro
        gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_first), "" );
1118 1 hiro
        gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_last), "" );
1119 1 hiro
        gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_nick), "" );
1120 1 hiro
1121 1 hiro
        personeditdlg.editNew = FALSE;
1122 1 hiro
        if( person ) {
1123 1 hiro
                if( ADDRITEM_NAME(person) )
1124 1 hiro
                        gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_name), ADDRITEM_NAME(person) );
1125 1 hiro
                if( person->firstName )
1126 1 hiro
                        gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_first), person->firstName );
1127 1 hiro
                if( person->lastName )
1128 1 hiro
                        gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_last), person->lastName );
1129 1 hiro
                if( person->nickName )
1130 1 hiro
                        gtk_entry_set_text(GTK_ENTRY(personeditdlg.entry_nick), person->nickName );
1131 1 hiro
                edit_person_load_email( person );
1132 1 hiro
                edit_person_load_attrib( person );
1133 1 hiro
        }
1134 1 hiro
        else {
1135 1 hiro
                personeditdlg.editNew = TRUE;
1136 1 hiro
        }
1137 1 hiro
1138 1 hiro
        /* Select appropriate start page */
1139 1 hiro
        if( pgMail ) {
1140 1 hiro
                gtk_notebook_set_current_page( GTK_NOTEBOOK(personeditdlg.notebook), PAGE_EMAIL );
1141 1 hiro
        }
1142 1 hiro
        else {
1143 1 hiro
                gtk_notebook_set_current_page( GTK_NOTEBOOK(personeditdlg.notebook), PAGE_BASIC );
1144 1 hiro
        }
1145 1 hiro
1146 1 hiro
        gtk_clist_select_row( GTK_CLIST(personeditdlg.clist_email), 0, 0 );
1147 1 hiro
        gtk_clist_select_row( GTK_CLIST(personeditdlg.clist_attrib), 0, 0 );
1148 1 hiro
        edit_person_email_clear( NULL );
1149 1 hiro
        edit_person_attrib_clear( NULL );
1150 1 hiro
1151 1 hiro
        gtk_main();
1152 1 hiro
        gtk_widget_hide( personeditdlg.window );
1153 1 hiro
1154 1 hiro
        listEMail = edit_person_build_email_list();
1155 1 hiro
        listAttrib = edit_person_build_attrib_list();
1156 1 hiro
        if( cancelled ) {
1157 1 hiro
                addritem_free_list_email( listEMail );
1158 1 hiro
                gtk_clist_clear( GTK_CLIST(personeditdlg.clist_email) );
1159 1 hiro
                gtk_clist_clear( GTK_CLIST(personeditdlg.clist_attrib) );
1160 1 hiro
                return NULL;
1161 1 hiro
        }
1162 1 hiro
1163 1 hiro
        cn = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_name), 0, -1 );
1164 1 hiro
        if( person ) {
1165 1 hiro
                /* Update email/attribute list */
1166 1 hiro
                addrbook_update_address_list( abf, person, listEMail );
1167 1 hiro
                addrbook_update_attrib_list( abf, person, listAttrib );
1168 1 hiro
        }
1169 1 hiro
        else {
1170 1 hiro
                /* Create new person and email/attribute list */
1171 1 hiro
                if( cn == NULL || *cn == '\0' ) {
1172 1 hiro
                        /* Wasting our time */
1173 1 hiro
                        if( listEMail == NULL && listAttrib == NULL ) cancelled = TRUE;
1174 1 hiro
                }
1175 1 hiro
                if( ! cancelled ) {
1176 1 hiro
                        person = addrbook_add_address_list( abf, parent, listEMail );
1177 1 hiro
                        addrbook_add_attrib_list( abf, person, listAttrib );
1178 1 hiro
                }
1179 1 hiro
        }
1180 1 hiro
1181 1 hiro
        if( !cancelled ) {
1182 1 hiro
                /* Set person stuff */
1183 1 hiro
                gchar *name;
1184 1 hiro
                addritem_person_set_common_name( person, cn );
1185 1 hiro
                name = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_first), 0, -1 );
1186 1 hiro
                addritem_person_set_first_name( person, name );
1187 1 hiro
                g_free( name );
1188 1 hiro
                name = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_last), 0, -1 );
1189 1 hiro
                addritem_person_set_last_name( person, name );
1190 1 hiro
                g_free( name );
1191 1 hiro
                name = gtk_editable_get_chars( GTK_EDITABLE(personeditdlg.entry_nick), 0, -1 );
1192 1 hiro
                addritem_person_set_nick_name( person, name );
1193 1 hiro
                g_free( name );
1194 1 hiro
        }
1195 1 hiro
        g_free( cn );
1196 1 hiro
1197 1 hiro
        listEMail = NULL;
1198 1 hiro
1199 1 hiro
        gtk_clist_clear( GTK_CLIST(personeditdlg.clist_email) );
1200 1 hiro
        gtk_clist_clear( GTK_CLIST(personeditdlg.clist_attrib) );
1201 1 hiro
1202 1 hiro
        return person;
1203 1 hiro
}
1204 1 hiro
1205 1 hiro
/*
1206 1 hiro
* End of Source.
1207 1 hiro
*/