From c38a6122c95132d3468a2bbadefac5c0dbaf28a1 Mon Sep 17 00:00:00 2001 From: nobody Date: Tue, 9 Dec 2003 01:57:09 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'GGV_2_6_2'. svn path=/tags/GGV_2_6_2/; revision=23746 --- addressbook/gui/contact-editor/.cvsignore | 11 - addressbook/gui/contact-editor/Makefile.am | 43 - .../gui/contact-editor/contact-editor.glade | 2360 ------------------ .../gui/contact-editor/e-contact-editor-address.c | 620 ----- .../gui/contact-editor/e-contact-editor-address.h | 73 - .../gui/contact-editor/e-contact-editor-fullname.c | 287 --- .../gui/contact-editor/e-contact-editor-fullname.h | 71 - .../contact-editor/e-contact-editor-marshal.list | 2 - addressbook/gui/contact-editor/e-contact-editor.c | 2612 -------------------- addressbook/gui/contact-editor/e-contact-editor.h | 134 - .../gui/contact-editor/e-contact-quick-add.c | 457 ---- .../gui/contact-editor/e-contact-quick-add.h | 40 - addressbook/gui/contact-editor/fulladdr.glade | 446 ---- addressbook/gui/contact-editor/fullname.glade | 674 ----- addressbook/gui/contact-editor/test-editor.c | 142 -- 15 files changed, 7972 deletions(-) delete mode 100644 addressbook/gui/contact-editor/.cvsignore delete mode 100644 addressbook/gui/contact-editor/Makefile.am delete mode 100644 addressbook/gui/contact-editor/contact-editor.glade delete mode 100644 addressbook/gui/contact-editor/e-contact-editor-address.c delete mode 100644 addressbook/gui/contact-editor/e-contact-editor-address.h delete mode 100644 addressbook/gui/contact-editor/e-contact-editor-fullname.c delete mode 100644 addressbook/gui/contact-editor/e-contact-editor-fullname.h delete mode 100644 addressbook/gui/contact-editor/e-contact-editor-marshal.list delete mode 100644 addressbook/gui/contact-editor/e-contact-editor.c delete mode 100644 addressbook/gui/contact-editor/e-contact-editor.h delete mode 100644 addressbook/gui/contact-editor/e-contact-quick-add.c delete mode 100644 addressbook/gui/contact-editor/e-contact-quick-add.h delete mode 100644 addressbook/gui/contact-editor/fulladdr.glade delete mode 100644 addressbook/gui/contact-editor/fullname.glade delete mode 100644 addressbook/gui/contact-editor/test-editor.c (limited to 'addressbook/gui/contact-editor') diff --git a/addressbook/gui/contact-editor/.cvsignore b/addressbook/gui/contact-editor/.cvsignore deleted file mode 100644 index ddbd38bb6e..0000000000 --- a/addressbook/gui/contact-editor/.cvsignore +++ /dev/null @@ -1,11 +0,0 @@ -.deps -.libs -.pure -Makefile -Makefile.in -*.lo -*.la -contact-editor-test -contact-editor.gladep -e-contact-editor-marshal.c -e-contact-editor-marshal.h diff --git a/addressbook/gui/contact-editor/Makefile.am b/addressbook/gui/contact-editor/Makefile.am deleted file mode 100644 index 685004dabb..0000000000 --- a/addressbook/gui/contact-editor/Makefile.am +++ /dev/null @@ -1,43 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/addressbook/ \ - -I$(top_srcdir)/addressbook/backend \ - -I$(top_builddir)/addressbook/backend \ - -I$(top_srcdir)/addressbook/gui/merging \ - -I$(top_srcdir)/widgets/e-table \ - -I$(top_builddir)/shell \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \ - -DEVOLUTION_UIDIR=\""$(evolutionuidir)\"" \ - -DPREFIX=\""$(prefix)"\" \ - -DG_LOG_DOMAIN=\"contact-editor\" \ - $(EVOLUTION_ADDRESSBOOK_CFLAGS) - -noinst_LTLIBRARIES = \ - libecontacteditor.la - -libecontacteditor_la_SOURCES = \ - $(MARSHAL_GENERATED) \ - e-contact-editor-address.c \ - e-contact-editor-address.h \ - e-contact-editor-fullname.c \ - e-contact-editor-fullname.h \ - e-contact-editor.c \ - e-contact-editor.h \ - e-contact-quick-add.c \ - e-contact-quick-add.h - -MARSHAL_GENERATED = e-contact-editor-marshal.c e-contact-editor-marshal.h -@EVO_MARSHAL_RULE@ - -glade_DATA = \ - contact-editor.glade \ - fulladdr.glade \ - fullname.glade - -BUILT_SOURCES = $(MARSHAL_GENERATED) -CLEANFILES = $(BUILT_SOURCES) - -EXTRA_DIST= $(glade_DATA) \ - e-contact-editor-marshal.list diff --git a/addressbook/gui/contact-editor/contact-editor.glade b/addressbook/gui/contact-editor/contact-editor.glade deleted file mode 100644 index 10b05c27b4..0000000000 --- a/addressbook/gui/contact-editor/contact-editor.glade +++ /dev/null @@ -1,2360 +0,0 @@ - - - - - - - - - 2 - - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - - - - True - False - 4 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - 0 - - - - - - True - True - True - gtk-apply - True - GTK_RELIEF_NORMAL - 0 - - - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - 0 - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - 2 - 2 - False - 0 - 2 - - - - True - True - True - True - 0 - - True - * - False - - - 0 - 2 - 1 - 2 - - - - - - - True - False - 2 - - - - 2 - True - True - _Add - True - GTK_RELIEF_NORMAL - - - 0 - False - False - - - - - - 2 - True - True - _Delete - True - GTK_RELIEF_NORMAL - - - 0 - False - False - - - - - 1 - 2 - 0 - 1 - fill - - - - - - True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - - - - - 0 - 1 - 0 - 1 - - - - - 0 - True - True - - - - - - - - New phone type - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - - - - True - False - 8 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - True - _Add - True - GTK_RELIEF_NORMAL - 0 - - - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - 0 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 4 - True - 0 - 0.5 - GTK_SHADOW_ETCHED_IN - - - - 9 - True - 0.5 - 0.5 - 1 - 1 - - - - True - True - True - True - True - 0 - - True - * - False - - - - - - - - True - New phone type - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - label_item - - - - - 0 - True - True - - - - - - - - Contact Editor - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - - - - True - True - - - - True - True - True - True - GTK_POS_TOP - False - False - - - - 6 - True - 14 - 8 - False - 6 - 6 - - - - True - True - True - True - 0 - - True - * - False - - - 7 - 8 - 0 - 1 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 7 - 8 - 1 - 2 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 7 - 8 - 2 - 3 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 7 - 8 - 3 - 4 - - - - - - - True - True - Full _Name... - True - GTK_RELIEF_NORMAL - - - 1 - 3 - 0 - 1 - fill - fill - - - - - - True - 1 - 0.5 - 0 - 1 - - - - True - GTK_RELIEF_NORMAL - - - - True - GTK_ARROW_DOWN - GTK_SHADOW_OUT - 0.5 - 0.5 - 0 - 0 - - - - - - - 2 - 3 - 5 - 6 - fill - fill - - - - - - True - 1 - 0.5 - 0 - 0 - - - - True - GTK_RELIEF_NORMAL - - - - True - GTK_ARROW_DOWN - GTK_SHADOW_OUT - 0.5 - 0.5 - 0 - 0 - - - - - - - 6 - 7 - 3 - 4 - fill - fill - - - - - - True - 1 - 0.5 - 0 - 0 - - - - True - GTK_RELIEF_NORMAL - - - - True - GTK_ARROW_DOWN - GTK_SHADOW_OUT - 0.5 - 0.5 - 0 - 0 - - - - - - - 6 - 7 - 1 - 2 - fill - fill - - - - - - True - 1 - 0.5 - 0 - 0 - - - - True - GTK_RELIEF_NORMAL - - - - True - GTK_ARROW_DOWN - GTK_SHADOW_OUT - 0.5 - 0.5 - 0 - 0 - - - - - - - 6 - 7 - 0 - 1 - fill - fill - - - - - - True - - - 4 - 8 - 4 - 5 - 2 - - - - - - - True - 1 - 0.5 - 0 - 0 - - - - True - GTK_RELIEF_NORMAL - - - - True - GTK_ARROW_DOWN - GTK_SHADOW_OUT - 0.5 - 0.5 - 0 - 0 - - - - - - - 6 - 7 - 2 - 3 - fill - fill - - - - - - True - True - True - True - True - True - True - 0 - - True - * - False - - - 3 - 4 - 0 - 1 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 3 - 4 - 1 - 2 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 3 - 4 - 2 - 3 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 3 - 4 - 5 - 6 - - - - - - - True - - - 0 - 4 - 4 - 5 - 2 - - - - - - - True - False - True - True - True - False - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - True - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - - 3 - 4 - 3 - 4 - - - - - - - True - - - 0 - 4 - 7 - 8 - 2 - fill - - - - - - True - 0.5 - 0 - 1 - 1 - - - - True - True - Wants to receive _HTML mail - True - GTK_RELIEF_NORMAL - False - False - True - - - - - 3 - 4 - 6 - 7 - expand|shrink|fill - shrink|fill - - - - - - True - 1 - 0.5 - 0 - 0 - - - - True - GTK_RELIEF_NORMAL - - - - True - GTK_ARROW_DOWN - GTK_SHADOW_OUT - 0.5 - 0.5 - 0 - 0 - - - - - - - 6 - 7 - 5 - 6 - fill - fill - - - - - - True - - - - True - _Business: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-phone1 - - - - - 5 - 6 - 0 - 1 - fill - fill - - - - - - True - - - - True - _Home: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-phone2 - - - - - 5 - 6 - 1 - 2 - fill - fill - - - - - - True - - - - True - Business fa_x: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-phone3 - - - - - 5 - 6 - 2 - 3 - fill - fill - - - - - - True - - - - True - _Mobile: - True - False - GTK_JUSTIFY_LEFT - False - False - 1 - 0.5 - 0 - 0 - entry-phone4 - - - - - 5 - 6 - 3 - 4 - fill - fill - - - - - - True - - - - True - Primary _email: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-email1 - - - - - 1 - 2 - 5 - 6 - fill - fill - - - - - - True - - - - True - B_usiness: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - text-address - - - - - 5 - 6 - 5 - 6 - fill - fill - - - - - - True - 0 - 0 - 0 - 0 - - - - True - _This is the mailing address - True - GTK_RELIEF_NORMAL - False - False - True - - - - - 7 - 8 - 9 - 10 - fill - - - - - - True - - - 0 - 4 - 11 - 12 - 2 - fill - - - - - - True - - - 4 - 8 - 11 - 12 - fill - - - - - - True - - - - True - _Job title: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-jobtitle - - - - - 1 - 3 - 1 - 2 - fill - fill - - - - - - True - e_create_image_widget - malehead.png - - 0 - 0 - Thu, 18 May 2000 12:19:47 GMT - - - 0 - 1 - 0 - 4 - fill - fill - - - - - - True - e_create_image_widget - cellphone.png - - 0 - 0 - Thu, 18 May 2000 12:20:02 GMT - - - 4 - 5 - 0 - 4 - fill - fill - - - - - - True - e_create_image_widget - envelope.png - - 0 - 0 - Thu, 18 May 2000 12:19:51 GMT - - - 0 - 1 - 5 - 7 - fill - fill - - - - - - True - e_create_image_widget - house.png - - 0 - 0 - Thu, 18 May 2000 12:20:06 GMT - - - 4 - 5 - 5 - 10 - fill - fill - - - - - - True - e_create_image_widget - globe.png - - 0 - 0 - Thu, 18 May 2000 12:19:56 GMT - - - 0 - 1 - 8 - 10 - fill - fill - - - - - - True - Organi_zation: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-company - - - 1 - 3 - 2 - 3 - fill - fill - - - - - - True - True - A_ddress... - True - GTK_RELIEF_NORMAL - - - 5 - 7 - 6 - 7 - fill - fill - - - - - - True - File a_s: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-file-as - - - 1 - 3 - 3 - 4 - fill - - - - - - - True - _Web page address: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-web - - - 1 - 3 - 8 - 9 - fill - - - - - - - True - 0.5 - 0.5 - 1 - 0 - - - - True - True - _Categories... - True - GTK_RELIEF_NORMAL - - - - - 1 - 3 - 12 - 13 - fill - fill - - - - - - True - e_create_image_widget - briefcase.png - - 0 - 0 - Thu, 18 May 2000 12:20:09 GMT - - - 0 - 1 - 12 - 14 - fill - fill - - - - - - True - 0.5 - 0.5 - 1 - 0 - - - - True - True - True - True - 0 - - True - * - False - - - - - 3 - 4 - 12 - 13 - fill - fill - - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - 7 - 8 - 5 - 9 - fill - - - - - - True - e_contact_editor_create_web - 0 - 0 - Sat, 08 Feb 2003 09:14:46 GMT - - - 3 - 4 - 8 - 9 - fill - fill - - - - - - True - Blog address: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-web - - - 1 - 3 - 9 - 10 - fill - - - - - - - True - e_contact_editor_create_web - 0 - 0 - Sat, 08 Feb 2003 09:14:46 GMT - - - 3 - 4 - 9 - 10 - fill - fill - - - - - False - True - - - - - - True - General - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - - - tab - - - - - - 6 - True - 9 - 6 - False - 6 - 6 - - - - True - D_epartment: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-department - - - 1 - 2 - 0 - 1 - fill - fill - - - - - - True - _Office: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-office - - - 1 - 2 - 1 - 2 - fill - fill - - - - - - True - P_rofession: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-profession - - - 1 - 2 - 2 - 3 - fill - fill - - - - - - True - _Nickname: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-nickname - - - 1 - 2 - 4 - 5 - fill - fill - - - - - - True - S_pouse: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-spouse - - - 1 - 2 - 5 - 6 - fill - fill - - - - - - True - Birthda_y: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - dateedit-birthday - - - 3 - 4 - 4 - 5 - fill - fill - - - - - - True - A_ssistant's name: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-assistant - - - 3 - 4 - 1 - 2 - fill - fill - - - - - - True - _Manager's name: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-manager - - - 3 - 4 - 0 - 1 - fill - fill - - - - - - True - Anni_versary: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - dateedit-anniversary - - - 3 - 4 - 5 - 6 - fill - fill - - - - - - True - True - True - True - 0 - - True - * - False - - - 2 - 3 - 5 - 6 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 2 - 3 - 0 - 1 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 2 - 3 - 1 - 2 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 2 - 3 - 2 - 3 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 2 - 3 - 4 - 5 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 4 - 6 - 1 - 2 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 4 - 6 - 0 - 1 - - - - - - - True - - - 0 - 6 - 3 - 4 - 2 - fill - fill - - - - - - True - No_tes: - True - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - text-comments - - - 1 - 2 - 7 - 8 - fill - fill - - - - - - True - - - 0 - 6 - 6 - 7 - fill - - - - - - True - e_create_image_widget - briefcase.png - - 0 - 0 - Thu, 18 May 2000 12:20:13 GMT - - - 0 - 1 - 0 - 2 - fill - fill - - - - - - True - e_create_image_widget - malehead.png - - 0 - 0 - Thu, 18 May 2000 12:20:16 GMT - - - 0 - 1 - 4 - 6 - fill - fill - - - - - - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - 1 - 6 - 8 - 9 - - - - - - True - e_create_image_widget - globe.png - - 0 - 0 - Thu, 18 May 2000 12:20:19 GMT - - - 0 - 1 - 7 - 9 - fill - fill - - - - - - True - True - e_contact_editor_create_date - 0 - 0 - Tue, 05 Jun 2001 02:36:27 GMT - - - 4 - 6 - 4 - 5 - fill - - - - - - True - True - e_contact_editor_create_date - 0 - 0 - Tue, 05 Jun 2001 02:36:32 GMT - - - 4 - 6 - 5 - 6 - fill - - - - - False - True - - - - - - True - Details - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - - - tab - - - - - - 6 - True - False - 6 - - - - 7 - True - False - 4 - - - - True - e_create_image_widget - globe.png - - 0 - 0 - Thu, 18 May 2000 12:20:13 GMT - - - 0 - False - False - - - - - - True - If this person publishes free/busy or other calendar information on the Internet, enter the address -of that information here. - False - False - GTK_JUSTIFY_LEFT - False - False - 7.45058e-09 - 0.5 - 0 - 0 - - - 0 - True - True - - - - - 0 - False - True - - - - - - True - 0.5 - 0.5 - 0.75 - 1 - - - - 6 - True - 2 - 2 - False - 6 - 6 - - - - True - _Public Calendar URL: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-caluri - - - 0 - 1 - 0 - 1 - fill - fill - - - - - - True - F_ree/Busy URL: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-fburl - - - 0 - 1 - 1 - 2 - fill - fill - - - - - - True - e_contact_editor_create_web - 0 - 0 - Mon, 10 Feb 2003 20:37:57 GMT - - - 1 - 2 - 0 - 1 - fill - - - - - - True - e_contact_editor_create_web - 0 - 0 - Mon, 10 Feb 2003 20:38:00 GMT - - - 1 - 2 - 1 - 2 - fill - fill - - - - - - - 0 - True - True - - - - - False - True - - - - - - True - Collaboration - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - - - tab - - - - - - - 0 - True - True - - - - - - True - True - True - - - 0 - True - True - - - - - diff --git a/addressbook/gui/contact-editor/e-contact-editor-address.c b/addressbook/gui/contact-editor/e-contact-editor-address.c deleted file mode 100644 index 34977e3fb7..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor-address.c +++ /dev/null @@ -1,620 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-editor-address.c - * Copyright (C) 2000 Ximian, Inc. - * Author: Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static void e_contact_editor_address_init (EContactEditorAddress *card); -static void e_contact_editor_address_class_init (EContactEditorAddressClass *klass); -static void e_contact_editor_address_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void e_contact_editor_address_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void e_contact_editor_address_dispose (GObject *object); - -static void fill_in_info(EContactEditorAddress *editor); -static void extract_info(EContactEditorAddress *editor); - -static GtkDialogClass *parent_class = NULL; - -/* The arguments we take */ -enum { - PROP_0, - PROP_ADDRESS, - PROP_EDITABLE -}; - -GType -e_contact_editor_address_get_type (void) -{ - static GType contact_editor_address_type = 0; - - if (!contact_editor_address_type) { - static const GTypeInfo contact_editor_address_info = { - sizeof (EContactEditorAddressClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_contact_editor_address_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EContactEditorAddress), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_contact_editor_address_init, - }; - - contact_editor_address_type = g_type_register_static (GTK_TYPE_DIALOG, "EContactEditorAddress", &contact_editor_address_info, 0); - } - - return contact_editor_address_type; -} - -static void -e_contact_editor_address_class_init (EContactEditorAddressClass *klass) -{ - GObjectClass *object_class; - - object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_ref (GTK_TYPE_DIALOG); - - object_class->set_property = e_contact_editor_address_set_property; - object_class->get_property = e_contact_editor_address_get_property; - object_class->dispose = e_contact_editor_address_dispose; - - g_object_class_install_property (object_class, PROP_ADDRESS, - g_param_spec_pointer ("address", - _("Address"), - /*_( */"XXX blurb" /*)*/, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EDITABLE, - g_param_spec_boolean ("editable", - _("Editable"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); -} - -static GList * -add_to_tab_order(GList *list, GladeXML *gui, char *name) -{ - GtkWidget *widget = glade_xml_get_widget(gui, name); - return g_list_prepend(list, widget); -} - -static void -setup_tab_order(GladeXML *gui) -{ - GtkWidget *container; - GList *list = NULL; - - container = glade_xml_get_widget(gui, "table-checkaddress"); - - if (container) { - list = add_to_tab_order(list, gui, "entry-city"); - list = add_to_tab_order(list, gui, "entry-region"); - list = add_to_tab_order(list, gui, "entry-code"); - list = add_to_tab_order(list, gui, "combo-country"); - list = g_list_reverse(list); - e_container_change_tab_order(GTK_CONTAINER(container), list); - g_list_free(list); - } -} - -static char * countries [] = { - N_("United States"), - N_("Afghanistan"), - N_("Albania"), - N_("Algeria"), - N_("American Samoa"), - N_("Andorra"), - N_("Angola"), - N_("Anguilla"), - N_("Antarctica"), - N_("Antigua And Barbuda"), - N_("Argentina"), - N_("Armenia"), - N_("Aruba"), - N_("Australia"), - N_("Austria"), - N_("Azerbaijan"), - N_("Bahamas"), - N_("Bahrain"), - N_("Bangladesh"), - N_("Barbados"), - N_("Belarus"), - N_("Belgium"), - N_("Belize"), - N_("Benin"), - N_("Bermuda"), - N_("Bhutan"), - N_("Bolivia"), - N_("Bosnia And Herzegowina"), - N_("Botswana"), - N_("Bouvet Island"), - N_("Brazil"), - N_("British Indian Ocean Territory"), - N_("Brunei Darussalam"), - N_("Bulgaria"), - N_("Burkina Faso"), - N_("Burundi"), - N_("Cambodia"), - N_("Cameroon"), - N_("Canada"), - N_("Cape Verde"), - N_("Cayman Islands"), - N_("Central African Republic"), - N_("Chad"), - N_("Chile"), - N_("China"), - N_("Christmas Island"), - N_("Cocos (Keeling) Islands"), - N_("Colombia"), - N_("Comoros"), - N_("Congo"), - N_("Congo"), - N_("Cook Islands"), - N_("Costa Rica"), - N_("Cote d'Ivoire"), - N_("Croatia"), - N_("Cuba"), - N_("Cyprus"), - N_("Czech Republic"), - N_("Denmark"), - N_("Djibouti"), - N_("Dominica"), - N_("Dominican Republic"), - N_("East Timor"), - N_("Ecuador"), - N_("Egypt"), - N_("El Salvador"), - N_("Equatorial Guinea"), - N_("Eritrea"), - N_("Estonia"), - N_("Ethiopia"), - N_("Falkland Islands"), - N_("Faroe Islands"), - N_("Fiji"), - N_("Finland"), - N_("France"), - N_("French Guiana"), - N_("French Polynesia"), - N_("French Southern Territories"), - N_("Gabon"), - N_("Gambia"), - N_("Georgia"), - N_("Germany"), - N_("Ghana"), - N_("Gibraltar"), - N_("Greece"), - N_("Greenland"), - N_("Grenada"), - N_("Guadeloupe"), - N_("Guam"), - N_("Guatemala"), - N_("Guinea"), - N_("Guinea-bissau"), - N_("Guyana"), - N_("Haiti"), - N_("Heard And McDonald Islands"), - N_("Holy See"), - N_("Honduras"), - N_("Hong Kong"), - N_("Hungary"), - N_("Iceland"), - N_("India"), - N_("Indonesia"), - N_("Ireland"), - N_("Israel"), - N_("Italy"), - N_("Jamaica"), - N_("Japan"), - N_("Jordan"), - N_("Kazakhstan"), - N_("Kenya"), - N_("Kiribati"), - N_("Korea, Republic Of"), - N_("Kuwait"), - N_("Kyrgyzstan"), - N_("Laos"), - N_("Latvia"), - N_("Lebanon"), - N_("Lesotho"), - N_("Liberia"), - N_("Liechtenstein"), - N_("Lithuania"), - N_("Luxembourg"), - N_("Macau"), - N_("Macedonia"), - N_("Madagascar"), - N_("Malawi"), - N_("Malaysia"), - N_("Maldives"), - N_("Mali"), - N_("Malta"), - N_("Marshall Islands"), - N_("Martinique"), - N_("Mauritania"), - N_("Mauritius"), - N_("Mayotte"), - N_("Mexico"), - N_("Micronesia"), - N_("Moldova, Republic Of"), - N_("Monaco"), - N_("Mongolia"), - N_("Montserrat"), - N_("Morocco"), - N_("Mozambique"), - N_("Myanmar"), - N_("Namibia"), - N_("Nauru"), - N_("Nepal"), - N_("Netherlands"), - N_("Netherlands Antilles"), - N_("New Caledonia"), - N_("New Zealand"), - N_("Nicaragua"), - N_("Niger"), - N_("Nigeria"), - N_("Niue"), - N_("Norfolk Island"), - N_("Northern Mariana Islands"), - N_("Norway"), - N_("Oman"), - N_("Pakistan"), - N_("Palau"), - N_("Palestinian Territory"), - N_("Panama"), - N_("Papua New Guinea"), - N_("Paraguay"), - N_("Peru"), - N_("Philippines"), - N_("Pitcairn"), - N_("Poland"), - N_("Portugal"), - N_("Puerto Rico"), - N_("Qatar"), - N_("Reunion"), - N_("Romania"), - N_("Russian Federation"), - N_("Rwanda"), - N_("Saint Kitts And Nevis"), - N_("Saint Lucia"), - N_("Saint Vincent And The Grena-dines"), - N_("Samoa"), - N_("San Marino"), - N_("Sao Tome And Principe"), - N_("Saudi Arabia"), - N_("Senegal"), - N_("Seychelles"), - N_("Sierra Leone"), - N_("Singapore"), - N_("Slovakia"), - N_("Slovenia"), - N_("Solomon Islands"), - N_("Somalia"), - N_("South Africa"), - N_("South Georgia And The South Sandwich Islands"), - N_("Spain"), - N_("Sri Lanka"), - N_("St. Helena"), - N_("St. Pierre And Miquelon"), - N_("Sudan"), - N_("Suriname"), - N_("Svalbard And Jan Mayen Islands"), - N_("Swaziland"), - N_("Sweden"), - N_("Switzerland"), - N_("Taiwan"), - N_("Tajikistan"), - N_("Tanzania, United Republic Of"), - N_("Thailand"), - N_("Togo"), - N_("Tokelau"), - N_("Tonga"), - N_("Trinidad And Tobago"), - N_("Tunisia"), - N_("Turkey"), - N_("Turkmenistan"), - N_("Turks And Caicos Islands"), - N_("Tuvalu"), - N_("Uganda"), - N_("Ukraine"), - N_("United Arab Emirates"), - N_("United Kingdom"), - N_("United States Minor Outlying Islands"), - N_("Uruguay"), - N_("Uzbekistan"), - N_("Vanuatu"), - N_("Venezuela"), - N_("Viet Nam"), - N_("Virgin Islands, British"), - N_("Virgin Islands, U.S."), - N_("Wallis And Futuna Islands"), - N_("Western Sahara"), - N_("Yemen"), - N_("Yugoslavia"), - N_("Zambia"), - N_("Zimbabwe"), - NULL -}; - -static int -compare_func (const void *voida, const void *voidb) -{ - char * const *stringa = voida, * const *stringb = voidb; - - return strcoll (*stringa, *stringb); -} - -static void -fill_in_countries (GladeXML *gui) -{ - GtkCombo *combo; - combo = (GtkCombo *) glade_xml_get_widget(gui, "combo-country"); - if (combo && GTK_IS_COMBO (combo)) { - static gboolean sorted = FALSE; - static GList *country_list; - if (!sorted) { - int i; - char *locale; - - for (i = 0; countries[i]; i++) { - countries[i] = _(countries[i]); - } - - locale = setlocale (LC_COLLATE, NULL); - qsort (countries + 1, i - 1, sizeof (countries[0]), compare_func); - country_list = NULL; - for (i = 0; countries[i]; i++) { - country_list = g_list_prepend (country_list, countries[i]); - } - country_list = g_list_reverse (country_list); - sorted = TRUE; - } - gtk_combo_set_popdown_strings (combo, country_list); - } -} - -static void -e_contact_editor_address_init (EContactEditorAddress *e_contact_editor_address) -{ - GladeXML *gui; - GtkWidget *widget; - char *icon_path; - - gtk_dialog_add_buttons (GTK_DIALOG (e_contact_editor_address), - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); - - gtk_window_set_resizable(GTK_WINDOW(e_contact_editor_address), TRUE); - -#if notyet - e_contact_editor_address->address = NULL; -#endif - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/fulladdr.glade", NULL, NULL); - e_contact_editor_address->gui = gui; - - setup_tab_order (gui); - fill_in_countries (gui); - - widget = glade_xml_get_widget(gui, "dialog-checkaddress"); - gtk_window_set_title (GTK_WINDOW (e_contact_editor_address), - GTK_WINDOW (widget)->title); - - widget = glade_xml_get_widget(gui, "table-checkaddress"); - g_object_ref(widget); - gtk_container_remove(GTK_CONTAINER(widget->parent), widget); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (e_contact_editor_address)->vbox), widget, TRUE, TRUE, 0); - g_object_unref(widget); - - icon_path = g_concat_dir_and_file (EVOLUTION_IMAGESDIR, "evolution-contacts-mini.png"); - gnome_window_icon_set_from_file (GTK_WINDOW (e_contact_editor_address), icon_path); - g_free (icon_path); -} - -void -e_contact_editor_address_dispose (GObject *object) -{ - EContactEditorAddress *e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS(object); - - if (e_contact_editor_address->gui) { - g_object_unref(e_contact_editor_address->gui); - e_contact_editor_address->gui = NULL; - } - -#if notyet - if (e_contact_editor_address->address) { - e_card_delivery_address_unref(e_contact_editor_address->address); - e_contact_editor_address->address = NULL; - } -#endif - - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); -} - -GtkWidget* -e_contact_editor_address_new (/* XXX notyet const ECardDeliveryAddress *address*/) -{ - GtkWidget *widget = g_object_new (E_TYPE_CONTACT_EDITOR_ADDRESS, NULL); -#if notyet - g_object_set (widget, - "address", address, - NULL); -#endif - return widget; -} - -static void -e_contact_editor_address_set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) -{ - EContactEditorAddress *e_contact_editor_address; - - e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS (object); - - switch (prop_id){ - case PROP_ADDRESS: -#if notyet - e_card_delivery_address_unref(e_contact_editor_address->address); - e_contact_editor_address->address = e_card_delivery_address_copy(g_value_get_pointer (value)); - fill_in_info(e_contact_editor_address); -#endif - break; - case PROP_EDITABLE: { - int i; - char *widget_names[] = { - "entry-street", - "entry-city", - "entry-ext", - "entry-po", - "entry-region", - "combo-country", - "entry-code", - "label-street", - "label-city", - "label-ext", - "label-po", - "label-region", - "label-country", - "label-code", - NULL - }; - e_contact_editor_address->editable = g_value_get_boolean (value) ? TRUE : FALSE; - for (i = 0; widget_names[i] != NULL; i ++) { - GtkWidget *w = glade_xml_get_widget(e_contact_editor_address->gui, widget_names[i]); - if (GTK_IS_ENTRY (w)) { - gtk_editable_set_editable (GTK_EDITABLE (w), - e_contact_editor_address->editable); - } - else if (GTK_IS_COMBO (w)) { - gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (w)->entry), - e_contact_editor_address->editable); - gtk_widget_set_sensitive (GTK_COMBO (w)->button, e_contact_editor_address->editable); - } - else if (GTK_IS_LABEL (w)) { - gtk_widget_set_sensitive (w, e_contact_editor_address->editable); - } - } - break; - } - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_contact_editor_address_get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) -{ - EContactEditorAddress *e_contact_editor_address; - - e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS (object); - - switch (prop_id) { - case PROP_ADDRESS: - extract_info(e_contact_editor_address); -#if notyet - g_value_set_pointer (value, e_card_delivery_address_ref(e_contact_editor_address->address)); -#endif - break; - case PROP_EDITABLE: - g_value_set_boolean (value, e_contact_editor_address->editable ? TRUE : FALSE); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -fill_in_field(EContactEditorAddress *editor, char *field, char *string) -{ - GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, field)); - if (entry) { - if (string) - gtk_entry_set_text(entry, string); - else - gtk_entry_set_text(entry, ""); - } -} - -static void -fill_in_info(EContactEditorAddress *editor) -{ -#if notyet - ECardDeliveryAddress *address = editor->address; - if (address) { - fill_in_field(editor, "entry-street" , address->street ); - fill_in_field(editor, "entry-po" , address->po ); - fill_in_field(editor, "entry-ext" , address->ext ); - fill_in_field(editor, "entry-city" , address->city ); - fill_in_field(editor, "entry-region" , address->region ); - fill_in_field(editor, "entry-code" , address->code ); - fill_in_field(editor, "entry-country", address->country); - } -#endif -} - -static char * -extract_field(EContactEditorAddress *editor, char *field) -{ - GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, field)); - if (entry) - return g_strdup (gtk_entry_get_text(entry)); - else - return NULL; -} - -static void -extract_info(EContactEditorAddress *editor) -{ -#if notyet - ECardDeliveryAddress *address = editor->address; - if (!address) { - address = e_card_delivery_address_new(); - editor->address = address; - } - address->street = extract_field(editor, "entry-street" ); - address->po = extract_field(editor, "entry-po" ); - address->ext = extract_field(editor, "entry-ext" ); - address->city = extract_field(editor, "entry-city" ); - address->region = extract_field(editor, "entry-region" ); - address->code = extract_field(editor, "entry-code" ); - address->country = extract_field(editor, "entry-country"); -#endif -} diff --git a/addressbook/gui/contact-editor/e-contact-editor-address.h b/addressbook/gui/contact-editor/e-contact-editor-address.h deleted file mode 100644 index 893a2ea2f7..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor-address.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-editor-address.h - * Copyright (C) 2000 Ximian, Inc. - * Author: Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_CONTACT_EDITOR_ADDRESS_H__ -#define __E_CONTACT_EDITOR_ADDRESS_H__ - -#include -#include -#include - -G_BEGIN_DECLS - -/* EContactEditorAddress - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * name ECardName * RW The card currently being edited. Returns a copy. - */ - -#define E_TYPE_CONTACT_EDITOR_ADDRESS (e_contact_editor_address_get_type ()) -#define E_CONTACT_EDITOR_ADDRESS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CONTACT_EDITOR_ADDRESS, EContactEditorAddress)) -#define E_CONTACT_EDITOR_ADDRESS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CONTACT_EDITOR_ADDRESS, EContactEditorAddressClass)) -#define E_IS_CONTACT_EDITOR_ADDRESS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CONTACT_EDITOR_ADDRESS)) -#define E_IS_CONTACT_EDITOR_ADDRESS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_CONTACT_EDITOR_ADDRESS)) - - -typedef struct _EContactEditorAddress EContactEditorAddress; -typedef struct _EContactEditorAddressClass EContactEditorAddressClass; - -struct _EContactEditorAddress -{ - GtkDialog parent; - -#if notyet - /* item specific fields */ - ECardDeliveryAddress *address; -#endif - - guint editable : 1; - - GladeXML *gui; -}; - -struct _EContactEditorAddressClass -{ - GtkDialogClass parent_class; -}; - - -GtkWidget *e_contact_editor_address_new(/* XXX not yet const ECardDeliveryAddress *name*/); -GType e_contact_editor_address_get_type (void); - -G_END_DECLS - -#endif /* __E_CONTACT_EDITOR_ADDRESS_H__ */ diff --git a/addressbook/gui/contact-editor/e-contact-editor-fullname.c b/addressbook/gui/contact-editor/e-contact-editor-fullname.c deleted file mode 100644 index c37f4cc8b7..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor-fullname.c +++ /dev/null @@ -1,287 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * eab-contact-editor-phones.c - * Copyright (C) 2003 Ximian, Inc. - * Author: Chris Toshok - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include "e-contact-editor-fullname.h" -#include -#include -#include -#include -#include -#include -#include - -static void e_contact_editor_fullname_init (EContactEditorFullname *card); -static void e_contact_editor_fullname_class_init (EContactEditorFullnameClass *klass); -static void e_contact_editor_fullname_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void e_contact_editor_fullname_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void e_contact_editor_fullname_dispose (GObject *object); - -static void fill_in_info(EContactEditorFullname *editor); -static void extract_info(EContactEditorFullname *editor); - -static GtkDialogClass *parent_class = NULL; - -/* The arguments we take */ -enum { - PROP_0, - PROP_NAME, - PROP_EDITABLE -}; - -GType -e_contact_editor_fullname_get_type (void) -{ - static GType contact_editor_fullname_type = 0; - - if (!contact_editor_fullname_type) { - static const GTypeInfo contact_editor_fullname_info = { - sizeof (EContactEditorFullnameClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_contact_editor_fullname_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EContactEditorFullname), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_contact_editor_fullname_init, - }; - - contact_editor_fullname_type = g_type_register_static (GTK_TYPE_DIALOG, "EContactEditorFullname", &contact_editor_fullname_info, 0); - } - - return contact_editor_fullname_type; -} - -static void -e_contact_editor_fullname_class_init (EContactEditorFullnameClass *klass) -{ - GObjectClass *object_class; - - object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_ref (GTK_TYPE_DIALOG); - - object_class->set_property = e_contact_editor_fullname_set_property; - object_class->get_property = e_contact_editor_fullname_get_property; - object_class->dispose = e_contact_editor_fullname_dispose; - - g_object_class_install_property (object_class, PROP_NAME, - g_param_spec_pointer ("name", - _("Name"), - /*_( */"XXX blurb" /*)*/, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EDITABLE, - g_param_spec_boolean ("editable", - _("Editable"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); -} - -static void -e_contact_editor_fullname_init (EContactEditorFullname *e_contact_editor_fullname) -{ - GladeXML *gui; - GtkWidget *widget; - char *icon_path; - - gtk_dialog_add_buttons (GTK_DIALOG (e_contact_editor_fullname), - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); - - gtk_window_set_resizable(GTK_WINDOW(e_contact_editor_fullname), TRUE); - - e_contact_editor_fullname->name = NULL; - gui = glade_xml_new (EVOLUTION_GLADEDIR "/fullname.glade", NULL, NULL); - e_contact_editor_fullname->gui = gui; - - widget = glade_xml_get_widget(gui, "dialog-checkfullname"); - gtk_window_set_title (GTK_WINDOW (e_contact_editor_fullname), - GTK_WINDOW (widget)->title); - - widget = glade_xml_get_widget(gui, "table-checkfullname"); - g_object_ref(widget); - gtk_container_remove(GTK_CONTAINER(widget->parent), widget); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (e_contact_editor_fullname)->vbox), widget, TRUE, TRUE, 0); - g_object_unref(widget); - - icon_path = g_concat_dir_and_file (EVOLUTION_IMAGESDIR, "evolution-contacts-mini.png"); - gnome_window_icon_set_from_file (GTK_WINDOW (e_contact_editor_fullname), icon_path); - g_free (icon_path); -} - -void -e_contact_editor_fullname_dispose (GObject *object) -{ - EContactEditorFullname *e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME(object); - - if (e_contact_editor_fullname->gui) { - g_object_unref(e_contact_editor_fullname->gui); - e_contact_editor_fullname->gui = NULL; - } - - if (e_contact_editor_fullname->name) { - e_contact_name_free(e_contact_editor_fullname->name); - e_contact_editor_fullname->name = NULL; - } - - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); -} - -GtkWidget* -e_contact_editor_fullname_new (const EContactName *name) -{ - GtkWidget *widget = g_object_new (E_TYPE_CONTACT_EDITOR_FULLNAME, NULL); - g_object_set (widget, - "name", name, - NULL); - return widget; -} - -static void -e_contact_editor_fullname_set_property (GObject *object, guint prop_id, - const GValue *value, GParamSpec *pspec) -{ - EContactEditorFullname *e_contact_editor_fullname; - - e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME (object); - - switch (prop_id){ - case PROP_NAME: - e_contact_name_free(e_contact_editor_fullname->name); - e_contact_editor_fullname->name = e_contact_name_copy(g_value_get_pointer (value)); - fill_in_info(e_contact_editor_fullname); - break; - case PROP_EDITABLE: { - int i; - char *widget_names[] = { - "combo-title", - "combo-suffix", - "entry-first", - "entry-middle", - "entry-last", - "label-title", - "label-suffix", - "label-first", - "label-middle", - "label-last", - NULL - }; - e_contact_editor_fullname->editable = g_value_get_boolean (value) ? TRUE : FALSE; - for (i = 0; widget_names[i] != NULL; i ++) { - GtkWidget *w = glade_xml_get_widget(e_contact_editor_fullname->gui, widget_names[i]); - if (GTK_IS_ENTRY (w)) { - gtk_editable_set_editable (GTK_EDITABLE (w), - e_contact_editor_fullname->editable); - } - else if (GTK_IS_COMBO (w)) { - gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (w)->entry), - e_contact_editor_fullname->editable); - gtk_widget_set_sensitive (GTK_COMBO (w)->button, e_contact_editor_fullname->editable); - } - else if (GTK_IS_LABEL (w)) { - gtk_widget_set_sensitive (w, e_contact_editor_fullname->editable); - } - } - break; - } - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_contact_editor_fullname_get_property (GObject *object, guint prop_id, - GValue *value, GParamSpec *pspec) -{ - EContactEditorFullname *e_contact_editor_fullname; - - e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME (object); - - switch (prop_id) { - case PROP_NAME: - extract_info(e_contact_editor_fullname); - g_value_set_pointer (value, e_contact_name_copy(e_contact_editor_fullname->name)); - break; - case PROP_EDITABLE: - g_value_set_boolean (value, e_contact_editor_fullname->editable ? TRUE : FALSE); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -fill_in_field(EContactEditorFullname *editor, char *field, char *string) -{ - GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, field)); - if (entry) { - if (string) - gtk_entry_set_text(entry, string); - else - gtk_entry_set_text(entry, ""); - } -} - -static void -fill_in_info(EContactEditorFullname *editor) -{ - EContactName *name = editor->name; - if (name) { - fill_in_field(editor, "entry-title", name->prefixes); - fill_in_field(editor, "entry-first", name->given); - fill_in_field(editor, "entry-middle", name->additional); - fill_in_field(editor, "entry-last", name->family); - fill_in_field(editor, "entry-suffix", name->suffixes); - } -} - -static char * -extract_field(EContactEditorFullname *editor, char *field) -{ - GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, field)); - if (entry) - return g_strdup (gtk_entry_get_text(entry)); - else - return NULL; -} - -static void -extract_info(EContactEditorFullname *editor) -{ - EContactName *name = editor->name; - if (!name) { - name = e_contact_name_new(); - editor->name = name; - } - - name->prefixes = extract_field(editor, "entry-title" ); - name->given = extract_field(editor, "entry-first" ); - name->additional = extract_field(editor, "entry-middle"); - name->family = extract_field(editor, "entry-last" ); - name->suffixes = extract_field(editor, "entry-suffix"); -} diff --git a/addressbook/gui/contact-editor/e-contact-editor-fullname.h b/addressbook/gui/contact-editor/e-contact-editor-fullname.h deleted file mode 100644 index 0b254c789c..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor-fullname.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-editor-fullname.h - * Copyright (C) 2000 Ximian, Inc. - * Author: Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_CONTACT_EDITOR_FULLNAME_H__ -#define __E_CONTACT_EDITOR_FULLNAME_H__ - -#include -#include -#include - -G_BEGIN_DECLS - -/* EContactEditorFullname - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * name ECardName * RW The card currently being edited. Returns a copy. - */ - -#define E_TYPE_CONTACT_EDITOR_FULLNAME (e_contact_editor_fullname_get_type ()) -#define E_CONTACT_EDITOR_FULLNAME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CONTACT_EDITOR_FULLNAME, EContactEditorFullname)) -#define E_CONTACT_EDITOR_FULLNAME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CONTACT_EDITOR_FULLNAME, EContactEditorFullnameClass)) -#define E_IS_CONTACT_EDITOR_FULLNAME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CONTACT_EDITOR_FULLNAME)) -#define E_IS_CONTACT_EDITOR_FULLNAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_CONTACT_EDITOR_FULLNAME)) - - -typedef struct _EContactEditorFullname EContactEditorFullname; -typedef struct _EContactEditorFullnameClass EContactEditorFullnameClass; - -struct _EContactEditorFullname -{ - GtkDialog parent; - - /* item specific fields */ - EContactName *name; - GladeXML *gui; - - /* Whether the dialog will accept modifications */ - guint editable : 1; -}; - -struct _EContactEditorFullnameClass -{ - GtkDialogClass parent_class; -}; - - -GtkWidget *e_contact_editor_fullname_new(const EContactName *name); -GType e_contact_editor_fullname_get_type (void); - -G_END_DECLS - -#endif /* __E_CONTACT_EDITOR_FULLNAME_H__ */ diff --git a/addressbook/gui/contact-editor/e-contact-editor-marshal.list b/addressbook/gui/contact-editor/e-contact-editor-marshal.list deleted file mode 100644 index 58b2640de5..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor-marshal.list +++ /dev/null @@ -1,2 +0,0 @@ -NONE:INT,OBJECT -NONE:NONE diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c deleted file mode 100644 index 1391ccf1b0..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ /dev/null @@ -1,2612 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * e-contact-editor.c - * Copyright (C) 2000 Ximian, Inc. - * Author: Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include - -#include "e-contact-editor.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "addressbook/printing/e-contact-print.h" -#include "addressbook/printing/e-contact-print-envelope.h" -#include "addressbook/gui/widgets/eab-gui-util.h" -#include "e-util/e-gui-utils.h" -#include "widgets/misc/e-dateedit.h" -#include "widgets/misc/e-url-entry.h" -#include "shell/evolution-shell-component-utils.h" - -#include "eab-contact-merging.h" - -#include "e-contact-editor-address.h" -#include "e-contact-editor-fullname.h" -#include "e-contact-editor-marshal.h" - -/* Signal IDs */ -enum { - CONTACT_ADDED, - CONTACT_MODIFIED, - CONTACT_DELETED, - EDITOR_CLOSED, - LAST_SIGNAL -}; - -static void e_contact_editor_init (EContactEditor *editor); -static void e_contact_editor_class_init (EContactEditorClass *klass); -static void e_contact_editor_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void e_contact_editor_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void e_contact_editor_dispose (GObject *object); - -static void _email_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor); -static void _phone_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor); -static void _address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor); -static void find_address_mailing (EContactEditor *editor); -static void enable_writable_fields(EContactEditor *editor); -static void set_editable(EContactEditor *editor); -static void fill_in_info(EContactEditor *editor); -static void extract_info(EContactEditor *editor); -static void set_field(EContactEditor *editor, GtkEntry *entry, const char *string); -static void set_address_field(EContactEditor *editor, int result); -static void set_phone_field(EContactEditor *editor, GtkWidget *entry, const char *phone_number); -static void set_fields(EContactEditor *editor); -static void command_state_changed (EContactEditor *ce); -static void widget_changed (GtkWidget *widget, EContactEditor *editor); -static void close_dialog (EContactEditor *ce); -static void enable_widget (GtkWidget *widget, gboolean enabled); - -static GtkObjectClass *parent_class = NULL; - -static guint contact_editor_signals[LAST_SIGNAL]; - -/* The arguments we take */ -enum { - PROP_0, - PROP_BOOK, - PROP_CONTACT, - PROP_IS_NEW_CONTACT, - PROP_EDITABLE, - PROP_CHANGED, - PROP_WRITABLE_FIELDS -}; - -enum { - DYNAMIC_LIST_EMAIL, - DYNAMIC_LIST_PHONE, - DYNAMIC_LIST_ADDRESS -}; - -static EContactField phones[] = { - E_CONTACT_PHONE_ASSISTANT, - E_CONTACT_PHONE_BUSINESS, - E_CONTACT_PHONE_BUSINESS_2, - E_CONTACT_PHONE_BUSINESS_FAX, - E_CONTACT_PHONE_CALLBACK, - E_CONTACT_PHONE_CAR, - E_CONTACT_PHONE_COMPANY, - E_CONTACT_PHONE_HOME, - E_CONTACT_PHONE_HOME_2, - E_CONTACT_PHONE_HOME_FAX, - E_CONTACT_PHONE_ISDN, - E_CONTACT_PHONE_MOBILE, - E_CONTACT_PHONE_OTHER, - E_CONTACT_PHONE_OTHER_FAX, - E_CONTACT_PHONE_PAGER, - E_CONTACT_PHONE_PRIMARY, - E_CONTACT_PHONE_RADIO, - E_CONTACT_PHONE_TELEX, - E_CONTACT_PHONE_TTYTDD, -}; - -static EContactField emails[] = { - E_CONTACT_EMAIL_1, - E_CONTACT_EMAIL_2, - E_CONTACT_EMAIL_3 -}; - -static GSList *all_contact_editors = NULL; - -GType -e_contact_editor_get_type (void) -{ - static GType contact_editor_type = 0; - - if (!contact_editor_type) { - static const GTypeInfo contact_editor_info = { - sizeof (EContactEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_contact_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EContactEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_contact_editor_init, - }; - - contact_editor_type = g_type_register_static (GTK_TYPE_OBJECT, "EContactEditor", &contact_editor_info, 0); - } - - return contact_editor_type; -} - -static void -e_contact_editor_class_init (EContactEditorClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_ref (GTK_TYPE_OBJECT); - - object_class->set_property = e_contact_editor_set_property; - object_class->get_property = e_contact_editor_get_property; - object_class->dispose = e_contact_editor_dispose; - - g_object_class_install_property (object_class, PROP_BOOK, - g_param_spec_object ("book", - _("Book"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_BOOK, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_CONTACT, - g_param_spec_object ("contact", - _("Contact"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_CONTACT, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_IS_NEW_CONTACT, - g_param_spec_boolean ("is_new_contact", - _("Is New Contact"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_WRITABLE_FIELDS, - g_param_spec_object ("writable_fields", - _("Writable Fields"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_LIST, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EDITABLE, - g_param_spec_boolean ("editable", - _("Editable"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_CHANGED, - g_param_spec_boolean ("changed", - _("Changed"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); - - contact_editor_signals[CONTACT_ADDED] = - g_signal_new ("contact_added", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EContactEditorClass, contact_added), - NULL, NULL, - e_contact_editor_marshal_NONE__INT_OBJECT, - G_TYPE_NONE, 2, - G_TYPE_INT, G_TYPE_OBJECT); - - contact_editor_signals[CONTACT_MODIFIED] = - g_signal_new ("contact_modified", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EContactEditorClass, contact_modified), - NULL, NULL, - e_contact_editor_marshal_NONE__INT_OBJECT, - G_TYPE_NONE, 2, - G_TYPE_INT, G_TYPE_OBJECT); - - contact_editor_signals[CONTACT_DELETED] = - g_signal_new ("contact_deleted", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EContactEditorClass, contact_deleted), - NULL, NULL, - e_contact_editor_marshal_NONE__INT_OBJECT, - G_TYPE_NONE, 2, - G_TYPE_INT, G_TYPE_OBJECT); - - contact_editor_signals[EDITOR_CLOSED] = - g_signal_new ("editor_closed", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EContactEditorClass, editor_closed), - NULL, NULL, - e_contact_editor_marshal_NONE__NONE, - G_TYPE_NONE, 0); -} - -static void -connect_arrow_button_signal (EContactEditor *editor, gchar *button_xml, GCallback func) -{ - GladeXML *gui = editor->gui; - GtkWidget *button = glade_xml_get_widget(gui, button_xml); - if (button && GTK_IS_BUTTON(button)) { - g_signal_connect(button, "button_press_event", func, editor); - } -} - -static void -connect_arrow_button_signals (EContactEditor *editor) -{ - connect_arrow_button_signal(editor, "button-phone1", G_CALLBACK (_phone_arrow_pressed)); - connect_arrow_button_signal(editor, "button-phone2", G_CALLBACK (_phone_arrow_pressed)); - connect_arrow_button_signal(editor, "button-phone3", G_CALLBACK (_phone_arrow_pressed)); - connect_arrow_button_signal(editor, "button-phone4", G_CALLBACK (_phone_arrow_pressed)); - connect_arrow_button_signal(editor, "button-address", G_CALLBACK (_address_arrow_pressed)); - connect_arrow_button_signal(editor, "button-email1", G_CALLBACK (_email_arrow_pressed)); -} - -static void -wants_html_changed (GtkWidget *widget, EContactEditor *editor) -{ - gboolean wants_html; - g_object_get (widget, - "active", &wants_html, - NULL); - - e_contact_set (editor->contact, E_CONTACT_WANTS_HTML, GINT_TO_POINTER (wants_html)); - - widget_changed (widget, editor); -} - -static void -phone_entry_changed (GtkWidget *widget, EContactEditor *editor) -{ - int which; - GtkEntry *entry = GTK_ENTRY(widget); - - if ( widget == glade_xml_get_widget(editor->gui, "entry-phone1") ) - which = 1; - else if ( widget == glade_xml_get_widget(editor->gui, "entry-phone2") ) - which = 2; - else if ( widget == glade_xml_get_widget(editor->gui, "entry-phone3") ) - which = 3; - else if ( widget == glade_xml_get_widget(editor->gui, "entry-phone4") ) - which = 4; - else - return; - - printf ("gtk_entry_get_text(entry) == %s\n", (char*)gtk_entry_get_text(entry)); - e_contact_set(editor->contact, editor->phone_choice[which - 1], (char*)gtk_entry_get_text(entry)); - - widget_changed (widget, editor); -} - -static void -email_entry_changed (GtkWidget *widget, EContactEditor *editor) -{ - GtkEntry *entry = GTK_ENTRY(widget); - - e_contact_set (editor->contact, editor->email_choice, (char*)gtk_entry_get_text(entry)); - - widget_changed (widget, editor); -} - -static void -address_text_changed (GtkTextBuffer *buffer, EContactEditor *editor) -{ -#if notyet - ECardAddrLabel *address; - GtkTextIter start_iter, end_iter; - - if (editor->address_choice == -1) - return; - - address = e_card_address_label_new(); - - if (editor->address_mailing == editor->address_choice || editor->address_mailing == -1) { - GtkWidget *check; - - address->flags |= E_CARD_ADDR_DEFAULT; - - check = glade_xml_get_widget(editor->gui, "checkbutton-mailingaddress"); - if (check && GTK_IS_CHECK_BUTTON (check)) { - g_signal_handlers_block_matched (check, - G_SIGNAL_MATCH_DATA, - 0, 0, - NULL, NULL, editor); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE); - g_signal_handlers_unblock_matched (check, - G_SIGNAL_MATCH_DATA, - 0, 0, - NULL, NULL, editor); - } - } - - gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (buffer), &start_iter); - gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (buffer), &end_iter); - - address->data = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (buffer), &start_iter, &end_iter, FALSE); - - e_card_simple_set_address(editor->simple, editor->address_choice, address); - e_card_address_label_unref(address); - - widget_changed (NULL, editor); -#endif -} - - -static void -address_mailing_changed (GtkWidget *widget, EContactEditor *editor) -{ -#if notyet - const ECardDeliveryAddress *curr; - ECardDeliveryAddress *address; - gboolean mailing_address; - - if (editor->address_choice == -1) - return; - - mailing_address = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); - - /* Mark the current address as the mailing address */ - curr = e_card_simple_get_delivery_address (editor->simple, - editor->address_choice); - - address = e_card_delivery_address_copy (curr); - - if (!address) - address = e_card_delivery_address_new (); - - if (mailing_address) - address->flags |= E_CARD_ADDR_DEFAULT; - else - address->flags &= ~E_CARD_ADDR_DEFAULT; - - e_card_simple_set_delivery_address(editor->simple, editor->address_choice, address); - e_card_delivery_address_unref (address); - - /* Unset the previous mailing address flag */ - if (mailing_address && editor->address_mailing != -1) { - const ECardDeliveryAddress *curr; - - curr = e_card_simple_get_delivery_address(editor->simple, - editor->address_mailing); - address = e_card_delivery_address_copy (curr); - address->flags &= ~E_CARD_ADDR_DEFAULT; - e_card_simple_set_delivery_address(editor->simple, - editor->address_mailing, - address); - e_card_delivery_address_unref (address); - } - - /* Remember the new mailing address */ - if (mailing_address) - editor->address_mailing = editor->address_choice; - else - editor->address_mailing = -1; - - widget_changed (widget, editor); -#endif -} - - -/* This function tells you whether name_to_style will make sense. */ -static gboolean -style_makes_sense(const EContactName *name, char *company, int style) -{ - switch (style) { - case 0: /* Fall Through */ - case 1: - return TRUE; - case 2: - if (company && *company) - return TRUE; - else - return FALSE; - case 3: /* Fall Through */ - case 4: - if (company && *company && name && ((name->given && *name->given) || (name->family && *name->family))) - return TRUE; - else - return FALSE; - default: - return FALSE; - } -} - -static char * -name_to_style(const EContactName *name, char *company, int style) -{ - char *string; - char *strings[4], **stringptr; - char *substring; - switch (style) { - case 0: - stringptr = strings; - if (name) { - if (name->family && *name->family) - *(stringptr++) = name->family; - if (name->given && *name->given) - *(stringptr++) = name->given; - } - *stringptr = NULL; - string = g_strjoinv(", ", strings); - break; - case 1: - stringptr = strings; - if (name) { - if (name->given && *name->given) - *(stringptr++) = name->given; - if (name->family && *name->family) - *(stringptr++) = name->family; - } - *stringptr = NULL; - string = g_strjoinv(" ", strings); - break; - case 2: - string = g_strdup(company); - break; - case 3: /* Fall Through */ - case 4: - stringptr = strings; - if (name) { - if (name->family && *name->family) - *(stringptr++) = name->family; - if (name->given && *name->given) - *(stringptr++) = name->given; - } - *stringptr = NULL; - substring = g_strjoinv(", ", strings); - if (!(company && *company)) - company = ""; - if (style == 3) - string = g_strdup_printf("%s (%s)", substring, company); - else - string = g_strdup_printf("%s (%s)", company, substring); - g_free(substring); - break; - default: - string = g_strdup(""); - } - return string; -} - -static int -file_as_get_style (EContactEditor *editor) -{ - GtkEntry *file_as = GTK_ENTRY(glade_xml_get_widget(editor->gui, "entry-file-as")); - char *filestring; - char *trystring; - EContactName *name = editor->name; - int i; - int style; - - if (!(file_as && GTK_IS_ENTRY(file_as))) - return -1; - - filestring = g_strdup (gtk_entry_get_text(file_as)); - - style = -1; - for (i = 0; i < 5; i++) { - trystring = name_to_style(name, editor->company, i); - if (!strcmp(trystring, filestring)) { - g_free(trystring); - g_free(filestring); - return i; - } - g_free(trystring); - } - g_free (filestring); - return -1; -} - -static void -file_as_set_style(EContactEditor *editor, int style) -{ - char *string; - int i; - GList *strings = NULL; - GtkEntry *file_as = GTK_ENTRY(glade_xml_get_widget(editor->gui, "entry-file-as")); - GtkWidget *widget; - - - if (!(file_as && GTK_IS_ENTRY(file_as))) - return; - - if (style == -1) { - string = g_strdup (gtk_entry_get_text(file_as)); - strings = g_list_append(strings, string); - } - - widget = glade_xml_get_widget(editor->gui, "combo-file-as"); - - for (i = 0; i < 5; i++) { - if (style_makes_sense(editor->name, editor->company, i)) { - char *u; - u = name_to_style(editor->name, editor->company, i); - if (u) strings = g_list_append(strings, u); - } - } - - if (widget && GTK_IS_COMBO(widget)) { - GtkCombo *combo = GTK_COMBO(widget); - gtk_combo_set_popdown_strings(combo, strings); - g_list_foreach(strings, (GFunc) g_free, NULL); - g_list_free(strings); - } - - if (style != -1) { - string = name_to_style(editor->name, editor->company, style); - gtk_entry_set_text(file_as, string); - g_free(string); - } -} - -static void -name_entry_changed (GtkWidget *widget, EContactEditor *editor) -{ - int style = 0; - const char *string; - - style = file_as_get_style(editor); - - e_contact_name_free (editor->name); - - string = gtk_entry_get_text (GTK_ENTRY(widget)); - - editor->name = e_contact_name_from_string(string); - - file_as_set_style(editor, style); - - widget_changed (widget, editor); -} - -static void -company_entry_changed (GtkWidget *widget, EContactEditor *editor) -{ - int style = 0; - - style = file_as_get_style(editor); - - g_free(editor->company); - - editor->company = g_strdup (gtk_entry_get_text(GTK_ENTRY(widget))); - - file_as_set_style(editor, style); - - widget_changed (widget, editor); -} - -static void -field_changed (GtkWidget *widget, EContactEditor *editor) -{ - if (!editor->changed) { - editor->changed = TRUE; - command_state_changed (editor); - } -} - -static void -set_entry_changed_signal_phone(EContactEditor *editor, char *id) -{ - GtkWidget *widget = glade_xml_get_widget(editor->gui, id); - if (widget && GTK_IS_ENTRY(widget)) - g_signal_connect(widget, "changed", - G_CALLBACK (phone_entry_changed), editor); -} - -static void -set_entry_changed_signal_email(EContactEditor *editor, char *id) -{ - GtkWidget *widget = glade_xml_get_widget(editor->gui, id); - if (widget && GTK_IS_ENTRY(widget)) - g_signal_connect(widget, "changed", - G_CALLBACK (email_entry_changed), editor); -} - -static void -widget_changed (GtkWidget *widget, EContactEditor *editor) -{ - if (!editor->editable) { - g_warning ("non-editable contact editor has an editable field in it."); - return; - } - - if (!editor->changed) { - editor->changed = TRUE; - command_state_changed (editor); - } -} - -static void -set_entry_changed_signal_field(EContactEditor *editor, char *id) -{ - GtkWidget *widget = glade_xml_get_widget(editor->gui, id); - if (widget && GTK_IS_ENTRY(widget)) - g_signal_connect(widget, "changed", - G_CALLBACK (field_changed), editor); -} - -static void -set_urlentry_changed_signal_field (EContactEditor *editor, char *id) -{ - GtkWidget *widget = glade_xml_get_widget(editor->gui, id); - if (widget && E_IS_URL_ENTRY(widget)) { - GtkWidget *entry = e_url_entry_get_entry (E_URL_ENTRY (widget)); - g_signal_connect (entry, "changed", - G_CALLBACK (field_changed), editor); - } -} - -static void -set_entry_changed_signals(EContactEditor *editor) -{ - GtkWidget *widget; - set_entry_changed_signal_phone(editor, "entry-phone1"); - set_entry_changed_signal_phone(editor, "entry-phone2"); - set_entry_changed_signal_phone(editor, "entry-phone3"); - set_entry_changed_signal_phone(editor, "entry-phone4"); - - set_entry_changed_signal_email(editor, "entry-email1"); - - widget = glade_xml_get_widget(editor->gui, "text-address"); - if (widget && GTK_IS_TEXT_VIEW(widget)) { - GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); - g_signal_connect(buffer, "changed", - G_CALLBACK (address_text_changed), editor); - } - - widget = glade_xml_get_widget(editor->gui, "entry-fullname"); - if (widget && GTK_IS_ENTRY(widget)) { - g_signal_connect (widget, "changed", - G_CALLBACK (name_entry_changed), editor); - } - - widget = glade_xml_get_widget(editor->gui, "entry-company"); - if (widget && GTK_IS_ENTRY(widget)) { - g_signal_connect (widget, "changed", - G_CALLBACK (company_entry_changed), editor); - } - - set_urlentry_changed_signal_field (editor, "entry-web"); - set_urlentry_changed_signal_field (editor, "entry-blog"); - set_urlentry_changed_signal_field (editor, "entry-caluri"); - set_urlentry_changed_signal_field (editor, "entry-fburl"); - - set_entry_changed_signal_field(editor, "entry-categories"); - set_entry_changed_signal_field(editor, "entry-jobtitle"); - set_entry_changed_signal_field(editor, "entry-file-as"); - set_entry_changed_signal_field(editor, "entry-manager"); - set_entry_changed_signal_field(editor, "entry-assistant"); - set_entry_changed_signal_field(editor, "entry-office"); - set_entry_changed_signal_field(editor, "entry-department"); - set_entry_changed_signal_field(editor, "entry-profession"); - set_entry_changed_signal_field(editor, "entry-nickname"); - set_entry_changed_signal_field(editor, "entry-spouse"); - - widget = glade_xml_get_widget(editor->gui, "text-comments"); - if (widget && GTK_IS_TEXT_VIEW(widget)) { - GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); - g_signal_connect (buffer, "changed", - G_CALLBACK (widget_changed), editor); - } - widget = glade_xml_get_widget(editor->gui, "dateedit-birthday"); - if (widget && E_IS_DATE_EDIT(widget)) { - g_signal_connect (widget, "changed", - G_CALLBACK (widget_changed), editor); - } - widget = glade_xml_get_widget(editor->gui, "dateedit-anniversary"); - if (widget && E_IS_DATE_EDIT(widget)) { - g_signal_connect (widget, "changed", - G_CALLBACK (widget_changed), editor); - } -} - -static void -full_name_clicked(GtkWidget *button, EContactEditor *editor) -{ - GtkDialog *dialog = GTK_DIALOG(e_contact_editor_fullname_new(editor->name)); - int result; - - g_object_set (dialog, - "editable", editor->fullname_editable, - NULL); - gtk_widget_show(GTK_WIDGET(dialog)); - result = gtk_dialog_run (dialog); - gtk_widget_hide (GTK_WIDGET (dialog)); - - if (editor->fullname_editable && result == GTK_RESPONSE_OK) { - EContactName *name; - GtkWidget *fname_widget; - int style = 0; - - g_object_get (dialog, - "name", &name, - NULL); - - style = file_as_get_style(editor); - - fname_widget = glade_xml_get_widget(editor->gui, "entry-fullname"); - if (fname_widget && GTK_IS_ENTRY(fname_widget)) { - char *full_name = e_contact_name_to_string(name); - gtk_entry_set_text(GTK_ENTRY(fname_widget), full_name); - g_free(full_name); - } - - e_contact_name_free(editor->name); - editor->name = name; - - file_as_set_style(editor, style); - } - gtk_widget_destroy (GTK_WIDGET (dialog)); -} - -static void -full_addr_clicked(GtkWidget *button, EContactEditor *editor) -{ -#if notyet - GtkDialog *dialog; - int result; - const ECardDeliveryAddress *address; - - address = e_card_simple_get_delivery_address(editor->simple, editor->address_choice); - - dialog = GTK_DIALOG(e_contact_editor_address_new(address)); - g_object_set (dialog, - "editable", editor->address_editable[editor->address_choice], - NULL); - gtk_widget_show(GTK_WIDGET(dialog)); - - result = gtk_dialog_run (dialog); - - gtk_widget_hide (GTK_WIDGET (dialog)); - - if (editor->address_editable[editor->address_choice] && result == GTK_RESPONSE_OK) { - ECardDeliveryAddress *new_address; - GtkWidget *address_widget; - int saved_choice = editor->address_choice; - - editor->address_choice = -1; - - g_object_get (dialog, - "address", &new_address, - NULL); - - address_widget = glade_xml_get_widget(editor->gui, "text-address"); - if (address_widget && GTK_IS_TEXT_VIEW(address_widget)) { - GtkTextBuffer *buffer; - char *string = e_card_delivery_address_to_string(new_address); - - buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (address_widget)); - - gtk_text_buffer_set_text (buffer, string, strlen (string)); - - g_free(string); - } - - editor->address_choice = saved_choice; - - e_card_simple_set_delivery_address(editor->simple, editor->address_choice, new_address); - - e_card_delivery_address_unref(new_address); - - widget_changed (NULL, editor); - } - gtk_widget_destroy (GTK_WIDGET (dialog)); -#endif -} - -static void -categories_clicked(GtkWidget *button, EContactEditor *editor) -{ - char *categories = NULL; - GtkDialog *dialog; - int result; - GtkWidget *entry = glade_xml_get_widget(editor->gui, "entry-categories"); - ECategoriesMasterList *ecml; - if (entry && GTK_IS_ENTRY(entry)) - categories = g_strdup (gtk_entry_get_text(GTK_ENTRY(entry))); - else if (editor->contact) - categories = e_contact_get (editor->contact, E_CONTACT_CATEGORIES); - - dialog = GTK_DIALOG(e_categories_new(categories)); - - if (dialog == NULL) { - GtkWidget *uh_oh = gtk_message_dialog_new (NULL, - 0, GTK_MESSAGE_ERROR, - GTK_RESPONSE_OK, - _("Category editor not available.")); - g_free (categories); - gtk_widget_show (uh_oh); - return; - } - - ecml = e_categories_master_list_wombat_new (); - g_object_set (dialog, - "header", _("This contact belongs to these categories:"), - "ecml", ecml, - NULL); - g_object_unref (ecml); - gtk_widget_show(GTK_WIDGET(dialog)); - result = gtk_dialog_run (dialog); - g_free (categories); - if (result == GTK_RESPONSE_OK) { - g_object_get (dialog, - "categories", &categories, - NULL); - if (entry && GTK_IS_ENTRY(entry)) - gtk_entry_set_text(GTK_ENTRY(entry), categories); - else - e_contact_set (editor->contact, E_CONTACT_CATEGORIES, categories); - - g_free(categories); - } - gtk_widget_destroy(GTK_WIDGET(dialog)); -} - -typedef struct { - EContactEditor *ce; - gboolean should_close; -} EditorCloseStruct; - -static void -contact_added_cb (EBook *book, EBookStatus status, const char *id, EditorCloseStruct *ecs) -{ - EContactEditor *ce = ecs->ce; - gboolean should_close = ecs->should_close; - - gtk_widget_set_sensitive (ce->app, TRUE); - ce->in_async_call = FALSE; - - e_contact_set (ce->contact, E_CONTACT_UID, (char*)id); - - g_signal_emit (ce, contact_editor_signals[CONTACT_ADDED], 0, - status, ce->contact); - - if (status == E_BOOK_ERROR_OK) { - ce->is_new_contact = FALSE; - - if (should_close) { - close_dialog (ce); - } - else { - ce->changed = FALSE; - command_state_changed (ce); - } - } - - g_object_unref (ce); - g_free (ecs); -} - -static void -contact_modified_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs) -{ - EContactEditor *ce = ecs->ce; - gboolean should_close = ecs->should_close; - - gtk_widget_set_sensitive (ce->app, TRUE); - ce->in_async_call = FALSE; - - g_signal_emit (ce, contact_editor_signals[CONTACT_MODIFIED], 0, - status, ce->contact); - - if (status == E_BOOK_ERROR_OK) { - if (should_close) { - close_dialog (ce); - } - else { - ce->changed = FALSE; - command_state_changed (ce); - } - } - - g_object_unref (ce); - g_free (ecs); -} - -/* Emits the signal to request saving a contact */ -static void -save_contact (EContactEditor *ce, gboolean should_close) -{ - extract_info (ce); - - if (ce->book) { - EditorCloseStruct *ecs = g_new(EditorCloseStruct, 1); - - ecs->ce = ce; - g_object_ref (ecs->ce); - - ecs->should_close = should_close; - - gtk_widget_set_sensitive (ce->app, FALSE); - ce->in_async_call = TRUE; - - if (ce->is_new_contact) - eab_merging_book_add_contact (ce->book, ce->contact, (EBookIdCallback)contact_added_cb, ecs); - else - eab_merging_book_commit_contact (ce->book, ce->contact, (EBookCallback)contact_modified_cb, ecs); - } -} - -/* Closes the dialog box and emits the appropriate signals */ -static void -close_dialog (EContactEditor *ce) -{ - if (ce->app != NULL) { - gtk_widget_destroy (ce->app); - ce->app = NULL; - g_signal_emit (ce, contact_editor_signals[EDITOR_CLOSED], 0); - } -} - -static gboolean -prompt_to_save_changes (EContactEditor *editor) -{ - if (!editor->changed) - return TRUE; - - switch (eab_prompt_save_dialog (GTK_WINDOW(editor->app))) { - case GTK_RESPONSE_YES: - save_contact (editor, FALSE); - return TRUE; - case GTK_RESPONSE_NO: - return TRUE; - case GTK_RESPONSE_CANCEL: - default: - return FALSE; - } -} - -/* Menu callbacks */ - -/* File/Save callback */ -static void -file_save_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - save_contact (ce, FALSE); -} - -/* File/Close callback */ -static void -file_close_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - if (!prompt_to_save_changes (ce)) - return; - - close_dialog (ce); -} - -static void -file_save_as_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - EContact *contact; - - ce = E_CONTACT_EDITOR (data); - - extract_info (ce); - - contact = ce->contact; - eab_contact_save(_("Save Contact as VCard"), contact, GTK_WINDOW (ce->app)); -} - -static void -file_send_as_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - - extract_info (ce); - - eab_send_contact(ce->contact, EAB_DISPOSITION_AS_ATTACHMENT); -} - -static void -file_send_to_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - - extract_info (ce); - - eab_send_contact(ce->contact, EAB_DISPOSITION_AS_TO); -} - -gboolean -e_contact_editor_confirm_delete (GtkWindow *parent) -{ - GtkWidget *dialog; - gint result; - - dialog = gtk_message_dialog_new (parent, - 0, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_NONE, -#if notyet - /* XXX we really need to handle the plural case here.. */ - (plural - ? _("Are you sure you want\n" - "to delete these contacts?")) -#endif - _("Are you sure you want\n" - "to delete this contact?")); - - gtk_dialog_add_buttons (GTK_DIALOG (dialog), - GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, - GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT, - NULL); - - result = gtk_dialog_run(GTK_DIALOG (dialog)); - - gtk_widget_destroy (dialog); - - return (result == GTK_RESPONSE_ACCEPT); -} - -static void -contact_deleted_cb (EBook *book, EBookStatus status, EContactEditor *ce) -{ - gtk_widget_set_sensitive (ce->app, TRUE); - ce->in_async_call = FALSE; - - g_signal_emit (ce, contact_editor_signals[CONTACT_DELETED], 0, - status, ce->contact); - - /* always close the dialog after we successfully delete a card */ - if (status == E_BOOK_ERROR_OK) - close_dialog (ce); -} - -static void -delete_cb (GtkWidget *widget, gpointer data) -{ - EContactEditor *ce = E_CONTACT_EDITOR (data); - EContact *contact = ce->contact; - - g_object_ref(contact); - - if (e_contact_editor_confirm_delete(GTK_WINDOW(ce->app))) { - - extract_info (ce); - - if (!ce->is_new_contact && ce->book) { - gtk_widget_set_sensitive (ce->app, FALSE); - ce->in_async_call = TRUE; - - e_book_async_remove_contact (ce->book, contact, (EBookCallback)contact_deleted_cb, ce); - } - } - - g_object_unref(contact); -} - -/* Emits the signal to request printing a card */ -static void -print_cb (BonoboUIComponent *uih, void *data, const char *path) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - - extract_info (ce); - - gtk_widget_show(e_contact_print_contact_dialog_new(ce->contact)); -} - -#if 0 /* Envelope printing is disabled for Evolution 1.0. */ -/* Emits the signal to request printing a card */ -static void -print_envelope_cb (BonoboUIComponent *uih, void *data, const char *path) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - - extract_info (ce); - e_card_simple_sync_card (ce->simple); - - gtk_widget_show(e_contact_print_envelope_dialog_new(ce->card)); -} -#endif - -/* Toolbar/Save and Close callback */ -static void -tb_save_and_close_cb (BonoboUIComponent *uih, void *data, const char *path) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - save_contact (ce, TRUE); -} - -static -BonoboUIVerb verbs [] = { - BONOBO_UI_UNSAFE_VERB ("ContactEditorSave", file_save_cb), - BONOBO_UI_UNSAFE_VERB ("ContactEditorSaveAs", file_save_as_cb), - BONOBO_UI_UNSAFE_VERB ("ContactEditorSaveClose", tb_save_and_close_cb), - BONOBO_UI_UNSAFE_VERB ("ContactEditorSendAs", file_send_as_cb), - BONOBO_UI_UNSAFE_VERB ("ContactEditorSendTo", file_send_to_cb), - BONOBO_UI_UNSAFE_VERB ("ContactEditorDelete", delete_cb), - BONOBO_UI_UNSAFE_VERB ("ContactEditorPrint", print_cb), -#if 0 /* Envelope printing is disabled for Evolution 1.0. */ - BONOBO_UI_UNSAFE_VERB ("ContactEditorPrintEnvelope", print_envelope_cb), -#endif - /* BONOBO_UI_UNSAFE_VERB ("ContactEditorPageSetup", file_page_setup_menu), */ - BONOBO_UI_UNSAFE_VERB ("ContactEditorClose", file_close_cb), - - BONOBO_UI_VERB_END -}; - -EPixmap pixmaps[] = { - E_PIXMAP ("/commands/ContactEditorSave", "save-16.png"), - E_PIXMAP ("/commands/ContactEditorSaveClose", "save-16.png"), - E_PIXMAP ("/commands/ContactEditorSaveAs", "save-as-16.png"), - E_PIXMAP ("/commands/ContactEditorDelete", "evolution-trash-mini.png"), - E_PIXMAP ("/commands/ContactEditorPrint", "print.xpm"), -#if 0 /* Envelope printing is disabled for Evolution 1.0. */ - E_PIXMAP ("/commands/ContactEditorPrintEnvelope", "print.xpm"), -#endif - E_PIXMAP ("/Toolbar/ContactEditorSaveClose", "buttons/save-24.png"), - E_PIXMAP ("/Toolbar/ContactEditorDelete", "buttons/delete-message.png"), - E_PIXMAP ("/Toolbar/ContactEditorPrint", "buttons/print.png"), - - E_PIXMAP_END -}; - -static void -create_ui (EContactEditor *ce) -{ - bonobo_ui_component_add_verb_list_with_data (ce->uic, verbs, ce); - - bonobo_ui_util_set_ui (ce->uic, PREFIX, - EVOLUTION_UIDIR "/evolution-contact-editor.xml", - "evolution-contact-editor", NULL); - - e_pixmaps_update (ce->uic, pixmaps); -} - -/* Callback used when the dialog box is destroyed */ -static gint -app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) -{ - EContactEditor *ce; - - ce = E_CONTACT_EDITOR (data); - - /* if we're saving, don't allow the dialog to close */ - if (ce->in_async_call) - return TRUE; - - if (!prompt_to_save_changes (ce)) - return TRUE; - - close_dialog (ce); - return TRUE; -} - -static GList * -add_to_tab_order(GList *list, GladeXML *gui, char *name) -{ - GtkWidget *widget = glade_xml_get_widget(gui, name); - return g_list_prepend(list, widget); -} - -static void -setup_tab_order(GladeXML *gui) -{ - GtkWidget *container; - GList *list = NULL; - - container = glade_xml_get_widget(gui, "table-contact-editor-general"); - - if (container) { - list = add_to_tab_order(list, gui, "entry-fullname"); - list = add_to_tab_order(list, gui, "entry-jobtitle"); - list = add_to_tab_order(list, gui, "entry-company"); - list = add_to_tab_order(list, gui, "combo-file-as"); - list = add_to_tab_order(list, gui, "entry-phone1"); - list = add_to_tab_order(list, gui, "entry-phone2"); - list = add_to_tab_order(list, gui, "entry-phone3"); - list = add_to_tab_order(list, gui, "entry-phone4"); - - list = add_to_tab_order(list, gui, "entry-email1"); - list = add_to_tab_order(list, gui, "alignment-htmlmail"); - list = add_to_tab_order(list, gui, "entry-web"); - list = add_to_tab_order(list, gui, "entry-blog"); - list = add_to_tab_order(list, gui, "button-fulladdr"); - list = add_to_tab_order(list, gui, "text-address"); - list = g_list_reverse(list); - e_container_change_tab_order(GTK_CONTAINER(container), list); - g_list_free(list); - } -} - -static void -e_contact_editor_init (EContactEditor *e_contact_editor) -{ - GladeXML *gui; - GtkWidget *widget; - GtkWidget *bonobo_win; - GtkWidget *wants_html; - BonoboUIContainer *container; - char *icon_path; - - e_contact_editor->email_info = NULL; - e_contact_editor->phone_info = NULL; - e_contact_editor->address_info = NULL; - e_contact_editor->email_popup = NULL; - e_contact_editor->phone_popup = NULL; - e_contact_editor->address_popup = NULL; - e_contact_editor->email_list = NULL; - e_contact_editor->phone_list = NULL; - e_contact_editor->address_list = NULL; - e_contact_editor->name = e_contact_name_new(); - e_contact_editor->company = g_strdup(""); - - e_contact_editor->email_choice = E_CONTACT_EMAIL_1; - e_contact_editor->phone_choice[0] = E_CONTACT_PHONE_BUSINESS; - e_contact_editor->phone_choice[1] = E_CONTACT_PHONE_HOME; - e_contact_editor->phone_choice[2] = E_CONTACT_PHONE_BUSINESS_FAX; - e_contact_editor->phone_choice[3] = E_CONTACT_PHONE_MOBILE; -#if 0 - e_contact_editor->address_choice = 0; - e_contact_editor->address_mailing = -1; -#endif - - e_contact_editor->contact = NULL; - e_contact_editor->changed = FALSE; - e_contact_editor->in_async_call = FALSE; - e_contact_editor->editable = TRUE; - - gui = glade_xml_new (EVOLUTION_GLADEDIR "/contact-editor.glade", NULL, NULL); - e_contact_editor->gui = gui; - - setup_tab_order(gui); - - e_contact_editor->app = glade_xml_get_widget (gui, "contact editor"); - - connect_arrow_button_signals(e_contact_editor); - set_entry_changed_signals(e_contact_editor); - - wants_html = glade_xml_get_widget(e_contact_editor->gui, "checkbutton-htmlmail"); - if (wants_html && GTK_IS_TOGGLE_BUTTON(wants_html)) - g_signal_connect (wants_html, "toggled", - G_CALLBACK (wants_html_changed), e_contact_editor); - - widget = glade_xml_get_widget(e_contact_editor->gui, "checkbutton-mailingaddress"); - if (widget && GTK_IS_TOGGLE_BUTTON(widget)) - g_signal_connect (widget, "toggled", - G_CALLBACK (address_mailing_changed), e_contact_editor); - - widget = glade_xml_get_widget(e_contact_editor->gui, "button-fullname"); - if (widget && GTK_IS_BUTTON(widget)) - g_signal_connect (widget, "clicked", - G_CALLBACK (full_name_clicked), e_contact_editor); - - widget = glade_xml_get_widget(e_contact_editor->gui, "button-fulladdr"); - if (widget && GTK_IS_BUTTON(widget)) - g_signal_connect (widget, "clicked", - G_CALLBACK (full_addr_clicked), e_contact_editor); - - widget = glade_xml_get_widget(e_contact_editor->gui, "button-categories"); - if (widget && GTK_IS_BUTTON(widget)) - g_signal_connect (widget, "clicked", - G_CALLBACK (categories_clicked), e_contact_editor); - - /* Construct the app */ - bonobo_win = bonobo_window_new ("contact-editor-dialog", _("Contact Editor")); - - /* FIXME: The sucking bit */ - { - GtkWidget *contents; - - contents = bonobo_dock_get_client_area (gnome_app_get_dock (GNOME_APP(e_contact_editor->app))); - - if (!contents) { - g_message ("contact_editor_construct(): Could not get contents"); - return; - } - g_object_ref (contents); - gtk_container_remove (GTK_CONTAINER (contents->parent), contents); - bonobo_window_set_contents (BONOBO_WINDOW (bonobo_win), contents); - gtk_widget_destroy (e_contact_editor->app); - e_contact_editor->app = bonobo_win; - } - - /* Build the menu and toolbar */ - container = bonobo_window_get_ui_container (BONOBO_WINDOW (e_contact_editor->app)); - - e_contact_editor->uic = bonobo_ui_component_new_default (); - if (!e_contact_editor->uic) { - g_message ("e_contact_editor_init(): eeeeek, could not create the UI handler!"); - return; - } - bonobo_ui_component_set_container (e_contact_editor->uic, - bonobo_object_corba_objref (BONOBO_OBJECT (container)), - NULL); - - create_ui (e_contact_editor); - - widget = glade_xml_get_widget(e_contact_editor->gui, "entry-fullname"); - if (widget) - gtk_widget_grab_focus (widget); - - /* Connect to the deletion of the dialog */ - - g_signal_connect (e_contact_editor->app, "delete_event", - GTK_SIGNAL_FUNC (app_delete_event_cb), e_contact_editor); - - /* set the icon */ - icon_path = g_build_filename (EVOLUTION_IMAGESDIR, "evolution-contacts-mini.png", NULL); - gnome_window_icon_set_from_file (GTK_WINDOW (e_contact_editor->app), icon_path); - g_free (icon_path); -} - -void -e_contact_editor_dispose (GObject *object) { - EContactEditor *e_contact_editor = E_CONTACT_EDITOR(object); - - if (e_contact_editor->writable_fields) { - g_object_unref(e_contact_editor->writable_fields); - e_contact_editor->writable_fields = NULL; - } - if (e_contact_editor->email_list) { - g_list_foreach(e_contact_editor->email_list, (GFunc) g_free, NULL); - g_list_free(e_contact_editor->email_list); - e_contact_editor->email_list = NULL; - } - if (e_contact_editor->email_info) { - g_free(e_contact_editor->email_info); - e_contact_editor->email_info = NULL; - } - if (e_contact_editor->email_popup) { - g_object_unref(e_contact_editor->email_popup); - e_contact_editor->email_popup = NULL; - } - - if (e_contact_editor->phone_list) { - g_list_foreach(e_contact_editor->phone_list, (GFunc) g_free, NULL); - g_list_free(e_contact_editor->phone_list); - e_contact_editor->phone_list = NULL; - } - if (e_contact_editor->phone_info) { - g_free(e_contact_editor->phone_info); - e_contact_editor->phone_info = NULL; - } - if (e_contact_editor->phone_popup) { - g_object_unref(e_contact_editor->phone_popup); - e_contact_editor->phone_popup = NULL; - } - - if (e_contact_editor->address_list) { - g_list_foreach(e_contact_editor->address_list, (GFunc) g_free, NULL); - g_list_free(e_contact_editor->address_list); - e_contact_editor->address_list = NULL; - } - if (e_contact_editor->address_info) { - g_free(e_contact_editor->address_info); - e_contact_editor->address_info = NULL; - } - if (e_contact_editor->address_popup) { - g_object_unref(e_contact_editor->address_popup); - e_contact_editor->address_popup = NULL; - } - - if (e_contact_editor->contact) { - g_object_unref(e_contact_editor->contact); - e_contact_editor->contact = NULL; - } - - if (e_contact_editor->book) { - g_object_unref(e_contact_editor->book); - e_contact_editor->book = NULL; - } - - if (e_contact_editor->name) { - e_contact_name_free(e_contact_editor->name); - e_contact_editor->name = NULL; - } - - if (e_contact_editor->company) { - g_free (e_contact_editor->company); - e_contact_editor->company = NULL; - } - - if (e_contact_editor->gui) { - g_object_unref(e_contact_editor->gui); - e_contact_editor->gui = NULL; - } -} - -static void -command_state_changed (EContactEditor *ce) -{ - bonobo_ui_component_set_prop (ce->uic, - "/commands/ContactEditorSaveClose", - "sensitive", - ce->changed ? "1" : "0", NULL); - bonobo_ui_component_set_prop (ce->uic, - "/commands/ContactEditorSave", - "sensitive", - ce->changed ? "1" : "0", NULL); - bonobo_ui_component_set_prop (ce->uic, - "/commands/ContactEditorDelete", - "sensitive", - (ce->editable && !ce->is_new_contact) ? "1" : "0", NULL); -} - -static void -supported_fields_cb (EBook *book, EBookStatus status, - EList *fields, EContactEditor *ce) -{ - if (!g_slist_find (all_contact_editors, ce)) { - g_warning ("supported_fields_cb called for book that's still around, but contact editor that's been destroyed."); - return; - } - - g_object_set (ce, - "writable_fields", fields, - NULL); - - e_contact_editor_show (ce); - - command_state_changed (ce); -} - -static void -contact_editor_destroy_notify (void *data, - GObject *where_the_object_was) -{ - EContactEditor *ce = E_CONTACT_EDITOR (data); - - all_contact_editors = g_slist_remove (all_contact_editors, ce); -} - -EContactEditor * -e_contact_editor_new (EBook *book, - EContact *contact, - gboolean is_new_contact, - gboolean editable) -{ - EContactEditor *ce; - - g_return_val_if_fail (E_IS_BOOK (book), NULL); - g_return_val_if_fail (E_IS_CONTACT (contact), NULL); - - ce = g_object_new (E_TYPE_CONTACT_EDITOR, NULL); - - all_contact_editors = g_slist_prepend (all_contact_editors, ce); - g_object_weak_ref (G_OBJECT (ce), contact_editor_destroy_notify, ce); - - g_object_ref (ce); - gtk_object_sink (GTK_OBJECT (ce)); - - g_object_set (ce, - "book", book, - "contact", contact, - "is_new_contact", is_new_contact, - "editable", editable, - NULL); - - if (book) - e_book_async_get_supported_fields (book, (EBookFieldsCallback)supported_fields_cb, ce); - - return ce; -} - -static void -e_contact_editor_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) -{ - EContactEditor *editor; - - editor = E_CONTACT_EDITOR (object); - - switch (prop_id){ - case PROP_BOOK: - if (editor->book) - g_object_unref(editor->book); - editor->book = E_BOOK(g_value_get_object (value)); - g_object_ref (editor->book); - /* XXX more here about editable/etc. */ - break; - case PROP_CONTACT: - if (editor->contact) - g_object_unref(editor->contact); - editor->contact = e_contact_duplicate(E_CONTACT(g_value_get_object (value))); - fill_in_info(editor); - editor->changed = FALSE; - break; - - case PROP_IS_NEW_CONTACT: - editor->is_new_contact = g_value_get_boolean (value) ? TRUE : FALSE; - break; - - case PROP_EDITABLE: { - gboolean new_value = g_value_get_boolean (value) ? TRUE : FALSE; - gboolean changed = (editor->editable != new_value); - - editor->editable = new_value; - - if (changed) { - set_editable (editor); - command_state_changed (editor); - } - break; - } - - case PROP_CHANGED: { - gboolean new_value = g_value_get_boolean (value) ? TRUE : FALSE; - gboolean changed = (editor->changed != new_value); - - editor->changed = new_value; - - if (changed) - command_state_changed (editor); - break; - } - case PROP_WRITABLE_FIELDS: - if (editor->writable_fields) - g_object_unref(editor->writable_fields); - editor->writable_fields = g_value_get_object (value); - if (editor->writable_fields) - g_object_ref (editor->writable_fields); - else - editor->writable_fields = e_list_new(NULL, NULL, NULL); - enable_writable_fields (editor); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -e_contact_editor_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) -{ - EContactEditor *e_contact_editor; - - e_contact_editor = E_CONTACT_EDITOR (object); - - switch (prop_id) { - case PROP_BOOK: - g_value_set_object (value, e_contact_editor->book); - break; - - case PROP_CONTACT: - extract_info(e_contact_editor); - g_value_set_object (value, e_contact_editor->contact); - break; - - case PROP_IS_NEW_CONTACT: - g_value_set_boolean (value, e_contact_editor->is_new_contact ? TRUE : FALSE); - break; - - case PROP_EDITABLE: - g_value_set_boolean (value, e_contact_editor->editable ? TRUE : FALSE); - break; - - case PROP_CHANGED: - g_value_set_boolean (value, e_contact_editor->changed ? TRUE : FALSE); - break; - - case PROP_WRITABLE_FIELDS: - if (e_contact_editor->writable_fields) - g_value_set_object (value, e_list_duplicate (e_contact_editor->writable_fields)); - else - g_value_set_object (value, NULL); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -_popup_position(GtkMenu *menu, - gint *x, - gint *y, - gboolean *push_in, - gpointer data) -{ - GtkWidget *button = GTK_WIDGET(data); - GtkRequisition request; - int mh, mw; - gdk_window_get_origin (button->window, x, y); - *x += button->allocation.x; - *y += button->allocation.y; - - gtk_widget_size_request(GTK_WIDGET(menu), &request); - - mh = request.height; - mw = request.width; - - *x -= mw; - if (*x < 0) - *x = 0; - - if (*y < 0) - *y = 0; - - if ((*x + mw) > gdk_screen_width ()) - *x = gdk_screen_width () - mw; - - if ((*y + mh) > gdk_screen_height ()) - *y = gdk_screen_height () - mh; - - *push_in = FALSE; -} - -static gint -_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor, GtkWidget *popup, GList **list, GnomeUIInfo **info, gchar *label) -{ - gint menu_item; - - g_signal_stop_emission_by_name (widget, "button_press_event"); - - gtk_widget_realize(popup); - menu_item = gnome_popup_menu_do_popup_modal(popup, _popup_position, widget, button, editor, widget); - if ( menu_item != -1 ) { - GtkWidget *label_widget = glade_xml_get_widget(editor->gui, label); - if (label_widget && GTK_IS_LABEL(label_widget)) { - g_object_set (label_widget, - "label", _(g_list_nth_data(*list, menu_item)), - NULL); - } - } - return menu_item; -} - -static void -e_contact_editor_build_ui_info(GList *list, GnomeUIInfo **infop) -{ - GnomeUIInfo *info; - GnomeUIInfo singleton = { GNOME_APP_UI_TOGGLEITEM, NULL, NULL, NULL, NULL, NULL, GNOME_APP_PIXMAP_NONE, 0, 0, 0, NULL }; - GnomeUIInfo end = GNOMEUIINFO_END; - int length; - int i; - - info = *infop; - - if ( info ) - g_free(info); - length = g_list_length( list ); - info = g_new(GnomeUIInfo, length + 2); - for (i = 0; i < length; i++) { - info[i] = singleton; - info[i].label = _(list->data); - list = list->next; - } - info[i] = end; - - *infop = info; -} - -static void -e_contact_editor_build_phone_ui (EContactEditor *editor) -{ - if (editor->phone_list == NULL) { - int i; - - for (i = 0; i < G_N_ELEMENTS (phones); i ++) { - editor->phone_list = g_list_append(editor->phone_list, g_strdup(e_contact_pretty_name (phones[i]))); - } - } - if (editor->phone_info == NULL) { - e_contact_editor_build_ui_info(editor->phone_list, &editor->phone_info); - - if ( editor->phone_popup ) - g_object_unref(editor->phone_popup); - - editor->phone_popup = gnome_popup_menu_new(editor->phone_info); - g_object_ref (editor->phone_popup); - gtk_object_sink (GTK_OBJECT (editor->phone_popup)); - } -} - -static void -e_contact_editor_build_email_ui (EContactEditor *editor) -{ - int i; - - if (editor->email_list == NULL) { - for (i = 0; i < G_N_ELEMENTS (emails); i++) - editor->email_list = g_list_append(editor->email_list, g_strdup(e_contact_pretty_name (emails[i]))); - } - if (editor->email_info == NULL) { - e_contact_editor_build_ui_info(editor->email_list, &editor->email_info); - - if ( editor->email_popup ) - g_object_unref(editor->email_popup); - - editor->email_popup = gnome_popup_menu_new(editor->email_info); - g_object_ref (editor->email_popup); - gtk_object_sink (GTK_OBJECT (editor->email_popup)); - } -} - -static void -e_contact_editor_build_address_ui (EContactEditor *editor) -{ - int i; - - if (editor->address_list == NULL) { - static char *info[] = { - N_("Business"), - N_("Home"), - N_("Other") - }; - - for (i = 0; i < sizeof(info) / sizeof(info[0]); i++) { - editor->address_list = g_list_append(editor->address_list, g_strdup(info[i])); - } - } - if (editor->address_info == NULL) { - e_contact_editor_build_ui_info(editor->address_list, &editor->address_info); - - if ( editor->address_popup ) - g_object_unref(editor->address_popup); - - editor->address_popup = gnome_popup_menu_new(editor->address_info); - g_object_ref (editor->address_popup); - gtk_object_sink (GTK_OBJECT (editor->address_popup)); - } -} - -static void -_phone_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor) -{ - int which; - int i; - gchar *label; - gchar *entry; - int result; - if ( widget == glade_xml_get_widget(editor->gui, "button-phone1") ) { - which = 1; - } else if ( widget == glade_xml_get_widget(editor->gui, "button-phone2") ) { - which = 2; - } else if ( widget == glade_xml_get_widget(editor->gui, "button-phone3") ) { - which = 3; - } else if ( widget == glade_xml_get_widget(editor->gui, "button-phone4") ) { - which = 4; - } else - return; - - label = g_strdup_printf("label-phone%d", which); - entry = g_strdup_printf("entry-phone%d", which); - - e_contact_editor_build_phone_ui (editor); - - for(i = 0; i < G_N_ELEMENTS (phones); i++) { - char *phone = e_contact_get (editor->contact, phones[i]); - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(editor->phone_info[i].widget), - phone && *phone); - g_free (phone); - } - - result = _arrow_pressed (widget, button, editor, editor->phone_popup, &editor->phone_list, &editor->phone_info, label); - - if (result != -1) { - GtkWidget *w = glade_xml_get_widget (editor->gui, entry); - editor->phone_choice[which - 1] = phones[result]; - set_fields (editor); - enable_widget (glade_xml_get_widget (editor->gui, label), TRUE); - enable_widget (w, editor->editable); - } - - g_free(label); - g_free(entry); -} - -static void -_email_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor) -{ - int i; - int result; - - e_contact_editor_build_email_ui (editor); - - for(i = 0; i < G_N_ELEMENTS (emails); i++) { - char *string = e_contact_get (editor->contact, emails[i]); - gboolean checked; - checked = string && *string; - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(editor->email_info[i].widget), - checked); - g_free (string); - } - - result = _arrow_pressed (widget, button, editor, editor->email_popup, &editor->email_list, &editor->email_info, "label-email1"); - - if (result != -1) { - GtkWidget *entry = glade_xml_get_widget (editor->gui, "entry-email1"); - editor->email_choice = result; - - set_fields (editor); - - /* make sure the buttons/entry is/are sensitive */ - enable_widget (glade_xml_get_widget (editor->gui, "label-email1"), TRUE); - enable_widget (entry, editor->editable); - enable_widget (glade_xml_get_widget (editor->gui, "checkbutton-htmlmail"), editor->editable); - } -} - -static void -_address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor) -{ -#if notyet - int i; - int result; - - e_contact_editor_build_address_ui (editor); - - for(i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) { - const ECardAddrLabel *address = e_card_simple_get_address(editor->simple, i); - gboolean checked; - checked = address && address->data && *address->data; - gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(editor->address_info[i].widget), - checked); - } - - result = _arrow_pressed (widget, button, editor, editor->address_popup, &editor->address_list, &editor->address_info, "label-address"); - - if (result != -1) { - set_address_field(editor, result); - - /* make sure the buttons/entry is/are sensitive */ - enable_widget (glade_xml_get_widget (editor->gui, "label-address"), TRUE); - enable_widget (glade_xml_get_widget (editor->gui, "text-address"), editor->address_editable[result]); - enable_widget (glade_xml_get_widget (editor->gui, "checkbutton-mailingaddress"), editor->address_editable[result]); - } -#endif -} - -static void -find_address_mailing (EContactEditor *editor) -{ -#if notyet - const ECardDeliveryAddress *address; - int i; - - editor->address_mailing = -1; - for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) { - address = e_card_simple_get_delivery_address(editor->simple, i); - if (address && (address->flags & E_CARD_ADDR_DEFAULT)) { - if (editor->address_mailing == -1) { - editor->address_mailing = i; - } else { - ECardDeliveryAddress *new; - - new = e_card_delivery_address_copy (address); - new->flags &= ~E_CARD_ADDR_DEFAULT; - e_card_simple_set_delivery_address(editor->simple, i, new); - e_card_delivery_address_unref (new); - } - } - } -#endif -} - -static void -set_field(EContactEditor *editor, GtkEntry *entry, const char *string) -{ - const char *oldstring = gtk_entry_get_text(entry); - if (!string) - string = ""; - if (strcmp(string, oldstring)) { - g_signal_handlers_block_matched (entry, - G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, editor); - gtk_entry_set_text(entry, string); - g_signal_handlers_unblock_matched (entry, - G_SIGNAL_MATCH_DATA, - 0, 0, NULL, NULL, editor); - } -} - -static void -set_phone_field(EContactEditor *editor, GtkWidget *entry, const char *phone_number) -{ - set_field(editor, GTK_ENTRY(entry), phone_number ? phone_number : ""); -} - -static void -set_fields(EContactEditor *editor) -{ - GtkWidget *entry; - GtkWidget *label_widget; - int i; - - entry = glade_xml_get_widget(editor->gui, "entry-phone1"); - if (entry && GTK_IS_ENTRY(entry)) - set_phone_field(editor, entry, e_contact_get_const(editor->contact, editor->phone_choice[0])); - - entry = glade_xml_get_widget(editor->gui, "entry-phone2"); - if (entry && GTK_IS_ENTRY(entry)) - set_phone_field(editor, entry, e_contact_get_const(editor->contact, editor->phone_choice[1])); - - entry = glade_xml_get_widget(editor->gui, "entry-phone3"); - if (entry && GTK_IS_ENTRY(entry)) - set_phone_field(editor, entry, e_contact_get_const(editor->contact, editor->phone_choice[2])); - - entry = glade_xml_get_widget(editor->gui, "entry-phone4"); - if (entry && GTK_IS_ENTRY(entry)) - set_phone_field(editor, entry, e_contact_get_const(editor->contact, editor->phone_choice[3])); - - entry = glade_xml_get_widget(editor->gui, "entry-email1"); - if (entry && GTK_IS_ENTRY(entry)) - set_field(editor, GTK_ENTRY(entry), e_contact_get_const(editor->contact, editor->email_choice)); - - - e_contact_editor_build_address_ui (editor); - -#if notyet - for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) { - const ECardAddrLabel *address = e_card_simple_get_address(editor->simple, i); - - if (address && address->data && *address->data) - break; - } - if (i == E_CARD_SIMPLE_ADDRESS_ID_LAST) - i = 0; - - label_widget = glade_xml_get_widget(editor->gui, "label-address"); - if (label_widget && GTK_IS_LABEL(label_widget)) { - g_object_set (label_widget, - "label", _(g_list_nth_data(editor->address_list, i)), - NULL); - } - - set_address_field(editor, i); -#endif -} - -static void -set_address_field(EContactEditor *editor, int result) -{ -#if notyet - GtkWidget *text, *check; - - text = glade_xml_get_widget(editor->gui, "text-address"); - - if (text && GTK_IS_TEXT_VIEW(text)) { - GtkTextBuffer *buffer; - GtkTextIter start_iter, end_iter; - const ECardAddrLabel *address; - - if (result == -1) - result = editor->address_choice; - editor->address_choice = -1; - - buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text)); - - gtk_text_buffer_get_start_iter (buffer, &start_iter); - gtk_text_buffer_get_end_iter (buffer, &end_iter); - - gtk_text_buffer_delete (buffer, &start_iter, &end_iter); - - address = e_card_simple_get_address(editor->simple, result); - if (address && address->data) - gtk_text_buffer_insert (buffer, &start_iter, address->data, strlen (address->data)); - - check = glade_xml_get_widget(editor->gui, "checkbutton-mailingaddress"); - if (check && GTK_IS_CHECK_BUTTON (check)) { - if (address && address->data) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), - address->flags & E_CARD_ADDR_DEFAULT); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), FALSE); - } - - editor->address_choice = result; - } -#endif -} - -static struct { - char *id; - EContactField field; -} field_mapping [] = { - { "entry-fullname", E_CONTACT_FULL_NAME }, - { "entry-web", E_CONTACT_HOMEPAGE_URL }, - { "entry-blog", E_CONTACT_BLOG_URL }, - { "entry-company", E_CONTACT_ORG }, - { "entry-department", E_CONTACT_ORG_UNIT }, - { "entry-office", E_CONTACT_OFFICE }, - { "entry-jobtitle", E_CONTACT_TITLE }, - { "entry-profession", E_CONTACT_ROLE }, - { "entry-manager", E_CONTACT_MANAGER }, - { "entry-assistant", E_CONTACT_ASSISTANT }, - { "entry-nickname", E_CONTACT_NICKNAME }, - { "entry-spouse", E_CONTACT_SPOUSE }, - { "text-comments", E_CONTACT_NOTE }, - { "entry-categories", E_CONTACT_CATEGORIES }, - { "entry-caluri", E_CONTACT_CALENDAR_URI }, - { "entry-fburl", E_CONTACT_FREEBUSY_URL }, -}; - -static void -fill_in_field(EContactEditor *editor, char *id, char *value) -{ - GtkWidget *widget = glade_xml_get_widget(editor->gui, id); - - if (!widget) - return; - - if (E_IS_URL_ENTRY (widget)) - widget = e_url_entry_get_entry (E_URL_ENTRY (widget)); - - if (GTK_IS_TEXT_VIEW (widget)) { - if (value) - gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)), - value, strlen (value)); - } - else if (GTK_IS_EDITABLE(widget)) { - int position = 0; - GtkEditable *editable = GTK_EDITABLE(widget); - gtk_editable_delete_text(editable, 0, -1); - if (value) - gtk_editable_insert_text(editable, value, strlen(value), &position); - } -} - -static void -disable_widget_foreach (char *key, GtkWidget *widget, gpointer closure) -{ - enable_widget (widget, FALSE); -} - -static struct { - char *widget_name; - EContactField field_id; - gboolean desensitize_for_read_only; -} widget_field_mappings[] = { - { "entry-web", E_CONTACT_HOMEPAGE_URL, TRUE }, - { "accellabel-web", E_CONTACT_HOMEPAGE_URL }, - - { "entry-blog", E_CONTACT_BLOG_URL, TRUE }, - { "accellabel-blog", E_CONTACT_BLOG_URL }, - - { "entry-jobtitle", E_CONTACT_TITLE, TRUE }, - { "label-jobtitle", E_CONTACT_TITLE }, - - { "entry-company", E_CONTACT_ORG, TRUE }, - { "label-company", E_CONTACT_ORG }, - - { "combo-file-as", E_CONTACT_FILE_AS, TRUE }, - { "entry-file-as", E_CONTACT_FILE_AS, TRUE }, - { "accellabel-fileas", E_CONTACT_FILE_AS }, - - { "label-department", E_CONTACT_ORG_UNIT }, - { "entry-department", E_CONTACT_ORG_UNIT, TRUE }, - - { "label-office", E_CONTACT_OFFICE }, - { "entry-office", E_CONTACT_OFFICE, TRUE }, - - { "label-profession", E_CONTACT_ROLE }, - { "entry-profession", E_CONTACT_ROLE, TRUE }, - - { "label-manager", E_CONTACT_MANAGER }, - { "entry-manager", E_CONTACT_MANAGER, TRUE }, - - { "label-assistant", E_CONTACT_ASSISTANT }, - { "entry-assistant", E_CONTACT_ASSISTANT, TRUE }, - - { "label-nickname", E_CONTACT_NICKNAME }, - { "entry-nickname", E_CONTACT_NICKNAME, TRUE }, - - { "label-spouse", E_CONTACT_SPOUSE }, - { "entry-spouse", E_CONTACT_SPOUSE, TRUE }, - - { "label-birthday", E_CONTACT_BIRTH_DATE }, - { "dateedit-birthday", E_CONTACT_BIRTH_DATE, TRUE }, - - { "label-anniversary", E_CONTACT_ANNIVERSARY }, - { "dateedit-anniversary", E_CONTACT_ANNIVERSARY, TRUE }, - - { "label-comments", E_CONTACT_NOTE }, - { "text-comments", E_CONTACT_NOTE, TRUE }, - - { "entry-fullname", E_CONTACT_FULL_NAME, TRUE }, - - { "button-categories", E_CONTACT_CATEGORIES, TRUE }, - { "entry-categories", E_CONTACT_CATEGORIES, TRUE }, - - { "label-caluri", E_CONTACT_CALENDAR_URI }, - { "entry-caluri", E_CONTACT_CALENDAR_URI, TRUE }, - - { "label-fburl", E_CONTACT_FREEBUSY_URL }, - { "entry-fburl", E_CONTACT_FREEBUSY_URL, TRUE } -}; -static int num_widget_field_mappings = sizeof(widget_field_mappings) / sizeof (widget_field_mappings[0]); - -static void -enable_writable_fields(EContactEditor *editor) -{ - EList *fields = editor->writable_fields; - EIterator *iter; - GHashTable *dropdown_hash, *supported_hash; - int i; - char *widget_name; - - if (!fields) - return; - - dropdown_hash = g_hash_table_new (g_str_hash, g_str_equal); - supported_hash = g_hash_table_new (g_str_hash, g_str_equal); - - /* build our hashtable of the drop down menu items */ - e_contact_editor_build_phone_ui (editor); - for (i = 0; i < G_N_ELEMENTS (phones); i ++) - g_hash_table_insert (dropdown_hash, - (char*)e_contact_field_name(phones[i]), - editor->phone_info[i].widget); - e_contact_editor_build_email_ui (editor); - for (i = 0; i < G_N_ELEMENTS (emails); i ++) - g_hash_table_insert (dropdown_hash, - (char*)e_contact_field_name(phones[i]), - editor->email_info[i].widget); -#if notyet - e_contact_editor_build_address_ui (editor); - for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i ++) - g_hash_table_insert (dropdown_hash, - (char*)e_card_simple_get_ecard_field(simple, e_card_simple_map_address_to_field (i)), - editor->address_info[i].widget); -#endif - - /* then disable them all */ - g_hash_table_foreach (dropdown_hash, (GHFunc)disable_widget_foreach, NULL); - - /* disable the label widgets for the dropdowns (4 phone, 1 - email and the toggle button, and 1 address and one for - the full address button */ - for (i = 0; i < 4; i ++) { - widget_name = g_strdup_printf ("label-phone%d", i+1); - enable_widget (glade_xml_get_widget (editor->gui, widget_name), FALSE); - g_free (widget_name); - widget_name = g_strdup_printf ("entry-phone%d", i+1); - enable_widget (glade_xml_get_widget (editor->gui, widget_name), FALSE); - g_free (widget_name); - } - enable_widget (glade_xml_get_widget (editor->gui, "label-email1"), FALSE); - enable_widget (glade_xml_get_widget (editor->gui, "entry-email1"), FALSE); - enable_widget (glade_xml_get_widget (editor->gui, "checkbutton-htmlmail"), FALSE); - enable_widget (glade_xml_get_widget (editor->gui, "checkbutton-mailingaddress"), FALSE); - enable_widget (glade_xml_get_widget (editor->gui, "label-address"), FALSE); - enable_widget (glade_xml_get_widget (editor->gui, "text-address"), FALSE); - - editor->fullname_editable = FALSE; - - /* enable widgets that map directly from a field to a widget (the drop down items) */ - iter = e_list_get_iterator (fields); - for (; e_iterator_is_valid (iter); e_iterator_next (iter)) { - char *field = (char*)e_iterator_get (iter); - GtkWidget *widget = g_hash_table_lookup (dropdown_hash, field); - int i; - - if (widget) { - enable_widget (widget, TRUE); - } - else { - /* if it's not a field that's handled by the - dropdown items, add it to the has to be - used in the second step */ - g_hash_table_insert (supported_hash, field, field); - } - -#if notyet - for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i ++) { - if (!strcmp (field, e_card_simple_get_ecard_field (simple, e_card_simple_map_address_to_field(i)))) { - editor->address_editable [i] = TRUE; - } - } -#endif - - /* ugh - this is needed to make sure we don't have a - disabled label next to a drop down when the item in - the menu (the one reflected in the label) is - enabled. */ - if (!strcmp (field, e_contact_field_name (editor->email_choice))) { - enable_widget (glade_xml_get_widget (editor->gui, "label-email1"), TRUE); - enable_widget (glade_xml_get_widget (editor->gui, "entry-email1"), editor->editable); - enable_widget (glade_xml_get_widget (editor->gui, "checkbutton-htmlmail"), editor->editable); - } - else if (!strcmp (field, e_contact_field_name (editor->address_choice))) { - enable_widget (glade_xml_get_widget (editor->gui, "label-address"), TRUE); - enable_widget (glade_xml_get_widget (editor->gui, "checkbutton-mailingaddress"), editor->editable); - enable_widget (glade_xml_get_widget (editor->gui, "text-address"), editor->editable); - } - else for (i = 0; i < 4; i ++) { - if (!strcmp (field, e_contact_field_name (editor->phone_choice[i]))) { - widget_name = g_strdup_printf ("label-phone%d", i+1); - enable_widget (glade_xml_get_widget (editor->gui, widget_name), TRUE); - g_free (widget_name); - widget_name = g_strdup_printf ("entry-phone%d", i+1); - enable_widget (glade_xml_get_widget (editor->gui, widget_name), editor->editable); - g_free (widget_name); - } - } - } - - /* handle the label next to the dropdown widgets */ - - for (i = 0; i < num_widget_field_mappings; i ++) { - gboolean enabled; - GtkWidget *w; - const char *field; - - w = glade_xml_get_widget(editor->gui, widget_field_mappings[i].widget_name); - if (!w) { - g_warning (_("Could not find widget for a field: `%s'"), - widget_field_mappings[i].widget_name); - continue; - } - field = e_contact_field_name (widget_field_mappings[i].field_id); - - enabled = (g_hash_table_lookup (supported_hash, field) != NULL); - - if (widget_field_mappings[i].desensitize_for_read_only && !editor->editable) { - enabled = FALSE; - } - - enable_widget (w, enabled); - } - - editor->fullname_editable = (g_hash_table_lookup (supported_hash, "full_name") != NULL); - - g_hash_table_destroy (dropdown_hash); - g_hash_table_destroy (supported_hash); -} - -static void -set_editable (EContactEditor *editor) -{ - int i; - char *entry; - /* set the sensitivity of all the non-dropdown entry/texts/dateedits */ - for (i = 0; i < num_widget_field_mappings; i ++) { - if (widget_field_mappings[i].desensitize_for_read_only) { - GtkWidget *widget = glade_xml_get_widget(editor->gui, widget_field_mappings[i].widget_name); - enable_widget (widget, editor->editable); - } - } - - /* handle the phone dropdown entries */ - for (i = 0; i < 4; i ++) { - entry = g_strdup_printf ("entry-phone%d", i+1); - - enable_widget (glade_xml_get_widget(editor->gui, entry), - editor->editable); - - g_free (entry); - } - - /* handle the email dropdown entry */ - entry = "entry-email1"; - enable_widget (glade_xml_get_widget(editor->gui, entry), - editor->editable); - enable_widget (glade_xml_get_widget(editor->gui, "checkbutton-htmlmail"), - editor->editable); - - /* handle the address dropdown entry */ - entry = "text-address"; - enable_widget (glade_xml_get_widget(editor->gui, entry), - editor->editable); -} - -static void -fill_in_info(EContactEditor *editor) -{ - EContact *contact = editor->contact; - if (contact) { - char *file_as; - EContactName *name; - EContactDate *anniversary; - EContactDate *bday; - int i; - GtkWidget *widget; - gboolean wants_html; - - g_object_get (contact, - "file_as", &file_as, - "name", &name, - "anniversary", &anniversary, - "birth_date", &bday, - "wants_html", &wants_html, - NULL); - - for (i = 0; i < sizeof(field_mapping) / sizeof(field_mapping[0]); i++) { - char *string = e_contact_get (contact, field_mapping[i].field); - fill_in_field(editor, field_mapping[i].id, string); - g_free (string); - } - - find_address_mailing (editor); - - widget = glade_xml_get_widget(editor->gui, "checkbutton-htmlmail"); - if (widget && GTK_IS_CHECK_BUTTON(widget)) { - g_object_set (widget, - "active", wants_html, - NULL); - } - - /* File as has to come after company and name or else it'll get messed up when setting them. */ - fill_in_field(editor, "entry-file-as", file_as); - - g_free (file_as); - if (editor->name) - e_contact_name_free(editor->name); - editor->name = name; - - widget = glade_xml_get_widget(editor->gui, "dateedit-anniversary"); - if (widget && E_IS_DATE_EDIT(widget)) { - EDateEdit *dateedit; - dateedit = E_DATE_EDIT(widget); - if (anniversary) - e_date_edit_set_date (dateedit, - anniversary->year, - anniversary->month, - anniversary->day); - else - e_date_edit_set_time (dateedit, -1); - } - - widget = glade_xml_get_widget(editor->gui, "dateedit-birthday"); - if (widget && E_IS_DATE_EDIT(widget)) { - EDateEdit *dateedit; - dateedit = E_DATE_EDIT(widget); - if (bday) - e_date_edit_set_date (dateedit, - bday->year, - bday->month, - bday->day); - else - e_date_edit_set_time (dateedit, -1); - } - - e_contact_date_free (anniversary); - e_contact_date_free (bday); - - set_fields(editor); - } -} - -static void -extract_field(EContactEditor *editor, EContact *contact, char *editable_id, EContactField field) -{ - GtkWidget *widget = glade_xml_get_widget(editor->gui, editable_id); - char *string = NULL; - - if (!widget) - return; - - if (E_IS_URL_ENTRY (widget)) - widget = e_url_entry_get_entry (E_URL_ENTRY (widget)); - - if (GTK_IS_EDITABLE (widget)) - string = gtk_editable_get_chars(GTK_EDITABLE (widget), 0, -1); - else if (GTK_IS_TEXT_VIEW (widget)) { - GtkTextIter start, end; - GtkTextBuffer *buffer; - - buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget)); - gtk_text_buffer_get_start_iter (buffer, &start); - gtk_text_buffer_get_end_iter (buffer, &end); - - string = gtk_text_buffer_get_text (buffer, &start, &end, TRUE); - } - - if (string && *string) - e_contact_set (contact, field, string); - else - e_contact_set (contact, field, NULL); - - if (string) g_free(string); -} - -static void -extract_info(EContactEditor *editor) -{ - EContact *contact = editor->contact; - if (contact) { - EContactDate anniversary; - EContactDate bday; - int i; - GtkWidget *widget; - - widget = glade_xml_get_widget(editor->gui, "entry-file-as"); - if (widget && GTK_IS_EDITABLE(widget)) { - GtkEditable *editable = GTK_EDITABLE(widget); - char *string = gtk_editable_get_chars(editable, 0, -1); - - if (string && *string) - e_contact_set (contact, E_CONTACT_FILE_AS, string); - - g_free(string); - } - - for (i = 0; i < sizeof(field_mapping) / sizeof(field_mapping[0]); i++) { - extract_field(editor, contact, field_mapping[i].id, field_mapping[i].field); - } - - if (editor->name) - e_contact_set (contact, E_CONTACT_NAME, editor->name); - - widget = glade_xml_get_widget(editor->gui, "dateedit-anniversary"); - if (widget && E_IS_DATE_EDIT(widget)) { - if (e_date_edit_get_date (E_DATE_EDIT (widget), - &anniversary.year, - &anniversary.month, - &anniversary.day)) { - /* g_print ("%d %d %d\n", anniversary.year, anniversary.month, anniversary.day); */ - e_contact_set (contact, E_CONTACT_ANNIVERSARY, &anniversary); - } else - e_contact_set (contact, E_CONTACT_ANNIVERSARY, NULL); - } - - widget = glade_xml_get_widget(editor->gui, "dateedit-birthday"); - if (widget && E_IS_DATE_EDIT(widget)) { - if (e_date_edit_get_date (E_DATE_EDIT (widget), - &bday.year, - &bday.month, - &bday.day)) { - /* g_print ("%d %d %d\n", bday.year, bday.month, bday.day); */ - e_contact_set (contact, E_CONTACT_BIRTH_DATE, &bday); - } else - e_contact_set (contact, E_CONTACT_BIRTH_DATE, NULL); - } - } -} - -/** - * e_contact_editor_raise: - * @config: The %EContactEditor object. - * - * Raises the dialog associated with this %EContactEditor object. - */ -void -e_contact_editor_raise (EContactEditor *editor) -{ - /* FIXME: perhaps we should raise at realize time */ - if (GTK_WIDGET (editor->app)->window) - gdk_window_raise (GTK_WIDGET (editor->app)->window); -} - -/** - * e_contact_editor_show: - * @ce: The %EContactEditor object. - * - * Shows the dialog associated with this %EContactEditor object. - */ -void -e_contact_editor_show (EContactEditor *ce) -{ - gtk_widget_show (ce->app); -} - -GtkWidget * -e_contact_editor_create_date(gchar *name, - gchar *string1, gchar *string2, - gint int1, gint int2); - -GtkWidget * -e_contact_editor_create_date(gchar *name, - gchar *string1, gchar *string2, - gint int1, gint int2) -{ - GtkWidget *widget = e_date_edit_new (); - e_date_edit_set_allow_no_date_set (E_DATE_EDIT (widget), - TRUE); - e_date_edit_set_show_time (E_DATE_EDIT (widget), FALSE); - e_date_edit_set_time (E_DATE_EDIT (widget), -1); - gtk_widget_show (widget); - return widget; -} - -GtkWidget * -e_contact_editor_create_web(gchar *name, - gchar *string1, gchar *string2, - gint int1, gint int2); - -GtkWidget * -e_contact_editor_create_web(gchar *name, - gchar *string1, gchar *string2, - gint int1, gint int2) -{ - GtkWidget *widget = e_url_entry_new (); - gtk_widget_show (widget); - return widget; -} - -static void -enable_widget (GtkWidget *widget, gboolean enabled) -{ - if (GTK_IS_ENTRY (widget)) { - gtk_editable_set_editable (GTK_EDITABLE (widget), enabled); - } - else if (GTK_IS_TEXT_VIEW (widget)) { - gtk_text_view_set_editable (GTK_TEXT_VIEW (widget), enabled); - } - else if (GTK_IS_COMBO (widget)) { - gtk_editable_set_editable (GTK_EDITABLE (GTK_COMBO (widget)->entry), - enabled); - gtk_widget_set_sensitive (GTK_COMBO (widget)->button, enabled); - } - else if (E_IS_URL_ENTRY (widget)) { - GtkWidget *e = e_url_entry_get_entry (E_URL_ENTRY (widget)); - gtk_editable_set_editable (GTK_EDITABLE (e), enabled); - } - else if (E_IS_DATE_EDIT (widget)) { - e_date_edit_set_editable (E_DATE_EDIT (widget), enabled); - } - else - gtk_widget_set_sensitive (widget, enabled); -} - - -gboolean -e_contact_editor_request_close_all (void) -{ - GSList *p; - GSList *pnext; - gboolean retval; - - retval = TRUE; - for (p = all_contact_editors; p != NULL; p = pnext) { - pnext = p->next; - - e_contact_editor_raise (E_CONTACT_EDITOR (p->data)); - if (! prompt_to_save_changes (E_CONTACT_EDITOR (p->data))) { - retval = FALSE; - break; - } - - close_dialog (E_CONTACT_EDITOR (p->data)); - } - - return retval; -} diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h deleted file mode 100644 index 27baa9f0fc..0000000000 --- a/addressbook/gui/contact-editor/e-contact-editor.h +++ /dev/null @@ -1,134 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* e-contact-editor.h - * Copyright (C) 2000 Ximian, Inc. - * Author: Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __E_CONTACT_EDITOR_H__ -#define __E_CONTACT_EDITOR_H__ - -#include -#include -#include -#include - -#include -#include - -G_BEGIN_DECLS - -/* EContactEditor - A dialog displaying information about a contact. - * - * The following arguments are available: - * - * name type read/write description - * -------------------------------------------------------------------------------- - * card ECard * RW The card currently being edited - */ - -#define E_TYPE_CONTACT_EDITOR (e_contact_editor_get_type ()) -#define E_CONTACT_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CONTACT_EDITOR, EContactEditor)) -#define E_CONTACT_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CONTACT_EDITOR, EContactEditorClass)) -#define E_IS_CONTACT_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CONTACT_EDITOR)) -#define E_IS_CONTACT_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_CONTACT_EDITOR)) - - -typedef struct _EContactEditor EContactEditor; -typedef struct _EContactEditorClass EContactEditorClass; - -struct _EContactEditor -{ - GtkObject object; - - /* item specific fields */ - EBook *book; - EContact *contact; - - /* UI handler */ - BonoboUIComponent *uic; - - GladeXML *gui; - GtkWidget *app; - GnomeUIInfo *email_info; - GnomeUIInfo *phone_info; - GnomeUIInfo *address_info; - GtkWidget *email_popup; - GtkWidget *phone_popup; - GtkWidget *address_popup; - GList *email_list; - GList *phone_list; - GList *address_list; - - EContactName *name; - char *company; - - EContactField email_choice; - EContactField phone_choice[4]; - EContactField address_choice; - EContactField address_mailing; - - /* Whether we are editing a new contact or an existing one */ - guint is_new_contact : 1; - - /* Whether the contact has been changed since bringing up the contact editor */ - guint changed : 1; - - /* Whether the contact editor will accept modifications */ - guint editable : 1; - - /* Whether the fullname will accept modifications */ - guint fullname_editable : 1; - -#if notyet - /* Whether each of the addresses are editable */ - gboolean address_editable[E_CARD_SIMPLE_ADDRESS_ID_LAST]; -#endif - - /* Whether an async wombat call is in progress */ - guint in_async_call : 1; - - EList *writable_fields; -}; - -struct _EContactEditorClass -{ - GtkObjectClass parent_class; - - /* Notification signals */ - - void (* contact_added) (EContactEditor *ce, EBookStatus status, EContact *contact); - void (* contact_modified) (EContactEditor *ce, EBookStatus status, EContact *contact); - void (* contact_deleted) (EContactEditor *ce, EBookStatus status, EContact *contact); - void (* editor_closed) (EContactEditor *ce); -}; - -EContactEditor *e_contact_editor_new (EBook *book, - EContact *contact, - gboolean is_new_contact, - gboolean editable); -GType e_contact_editor_get_type (void); - -void e_contact_editor_show (EContactEditor *editor); -void e_contact_editor_close (EContactEditor *editor); -void e_contact_editor_raise (EContactEditor *editor); - -gboolean e_contact_editor_confirm_delete (GtkWindow *parent); - -gboolean e_contact_editor_request_close_all (void); - -G_END_DECLS - -#endif /* __E_CONTACT_EDITOR_H__ */ diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c deleted file mode 100644 index 0f59c1145f..0000000000 --- a/addressbook/gui/contact-editor/e-contact-quick-add.c +++ /dev/null @@ -1,457 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * e-contact-quick-add.c - * - * Copyright (C) 2001 Ximian, Inc. - * - * Developed by Jon Trowbridge - */ - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "e-contact-editor.h" -#include "e-contact-quick-add.h" -#include "eab-contact-merging.h" - -typedef struct _QuickAdd QuickAdd; -struct _QuickAdd { - gchar *name; - gchar *email; - EContact *contact; - - EContactQuickAddCallback cb; - gpointer closure; - - GtkWidget *name_entry; - GtkWidget *email_entry; - - gint refs; - -}; - -static QuickAdd * -quick_add_new (void) -{ - QuickAdd *qa = g_new0 (QuickAdd, 1); - qa->contact = e_contact_new (); - qa->refs = 1; - return qa; -} - -static void -quick_add_ref (QuickAdd *qa) -{ - if (qa) { - ++qa->refs; - } -} - -static void -quick_add_unref (QuickAdd *qa) -{ - if (qa) { - --qa->refs; - if (qa->refs == 0) { - g_free (qa->name); - g_free (qa->email); - g_object_unref (qa->contact); - g_free (qa); - } - } -} - -static void -quick_add_set_name (QuickAdd *qa, const gchar *name) -{ -#if notyet - EContactName *card_name; - - if (name == qa->name) - return; - - g_free (qa->name); - - card_name = e_card_name_from_string (name); - qa->name = e_card_name_to_string (card_name); - - g_object_set (qa->card, - "full_name", qa->name, - NULL); - - e_card_name_unref (card_name); -#endif -} - -static void -quick_add_set_email (QuickAdd *qa, const gchar *email) -{ - if (email == qa->email) - return; - - g_free (qa->email); - qa->email = g_strdup (email); - - e_contact_set (qa->contact, E_CONTACT_EMAIL_1, (char*)email); -} - -static void -merge_cb (EBook *book, EBookStatus status, gpointer closure) -{ - QuickAdd *qa = (QuickAdd *) closure; - - if (status == E_BOOK_ERROR_OK) { - eab_merging_book_add_contact (book, qa->contact, NULL, NULL); - if (qa->cb) - qa->cb (qa->contact, qa->closure); - g_object_unref (book); - } else { - /* Something went wrong. */ - if (book) - g_object_unref (book); - if (qa->cb) - qa->cb (NULL, qa->closure); - } - - quick_add_unref (qa); -} - -static void -quick_add_merge_contact (QuickAdd *qa) -{ - quick_add_ref (qa); - - addressbook_load_default_book (merge_cb, qa); -} - - -/* - * Raise a contact editor with all fields editable, and hook up all signals accordingly. - */ - -static void -contact_added_cb (EContactEditor *ce, EBookStatus status, EContact *contact, gpointer closure) -{ - QuickAdd *qa = (QuickAdd *) g_object_get_data (G_OBJECT (ce), "quick_add"); - - if (qa) { - - if (qa->cb) - qa->cb (qa->contact, qa->closure); - - /* We don't need to unref qa because we set_data_full below */ - g_object_set_data (G_OBJECT (ce), "quick_add", NULL); - } -} - -static void -editor_closed_cb (GtkWidget *w, gpointer closure) -{ - QuickAdd *qa = (QuickAdd *) g_object_get_data (G_OBJECT (w), "quick_add"); - - if (qa) - /* We don't need to unref qa because we set_data_full below */ - g_object_set_data (G_OBJECT (w), "quick_add", NULL); - - g_object_unref (w); -} - -static void -ce_have_book (EBook *book, EBookStatus status, gpointer closure) -{ - QuickAdd *qa = (QuickAdd *) closure; - - if (status != E_BOOK_ERROR_OK) { - if (book) - g_object_unref (book); - g_warning ("Couldn't open local address book."); - quick_add_unref (qa); - } else { - EContactEditor *contact_editor = e_contact_editor_new (book, qa->contact, TRUE, TRUE /* XXX */); - - /* mark it as changed so the Save buttons are enabled when we bring up the dialog. */ - g_object_set (contact_editor, - "changed", TRUE, - NULL); - - /* We pass this via object data, so that we don't get a dangling pointer referenced if both - the "contact_added" and "editor_closed" get emitted. (Which, based on a backtrace in bugzilla, - I think can happen and cause a crash. */ - g_object_set_data_full (G_OBJECT (contact_editor), "quick_add", qa, - (GDestroyNotify) quick_add_unref); - - g_signal_connect (contact_editor, - "contact_added", - G_CALLBACK (contact_added_cb), - NULL); - g_signal_connect (contact_editor, - "editor_closed", - G_CALLBACK (editor_closed_cb), - NULL); - - g_object_unref (book); - } -} - -static void -edit_contact (QuickAdd *qa) -{ - addressbook_load_default_book (ce_have_book, qa); -} - -#define QUICK_ADD_RESPONSE_EDIT_FULL 2 - -static void -clicked_cb (GtkWidget *w, gint button, gpointer closure) -{ - QuickAdd *qa = (QuickAdd *) closure; - - /* Get data out of entries. */ - if (button == GTK_RESPONSE_OK || button == QUICK_ADD_RESPONSE_EDIT_FULL) { - gchar *name = NULL; - gchar *email = NULL; - - if (qa->name_entry) { - gchar *tmp; - tmp = gtk_editable_get_chars (GTK_EDITABLE (qa->name_entry), 0, -1); - name = tmp; - } - - if (qa->email_entry) { - gchar *tmp; - tmp = gtk_editable_get_chars (GTK_EDITABLE (qa->email_entry), 0, -1); - email = tmp; - } - - quick_add_set_name (qa, name); - quick_add_set_email (qa, email); - - g_free (name); - g_free (email); - } - - gtk_widget_destroy (w); - - if (button == GTK_RESPONSE_OK) { - - /* OK */ - quick_add_merge_contact (qa); - - } else if (button == QUICK_ADD_RESPONSE_EDIT_FULL) { - - /* EDIT FULL */ - edit_contact (qa); - - } else { - /* CANCEL */ - quick_add_unref (qa); - } - -} - -static GtkWidget * -build_quick_add_dialog (QuickAdd *qa) -{ - GtkWidget *dialog; - GtkTable *table; - const gint xpad=6, ypad=6; - - g_return_val_if_fail (qa != NULL, NULL); - - dialog = gtk_dialog_new_with_buttons (_("Contact Quick-Add"), - NULL, /* XXX */ - (GtkDialogFlags) 0, - _("_Edit Full"), QUICK_ADD_RESPONSE_EDIT_FULL, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); - - g_signal_connect (dialog, "response", G_CALLBACK (clicked_cb), qa); - - qa->name_entry = gtk_entry_new (); - if (qa->name) - gtk_entry_set_text (GTK_ENTRY (qa->name_entry), qa->name); - - - qa->email_entry = gtk_entry_new (); - if (qa->email) - gtk_entry_set_text (GTK_ENTRY (qa->email_entry), qa->email); - - table = GTK_TABLE (gtk_table_new (2, 2, FALSE)); - - gtk_table_attach (table, gtk_label_new_with_mnemonic (_("_Full Name:")), - 0, 1, 0, 1, - 0, 0, xpad, ypad); - gtk_table_attach (table, qa->name_entry, - 1, 2, 0, 1, - GTK_EXPAND | GTK_FILL, GTK_EXPAND, xpad, ypad); - gtk_table_attach (table, gtk_label_new_with_mnemonic (_("E-_mail:")), - 0, 1, 1, 2, - 0, 0, xpad, ypad); - gtk_table_attach (table, qa->email_entry, - 1, 2, 1, 2, - GTK_EXPAND | GTK_FILL, GTK_EXPAND, xpad, ypad); - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), - 6); - - gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox),6); - - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), - GTK_WIDGET (table), - TRUE, TRUE, 6); - gtk_widget_show_all (GTK_WIDGET (table)); - - - return dialog; -} - -void -e_contact_quick_add (const gchar *in_name, const gchar *email, - EContactQuickAddCallback cb, gpointer closure) -{ - QuickAdd *qa; - GtkWidget *dialog; - gchar *name = NULL; - gint len; - - /* We need to have *something* to work with. */ - if (in_name == NULL && email == NULL) { - if (cb) - cb (NULL, closure); - return; - } - - if (in_name) { - name = g_strdup (in_name); - - /* Remove extra whitespace and the quotes some mailers put around names. */ - g_strstrip (name); - len = strlen (name); - if ((name[0] == '\'' && name[len-1] == '\'') || (name[0] == '"' && name[len-1] == '"')) { - name[0] = ' '; - name[len-1] = ' '; - } - g_strstrip (name); - } - - qa = quick_add_new (); - qa->cb = cb; - qa->closure = closure; - if (name) - quick_add_set_name (qa, name); - if (email) - quick_add_set_email (qa, email); - - dialog = build_quick_add_dialog (qa); - gtk_widget_show_all (dialog); - - g_free (name); -} - -void -e_contact_quick_add_free_form (const gchar *text, EContactQuickAddCallback cb, gpointer closure) -{ - gchar *name=NULL, *email=NULL; - const gchar *last_at, *s; - gboolean in_quote; - - if (text == NULL) { - e_contact_quick_add (NULL, NULL, cb, closure); - return; - } - - /* Look for things that look like e-mail addresses embedded in text */ - in_quote = FALSE; - last_at = NULL; - for (s = text; *s; ++s) { - if (*s == '@' && !in_quote) - last_at = s; - else if (*s == '"') - in_quote = !in_quote; - } - - - if (last_at == NULL) { - /* No at sign, so we treat it all as the name */ - name = g_strdup (text); - } else { - gboolean bad_char = FALSE; - - /* walk backwards to whitespace or a < or a quote... */ - while (last_at >= text && !bad_char - && !(isspace ((gint) *last_at) || *last_at == '<' || *last_at == '"')) { - /* Check for some stuff that can't appear in a legal e-mail address. */ - if (*last_at == '[' - || *last_at == ']' - || *last_at == '(' - || *last_at == ')') - bad_char = TRUE; - --last_at; - } - if (last_at < text) - last_at = text; - - /* ...and then split the text there */ - if (!bad_char) { - if (text < last_at) - name = g_strndup (text, last_at-text); - email = g_strdup (last_at); - } - } - - /* If all else has failed, make it the name. */ - if (name == NULL && email == NULL) - name = g_strdup (text); - - - - /* Clean up email, remove bracketing <>s */ - if (email && *email) { - gboolean changed = FALSE; - g_strstrip (email); - if (*email == '<') { - *email = ' '; - changed = TRUE; - } - if (email[strlen (email)-1] == '>') { - email[strlen (email)-1] = ' '; - changed = TRUE; - } - if (changed) - g_strstrip (email); - } - - - e_contact_quick_add (name, email, cb, closure); - g_free (name); - g_free (email); -} diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.h b/addressbook/gui/contact-editor/e-contact-quick-add.h deleted file mode 100644 index a969211915..0000000000 --- a/addressbook/gui/contact-editor/e-contact-quick-add.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -/* - * e-contact-quick-add.h - * - * Copyright (C) 2001 Ximian, Inc. - * - * Developed by Jon Trowbridge - */ - -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. - */ - -#ifndef __E_CONTACT_QUICK_ADD_H__ -#define __E_CONTACT_QUICK_ADD_H__ - -#include - -typedef void (*EContactQuickAddCallback) (EContact *new_contact, gpointer closure); - -void e_contact_quick_add (const gchar *name, const gchar *email, - EContactQuickAddCallback cb, gpointer closure); - -void e_contact_quick_add_free_form (const gchar *text, EContactQuickAddCallback cb, gpointer closure); - -#endif /* __E_CONTACT_QUICK_ADD_H__ */ - diff --git a/addressbook/gui/contact-editor/fulladdr.glade b/addressbook/gui/contact-editor/fulladdr.glade deleted file mode 100644 index c7767b9751..0000000000 --- a/addressbook/gui/contact-editor/fulladdr.glade +++ /dev/null @@ -1,446 +0,0 @@ - - - - - - - Full Address - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - True - True - False - True - - - - True - False - 8 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - 0 - - - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - 0 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 6 - True - 4 - 4 - False - 6 - 6 - - - - True - _Address: - True - False - GTK_JUSTIFY_LEFT - False - False - 1 - 0.5 - 0 - 0 - entry-street - - - 0 - 1 - 0 - 1 - fill - fill - - - - - - True - Ci_ty: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-city - - - 0 - 1 - 2 - 3 - fill - fill - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 2 - 3 - fill - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 1 - 2 - fill - - - - - - True - _PO Box: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-po - - - 2 - 3 - 1 - 2 - fill - fill - - - - - - True - Address _2: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-ext - - - 0 - 1 - 1 - 2 - fill - fill - - - - - - True - True - True - True - 0 - - True - * - False - - - 3 - 4 - 1 - 2 - fill - fill - - - - - - True - True - True - True - True - 0 - - True - * - False - - - 1 - 4 - 0 - 1 - fill - - - - - - True - _State/Province: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-region - - - 0 - 1 - 3 - 4 - fill - fill - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 3 - 4 - fill - - - - - - True - True - False - True - False - True - False - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - True - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - - 3 - 4 - 3 - 4 - fill - fill - - - - - - True - True - True - True - 0 - - True - * - False - - - 3 - 4 - 2 - 3 - fill - fill - - - - - - True - _ZIP Code: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-code - - - 2 - 3 - 2 - 3 - fill - fill - - - - - - True - Countr_y: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-country - - - 2 - 3 - 3 - 4 - fill - fill - - - - - 0 - True - True - - - - - - - diff --git a/addressbook/gui/contact-editor/fullname.glade b/addressbook/gui/contact-editor/fullname.glade deleted file mode 100644 index 9e170c93d0..0000000000 --- a/addressbook/gui/contact-editor/fullname.glade +++ /dev/null @@ -1,674 +0,0 @@ - - - - - - - Full Name - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - True - True - False - True - - - - True - False - 8 - - - - True - GTK_BUTTONBOX_END - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - 0 - - - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - 0 - - - - - 0 - False - True - GTK_PACK_END - - - - - - 6 - True - 5 - 3 - False - 6 - 6 - - - - True - False - True - False - True - False - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - True - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - True - - - - True - Mr. - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - True - - - - True - Mrs. - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - True - - - - True - Ms. - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - True - - - - True - Miss - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - True - - - - True - Dr. - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - True - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - - 1 - 2 - 0 - 1 - - - - - - - True - False - True - False - True - False - - - - True - True - True - True - 0 - - True - * - False - - - - - - True - GTK_SELECTION_BROWSE - - - - True - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - True - - - - True - Sr. - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - True - - - - True - Jr. - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - True - - - - True - I - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - True - - - - True - II - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - True - - - - True - III - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - True - - - - True - Esq. - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - True - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - - - - - - - 1 - 2 - 4 - 5 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 3 - 1 - 2 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 3 - 2 - 3 - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 3 - 3 - 4 - - - - - - - True - _First: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-first - - - 0 - 1 - 1 - 2 - fill - fill - - - - - - True - _Title: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-title - - - 0 - 1 - 0 - 1 - fill - fill - - - - - - True - _Middle: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-middle - - - 0 - 1 - 2 - 3 - fill - fill - - - - - - True - _Last: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-last - - - 0 - 1 - 3 - 4 - fill - fill - - - - - - True - _Suffix: - True - False - GTK_JUSTIFY_CENTER - False - False - 1 - 0.5 - 0 - 0 - entry-suffix - - - 0 - 1 - 4 - 5 - fill - fill - - - - - 0 - True - True - - - - - - - diff --git a/addressbook/gui/contact-editor/test-editor.c b/addressbook/gui/contact-editor/test-editor.c deleted file mode 100644 index 4a8c111563..0000000000 --- a/addressbook/gui/contact-editor/test-editor.c +++ /dev/null @@ -1,142 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * test-editor.c - * Copyright (C) 2000 Ximian, Inc. - * Author: Chris Lahey - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include "e-contact-editor.h" -#include "ebook/e-card.h" - -#define TEST_VCARD \ -"BEGIN:VCARD -" \ -"FN:Nat -" \ -"N:Friedman;Nat;D;Mr. -" \ -"BDAY:1977-08-06 -" \ -"TEL;WORK:617 679 1984 -" \ -"TEL;CELL:123 456 7890 -" \ -"EMAIL;INTERNET:nat@nat.org -" \ -"EMAIL;INTERNET:nat@ximian.com -" \ -"ADR;WORK;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234; -" \ -"ADR;HOME;POSTAL;INTL:P.O. Box 202;;;Any Town 2;MI;12344-4321;USA -" \ -"END:VCARD -" \ -" -" - -static char * -read_file (char *name) -{ - int len; - char buff[65536]; - char line[1024]; - FILE *f; - - f = fopen (name, "r"); - if (f == NULL) - g_error ("Unable to open %s!\n", name); - - len = 0; - while (fgets (line, sizeof (line), f) != NULL) { - strcpy (buff + len, line); - len += strlen (line); - } - - fclose (f); - - return g_strdup (buff); -} - -/* Callback used when a contact editor is closed */ -static void -editor_closed_cb (EContactEditor *ce, gpointer data) -{ - static int count = 2; - - count--; - g_object_unref (ce); - - if (count == 0) - exit (0); -} - -#if 0 -static void about_callback( GtkWidget *widget, gpointer data ) -{ - - const gchar *authors[] = - { - "Christopher James Lahey ", - NULL - }; - - GtkWidget *about = - gnome_about_new ( _( "Contact Editor Test" ), VERSION, - _( "Copyright (C) 2000, Ximian, Inc." ), - authors, - _( "This should test the contact editor canvas item" ), - NULL); - gtk_widget_show (about); -} -#endif - -int main( int argc, char *argv[] ) -{ - char *cardstr; - EContactEditor *ce; - - gnome_program_init("Contact Editor Test", VERSION, LIBGNOMEUI_MODULE, argc, argv, NULL); - - glade_init (); - - cardstr = NULL; - if (argc == 2) - cardstr = read_file (argv [1]); - - if (cardstr == NULL) - cardstr = TEST_VCARD; - - ce = e_contact_editor_new (NULL, e_card_new_with_default_charset (cardstr, "ISO-8859-1"), TRUE, FALSE); - g_signal_connect (ce, "editor_closed", - G_CALLBACK (editor_closed_cb), NULL); - - ce = e_contact_editor_new (NULL, e_card_new_with_default_charset (cardstr, "ISO-8859-1"), TRUE, FALSE); - g_signal_connect (ce, "editor_closed", - G_CALLBACK (editor_closed_cb), NULL); - - gtk_main(); - - /* Not reached. */ - return 0; -} -- cgit v1.2.3