aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authornobody <nobody@localhost>2001-08-04 06:36:03 +0800
committernobody <nobody@localhost>2001-08-04 06:36:03 +0800
commitb266f65c147b99ecae0297ff1ef1c801bfc6f883 (patch)
treef3c195439d0a5928ddb85c3a1583b09eb498443a /addressbook/gui
parent308aaf47ea788683b47a600d6c6f31563d7ee070 (diff)
downloadgsoc2013-evolution-gnomemm_1_2_1.tar
gsoc2013-evolution-gnomemm_1_2_1.tar.gz
gsoc2013-evolution-gnomemm_1_2_1.tar.bz2
gsoc2013-evolution-gnomemm_1_2_1.tar.lz
gsoc2013-evolution-gnomemm_1_2_1.tar.xz
gsoc2013-evolution-gnomemm_1_2_1.tar.zst
gsoc2013-evolution-gnomemm_1_2_1.zip
This commit was manufactured by cvs2svn to create taggnomemm_1_2_1
'gnomemm_1_2_1'. svn path=/tags/gnomemm_1_2_1/; revision=11631
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/.cvsignore6
-rw-r--r--addressbook/gui/Makefile.am1
-rw-r--r--addressbook/gui/component/.cvsignore11
-rw-r--r--addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in147
-rw-r--r--addressbook/gui/component/Makefile.am93
-rw-r--r--addressbook/gui/component/addressbook-component.c375
-rw-r--r--addressbook/gui/component/addressbook-component.h33
-rw-r--r--addressbook/gui/component/addressbook-config.c984
-rw-r--r--addressbook/gui/component/addressbook-config.glade158
-rw-r--r--addressbook/gui/component/addressbook-config.h31
-rw-r--r--addressbook/gui/component/addressbook-factory.c94
-rw-r--r--addressbook/gui/component/addressbook-storage.c582
-rw-r--r--addressbook/gui/component/addressbook-storage.h81
-rw-r--r--addressbook/gui/component/addressbook.c795
-rw-r--r--addressbook/gui/component/addressbook.h12
-rw-r--r--addressbook/gui/component/e-address-popup.c1196
-rw-r--r--addressbook/gui/component/e-address-popup.h85
-rw-r--r--addressbook/gui/component/e-address-widget.c577
-rw-r--r--addressbook/gui/component/e-address-widget.h103
-rw-r--r--addressbook/gui/component/e-cardlist-model.c226
-rw-r--r--addressbook/gui/component/e-cardlist-model.h42
-rw-r--r--addressbook/gui/component/select-names/.cvsignore12
-rw-r--r--addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl42
-rw-r--r--addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.oaf.in29
-rw-r--r--addressbook/gui/component/select-names/Makefile.am85
-rw-r--r--addressbook/gui/component/select-names/e-select-names-bonobo.c431
-rw-r--r--addressbook/gui/component/select-names/e-select-names-bonobo.h71
-rw-r--r--addressbook/gui/component/select-names/e-select-names-completion.c1189
-rw-r--r--addressbook/gui/component/select-names/e-select-names-completion.h68
-rw-r--r--addressbook/gui/component/select-names/e-select-names-factory.c59
-rw-r--r--addressbook/gui/component/select-names/e-select-names-factory.h31
-rw-r--r--addressbook/gui/component/select-names/e-select-names-manager.c512
-rw-r--r--addressbook/gui/component/select-names/e-select-names-manager.h66
-rw-r--r--addressbook/gui/component/select-names/e-select-names-model.c694
-rw-r--r--addressbook/gui/component/select-names/e-select-names-model.h76
-rw-r--r--addressbook/gui/component/select-names/e-select-names-popup.c445
-rw-r--r--addressbook/gui/component/select-names/e-select-names-popup.h36
-rw-r--r--addressbook/gui/component/select-names/e-select-names-table-model.c344
-rw-r--r--addressbook/gui/component/select-names/e-select-names-table-model.h51
-rw-r--r--addressbook/gui/component/select-names/e-select-names-text-model.c723
-rw-r--r--addressbook/gui/component/select-names/e-select-names-text-model.h45
-rw-r--r--addressbook/gui/component/select-names/e-select-names.c801
-rw-r--r--addressbook/gui/component/select-names/e-select-names.h107
-rw-r--r--addressbook/gui/component/select-names/recipient.glade61
-rw-r--r--addressbook/gui/component/select-names/select-names.glade320
-rw-r--r--addressbook/gui/contact-editor/.cvsignore8
-rw-r--r--addressbook/gui/contact-editor/Makefile.am65
-rw-r--r--addressbook/gui/contact-editor/arrow.pngbin174 -> 0 bytes
-rw-r--r--addressbook/gui/contact-editor/contact-editor.glade2334
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-address.c243
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-address.h78
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-confirm-delete.glade83
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-fullname.c243
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-fullname.h78
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c2448
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.h134
-rw-r--r--addressbook/gui/contact-editor/e-contact-quick-add.c416
-rw-r--r--addressbook/gui/contact-editor/e-contact-quick-add.h41
-rw-r--r--addressbook/gui/contact-editor/e-contact-save-as.c152
-rw-r--r--addressbook/gui/contact-editor/e-contact-save-as.h43
-rw-r--r--addressbook/gui/contact-editor/file-exists.glade95
-rw-r--r--addressbook/gui/contact-editor/fulladdr.glade475
-rw-r--r--addressbook/gui/contact-editor/fullname.glade389
-rw-r--r--addressbook/gui/contact-editor/test-editor.c145
-rw-r--r--addressbook/gui/contact-list-editor/.cvsignore3
-rw-r--r--addressbook/gui/contact-list-editor/Makefile.am30
-rw-r--r--addressbook/gui/contact-list-editor/contact-list-editor.glade272
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c843
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.h108
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-model.c253
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-model.h47
-rw-r--r--addressbook/gui/merging/.cvsignore6
-rw-r--r--addressbook/gui/merging/Makefile.am23
-rw-r--r--addressbook/gui/merging/e-card-duplicate-detected.glade255
-rw-r--r--addressbook/gui/merging/e-card-merging-book-commit-duplicate-detected.glade255
-rw-r--r--addressbook/gui/merging/e-card-merging.c164
-rw-r--r--addressbook/gui/merging/e-card-merging.h31
-rw-r--r--addressbook/gui/search/.cvsignore7
-rw-r--r--addressbook/gui/search/Makefile.am24
-rw-r--r--addressbook/gui/search/addresstypes.xml83
-rw-r--r--addressbook/gui/search/e-addressbook-search-dialog.c239
-rw-r--r--addressbook/gui/search/e-addressbook-search-dialog.h76
-rw-r--r--addressbook/gui/widgets/.cvsignore12
-rw-r--r--addressbook/gui/widgets/Makefile.am140
-rw-r--r--addressbook/gui/widgets/alphabet.glade355
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c522
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.h72
-rw-r--r--addressbook/gui/widgets/e-addressbook-reflow-adapter.c610
-rw-r--r--addressbook/gui/widgets/e-addressbook-reflow-adapter.h51
-rw-r--r--addressbook/gui/widgets/e-addressbook-table-adapter.c391
-rw-r--r--addressbook/gui/widgets/e-addressbook-table-adapter.h44
-rw-r--r--addressbook/gui/widgets/e-addressbook-util.c131
-rw-r--r--addressbook/gui/widgets/e-addressbook-util.h46
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c1426
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.h133
-rw-r--r--addressbook/gui/widgets/e-minicard-control.c336
-rw-r--r--addressbook/gui/widgets/e-minicard-control.h8
-rw-r--r--addressbook/gui/widgets/e-minicard-label.c457
-rw-r--r--addressbook/gui/widgets/e-minicard-label.h85
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.c343
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.h78
-rw-r--r--addressbook/gui/widgets/e-minicard-view.c441
-rw-r--r--addressbook/gui/widgets/e-minicard-view.h100
-rw-r--r--addressbook/gui/widgets/e-minicard-widget-test.c114
-rw-r--r--addressbook/gui/widgets/e-minicard-widget.c250
-rw-r--r--addressbook/gui/widgets/e-minicard-widget.h77
-rw-r--r--addressbook/gui/widgets/e-minicard.c937
-rw-r--r--addressbook/gui/widgets/e-minicard.h122
-rw-r--r--addressbook/gui/widgets/gal-view-factory-minicard.c120
-rw-r--r--addressbook/gui/widgets/gal-view-factory-minicard.h35
-rw-r--r--addressbook/gui/widgets/gal-view-minicard.c154
-rw-r--r--addressbook/gui/widgets/gal-view-minicard.h38
-rw-r--r--addressbook/gui/widgets/test-minicard-label.c129
-rw-r--r--addressbook/gui/widgets/test-minicard-view.c204
-rw-r--r--addressbook/gui/widgets/test-minicard.c119
-rw-r--r--addressbook/gui/widgets/test-reflow.c198
116 files changed, 0 insertions, 30397 deletions
diff --git a/addressbook/gui/.cvsignore b/addressbook/gui/.cvsignore
deleted file mode 100644
index 09980ae6ba..0000000000
--- a/addressbook/gui/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-*.la
diff --git a/addressbook/gui/Makefile.am b/addressbook/gui/Makefile.am
deleted file mode 100644
index 6b0850da5d..0000000000
--- a/addressbook/gui/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = contact-editor contact-list-editor merging widgets search component
diff --git a/addressbook/gui/component/.cvsignore b/addressbook/gui/component/.cvsignore
deleted file mode 100644
index 8bcb766191..0000000000
--- a/addressbook/gui/component/.cvsignore
+++ /dev/null
@@ -1,11 +0,0 @@
-.deps
-.libs
-.pure
-Makefile
-Makefile.in
-*.lo
-*.la
-evolution-addressbook
-evolution-addressbook.pure
-test-addressbook
-GNOME_Evolution_Addressbook.oaf \ No newline at end of file
diff --git a/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in b/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in
deleted file mode 100644
index 7350b4925e..0000000000
--- a/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in
+++ /dev/null
@@ -1,147 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_MiniCard_ControlFactory"
- type="exe"
- location="evolution-addressbook">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string"
- _value="Factory for the Addressbook Minicard control"/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_MiniCard_Control"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_MiniCard_ControlFactory">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:Bonobo/Control:1.0"/>
- <item value="IDL:Bonobo/PersistStream:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="bonobo:supported_mime_types" type="stringv">
- <item value="text/vcard"/>
- <item value="text/x-vcard"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution Addressbook minicard viewer"/>
- <oaf_attribute name="description" type="string"
- _value="Control that displays an Evolution addressbook minicard."/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_ControlFactory"
- type="exe"
- location="evolution-addressbook">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string"
- _value="Factory for the sample Addressbook control"/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_Control"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_ControlFactory">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:BonoboControl/addressbook-control:1.0"/>
- <item value="IDL:GNOME/Control:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string"
- _value="A sample Bonobo control which displays an addressbook."/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_ShellComponentFactory"
- type="exe"
- location="evolution-addressbook">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string"
- _value="Factory for the Evolution addressbook component."/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_ShellComponent"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_ShellComponentFactory">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution/ShellComponent:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string"
- _value="Evolution component for handling contacts."/>
-
- <oaf_attribute name="evolution:shell-component-icon" type="string"
- value="evolution-contacts.png"/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_AddressWidgetFactory"
- type="exe"
- location="evolution-addressbook">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string"
- _value="Factory for the Addressbook's address displayer"/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_AddressWidget"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_AddressWidgetFactory">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:BonoboControl/address-widget:1.0"/>
- <item value="IDL:GNOME/Control:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string"
- _value="A Bonobo control for displaying an address."/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_AddressPopupFactory"
- type="exe"
- location="evolution-addressbook">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string"
- _value="Factory for the Addressbook's address popup"/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_AddressPopup"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_AddressPopupFactory">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:BonoboControl/address-widget:1.0"/>
- <item value="IDL:GNOME/Control:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string"
- _value="A Bonobo control for an address popup."/>
-
-</oaf_server>
-
-</oaf_info>
diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am
deleted file mode 100644
index 29d3663f56..0000000000
--- a/addressbook/gui/component/Makefile.am
+++ /dev/null
@@ -1,93 +0,0 @@
-SUBDIRS = select-names
-
-INCLUDES = \
- -DG_LOG_DOMAIN=\"evolution-addressbook\" \
- $(EXTRA_GNOME_CFLAGS) \
- $(GNOME_INCLUDEDIR) \
- -I$(top_srcdir) \
- -I$(top_builddir) \
- -I$(top_srcdir)/shell \
- -I$(top_builddir)/shell \
- -I$(top_srcdir)/widgets/misc \
- -I$(top_srcdir)/addressbook/gui/contact-editor \
- -I$(top_srcdir)/addressbook/gui/contact-list-editor \
- -I$(top_srcdir)/addressbook/gui/minicard \
- -I$(top_srcdir)/addressbook/gui/widgets \
- -I$(top_srcdir)/addressbook/backend \
- -I$(top_builddir)/addressbook/backend \
- $(BONOBO_HTML_GNOME_CFLAGS) \
- -DEVOLUTION_DATADIR=\""$(datadir)"\" \
- -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
- -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \
- -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
- -DCAMEL_PROVIDERDIR=\""$(providerdir)"\"
-
-bin_PROGRAMS = \
- evolution-addressbook
-
-evolution_addressbook_SOURCES = \
- addressbook-component.c \
- addressbook-component.h \
- addressbook-config.c \
- addressbook-config.h \
- addressbook-factory.c \
- addressbook-storage.c \
- addressbook-storage.h \
- addressbook.c \
- addressbook.h \
- e-cardlist-model.c \
- e-cardlist-model.h \
- e-address-widget.h \
- e-address-widget.c \
- e-address-popup.h \
- e-address-popup.c
-
-evolution_addressbook_LDADD = \
- select-names/libeselectnames.la \
- $(top_builddir)/shell/libeshell.la \
- $(EXTRA_GNOME_LIBS) \
- $(BONOBO_HTML_GNOME_LIBS) \
- $(BONOBO_CONF_LIBS) \
- $(top_builddir)/addressbook/gui/widgets/libeminicard.a \
- $(top_builddir)/addressbook/backend/ebook/libebook.la \
- $(top_builddir)/camel/libcamel.la \
- $(top_builddir)/libibex/libibex.la \
- $(top_builddir)/e-util/ename/libename.la \
- $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.a \
- $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.a \
- $(top_builddir)/libversit/libversit.la \
- $(top_builddir)/widgets/misc/libemiscwidgets.a \
- $(top_builddir)/addressbook/printing/libecontactprint.a \
- $(top_builddir)/addressbook/gui/search/libeaddressbooksearch.a \
- $(top_builddir)/addressbook/gui/merging/libecardmerging.a \
- $(top_builddir)/filter/libfilter.la \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/widgets/menus/libmenus.la
-
-evolution_addressbook_LDFLAGS = `gnome-config --libs gdk_pixbuf` -export-dynamic
-
-@XML_I18N_MERGE_OAF_RULE@
-
-oafdir = $(datadir)/oaf
-oaf_in_files = GNOME_Evolution_Addressbook.oaf.in
-oaf_DATA = $(oaf_in_files:.oaf.in=.oaf)
-
-gladedir = $(datadir)/evolution/glade
-glade_DATA = addressbook-config.glade
-
-EXTRA_DIST = \
- $(glade_DATA) \
- $(oaf_DATA) \
- addressbook-config.glade\
- $(oaf_in_files)
-
-if ENABLE_PURIFY
-PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
-
-all-local: evolution-addressbook.pure
-
-evolution-addressbook.pure: evolution-addressbook
- @rm -f evolution-addressbook.pure
- $(PLINK) $(evolution_addressbook_LDFLAGS) $(evolution_addressbook_OBJECTS) $(evolution_addressbook_LDADD) $(LIBS)
-
-endif
diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c
deleted file mode 100644
index 1dca130042..0000000000
--- a/addressbook/gui/component/addressbook-component.c
+++ /dev/null
@@ -1,375 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* addressbook-component.c
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-
-#include <bonobo/bonobo-generic-factory.h>
-
-#include "evolution-shell-component.h"
-#include "evolution-shell-component-dnd.h"
-#include "evolution-storage.h"
-
-#include "ebook/e-book.h"
-#include "ebook/e-card.h"
-
-#include "addressbook-storage.h"
-#include "addressbook-component.h"
-#include "addressbook.h"
-#include "addressbook/gui/merging/e-card-merging.h"
-
-
-
-#define GNOME_EVOLUTION_ADDRESSBOOK_COMPONENT_FACTORY_ID "OAFIID:GNOME_Evolution_Addressbook_ShellComponentFactory"
-
-EvolutionShellClient *global_shell_client;
-
-EvolutionShellClient *
-addressbook_component_get_shell_client (void)
-{
- return global_shell_client;
-}
-
-static BonoboGenericFactory *factory = NULL;
-
-static char *accepted_dnd_types[] = {
- "text/x-vcard",
- NULL
-};
-
-static const EvolutionShellComponentFolderType folder_types[] = {
- { "contacts", "evolution-contacts.png", TRUE, accepted_dnd_types, NULL },
- { NULL, NULL, FALSE, NULL, NULL }
-};
-
-
-/* EvolutionShellComponent methods and signals. */
-
-static EvolutionShellComponentResult
-create_view (EvolutionShellComponent *shell_component,
- const char *physical_uri,
- const char *type,
- BonoboControl **control_return,
- void *closure)
-{
- BonoboControl *control;
-
- if (g_strcasecmp (type, "contacts") != 0)
- return EVOLUTION_SHELL_COMPONENT_UNSUPPORTEDTYPE;
-
- control = addressbook_factory_new_control ();
- bonobo_control_set_property (control, "folder_uri", physical_uri, NULL);
-
- *control_return = control;
-
- return EVOLUTION_SHELL_COMPONENT_OK;
-}
-
-static void
-create_folder (EvolutionShellComponent *shell_component,
- const char *physical_uri,
- const char *type,
- const GNOME_Evolution_ShellComponentListener listener,
- void *closure)
-{
- CORBA_Environment ev;
- GNOME_Evolution_ShellComponentListener_Result result;
-
- if (g_strcasecmp (type, "contacts") != 0)
- result = GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE;
- else
- result = GNOME_Evolution_ShellComponentListener_OK;
-
- CORBA_exception_init(&ev);
- GNOME_Evolution_ShellComponentListener_notifyResult(listener, result, &ev);
- CORBA_exception_free(&ev);
-}
-
-static void
-remove_folder (EvolutionShellComponent *shell_component,
- const char *physical_uri,
- const char *type,
- const GNOME_Evolution_ShellComponentListener listener,
- void *closure)
-{
- CORBA_Environment ev;
- char *addressbook_db_path, *subdir_path;
- struct stat sb;
- int rv;
-
- CORBA_exception_init(&ev);
-
- if (strcmp (type, "contacts") != 0) {
- GNOME_Evolution_ShellComponentListener_notifyResult (listener,
- GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE,
- &ev);
- CORBA_exception_free(&ev);
- return;
- }
-
- if (!strncmp (physical_uri, "ldap://", 7)) {
- GNOME_Evolution_ShellComponentListener_notifyResult (listener,
- GNOME_Evolution_ShellComponentListener_UNSUPPORTED_OPERATION,
- &ev);
- CORBA_exception_free(&ev);
- return;
- }
- if (strncmp (physical_uri, "file://", 7)) {
- GNOME_Evolution_ShellComponentListener_notifyResult (listener,
- GNOME_Evolution_ShellComponentListener_INVALID_URI,
- &ev);
- CORBA_exception_free(&ev);
- return;
- }
-
- subdir_path = g_concat_dir_and_file (physical_uri + 7, "subfolders");
- rv = stat (subdir_path, &sb);
- g_free (subdir_path);
- if (rv != -1) {
- GNOME_Evolution_ShellComponentListener_notifyResult (listener,
- GNOME_Evolution_ShellComponentListener_HAS_SUBFOLDERS,
- &ev);
- CORBA_exception_free(&ev);
- return;
- }
-
- addressbook_db_path = g_concat_dir_and_file (physical_uri + 7, "addressbook.db");
- rv = unlink (addressbook_db_path);
- g_free (addressbook_db_path);
- if (rv == 0) {
- GNOME_Evolution_ShellComponentListener_notifyResult (listener,
- GNOME_Evolution_ShellComponentListener_OK,
- &ev);
- }
- else {
- if (errno == EACCES || errno == EPERM)
- GNOME_Evolution_ShellComponentListener_notifyResult (listener,
- GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED,
- &ev);
- else
- GNOME_Evolution_ShellComponentListener_notifyResult (listener,
- GNOME_Evolution_ShellComponentListener_INVALID_URI, /*XXX*/
- &ev);
- }
- CORBA_exception_free(&ev);
-}
-
-static void
-xfer_folder (EvolutionShellComponent *shell_component,
- const char *source_physical_uri,
- const char *destination_physical_uri,
- const char *type,
- gboolean remove_source,
- const GNOME_Evolution_ShellComponentListener listener,
- void *closure)
-{
- CORBA_Environment ev;
- char *source_path;
- char *destination_path;
-
- if (strcmp (type, "contacts") != 0) {
- GNOME_Evolution_ShellComponentListener_notifyResult (listener,
- GNOME_Evolution_ShellComponentListener_UNSUPPORTED_TYPE,
- &ev);
- CORBA_exception_free(&ev);
- return;
- }
-
- if (!strncmp (source_physical_uri, "ldap://", 7)
- || !strncmp (destination_physical_uri, "ldap://", 7)) {
- GNOME_Evolution_ShellComponentListener_notifyResult (listener,
- GNOME_Evolution_ShellComponentListener_UNSUPPORTED_OPERATION,
- &ev);
- CORBA_exception_free(&ev);
- return;
- }
- if (strncmp (source_physical_uri, "file://", 7)
- || strncmp (destination_physical_uri, "file://", 7)) {
- GNOME_Evolution_ShellComponentListener_notifyResult (listener,
- GNOME_Evolution_ShellComponentListener_INVALID_URI,
- &ev);
- CORBA_exception_free(&ev);
- return;
- }
-
- /* strip the 'file://' from the beginning of each uri and add addressbook.db */
- source_path = g_concat_dir_and_file (source_physical_uri + 7, "addressbook.db");
- destination_path = g_concat_dir_and_file (destination_physical_uri + 7, "addressbook.db");
-
- CORBA_exception_init (&ev);
-
- /* XXX always fail for now, until the above stuff is written */
- GNOME_Evolution_ShellComponentListener_notifyResult (listener, GNOME_Evolution_ShellComponentListener_PERMISSION_DENIED, &ev);
-
- g_free (source_path);
- g_free (destination_path);
- CORBA_exception_free (&ev);
-}
-
-static char*
-get_dnd_selection (EvolutionShellComponent *shell_component,
- const char *physical_uri,
- int type,
- int *format_return,
- const char **selection_return,
- int *selection_length_return,
- void *closure)
-{
- g_print ("should get dnd selection for %s\n", physical_uri);
- return NULL;
-}
-
-static int owner_count = 0;
-
-static void
-owner_set_cb (EvolutionShellComponent *shell_component,
- EvolutionShellClient *shell_client,
- const char *evolution_homedir,
- gpointer user_data)
-{
- owner_count ++;
-
- if (global_shell_client == NULL)
- global_shell_client = shell_client;
-
- addressbook_storage_setup (shell_component, evolution_homedir);
-}
-
-static void
-owner_unset_cb (EvolutionShellComponent *shell_component,
- GNOME_Evolution_Shell shell_interface,
- gpointer user_data)
-{
- owner_count --;
- if (owner_count == 0)
- gtk_main_quit();
-}
-
-
-/* Destination side DnD */
-
-static CORBA_boolean
-destination_folder_handle_motion (EvolutionShellComponentDndDestinationFolder *folder,
- const char *physical_uri,
- const GNOME_Evolution_ShellComponentDnd_DestinationFolder_Context * destination_context,
- GNOME_Evolution_ShellComponentDnd_Action * suggested_action_return,
- gpointer user_data)
-{
- g_print ("in destination_folder_handle_motion (%s)\n", physical_uri);
- *suggested_action_return = GNOME_Evolution_ShellComponentDnd_ACTION_MOVE;
- return TRUE;
-}
-
-static void
-dnd_drop_book_open_cb (EBook *book, EBookStatus status, GList *card_list)
-{
- GList *l;
-
- for (l = card_list; l; l = l->next) {
- ECard *card = l->data;
-
- e_card_merging_book_add_card (book, card, NULL /* XXX */, NULL);
- }
-}
-
-static CORBA_boolean
-destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *folder,
- const char *physical_uri,
- const GNOME_Evolution_ShellComponentDnd_DestinationFolder_Context * destination_context,
- const GNOME_Evolution_ShellComponentDnd_Action action,
- const GNOME_Evolution_ShellComponentDnd_Data * data,
- gpointer user_data)
-{
- EBook *book;
- GList *card_list;
- char *expanded_uri;
-
- if (action == GNOME_Evolution_ShellComponentDnd_ACTION_LINK)
- return FALSE; /* we can't create links in our addressbook format */
-
- g_print ("in destination_folder_handle_drop (%s)\n", physical_uri);
-
- card_list = e_card_load_cards_from_string (data->bytes._buffer);
-
- expanded_uri = addressbook_expand_uri (physical_uri);
-
- book = e_book_new ();
- e_book_load_uri (book, expanded_uri,
- (EBookCallback)dnd_drop_book_open_cb, card_list);
-
- g_free (expanded_uri);
-
- return TRUE;
-}
-
-
-/* The factory function. */
-
-static BonoboObject *
-factory_fn (BonoboGenericFactory *factory,
- void *closure)
-{
- EvolutionShellComponent *shell_component;
- EvolutionShellComponentDndDestinationFolder *destination_interface;
-
- shell_component = evolution_shell_component_new (folder_types, NULL,
- create_view, create_folder,
- remove_folder, xfer_folder,
- NULL,
- get_dnd_selection,
- NULL);
-
- destination_interface = evolution_shell_component_dnd_destination_folder_new (destination_folder_handle_motion,
- destination_folder_handle_drop,
- shell_component);
-
- bonobo_object_add_interface (BONOBO_OBJECT (shell_component),
- BONOBO_OBJECT (destination_interface));
-
- gtk_signal_connect (GTK_OBJECT (shell_component), "owner_set",
- GTK_SIGNAL_FUNC (owner_set_cb), NULL);
-
- gtk_signal_connect (GTK_OBJECT (shell_component), "owner_unset",
- GTK_SIGNAL_FUNC (owner_unset_cb), NULL);
-
- return BONOBO_OBJECT (shell_component);
-}
-
-
-void
-addressbook_component_factory_init (void)
-{
- if (factory != NULL)
- return;
-
- factory = bonobo_generic_factory_new (GNOME_EVOLUTION_ADDRESSBOOK_COMPONENT_FACTORY_ID, factory_fn, NULL);
-
- if (factory == NULL)
- g_error ("Cannot initialize the Evolution addressbook factory.");
-}
-
diff --git a/addressbook/gui/component/addressbook-component.h b/addressbook/gui/component/addressbook-component.h
deleted file mode 100644
index e5dc74e17e..0000000000
--- a/addressbook/gui/component/addressbook-component.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* addressbook-component.h
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef _ADDRESSBOOK_COMPONENT_H
-#define _ADDRESSBOOK_COMPONENT_H
-
-#include "evolution-shell-component.h"
-#include "evolution-storage.h"
-
-void addressbook_component_factory_init (void);
-EvolutionShellClient *addressbook_component_get_shell_client (void);
-
-#endif /* _ADDRESSBOOK_COMPONENT_H */
diff --git a/addressbook/gui/component/addressbook-config.c b/addressbook/gui/component/addressbook-config.c
deleted file mode 100644
index 003b29b96a..0000000000
--- a/addressbook/gui/component/addressbook-config.c
+++ /dev/null
@@ -1,984 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#include <config.h>
-
-#include <glib.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-propertybox.h>
-#include <libgnomeui/gnome-stock.h>
-#include <glade/glade.h>
-#include <gal/widgets/e-unicode.h>
-#include <gtkhtml/gtkhtml.h>
-#include <e-util/e-html-utils.h>
-#include "addressbook-config.h"
-#include "addressbook-storage.h"
-
-/* #define INCLUDE_FILE_SOURCE */
-
-typedef struct _AddressbookSourceDialog AddressbookSourceDialog;
-typedef struct _AddressbookSourcePageItem AddressbookSourcePageItem;
-typedef struct _LDAPAuthPageItem LDAPAuthPageItem;
-
-struct _AddressbookSourceDialog {
- GtkWidget *html;
- GtkWidget *dialog;
- GtkWidget *vbox;
- GtkWidget *name;
- GtkWidget *description;
- GtkWidget *source_option;
- GtkWidget *notebook;
-
- GList *source_pages;
- AddressbookSourcePageItem *source_page;
-
- gint id; /* button we closed the dialog with */
-
- AddressbookSource *source; /* our result if the Ok button was clicked */
-};
-
-struct _AddressbookSourcePageItem {
- gint pnum;
-
- AddressbookSourceType source_type;
-
- AddressbookSourceDialog *dialog;
-
- GtkWidget *item;
- GtkWidget *vbox;
-
- /* file: addressbook's */
- GtkWidget *path;
- GtkWidget *creat;
-
- /* ldap: addressbook's */
- GtkWidget *host;
- GtkWidget *port;
- GtkWidget *rootdn;
- GtkWidget *scope_optionmenu;
- GtkWidget *auth_optionmenu;
- GtkWidget *auth_notebook;
-
- GList *auths;
- LDAPAuthPageItem *auth;
-};
-
-struct _LDAPAuthPageItem {
- gint pnum;
-
- AddressbookLDAPAuthType auth_type;
-
- AddressbookSourceDialog *dialog;
- AddressbookSourcePageItem *page;
-
- GtkWidget *item;
- GtkWidget *vbox;
-
- /* simple (password) auth */
- GtkWidget *binddn;
- GtkWidget *remember_passwd;
-};
-
-static void
-html_size_req (GtkWidget *widget, GtkRequisition *requisition)
-{
- requisition->height = GTK_LAYOUT (widget)->height;
-}
-
-/* Returns a GtkHTML which is already inside a GtkScrolledWindow. If
- * @white is TRUE, the GtkScrolledWindow will be inside a GtkFrame.
- */
-static GtkWidget *
-html_new (gboolean white)
-{
- GtkWidget *html, *scrolled, *frame;
- GtkStyle *style;
-
- html = gtk_html_new ();
- GTK_LAYOUT (html)->height = 0;
- gtk_signal_connect (GTK_OBJECT (html), "size_request",
- GTK_SIGNAL_FUNC (html_size_req), NULL);
- gtk_html_set_editable (GTK_HTML (html), FALSE);
- style = gtk_rc_get_style (html);
- if (style) {
- gtk_html_set_default_background_color (GTK_HTML (html),
- white ? &style->white :
- &style->bg[0]);
- }
- gtk_widget_set_sensitive (html, FALSE);
- scrolled = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
- GTK_POLICY_NEVER,
- GTK_POLICY_NEVER);
- gtk_container_add (GTK_CONTAINER (scrolled), html);
-
- if (white) {
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame),
- GTK_SHADOW_ETCHED_IN);
- gtk_container_add (GTK_CONTAINER (frame), scrolled);
- gtk_widget_show_all (frame);
- } else
- gtk_widget_show_all (scrolled);
-
- return html;
-}
-
-static void
-put_html (GtkHTML *html, char *text)
-{
- GtkHTMLStream *handle;
-
- text = e_text_to_html (text, E_TEXT_TO_HTML_CONVERT_NL);
- handle = gtk_html_begin (html);
- gtk_html_write (html, handle, "<HTML><BODY>", 12);
- gtk_html_write (html, handle, text, strlen (text));
- gtk_html_write (html, handle, "</BODY></HTML>", 14);
- g_free (text);
- gtk_html_end (html, handle, GTK_HTML_STREAM_OK);
-}
-
-#ifdef INCLUDE_FILE_SOURCE
-static const char *
-addressbook_config_source_label (AddressbookSourceType type)
-{
- switch (type) {
- case ADDRESSBOOK_SOURCE_LDAP:
- return _("LDAP Server");
- case ADDRESSBOOK_SOURCE_FILE:
- return _("File");
- default:
- g_assert(0);
- return _("Unknown addressbook type");
- }
-}
-#endif
-
-static const char *
-addressbook_config_auth_label (AddressbookLDAPAuthType type)
-{
- switch (type) {
- case ADDRESSBOOK_LDAP_AUTH_NONE:
- return _("None (anonymous mode)");
- case ADDRESSBOOK_LDAP_AUTH_SIMPLE:
- return _("Password");
- default:
- g_assert(0);
- return _("Unknown auth type");
- }
-}
-
-static const char *
-addressbook_config_scope_label (AddressbookLDAPScopeType scope)
-{
- switch (scope) {
- case ADDRESSBOOK_LDAP_SCOPE_BASE:
- return _("Base");
- case ADDRESSBOOK_LDAP_SCOPE_ONELEVEL:
- return _("One");
- case ADDRESSBOOK_LDAP_SCOPE_SUBTREE:
- return _("Subtree");
- default:
- g_assert (0);
- return _("Unknown scope type");
- }
-}
-
-static void
-addressbook_source_edit_changed (GtkWidget *item, AddressbookSourceDialog *dialog)
-{
- char *data;
- gboolean complete = TRUE;
- AddressbookSourcePageItem *source_page = dialog->source_page;
-
- if (source_page == NULL)
- complete = FALSE;
-
- if (complete) {
- data = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (dialog->name), 0, -1);
- if (!data || !*data)
- complete = FALSE;
- g_free (data);
- }
-
- if (complete) {
- if (source_page->source_type == ADDRESSBOOK_SOURCE_FILE) {
- if (complete) {
- data = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (source_page->path), 0, -1);
- if (!data || !*data)
- complete = FALSE;
- g_free (data);
- }
- }
- else {
- if (complete) {
- data = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (source_page->host), 0, -1);
- if (!data || !*data)
- complete = FALSE;
- g_free (data);
- }
-
- if (complete) {
- data = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (source_page->port), 0, -1);
- if (!data || !*data)
- complete = FALSE;
- /* XXX more validation on port here */
- g_free (data);
- }
-
- if (complete) {
- LDAPAuthPageItem *auth_page = source_page->auth;
-
- if (auth_page->auth_type == ADDRESSBOOK_LDAP_AUTH_SIMPLE) {
- data = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (auth_page->binddn), 0, -1);
- if (!data || !*data)
- complete = FALSE;
- g_free (data);
- }
- data = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (source_page->port), 0, -1);
- if (!data || !*data)
- complete = FALSE;
- /* XXX more validation on port here */
- g_free (data);
- }
- }
- }
-
- gnome_dialog_set_sensitive (GNOME_DIALOG (dialog->dialog), 0, complete);
-}
-
-static void
-source_type_menuitem_activate (GtkWidget *item, gpointer data)
-{
- AddressbookSourcePageItem *sitem = data;
-
- gtk_notebook_set_page (GTK_NOTEBOOK(sitem->dialog->notebook), sitem->pnum);
- sitem->dialog->source_page = sitem;
-
- addressbook_source_edit_changed (item, sitem->dialog);
-}
-
-typedef struct {
- AddressbookSourceDialog *dialog;
- char *help_text;
-} FocusHelpClosure;
-
-static void
-free_focus_help_closure (gpointer data)
-{
- FocusHelpClosure *closure = data;
- g_free(closure->help_text);
- g_free(closure);
-}
-
-static gint
-focus_help (GtkWidget *widget, GdkEventFocus *event, FocusHelpClosure *closure)
-{
- put_html (GTK_HTML(closure->dialog->html), closure->help_text);
- return FALSE;
-}
-
-static GtkWidget *
-table_add_elem (AddressbookSourceDialog *dialog, GtkWidget *table,
- int row,
- const char *label_text,
- char *help_text)
-{
- GtkWidget *label, *entry;
- FocusHelpClosure *focus_closure;
-
- label = gtk_label_new (label_text);
- gtk_table_attach (GTK_TABLE (table), label, 0, 1,
- row, row + 1, GTK_FILL, 0, 0, 0);
- gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
-
- entry = gtk_entry_new ();
- gtk_table_attach (GTK_TABLE (table), entry, 1, 3, row, row + 1,
- GTK_EXPAND | GTK_FILL, 0, 0, 0);
-
- gtk_signal_connect (GTK_OBJECT (entry), "changed",
- GTK_SIGNAL_FUNC (addressbook_source_edit_changed), dialog);
-
- focus_closure = g_new0 (FocusHelpClosure, 1);
- focus_closure->dialog = dialog;
- focus_closure->help_text = g_strdup(help_text);
-
- gtk_signal_connect_full (GTK_OBJECT (entry),
- "focus_in_event" /* XXX */,
- (GtkSignalFunc) focus_help, NULL,
- focus_closure,
- (GtkDestroyNotify) free_focus_help_closure,
- FALSE, FALSE);
- return entry;
-}
-
-static void
-ldap_auth_type_menuitem_activate (GtkWidget *item, gpointer data)
-{
- LDAPAuthPageItem *auth_item = data;
-
- gtk_notebook_set_page (GTK_NOTEBOOK(auth_item->page->auth_notebook), auth_item->pnum);
-
- auth_item->page->auth = auth_item;
-
- addressbook_source_edit_changed (item, auth_item->dialog);
-}
-
-static LDAPAuthPageItem *
-addressbook_ldap_auth_item_new (AddressbookSourceDialog *dialog,
- AddressbookSourcePageItem *page,
- AddressbookLDAPAuthType type)
-{
- LDAPAuthPageItem *item = g_new0 (LDAPAuthPageItem, 1);
- GtkWidget *table = NULL;
- int row = 0;
-
- item->pnum = type;
- item->auth_type = type;
- item->dialog = dialog;
- item->page = page;
- item->vbox = gtk_vbox_new (FALSE, 0);
-
- switch (type) {
- case ADDRESSBOOK_LDAP_AUTH_NONE:
- break;
- case ADDRESSBOOK_LDAP_AUTH_SIMPLE:
- table = gtk_table_new (2, 2, FALSE);
- item->binddn = table_add_elem (dialog, table, row++,
- _("Bind DN:"),
- _("FIXME Bind DN Help text here"));
-
- item->remember_passwd = gtk_check_button_new_with_label (_("Remember this password"));
-
- gtk_table_attach (GTK_TABLE (table), item->remember_passwd, 1, 2,
- row, row + 1, GTK_FILL, 0, 0, 0);
-
- gtk_box_pack_start (GTK_BOX (item->vbox), table,
- TRUE, TRUE, 0);
- break;
- default:
- g_assert (0);
- return item;
- }
-
- if (table) {
- gtk_table_set_row_spacings (GTK_TABLE (table), 2);
- gtk_table_set_col_spacings (GTK_TABLE (table), 10);
- gtk_container_set_border_width (GTK_CONTAINER (table), 8);
- }
-
- gtk_widget_show_all (item->vbox);
-
- return item;
-}
-
-static AddressbookSourcePageItem *
-addressbook_source_item_new (AddressbookSourceDialog *dialog, AddressbookSourceType type)
-{
- AddressbookSourcePageItem *item = g_new0 (AddressbookSourcePageItem, 1);
- GtkWidget *table = NULL;
-#if 0
- GtkWidget *advanced_button;
-#endif
- int row = 0;
-
- item->pnum = type;
- item->source_type = type;
- item->dialog = dialog;
-
- item->vbox = gtk_vbox_new (FALSE, 0);
-
- switch (type) {
- case ADDRESSBOOK_SOURCE_LDAP: {
- GtkWidget *label;
- GtkWidget *menu;
- int i;
- LDAPAuthPageItem *first_item = NULL;
- int position;
-
- table = gtk_table_new (6, 2, FALSE);
-
- item->host = table_add_elem (dialog, table, row++,
- _("Host:"),
- _("FIXME Host help text here."));
- item->rootdn = table_add_elem (dialog, table, row++,
- _("Root DN:"),
- _("FIXME Root DN help text here."));
-
- /* XXX BEGIN PUT IN ADVANCED DIALOG */
- item->port = table_add_elem (dialog, table, row++,
- _("Port:"),
- _("FIXME Port help text here."));
- gtk_editable_insert_text (GTK_EDITABLE (item->port), "389", 3, &position);
-
- item->scope_optionmenu = gtk_option_menu_new ();
- menu = gtk_menu_new ();
-
- for (i = 0; i < ADDRESSBOOK_LDAP_SCOPE_LAST; i ++) {
- GtkWidget *scope_item = gtk_menu_item_new_with_label (addressbook_config_scope_label (i));
-
- gtk_signal_connect (GTK_OBJECT (scope_item), "activate",
- GTK_SIGNAL_FUNC (addressbook_source_edit_changed),
- dialog);
-
- gtk_menu_append (GTK_MENU (menu), scope_item);
- gtk_widget_show (scope_item);
- }
-
- gtk_option_menu_set_menu (GTK_OPTION_MENU (item->scope_optionmenu), menu);
- // ldap_auth_type_menuitem_activate (first_item->item, first_item);
- gtk_option_menu_set_history (GTK_OPTION_MENU(item->scope_optionmenu), 0);
- label = gtk_label_new (_("Search Scope:"));
- gtk_table_attach (GTK_TABLE (table), label, 0, 1,
- row, row + 1, GTK_FILL, 0, 0, 0);
- gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
-
- gtk_table_attach (GTK_TABLE (table),
- item->scope_optionmenu,
- 1, 2, row, row + 1,
- GTK_EXPAND | GTK_FILL, 0,
- 0, 0);
-
- row++;
- /* XXX END PUT IN ADVANCED DIALOG */
-
- item->auth_optionmenu = gtk_option_menu_new ();
- menu = gtk_menu_new ();
-
- item->auth_notebook = gtk_notebook_new();
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (item->auth_notebook), FALSE);
-
- for (i = 0; i < ADDRESSBOOK_LDAP_AUTH_LAST; i++) {
- LDAPAuthPageItem *auth_item;
-
- auth_item = addressbook_ldap_auth_item_new (dialog, item, i);
-
- item->auths = g_list_append (item->auths, auth_item);
-
- if (!first_item)
- first_item = auth_item;
-
- auth_item->item = gtk_menu_item_new_with_label (addressbook_config_auth_label (i));
-
- gtk_notebook_append_page (GTK_NOTEBOOK (item->auth_notebook),
- auth_item->vbox, NULL);
-
- gtk_signal_connect (GTK_OBJECT (auth_item->item), "activate",
- GTK_SIGNAL_FUNC (ldap_auth_type_menuitem_activate),
- auth_item);
-
- gtk_menu_append (GTK_MENU (menu), auth_item->item);
- gtk_widget_show (auth_item->item);
- }
-
- gtk_option_menu_set_menu (GTK_OPTION_MENU (item->auth_optionmenu), menu);
- ldap_auth_type_menuitem_activate (first_item->item, first_item);
- gtk_option_menu_set_history (GTK_OPTION_MENU(item->auth_optionmenu), 0);
-
- label = gtk_label_new (_("Authentication:"));
- gtk_table_attach (GTK_TABLE (table), label, 0, 1,
- row, row + 1, GTK_FILL, 0, 0, 0);
- gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
-
- gtk_table_attach (GTK_TABLE (table),
- item->auth_optionmenu,
- 1, 2, row, row + 1,
- GTK_EXPAND | GTK_FILL, 0,
- 0, 0);
-
- row++;
-
- gtk_box_pack_start (GTK_BOX (item->vbox), table,
- TRUE, FALSE, 0);
-
- gtk_box_pack_start (GTK_BOX (item->vbox), item->auth_notebook,
- TRUE, TRUE, 0);
-
-#if 0
- table = gtk_table_new (1, 4, FALSE);
-
- advanced_button = gtk_button_new_with_label (_("Advanced LDAP Options"));
-
- gtk_table_attach (GTK_TABLE (table),
- advanced_button,
- 3, 4, 0, 1,
- 0, 0,
- 0, 0);
-
-
- gtk_box_pack_start (GTK_BOX (item->vbox), table,
- FALSE, FALSE, 0);
-
- gtk_signal_connect (GTK_OBJECT (advanced_button), "clicked",
- GTK_SIGNAL_FUNC (), dialog);
-#endif
-
- break;
- }
- case ADDRESSBOOK_SOURCE_FILE: {
- table = gtk_table_new (2, 2, FALSE);
- item->path = table_add_elem (dialog, table, row++,
- _("Path:"),
- _("FIXME Path Help text here"));
-
- gtk_box_pack_start (GTK_BOX (item->vbox), table,
- TRUE, TRUE, 0);
-
- item->creat = gtk_check_button_new_with_label (_("Create path if it doesn't exist."));
- gtk_table_attach (GTK_TABLE (table), item->creat, 1, 2,
- row, row + 1, GTK_FILL, 0, 0, 0);
- break;
- }
- default:
- g_assert(0);
- return item;
- }
-
- gtk_table_set_row_spacings (GTK_TABLE (table), 2);
- gtk_table_set_col_spacings (GTK_TABLE (table), 10);
- gtk_container_set_border_width (GTK_CONTAINER (table), 8);
-
- gtk_widget_show_all (item->vbox);
-
- return item;
-}
-
-static void
-addressbook_source_dialog_set_source (AddressbookSourceDialog *dialog, AddressbookSource *source)
-{
- AddressbookSourcePageItem *source_page;
-
- e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->name), source->name);
- e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->description), source->description);
-
- /* choose the correct server page */
- source_page = g_list_nth_data (dialog->source_pages, source->type);
- source_type_menuitem_activate (source_page->item, source_page);
- gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->source_option), source->type);
-
- if (source->type == ADDRESSBOOK_SOURCE_LDAP) {
- LDAPAuthPageItem *auth_page;
-
- e_utf8_gtk_entry_set_text (GTK_ENTRY (source_page->host), source->ldap.host);
- e_utf8_gtk_entry_set_text (GTK_ENTRY (source_page->port), source->ldap.port);
- e_utf8_gtk_entry_set_text (GTK_ENTRY (source_page->rootdn), source->ldap.rootdn);
-
- gtk_option_menu_set_history (GTK_OPTION_MENU(source_page->scope_optionmenu), source->ldap.scope);
-
- auth_page = g_list_nth_data (source_page->auths, source->ldap.auth);
- ldap_auth_type_menuitem_activate (auth_page->item, auth_page);
- gtk_option_menu_set_history (GTK_OPTION_MENU(source_page->auth_optionmenu), auth_page->auth_type);
-
- if (auth_page->auth_type == ADDRESSBOOK_LDAP_AUTH_SIMPLE) {
- e_utf8_gtk_entry_set_text (GTK_ENTRY (auth_page->binddn), source->ldap.binddn);
- }
- }
- else {
- e_utf8_gtk_entry_set_text (GTK_ENTRY (source_page->path), source->file.path);
- }
-}
-
-static AddressbookSource *
-addressbook_source_dialog_get_source (AddressbookSourceDialog *dialog)
-{
- AddressbookSource *source = g_new0 (AddressbookSource, 1);
- AddressbookSourcePageItem *source_page;
-
- source_page = dialog->source_page;
-
- source->name = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->name));
- source->description = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->description));
- source->type = source_page->source_type;
-
- if (source->type == ADDRESSBOOK_SOURCE_FILE) {
- source->file.path = e_utf8_gtk_entry_get_text (GTK_ENTRY (source_page->path));
- }
- else {
- LDAPAuthPageItem *auth_page;
-
- source->ldap.host = e_utf8_gtk_entry_get_text (GTK_ENTRY (source_page->host));
- source->ldap.port = e_utf8_gtk_entry_get_text (GTK_ENTRY (source_page->port));
- source->ldap.rootdn = e_utf8_gtk_entry_get_text (GTK_ENTRY (source_page->rootdn));
-
- auth_page = source_page->auth;
-
- source->ldap.auth = auth_page->auth_type;
- if (source->ldap.auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE) {
- source->ldap.binddn = e_utf8_gtk_entry_get_text (GTK_ENTRY (auth_page->binddn));
- source->ldap.remember_passwd = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (auth_page->remember_passwd));
- }
-
- ldap_auth_type_menuitem_activate (auth_page->item, auth_page);
- gtk_option_menu_set_history (GTK_OPTION_MENU(source_page->auth_optionmenu), auth_page->auth_type);
- }
-
- addressbook_storage_init_source_uri (source);
-
- return source;
-}
-
-static void
-addressbook_source_dialog_ok_clicked (GtkWidget *widget, AddressbookSourceDialog *dialog)
-{
- dialog->source = addressbook_source_dialog_get_source (dialog);
-}
-
-static void
-addressbook_source_dialog_destroy (AddressbookSourceDialog *dialog)
-{
- GList *s;
-
- for (s = dialog->source_pages; s; s = s->next) {
- AddressbookSourcePageItem *source_item = s->data;
-
- g_list_foreach (source_item->auths, (GFunc)g_free, NULL);
- g_list_free (source_item->auths);
- g_free (source_item);
- }
-
- g_list_free (dialog->source_pages);
-
- if (dialog->source)
- addressbook_source_free (dialog->source);
- g_free (dialog);
-}
-
-static AddressbookSourceDialog*
-addressbook_source_dialog (AddressbookSource *source, GtkWidget *parent)
-{
- GtkWidget *table;
- AddressbookSourceDialog *dialog = g_new0 (AddressbookSourceDialog, 1);
- GtkWidget *vbox, *dialog_vbox;
-#ifdef INCLUDE_FILE_SOURCE
- GtkWidget *menu;
-#endif
- AddressbookSourcePageItem *first_item = NULL;
- GtkWidget *area;
- int i;
- int row = 0;
- char *tmp_utf;
-
- if (source)
- dialog->dialog = gnome_dialog_new (_("Edit Addressbook"), NULL);
- else
- dialog->dialog = gnome_dialog_new (_("Add Addressbook"), NULL);
-
- gtk_window_set_modal (GTK_WINDOW (dialog->dialog), TRUE);
- gtk_window_set_policy (GTK_WINDOW (dialog->dialog),
- FALSE, TRUE, FALSE);
-#if 0
- gtk_window_set_default_size (GTK_WINDOW (dialog->dialog), 300, 300);
-#endif
- gnome_dialog_set_parent (GNOME_DIALOG (dialog->dialog),
- GTK_WINDOW (parent));
-
- dialog->vbox = gtk_vbox_new (FALSE, 5);
- dialog_vbox = GNOME_DIALOG (dialog->dialog)->vbox;
-
- vbox = gtk_vbox_new (FALSE, 0);
-
- dialog->html = html_new (FALSE);
- tmp_utf = e_utf8_from_locale_string (
- _("Select the kind of addressbook you have, and enter "
- "the relevant information about it."));
- put_html (GTK_HTML (dialog->html), tmp_utf);
- g_free (tmp_utf);
-
- table = gtk_table_new (2, 2, FALSE);
-
- dialog->name = table_add_elem (dialog, table, row++,
- _("Name:"),
- _("FIXME Name help text here"));
- dialog->description = table_add_elem (dialog, table, row++,
- _("Description:"),
- _("FIXME Description help text here"));
-
- gtk_table_set_row_spacings (GTK_TABLE (table), 2);
- gtk_table_set_col_spacings (GTK_TABLE (table), 10);
- gtk_container_set_border_width (GTK_CONTAINER (table), 8);
-
- dialog->notebook = gtk_notebook_new();
- gtk_notebook_set_show_tabs (GTK_NOTEBOOK (dialog->notebook), FALSE);
-
-#ifdef INCLUDE_FILE_SOURCE
- dialog->source_option = gtk_option_menu_new ();
- menu = gtk_menu_new ();
-#endif
-
- for (i = ADDRESSBOOK_SOURCE_LDAP;
- i < ADDRESSBOOK_SOURCE_LAST;
- i ++) {
- AddressbookSourcePageItem *item;
-
- item = addressbook_source_item_new (dialog, i);
-
- dialog->source_pages = g_list_append (dialog->source_pages, item);
-
-#ifdef INCLUDE_FILE_SOURCE
- item->item = gtk_menu_item_new_with_label (addressbook_config_source_label (i));
-#endif
-
- if (!first_item)
- first_item = item;
-
- gtk_notebook_append_page (GTK_NOTEBOOK (dialog->notebook),
- item->vbox, NULL);
-
- gtk_signal_connect (GTK_OBJECT (item->item), "activate",
- GTK_SIGNAL_FUNC (source_type_menuitem_activate),
- item);
-
-#ifdef INCLUDE_FILE_SOURCE
- gtk_menu_append (GTK_MENU (menu), item->item);
-#endif
- gtk_widget_show (item->item);
- }
-
-#ifdef INCLUDE_FILE_SOURCE
- gtk_option_menu_set_menu (GTK_OPTION_MENU (dialog->source_option), menu);
-#endif
- source_type_menuitem_activate (first_item->item, first_item);
-#ifdef INCLUDE_FILE_SOURCE
- gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->source_option), 0);
-#endif
-
- gtk_box_pack_start (GTK_BOX (vbox), dialog->html->parent,
- FALSE, TRUE, 0);
-
- gtk_box_pack_start (GTK_BOX (vbox), table,
- FALSE, FALSE, 0);
-
-#ifdef INCLUDE_FILE_SOURCE
- gtk_box_pack_start (GTK_BOX (vbox), dialog->source_option,
- FALSE, FALSE, 0);
-#endif
-
- gtk_box_pack_start (GTK_BOX (dialog->vbox), vbox, FALSE, TRUE, 0);
-
- gtk_box_pack_start (GTK_BOX (dialog->vbox), dialog->notebook,
- TRUE, TRUE, 0);
-
- /* hook our ui into the gnome-dialog */
- gtk_box_pack_start (GTK_BOX (dialog_vbox), dialog->vbox, TRUE, TRUE, 0);
-
- gtk_widget_show_all (dialog->vbox);
-
- /* Buttons */
- area = GNOME_DIALOG (dialog->dialog)->action_area;
- gtk_widget_show (area);
- gtk_button_box_set_layout (GTK_BUTTON_BOX (area), GTK_BUTTONBOX_END);
- gtk_button_box_set_spacing (GTK_BUTTON_BOX (area), 8);
-
- gnome_dialog_append_button (GNOME_DIALOG (dialog->dialog),
- GNOME_STOCK_BUTTON_OK);
- gnome_dialog_append_button (GNOME_DIALOG (dialog->dialog),
- GNOME_STOCK_BUTTON_CANCEL);
-
- gnome_dialog_set_default (GNOME_DIALOG (dialog->dialog), 0);
-
- /* fill in source info if there is some */
- if (source)
- addressbook_source_dialog_set_source (dialog, source);
-
- gnome_dialog_set_sensitive (GNOME_DIALOG (dialog->dialog), 0, FALSE);
-
- gnome_dialog_button_connect( GNOME_DIALOG (dialog->dialog), 0,
- GTK_SIGNAL_FUNC (addressbook_source_dialog_ok_clicked),
- dialog);
-
- return dialog;
-}
-
-static AddressbookSourceDialog *
-addressbook_config_source (AddressbookSource *source, GtkWidget *parent)
-{
- AddressbookSourceDialog* dialog = addressbook_source_dialog (source, parent);
-
- dialog->id = gnome_dialog_run_and_close (GNOME_DIALOG (dialog->dialog));
-
- return dialog;
-}
-
-
-
-typedef struct {
- GladeXML *gui;
- GNOME_Evolution_Shell shell;
- GtkWidget *dialog;
- GtkWidget *clistSources;
- GtkWidget *addSource;
- GtkWidget *editSource;
- GtkWidget *deleteSource;
- gint source_row;
-} AddressbookDialog;
-
-static void
-update_sensitivity (AddressbookDialog *dialog)
-{
- gboolean sensitive = dialog->source_row != -1;
-
- gtk_widget_set_sensitive (dialog->editSource, sensitive);
- gtk_widget_set_sensitive (dialog->deleteSource, sensitive);
-}
-
-static void
-add_source_clicked (GtkWidget *widget, AddressbookDialog *dialog)
-{
- AddressbookSourceDialog *sdialog;
-
- sdialog = addressbook_config_source (NULL, dialog->dialog);
- if (sdialog->id == 0) {
- /* Ok was clicked */
- AddressbookSource *source = addressbook_source_copy(sdialog->source);
- gint row;
- gchar *text[2];
-
- text[0] = source->name;
- text[1] = source->uri;
-
- row = e_utf8_gtk_clist_append (GTK_CLIST(dialog->clistSources), text);
- gtk_clist_set_row_data_full (GTK_CLIST(dialog->clistSources), row, source, (GtkDestroyNotify) addressbook_source_free);
- gnome_property_box_changed (GNOME_PROPERTY_BOX (dialog->dialog));
- update_sensitivity (dialog);
- }
-
- addressbook_source_dialog_destroy (sdialog);
-}
-
-static void
-edit_source_clicked (GtkWidget *widget, AddressbookDialog *dialog)
-{
- AddressbookSource *source;
- AddressbookSourceDialog *sdialog;
-
- source = gtk_clist_get_row_data (GTK_CLIST (dialog->clistSources), dialog->source_row);
-
- sdialog = addressbook_config_source (source, dialog->dialog);
- if (sdialog->id == 0) {
- /* Ok was clicked */
- source = addressbook_source_copy(sdialog->source);
-
- e_utf8_gtk_clist_set_text (GTK_CLIST (dialog->clistSources), dialog->source_row, 0, source->name);
- e_utf8_gtk_clist_set_text (GTK_CLIST (dialog->clistSources), dialog->source_row, 1, source->uri);
- gtk_clist_set_row_data (GTK_CLIST (dialog->clistSources), dialog->source_row, source);
- gnome_property_box_changed (GNOME_PROPERTY_BOX (dialog->dialog));
- update_sensitivity (dialog);
- }
-
- addressbook_source_dialog_destroy (sdialog);
-}
-
-static void
-delete_source_clicked (GtkWidget *widget, AddressbookDialog *dialog)
-{
- gtk_clist_remove (GTK_CLIST (dialog->clistSources), dialog->source_row);
- dialog->source_row = -1;
- gnome_property_box_changed (GNOME_PROPERTY_BOX(dialog->dialog));
- update_sensitivity (dialog);
-}
-
-static void
-sources_select_row (GtkWidget *widget, gint row, gint column,
- GdkEventButton *event, AddressbookDialog *dialog)
-{
- dialog->source_row = row;
-
- update_sensitivity (dialog);
-}
-
-static void
-addressbook_dialog_apply (GnomePropertyBox *property_box, gint page_num, AddressbookDialog *dialog)
-{
- int i;
-
- if (page_num != -1)
- return;
-
- addressbook_storage_clear_sources();
-
- for (i = 0; i < GTK_CLIST(dialog->clistSources)->rows; i ++) {
- AddressbookSource *source = (AddressbookSource*)gtk_clist_get_row_data (GTK_CLIST (dialog->clistSources), i);
- addressbook_storage_add_source (addressbook_source_copy (source));
- }
-
- addressbook_storage_write_sources();
-}
-
-static void
-addressbook_dialog_close (GnomePropertyBox *property_box, AddressbookDialog *dialog)
-{
- gtk_object_unref (GTK_OBJECT (dialog->gui));
- g_free (dialog);
-}
-
-void
-addressbook_config (GNOME_Evolution_Shell shell)
-{
- AddressbookDialog *dialog;
- GladeXML *gui;
- GtkWidget *clist;
- GList *l;
-
- dialog = g_new0 (AddressbookDialog, 1);
-
- dialog->source_row = -1;
-
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/addressbook-config.glade", NULL);
- dialog->gui = gui;
- dialog->shell = shell;
-
- dialog->dialog = glade_xml_get_widget (gui, "dialog");
-
- clist = glade_xml_get_widget (gui, "clistSources");
- dialog->clistSources = clist;
-
- gtk_clist_column_titles_passive (GTK_CLIST (clist));
- gtk_clist_set_column_width (GTK_CLIST (clist), 0, 80);
-
- dialog->addSource = glade_xml_get_widget (gui, "addSource");
- gtk_signal_connect (GTK_OBJECT(dialog->addSource), "clicked",
- GTK_SIGNAL_FUNC (add_source_clicked),
- dialog);
-
- dialog->editSource = glade_xml_get_widget (gui, "editSource");
- gtk_signal_connect (GTK_OBJECT(dialog->editSource), "clicked",
- GTK_SIGNAL_FUNC (edit_source_clicked),
- dialog);
-
- dialog->deleteSource = glade_xml_get_widget (gui, "deleteSource");
- gtk_signal_connect (GTK_OBJECT(dialog->deleteSource), "clicked",
- GTK_SIGNAL_FUNC (delete_source_clicked),
- dialog);
-
- update_sensitivity (dialog);
-
- l = addressbook_storage_get_sources ();
- for (; l != NULL; l = l->next) {
- AddressbookSource *source;
- gint row;
- gchar *text[2];
-
- source = addressbook_source_copy ((AddressbookSource*)l->data);
-
- text[0] = source->name;
- text[1] = source->uri;
-
- row = e_utf8_gtk_clist_append (GTK_CLIST(clist), text);
- gtk_clist_set_row_data_full (GTK_CLIST(clist), row, source, (GtkDestroyNotify) addressbook_source_free);
- }
-
- gtk_signal_connect (GTK_OBJECT (clist), "select_row",
- GTK_SIGNAL_FUNC (sources_select_row),
- dialog);
-
- gtk_signal_connect (GTK_OBJECT (dialog->dialog), "apply",
- addressbook_dialog_apply, dialog);
-
- gtk_signal_connect (GTK_OBJECT (dialog->dialog), "destroy",
- addressbook_dialog_close, dialog);
-
- gtk_window_set_default_size (GTK_WINDOW (dialog->dialog), 300, 350);
-
- gtk_widget_show (dialog->dialog);
-}
diff --git a/addressbook/gui/component/addressbook-config.glade b/addressbook/gui/component/addressbook-config.glade
deleted file mode 100644
index c327cc04cc..0000000000
--- a/addressbook/gui/component/addressbook-config.glade
+++ /dev/null
@@ -1,158 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
-</project>
-
-<widget>
- <class>GnomePropertyBox</class>
- <name>dialog</name>
- <width>460</width>
- <height>360</height>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>False</allow_grow>
- <auto_shrink>False</auto_shrink>
-
- <widget>
- <class>GtkNotebook</class>
- <child_name>GnomePropertyBox:notebook</child_name>
- <name>notebook1</name>
- <can_focus>True</can_focus>
- <show_tabs>True</show_tabs>
- <show_border>True</show_border>
- <tab_pos>GTK_POS_TOP</tab_pos>
- <scrollable>False</scrollable>
- <tab_hborder>2</tab_hborder>
- <tab_vborder>2</tab_vborder>
- <popup_enable>False</popup_enable>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox2</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
-
- <widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow1</name>
- <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
- <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
- <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
- <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkCList</class>
- <name>clistSources</name>
- <can_focus>True</can_focus>
- <columns>2</columns>
- <column_widths>80,80</column_widths>
- <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
- <show_titles>True</show_titles>
- <shadow_type>GTK_SHADOW_IN</shadow_type>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>CList:title</child_name>
- <name>label10</name>
- <label>Name</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>CList:title</child_name>
- <name>label11</name>
- <label>URI</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVButtonBox</class>
- <name>vbuttonbox2</name>
- <layout_style>GTK_BUTTONBOX_START</layout_style>
- <spacing>10</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>addSource</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>_Add</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>editSource</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>_Edit</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>deleteSource</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>De_lete</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>Notebook:tab</child_name>
- <name>label8</name>
- <label>Addressbook Sources</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/addressbook/gui/component/addressbook-config.h b/addressbook/gui/component/addressbook-config.h
deleted file mode 100644
index 95635b8918..0000000000
--- a/addressbook/gui/component/addressbook-config.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* addressbook-storage.h
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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.
- *
- * Author: Chris Toshok
- */
-
-#ifndef __ADDRESSBOOK_CONFIG_H__
-#define __ADDRESSBOOK_CONFIG_H__
-
-#include "addressbook-storage.h"
-
-void addressbook_config (GNOME_Evolution_Shell shell);
-
-#endif /* __ADDRESSBOOK_CONFIG_H__ */
diff --git a/addressbook/gui/component/addressbook-factory.c b/addressbook/gui/component/addressbook-factory.c
deleted file mode 100644
index 305751aefd..0000000000
--- a/addressbook/gui/component/addressbook-factory.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/**
- * sample-control-factory.c
- *
- * Copyright 1999, Ximian, Inc.
- *
- * Author:
- * Nat Friedman (nat@nat.org)
- *
- */
-
-#include <config.h>
-#include <glib.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-init.h>
-#include <liboaf/liboaf.h>
-#include <bonobo/bonobo-main.h>
-#include <glade/glade.h>
-#include <gal/widgets/e-cursors.h>
-
-#include <camel/camel.h>
-
-#ifdef GTKHTML_HAVE_GCONF
-#include <gconf/gconf.h>
-#endif
-
-#include "addressbook.h"
-#include "addressbook-component.h"
-#include "e-address-widget.h"
-#include "e-address-popup.h"
-#include "addressbook/gui/widgets/e-minicard-control.h"
-#include "select-names/e-select-names-factory.h"
-
-
-static void
-init_corba (int *argc, char **argv)
-{
- gnome_init_with_popt_table ("evolution-addressbook", "0.0",
- *argc, argv, oaf_popt_options, 0, NULL);
-
- oaf_init (*argc, argv);
-}
-
-static void
-init_bonobo (int argc, char **argv)
-{
- if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE)
- g_error (_("Could not initialize Bonobo"));
-
-#ifdef GTKHTML_HAVE_GCONF
- gconf_init (argc, argv, NULL);
-#endif
-
- glade_gnome_init ();
-}
-
-int
-main (int argc, char **argv)
-{
- bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR);
- textdomain (PACKAGE);
-
- init_corba (&argc, argv);
-
- init_bonobo (argc, argv);
-
- /* FIXME: Messy names here. This file should be `main.c'. `addressbook.c' should
- be `addressbook-control-factory.c' and the functions should be called
- `addressbook_control_factory_something()'. And `addressbook-component.c'
- should be `addressbook-component-factory.c'. */
-
- addressbook_factory_init ();
- addressbook_component_factory_init ();
-
- e_select_names_factory_init ();
-
- e_minicard_control_factory_init ();
-
- e_address_widget_factory_init ();
- e_address_popup_factory_init ();
-
- e_cursors_init();
-
-#if 0
- g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING);
-#endif
-
- g_thread_init (NULL);
- camel_type_init ();
-
- bonobo_main ();
-
- return 0;
-}
diff --git a/addressbook/gui/component/addressbook-storage.c b/addressbook/gui/component/addressbook-storage.c
deleted file mode 100644
index aed394d829..0000000000
--- a/addressbook/gui/component/addressbook-storage.c
+++ /dev/null
@@ -1,582 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-ldap-storage.c
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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.
- *
- * Author: Chris Toshok
- */
-
-/* The ldap server file goes like this:
-
- <?xml version="1.0"?>
- <addressbooks>
- <contactserver>
- <name>LDAP Server</name>
- <description>This is my company address book.</description>
- <host>ldap.server.com</host>
- <port>389</port>
- <rootdn></rootdn>
- <authmethod>simple</authmethod>
- <binddn>cn=Chris Toshok,dc=helixcode,dc=com</binddn>
- <rememberpass/>
- </contactserver>
- <contactfile>
- <name>On Disk Contacts</name>
- <description>This is one of my private contact dbs.</description>
- <path>/home/toshok/contacts/work-contacts.db</path>
- </contactfile>
- </addressbooks>
-
- FIXME: Do we want to use a namespace for this?
- FIXME: Do we want to have an internationalized description?
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <errno.h>
-
-#include <glib.h>
-#include <gnome-xml/parser.h>
-#include <gnome-xml/xmlmemory.h>
-
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnome/gnome-util.h>
-#include <bonobo/bonobo-object.h>
-
-#include <gal/util/e-util.h>
-#include <gal/util/e-xml-utils.h>
-#include <libgnome/gnome-i18n.h>
-
-#include "evolution-shell-component.h"
-#include "evolution-storage.h"
-
-#include "addressbook-storage.h"
-
-#define ADDRESSBOOK_SOURCES_XML "addressbook-sources.xml"
-
-static gboolean load_source_data (const char *file_path);
-static gboolean save_source_data (const char *file_path);
-static void register_storage (void);
-static void deregister_storage (void);
-
-static GList *sources;
-static EvolutionStorage *storage;
-static char *storage_path;
-static GNOME_Evolution_Shell corba_shell;
-
-void
-addressbook_storage_setup (EvolutionShellComponent *shell_component,
- const char *evolution_homedir)
-{
- EvolutionShellClient *shell_client;
-
- shell_client = evolution_shell_component_get_owner (shell_component);
- if (shell_client == CORBA_OBJECT_NIL) {
- g_warning ("We have no shell!?");
- return;
- }
-
- corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
-
- sources = NULL;
-
- if (storage_path)
- g_free (storage_path);
- storage_path = g_concat_dir_and_file (evolution_homedir, ADDRESSBOOK_SOURCES_XML);
- if (!load_source_data (storage_path))
- deregister_storage ();
-}
-
-static void
-register_storage (void)
-{
-#ifdef HAVE_LDAP
- EvolutionStorageResult result;
-
- if (storage == NULL) {
- storage = evolution_storage_new (_("Other Contacts"), NULL, NULL);
- result = evolution_storage_register_on_shell (storage, corba_shell);
- switch (result) {
- case EVOLUTION_STORAGE_OK:
- break;
- case EVOLUTION_STORAGE_ERROR_GENERIC :
- g_warning("register_storage: generic error");
- break;
- case EVOLUTION_STORAGE_ERROR_CORBA :
- g_warning("register_storage: corba error");
- break;
- case EVOLUTION_STORAGE_ERROR_ALREADYREGISTERED :
- g_warning("register_storage: already registered error");
- break;
- case EVOLUTION_STORAGE_ERROR_EXISTS :
- g_warning("register_storage: already exists error");
- break;
- default:
- g_warning("register_storage: other error");
- break;
- }
- }
-#endif
-}
-
-static void
-deregister_storage (void)
-{
- if (evolution_storage_deregister_on_shell (storage, corba_shell) !=
- EVOLUTION_STORAGE_OK) {
- g_warning("couldn't deregister storage");
- }
-
- storage = NULL;
-}
-
-static char *
-get_string_value (xmlNode *node,
- const char *name)
-{
- xmlNode *p;
- xmlChar *xml_string;
- char *retval;
-
- p = e_xml_get_child_by_name (node, (xmlChar *) name);
- if (p == NULL)
- return NULL;
-
- p = e_xml_get_child_by_name (p, (xmlChar *) "text");
- if (p == NULL) /* there's no text between the tags, return the empty string */
- return g_strdup("");
-
- xml_string = xmlNodeListGetString (node->doc, p, 1);
- retval = g_strdup ((char *) xml_string);
- xmlFree (xml_string);
-
- return retval;
-}
-
-static char *
-ldap_unparse_auth (AddressbookLDAPAuthType auth_type)
-{
- switch (auth_type) {
- case ADDRESSBOOK_LDAP_AUTH_NONE:
- return "none";
- case ADDRESSBOOK_LDAP_AUTH_SIMPLE:
- return "simple";
- default:
- g_assert(0);
- return "none";
- }
-}
-
-static AddressbookLDAPAuthType
-ldap_parse_auth (const char *auth)
-{
- if (!auth)
- return ADDRESSBOOK_LDAP_AUTH_NONE;
-
- if (!strcmp (auth, "simple"))
- return ADDRESSBOOK_LDAP_AUTH_SIMPLE;
- else
- return ADDRESSBOOK_LDAP_AUTH_NONE;
-}
-
-static char *
-ldap_unparse_scope (AddressbookLDAPScopeType scope_type)
-{
- switch (scope_type) {
- case ADDRESSBOOK_LDAP_SCOPE_BASE:
- return "base";
- case ADDRESSBOOK_LDAP_SCOPE_ONELEVEL:
- return "one";
- case ADDRESSBOOK_LDAP_SCOPE_SUBTREE:
- return "sub";
- default:
- g_assert(0);
- return "";
- }
-}
-
-static AddressbookLDAPScopeType
-ldap_parse_scope (const char *scope)
-{
- if (!scope)
- return ADDRESSBOOK_LDAP_SCOPE_SUBTREE; /* XXX good default? */
-
- if (!strcmp (scope, "base"))
- return ADDRESSBOOK_LDAP_SCOPE_BASE;
- else if (!strcmp (scope, "one"))
- return ADDRESSBOOK_LDAP_SCOPE_ONELEVEL;
- else
- return ADDRESSBOOK_LDAP_SCOPE_SUBTREE;
-}
-
-void
-addressbook_storage_init_source_uri (AddressbookSource *source)
-{
- if (source->uri)
- g_free (source->uri);
-
- if (source->type == ADDRESSBOOK_SOURCE_LDAP)
- source->uri = g_strdup_printf ("ldap://%s:%s/%s??%s",
- source->ldap.host, source->ldap.port,
- source->ldap.rootdn, ldap_unparse_scope(source->ldap.scope));
- else
- source->uri = g_strdup_printf ("file://%s",
- source->file.path);
-}
-
-static gboolean
-load_source_data (const char *file_path)
-{
- xmlDoc *doc;
- xmlNode *root;
- xmlNode *child;
-
- register_storage ();
-
- tryagain:
- doc = xmlParseFile (file_path);
- if (doc == NULL) {
- /* Check to see if a addressbook-sources.xml.new file
- exists. If it does, rename it and try loading it */
- char *new_path = g_strdup_printf ("%s.new", file_path);
- struct stat sb;
-
- if (stat (new_path, &sb) == 0) {
- int rv;
-
- rv = rename (new_path, file_path);
- g_free (new_path);
-
- if (rv < 0) {
- g_error ("Failed to rename %s: %s\n",
- ADDRESSBOOK_SOURCES_XML,
- strerror(errno));
- return FALSE;
- } else
- goto tryagain;
- }
-
- g_free (new_path);
- return FALSE;
- }
-
- root = xmlDocGetRootElement (doc);
- if (root == NULL || strcmp (root->name, "addressbooks") != 0) {
- xmlFreeDoc (doc);
- return FALSE;
- }
-
- for (child = root->childs; child; child = child->next) {
- char *path;
- AddressbookSource *source;
-
- source = g_new0 (AddressbookSource, 1);
-
- if (!strcmp (child->name, "contactserver")) {
- source->type = ADDRESSBOOK_SOURCE_LDAP;
- source->ldap.port = get_string_value (child, "port");
- source->ldap.host = get_string_value (child, "host");
- source->ldap.rootdn = get_string_value (child, "rootdn");
- source->ldap.scope = ldap_parse_scope (get_string_value (child, "scope"));
- source->ldap.auth = ldap_parse_auth (get_string_value (child, "authmethod"));
- source->ldap.binddn = get_string_value (child, "binddn");
- }
- else if (!strcmp (child->name, "contactfile")) {
- source->type = ADDRESSBOOK_SOURCE_FILE;
- source->file.path = get_string_value (child, "path");
- }
- else {
- g_warning ("unknown node '%s' in %s", child->name, file_path);
- g_free (source);
- continue;
- }
-
- addressbook_storage_init_source_uri (source);
-
- source->name = get_string_value (child, "name");
- source->description = get_string_value (child, "description");
-
- path = g_strdup_printf ("/%s", source->name);
- evolution_storage_new_folder (storage, path, source->name,
- "contacts", source->uri,
- source->description, FALSE);
-
- sources = g_list_append (sources, source);
-
- g_free (path);
- }
-
- if (g_list_length (sources) == 0)
- deregister_storage();
-
- xmlFreeDoc (doc);
- return TRUE;
-}
-
-static void
-ldap_source_foreach(AddressbookSource *source, xmlNode *root)
-{
- xmlNode *source_root = xmlNewNode (NULL,
- (xmlChar *) "contactserver");
-
- xmlAddChild (root, source_root);
-
- xmlNewChild (source_root, NULL, (xmlChar *) "name",
- (xmlChar *) source->name);
- xmlNewChild (source_root, NULL, (xmlChar *) "description",
- (xmlChar *) source->description);
-
- xmlNewChild (source_root, NULL, (xmlChar *) "port",
- (xmlChar *) source->ldap.port);
- xmlNewChild (source_root, NULL, (xmlChar *) "host",
- (xmlChar *) source->ldap.host);
- xmlNewChild (source_root, NULL, (xmlChar *) "rootdn",
- (xmlChar *) source->ldap.rootdn);
- xmlNewChild (source_root, NULL, (xmlChar *) "scope",
- (xmlChar *) ldap_unparse_scope(source->ldap.scope));
- xmlNewChild (source_root, NULL, (xmlChar *) "authmethod",
- (xmlChar *) ldap_unparse_auth(source->ldap.auth));
- if (source->ldap.auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE) {
- xmlNewChild (source_root, NULL, (xmlChar *) "binddn",
- (xmlChar *) source->ldap.binddn);
- if (source->ldap.remember_passwd)
- xmlNewChild (source_root, NULL, (xmlChar *) "rememberpass",
- NULL);
- }
-}
-
-static void
-file_source_foreach (AddressbookSource *source, xmlNode *root)
-{
- xmlNode *source_root = xmlNewNode (NULL,
- (xmlChar *) "contactfile");
-
- xmlAddChild (root, source_root);
-
- xmlNewChild (source_root, NULL, (xmlChar *) "name",
- (xmlChar *) source->name);
- xmlNewChild (source_root, NULL, (xmlChar *) "description",
- (xmlChar *) source->description);
-
- xmlNewChild (source_root, NULL, (xmlChar *) "path",
- (xmlChar *) source->file.path);
-}
-
-static void
-source_foreach(gpointer value, gpointer user_data)
-{
- AddressbookSource *source = value;
- xmlNode *root = user_data;
-
- if (source->type == ADDRESSBOOK_SOURCE_LDAP)
- ldap_source_foreach(source, root);
- else
- file_source_foreach(source, root);
-}
-
-static gboolean
-save_source_data (const char *file_path)
-{
- xmlDoc *doc;
- xmlNode *root;
- int fd, rv;
- xmlChar *buf;
- int buf_size;
- char *new_path = g_strdup_printf ("%s.new", file_path);
-
- doc = xmlNewDoc ((xmlChar *) "1.0");
- root = xmlNewDocNode (doc, NULL, (xmlChar *) "addressbooks", NULL);
- xmlDocSetRootElement (doc, root);
-
- g_list_foreach (sources, source_foreach, root);
-
- fd = open (new_path, O_CREAT | O_TRUNC | O_WRONLY, 0600);
- fchmod (fd, 0600);
-
- xmlDocDumpMemory (doc, &buf, &buf_size);
-
- if (buf == NULL) {
- g_error ("Failed to write %s: xmlBufferCreate() == NULL", ADDRESSBOOK_SOURCES_XML);
- return FALSE;
- }
-
- rv = write (fd, buf, buf_size);
- xmlFree (buf);
- close (fd);
-
- if (0 > rv) {
- g_error ("Failed to write new %s: %s\n", ADDRESSBOOK_SOURCES_XML, strerror(errno));
- unlink (new_path);
- return FALSE;
- }
- else {
- if (0 > rename (new_path, file_path)) {
- g_error ("Failed to rename %s: %s\n", ADDRESSBOOK_SOURCES_XML, strerror(errno));
- unlink (new_path);
- return FALSE;
- }
- return TRUE;
- }
-}
-
-void
-addressbook_storage_add_source (AddressbookSource *source)
-{
- char *path;
-
- sources = g_list_append (sources, source);
-
- /* And then to the ui */
- register_storage ();
- path = g_strdup_printf ("/%s", source->name);
- evolution_storage_new_folder (storage, path, source->name, "contacts",
- source->uri, source->description, FALSE);
-
- g_free (path);
-}
-
-void
-addressbook_storage_remove_source (const char *name)
-{
- char *path;
- AddressbookSource *source = NULL;
- GList *l;
-
- /* remove it from our hashtable */
- for (l = sources; l; l = l->next) {
- AddressbookSource *s = l->data;
- if (!strcmp (s->name, name)) {
- source = s;
- break;
- }
- }
-
- if (!source)
- return;
-
- sources = g_list_remove_link (sources, l);
- g_list_free_1 (l);
-
- addressbook_source_free (source);
-
- /* and then from the ui */
- path = g_strdup_printf ("/%s", name);
- evolution_storage_removed_folder (storage, path);
-
- if (g_list_length (sources) == 0)
- deregister_storage ();
-
- g_free (path);
-}
-
-GList *
-addressbook_storage_get_sources ()
-{
- return sources;
-}
-
-AddressbookSource *
-addressbook_storage_get_source_by_uri (const char *uri)
-{
- GList *l;
-
- for (l = sources; l ; l = l->next) {
- AddressbookSource *source = l->data;
- if (!strcmp (uri, source->uri))
- return source;
- }
-
- return NULL;
-}
-
-void
-addressbook_source_free (AddressbookSource *source)
-{
- g_free (source->name);
- g_free (source->description);
- g_free (source->uri);
- if (source->type == ADDRESSBOOK_SOURCE_LDAP) {
- g_free (source->ldap.host);
- g_free (source->ldap.port);
- g_free (source->ldap.rootdn);
- g_free (source->ldap.binddn);
- } else {
- g_free (source->file.path);
- }
-
- g_free (source);
-}
-
-static void
-addressbook_source_foreach (AddressbookSource *source, gpointer data)
-{
- char *path = g_strdup_printf ("/%s", source->name);
-
- evolution_storage_removed_folder (storage, path);
-
- g_free (path);
-
- addressbook_source_free (source);
-}
-
-void
-addressbook_storage_clear_sources (void)
-{
- g_list_foreach (sources, (GFunc)addressbook_source_foreach, NULL);
- g_list_free (sources);
- deregister_storage ();
- sources = NULL;
-}
-
-void
-addressbook_storage_write_sources (void)
-{
- save_source_data (storage_path);
-}
-
-AddressbookSource *
-addressbook_source_copy (const AddressbookSource *source)
-{
- AddressbookSource *copy;
-
- copy = g_new0 (AddressbookSource, 1);
- copy->name = g_strdup (source->name);
- copy->description = g_strdup (source->description);
- copy->type = source->type;
- copy->uri = g_strdup (source->uri);
-
- if (copy->type == ADDRESSBOOK_SOURCE_LDAP) {
- copy->ldap.host = g_strdup (source->ldap.host);
- copy->ldap.port = g_strdup (source->ldap.port);
- copy->ldap.rootdn = g_strdup (source->ldap.rootdn);
- copy->ldap.scope = source->ldap.scope;
- copy->ldap.auth = source->ldap.auth;
- copy->ldap.binddn = g_strdup (source->ldap.binddn);
- copy->ldap.remember_passwd = source->ldap.remember_passwd;
- }
- else {
- copy->file.path = g_strdup (source->file.path);
- }
- return copy;
-}
diff --git a/addressbook/gui/component/addressbook-storage.h b/addressbook/gui/component/addressbook-storage.h
deleted file mode 100644
index f2a1910e13..0000000000
--- a/addressbook/gui/component/addressbook-storage.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* addressbook-storage.h
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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.
- *
- * Author: Chris Toshok
- */
-
-#ifndef __ADDRESSBOOK_STORAGE_H__
-#define __ADDRESSBOOK_STORAGE_H__
-
-#include "evolution-shell-component.h"
-
-typedef enum {
- ADDRESSBOOK_SOURCE_LDAP,
- ADDRESSBOOK_SOURCE_FILE,
- ADDRESSBOOK_SOURCE_LAST
-} AddressbookSourceType;
-
-typedef enum {
- ADDRESSBOOK_LDAP_AUTH_NONE,
- ADDRESSBOOK_LDAP_AUTH_SIMPLE,
- ADDRESSBOOK_LDAP_AUTH_LAST
-} AddressbookLDAPAuthType;
-
-typedef enum {
- ADDRESSBOOK_LDAP_SCOPE_SUBTREE,
- ADDRESSBOOK_LDAP_SCOPE_BASE,
- ADDRESSBOOK_LDAP_SCOPE_ONELEVEL,
- ADDRESSBOOK_LDAP_SCOPE_LAST
-} AddressbookLDAPScopeType;
-
-typedef struct {
- AddressbookSourceType type;
- char *name;
- char *description;
- struct {
- char *path;
- } file;
- struct {
- char *host;
- char *port;
- char *rootdn;
- AddressbookLDAPScopeType scope;
- AddressbookLDAPAuthType auth;
- char *binddn; /* used in AUTH_SIMPLE */
- gboolean remember_passwd;
- } ldap;
- char *uri; /* filled in from the above */
-} AddressbookSource;
-
-void addressbook_storage_setup (EvolutionShellComponent *shell_component,
- const char *evolution_homedir);
-
-GList *addressbook_storage_get_sources (void);
-AddressbookSource *addressbook_storage_get_source_by_uri (const char *uri);
-void addressbook_storage_clear_sources (void);
-void addressbook_storage_write_sources (void);
-AddressbookSource *addressbook_source_copy (const AddressbookSource *source);
-void addressbook_source_free (AddressbookSource *source);
-void addressbook_storage_init_source_uri (AddressbookSource *source);
-
-void addressbook_storage_add_source (AddressbookSource *source);
-void addressbook_storage_remove_source (const char *name);
-
-#endif /* __ADDRESSBOOK_STORAGE_H__ */
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
deleted file mode 100644
index f87d49d689..0000000000
--- a/addressbook/gui/component/addressbook.c
+++ /dev/null
@@ -1,795 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * addressbook.c:
- *
- * Author:
- * Chris Lahey (clahey@ximian.com)
- *
- * (C) 2000 Ximian, Inc.
- */
-
-#include <config.h>
-
-#include <glib.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-app.h>
-#include <libgnomeui/gnome-stock.h>
-#include <libgnomeui/gnome-uidefs.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <gal/util/e-util.h>
-#include <gal/widgets/e-unicode.h>
-
-#include "select-names/e-select-names.h"
-#include "select-names/e-select-names-manager.h"
-
-#include "evolution-shell-component-utils.h"
-#include "e-contact-editor.h"
-#include "e-contact-save-as.h"
-#include "addressbook-config.h"
-#include "addressbook.h"
-#include "addressbook/gui/search/e-addressbook-search-dialog.h"
-#include "addressbook/gui/widgets/e-addressbook-view.h"
-#include "addressbook/gui/widgets/e-addressbook-util.h"
-#include "addressbook/printing/e-contact-print.h"
-
-#include <ebook/e-book.h>
-#include <widgets/misc/e-search-bar.h>
-#include <widgets/misc/e-filter-bar.h>
-
-#define PROPERTY_FOLDER_URI "folder_uri"
-
-#define PROPERTY_FOLDER_URI_IDX 1
-
-typedef struct {
- EAddressbookView *view;
- ESearchBar *search;
- GtkWidget *vbox;
- BonoboControl *control;
- BonoboPropertyBag *properties;
- char *uri;
- char *passwd;
-} AddressbookView;
-
-static void
-new_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- EBook *book;
- AddressbookView *view = (AddressbookView *) user_data;
-
- gtk_object_get(GTK_OBJECT(view->view),
- "book", &book,
- NULL);
-
- g_assert (E_IS_BOOK (book));
-
- e_addressbook_show_contact_editor (book, e_card_new(""), TRUE, e_addressbook_view_can_create(view->view));
-}
-
-static void
-new_contact_list_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- EBook *book;
- AddressbookView *view = (AddressbookView *) user_data;
-
- gtk_object_get(GTK_OBJECT(view->view),
- "book", &book,
- NULL);
-
- g_assert (E_IS_BOOK (book));
-
- e_addressbook_show_contact_list_editor (book, e_card_new(""), TRUE, e_addressbook_view_can_create(view->view));
-}
-
-static void
-save_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- e_addressbook_view_save_as(view->view);
-}
-
-static void
-config_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- addressbook_config (NULL /* XXX */);
-}
-
-static void
-search_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- EBook *book;
- AddressbookView *view = (AddressbookView *) user_data;
-
- gtk_object_get(GTK_OBJECT(view->view),
- "book", &book,
- NULL);
- g_assert (E_IS_BOOK (book));
-
- gtk_widget_show(e_addressbook_search_dialog_new(book));
-}
-
-static void
-delete_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- e_addressbook_view_delete_selection(view->view);
-}
-
-static void
-print_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- e_addressbook_view_print(view->view);
-}
-
-static void
-stop_loading_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- e_addressbook_view_stop(view->view);
-}
-
-static void
-cut_contacts_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- e_addressbook_view_cut(view->view);
-}
-
-static void
-copy_contacts_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- e_addressbook_view_copy(view->view);
-}
-
-static void
-paste_contacts_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- e_addressbook_view_paste(view->view);
-}
-
-static void
-select_all_contacts_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- e_addressbook_view_select_all (view->view);
-}
-
-static void
-send_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- e_addressbook_view_send(view->view);
-}
-
-static void
-send_contact_to_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- e_addressbook_view_send_to(view->view);
-}
-
-static void
-update_command_state (EAddressbookView *eav, AddressbookView *view)
-{
- BonoboUIComponent *uic = bonobo_control_get_ui_component (view->control);
-
- /* New Contact */
- bonobo_ui_component_set_prop (uic,
- "/commands/ContactNew",
- "sensitive",
- e_addressbook_view_can_create (view->view) ? "1" : "0", NULL);
- bonobo_ui_component_set_prop (uic,
- "/commands/ContactNewList",
- "sensitive",
- e_addressbook_view_can_create (view->view) ? "1" : "0", NULL);
-
- bonobo_ui_component_set_prop (uic,
- "/commands/ContactsSaveAsVCard",
- "sensitive",
- e_addressbook_view_can_save_as (view->view) ? "1" : "0", NULL);
-
- /* Print Contact */
- bonobo_ui_component_set_prop (uic,
- "/commands/ContactsPrint",
- "sensitive",
- e_addressbook_view_can_print (view->view) ? "1" : "0", NULL);
-
- /* Delete Contact */
- bonobo_ui_component_set_prop (uic,
- "/commands/ContactDelete",
- "sensitive",
- e_addressbook_view_can_delete (view->view) ? "1" : "0", NULL);
-
- bonobo_ui_component_set_prop (uic,
- "/commands/ContactsCut",
- "sensitive",
- e_addressbook_view_can_cut (view->view) ? "1" : "0", NULL);
- bonobo_ui_component_set_prop (uic,
- "/commands/ContactsCopy",
- "sensitive",
- e_addressbook_view_can_copy (view->view) ? "1" : "0", NULL);
- bonobo_ui_component_set_prop (uic,
- "/commands/ContactsPaste",
- "sensitive",
- e_addressbook_view_can_paste (view->view) ? "1" : "0", NULL);
- bonobo_ui_component_set_prop (uic,
- "/commands/ContactsSelectAll",
- "sensitive",
- e_addressbook_view_can_select_all (view->view) ? "1" : "0", NULL);
-
- bonobo_ui_component_set_prop (uic,
- "/commands/ContactsSendContactToOther",
- "sensitive",
- e_addressbook_view_can_send (view->view) ? "1" : "0", NULL);
-
- bonobo_ui_component_set_prop (uic,
- "/commands/ContactsSendMessageToContact",
- "sensitive",
- e_addressbook_view_can_send_to (view->view) ? "1" : "0", NULL);
-
-
- /* Stop */
- bonobo_ui_component_set_prop (uic,
- "/commands/ContactStop",
- "sensitive",
- e_addressbook_view_can_stop (view->view) ? "1" : "0", NULL);
-}
-
-static void
-change_view_type (AddressbookView *view, EAddressbookViewType view_type)
-{
- gtk_object_set (GTK_OBJECT (view->view), "type", view_type, NULL);
-}
-
-BonoboUIVerb verbs [] = {
- BONOBO_UI_UNSAFE_VERB ("ContactsPrint", print_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsSaveAsVCard", save_contact_cb),
- BONOBO_UI_UNSAFE_VERB ("ToolSearch", search_cb),
-
- BONOBO_UI_UNSAFE_VERB ("AddressbookConfig", config_cb),
-
- BONOBO_UI_UNSAFE_VERB ("ContactNew", new_contact_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactNewList", new_contact_list_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactDelete", delete_contact_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactStop", stop_loading_cb),
-
- BONOBO_UI_UNSAFE_VERB ("ContactsCut", cut_contacts_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsCopy", copy_contacts_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsPaste", paste_contacts_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsSelectAll", select_all_contacts_cb),
-
- BONOBO_UI_UNSAFE_VERB ("ContactsSendContactToOther", send_contact_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsSendMessageToContact", send_contact_to_cb),
-
- BONOBO_UI_VERB_END
-};
-
-static EPixmap pixmaps [] = {
- E_PIXMAP ("/menu/File/New/NewFirstItem/ContactNew", "evolution-contacts-mini.png"),
- E_PIXMAP ("/menu/File/Print/ContactsPrint", "print.xpm"),
- E_PIXMAP ("/menu/File/Print/ContactsPrintPreview", "print-preview.xpm"),
- E_PIXMAP ("/menu/Tools/Component/AddressbookConfig", "configure_16_addressbook.xpm"),
-
- E_PIXMAP ("/Toolbar/ContactNew", "new_contact.xpm"),
- E_PIXMAP ("/Toolbar/ContactNewList", "all_contacts.xpm"),
-
- E_PIXMAP_END
-};
-
-static void
-control_activate (BonoboControl *control,
- BonoboUIComponent *uic,
- AddressbookView *view)
-{
- Bonobo_UIContainer remote_ui_container;
-
- remote_ui_container = bonobo_control_get_remote_ui_container (control);
- bonobo_ui_component_set_container (uic, remote_ui_container);
- bonobo_object_release_unref (remote_ui_container, NULL);
-
- bonobo_ui_component_add_verb_list_with_data (
- uic, verbs, view);
-
- bonobo_ui_component_freeze (uic, NULL);
-
- bonobo_ui_util_set_ui (uic, EVOLUTION_DATADIR,
- "evolution-addressbook.xml",
- "evolution-addressbook");
-
- e_addressbook_view_setup_menus (view->view, uic);
-
- e_pixmaps_update (uic, pixmaps);
-
- bonobo_ui_component_thaw (uic, NULL);
-
- update_command_state (view->view, view);
-}
-
-static void
-control_activate_cb (BonoboControl *control,
- gboolean activate,
- AddressbookView *view)
-{
- BonoboUIComponent *uic;
-
- uic = bonobo_control_get_ui_component (control);
- g_assert (uic != NULL);
-
- if (activate)
- control_activate (control, uic, view);
- else {
- bonobo_ui_component_unset_container (uic);
- e_addressbook_view_discard_menus (view->view);
- }
-}
-
-static void
-addressbook_view_free(AddressbookView *view)
-{
- EBook *book;
-
- gtk_object_get(GTK_OBJECT(view->view),
- "book", &book,
- NULL);
- if (view->uri)
- gtk_object_unref (GTK_OBJECT (book));
-
- if (view->properties)
- bonobo_object_unref(BONOBO_OBJECT(view->properties));
- g_free(view->passwd);
- g_free(view->uri);
- g_free(view);
-}
-
-static void
-book_auth_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- AddressbookView *view = closure;
- if (status == E_BOOK_STATUS_SUCCESS) {
- gtk_object_set(GTK_OBJECT(view->view),
- "book", book,
- NULL);
- }
- else {
- /* pop up a nice dialog, or redo the authentication
- bit some number of times. */
- }
-}
-
-static void
-passwd_cb (gchar *string, gpointer data)
-{
- AddressbookView *view = (AddressbookView*)data;
-
- view->passwd = g_strdup (string);
-}
-
-static void
-book_open_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- AddressbookView *view = closure;
- AddressbookSource *source;
- source = addressbook_storage_get_source_by_uri (view->uri);
-
- if (status == E_BOOK_STATUS_SUCCESS) {
- /* check if the addressbook needs authentication */
-
- if (source &&
- source->type == ADDRESSBOOK_SOURCE_LDAP &&
- source->ldap.auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE) {
- int button;
- char *msg = g_strdup_printf (_("Enter password for %s"), source->ldap.binddn);
- /* give a password prompt for the binddn */
- GtkWidget *dialog = gnome_request_dialog (TRUE, msg, NULL,
- 0, passwd_cb, view, NULL);
-
- button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
-
- if (button == 0 && *(view->passwd)) {
- e_book_authenticate_user (book, source->ldap.binddn, view->passwd,
- book_auth_cb, closure);
- memset (view->passwd, 0, strlen (view->passwd)); /* clear out the passwd */
- g_free (view->passwd);
- view->passwd = NULL;
- return;
- }
- }
-
-
- /* if they either didn't configure the source to use
- authentication, or they canceled the dialog,
- proceed without authenticating */
- gtk_object_set(GTK_OBJECT(view->view),
- "book", book,
- NULL);
-
- } else {
- GtkWidget *warning_dialog, *label;
- warning_dialog = gnome_dialog_new (
- _("Unable to open addressbook"),
- GNOME_STOCK_BUTTON_CLOSE,
- NULL);
-
- if (source->type == ADDRESSBOOK_SOURCE_LDAP) {
-#if HAVE_LDAP
- label = gtk_label_new (
- _("We were unable to open this addressbook. This either\n"
- "means you have entered an incorrect URI, or the LDAP server\n"
- "is down"));
-#else
- label = gtk_label_new (
- _("This version of Evolution does not have LDAP support\n"
- "compiled in to it. If you want to use LDAP in Evolution\n"
- "you must compile the program from the CVS sources after\n"
- "retrieving OpenLDAP from the link below.\n"));
-#endif
- }
- else {
- label = gtk_label_new (
- _("We were unable to open this addressbook. Please check that the\n"
- "path exists and that you have permission to access it."));
- }
-
- gtk_misc_set_alignment(GTK_MISC(label),
- 0, .5);
- gtk_label_set_justify(GTK_LABEL(label),
- GTK_JUSTIFY_LEFT);
-
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (warning_dialog)->vbox),
- label, TRUE, TRUE, 0);
- gtk_widget_show (label);
-
-#ifndef HAVE_LDAP
- if (source->type == ADDRESSBOOK_SOURCE_LDAP) {
- GtkWidget *href;
- href = gnome_href_new ("http://www.openldap.org/", "OpenLDAP at http://www.openldap.org/");
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (warning_dialog)->vbox),
- href, FALSE, FALSE, 0);
- gtk_widget_show (href);
- }
-#endif
- gnome_dialog_run (GNOME_DIALOG (warning_dialog));
-
- gtk_object_destroy (GTK_OBJECT (warning_dialog));
- }
-}
-
-static void destroy_callback(GtkWidget *widget, gpointer data)
-{
- AddressbookView *view = data;
- addressbook_view_free(view);
-}
-
-static void
-get_prop (BonoboPropertyBag *bag,
- BonoboArg *arg,
- guint arg_id,
- CORBA_Environment *ev,
- gpointer user_data)
-{
- AddressbookView *view = user_data;
-
- switch (arg_id) {
-
- case PROPERTY_FOLDER_URI_IDX:
- if (view && view->uri)
- BONOBO_ARG_SET_STRING (arg, view->uri);
- else
- BONOBO_ARG_SET_STRING (arg, "");
- break;
-
- default:
- g_warning ("Unhandled arg %d\n", arg_id);
- }
-}
-
-char *
-addressbook_expand_uri (const char *uri)
-{
- char *new_uri;
-
- if (!strncmp (uri, "file:", 5)) {
- if (strlen (uri + 7) > 3
- && !strcmp (uri + strlen(uri) - 3, ".db")) {
- /* it's a .db file */
- new_uri = g_strdup (uri);
- }
- else {
- char *file_name;
- /* we assume it's a dir and glom addressbook.db onto the end. */
- file_name = g_concat_dir_and_file(uri + 7, "addressbook.db");
- new_uri = g_strdup_printf("file://%s", file_name);
- g_free(file_name);
- }
- }
- else {
- new_uri = g_strdup (uri);
- }
-
- return new_uri;
-}
-
-
-static void
-set_prop (BonoboPropertyBag *bag,
- const BonoboArg *arg,
- guint arg_id,
- CORBA_Environment *ev,
- gpointer user_data)
-{
- AddressbookView *view = user_data;
-
- char *uri_data;
- EBook *book;
-
- switch (arg_id) {
-
- case PROPERTY_FOLDER_URI_IDX:
- gtk_object_get(GTK_OBJECT(view->view),
- "book", &book,
- NULL);
- if (view->uri) {
- /* we've already had a uri set on this view, so unload it */
- e_book_unload_uri (book);
- g_free (view->uri);
- } else {
- book = e_book_new ();
- }
-
- view->uri = g_strdup(BONOBO_ARG_GET_STRING (arg));
-
- uri_data = addressbook_expand_uri (view->uri);
-
- if (! e_book_load_uri (book, uri_data, book_open_cb, view))
- printf ("error calling load_uri!\n");
-
- g_free(uri_data);
-
- break;
-
- default:
- g_warning ("Unhandled arg %d\n", arg_id);
- break;
- }
-}
-
-static ESearchBarItem addressbook_search_menu_items[] = {
- E_FILTERBAR_RESET,
- { NULL, 0 },
- E_FILTERBAR_ADVANCED,
- { NULL, -1 }
-};
-
-static void
-addressbook_menu_activated (ESearchBar *esb, int id, AddressbookView *view)
-{
- EBook *book;
- switch (id) {
- case E_FILTERBAR_RESET_ID:
- e_addressbook_view_show_all(view->view);
- break;
- case E_FILTERBAR_ADVANCED_ID:
- gtk_object_get(GTK_OBJECT(view->view),
- "book", &book,
- NULL);
- g_assert (E_IS_BOOK (book));
-
- gtk_widget_show(e_addressbook_search_dialog_new(book));
- break;
- }
-}
-
-enum {
- ESB_ANY,
- ESB_FULL_NAME,
- ESB_EMAIL,
- ESB_CATEGORY,
-};
-
-static ESearchBarItem addressbook_search_option_items[] = {
- { N_("Any field contains"), ESB_ANY },
- { N_("Name contains"), ESB_FULL_NAME },
- { N_("Email contains"), ESB_EMAIL },
- { N_("Category contains"), ESB_CATEGORY },
- { NULL, -1 }
-};
-
-static void
-addressbook_query_changed (ESearchBar *esb, AddressbookView *view)
-{
- char *search_word, *search_query;
- int search_type;
-
- gtk_object_get(GTK_OBJECT(esb),
- "text", &search_word,
- "option_choice", &search_type,
- NULL);
-
- if (search_word && strlen (search_word)) {
- switch (search_type) {
- case ESB_ANY:
- search_query = g_strdup_printf ("(contains \"x-evolution-any-field\" \"%s\")",
- search_word);
- break;
- case ESB_FULL_NAME:
- search_query = g_strdup_printf ("(contains \"full_name\" \"%s\")",
- search_word);
- break;
- case ESB_EMAIL:
- search_query = g_strdup_printf ("(contains \"email\" \"%s\")",
- search_word);
- break;
- case ESB_CATEGORY:
- search_query = g_strdup_printf ("(contains \"category\" \"%s\")",
- search_word);
- break;
- default:
- search_query = g_strdup ("(contains \"full_name\" \"\")");
- break;
- }
- } else
- search_query = g_strdup ("(contains \"full_name\" \"\")");
-
- gtk_object_set (GTK_OBJECT(view->view),
- "query", search_query,
- NULL);
-
- g_free (search_query);
- g_free (search_word);
-}
-
-static GNOME_Evolution_ShellView
-retrieve_shell_view_interface_from_control (BonoboControl *control)
-{
- Bonobo_ControlFrame control_frame;
- GNOME_Evolution_ShellView shell_view_interface;
- CORBA_Environment ev;
-
- shell_view_interface = gtk_object_get_data (GTK_OBJECT (control),
- "shell_view_interface");
-
- if (shell_view_interface)
- return shell_view_interface;
-
- control_frame = bonobo_control_get_control_frame (control);
-
- if (control_frame == NULL)
- return CORBA_OBJECT_NIL;
-
- CORBA_exception_init (&ev);
- shell_view_interface = Bonobo_Unknown_queryInterface (control_frame,
- "IDL:GNOME/Evolution/ShellView:1.0",
- &ev);
- CORBA_exception_free (&ev);
-
- if (shell_view_interface != CORBA_OBJECT_NIL)
- gtk_object_set_data (GTK_OBJECT (control),
- "shell_view_interface",
- shell_view_interface);
- else
- g_warning ("Control frame doesn't have Evolution/ShellView.");
-
- return shell_view_interface;
-}
-
-static void
-set_status_message (EAddressbookView *eav, const char *message, AddressbookView *view)
-{
- CORBA_Environment ev;
- GNOME_Evolution_ShellView shell_view_interface;
-
- CORBA_exception_init (&ev);
-
- shell_view_interface = retrieve_shell_view_interface_from_control (view->control);
- if (!shell_view_interface) {
- CORBA_exception_free (&ev);
- return;
- }
-
- if (message == NULL || message[0] == 0) {
- GNOME_Evolution_ShellView_unsetMessage (shell_view_interface, &ev);
- }
- else {
- GNOME_Evolution_ShellView_setMessage (shell_view_interface,
- message,
- e_addressbook_view_can_stop (view->view), &ev);
- }
-
- CORBA_exception_free (&ev);
-}
-
-BonoboControl *
-addressbook_factory_new_control (void)
-{
- AddressbookView *view;
- GtkWidget *frame;
-
- frame = gtk_frame_new (NULL);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
-
- view = g_new0 (AddressbookView, 1);
-
- view->vbox = gtk_vbox_new (FALSE, 0);
-
- gtk_signal_connect (GTK_OBJECT (view->vbox), "destroy",
- GTK_SIGNAL_FUNC (destroy_callback),
- (gpointer) view);
-
- /* Create the control. */
- view->control = bonobo_control_new (view->vbox);
-
- view->search = E_SEARCH_BAR(e_search_bar_new(addressbook_search_menu_items,
- addressbook_search_option_items));
- gtk_box_pack_start (GTK_BOX (view->vbox), GTK_WIDGET (view->search),
- FALSE, FALSE, 0);
- gtk_signal_connect (GTK_OBJECT (view->search), "query_changed",
- GTK_SIGNAL_FUNC (addressbook_query_changed), view);
- gtk_signal_connect (GTK_OBJECT (view->search), "menu_activated",
- GTK_SIGNAL_FUNC (addressbook_menu_activated), view);
-
- view->view = E_ADDRESSBOOK_VIEW(e_addressbook_view_new());
- gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET (view->view));
- gtk_box_pack_start (GTK_BOX (view->vbox), frame,
- TRUE, TRUE, 0);
-
- /* create the initial view */
- change_view_type (view, E_ADDRESSBOOK_VIEW_MINICARD);
-
- gtk_widget_show (frame);
- gtk_widget_show (view->vbox);
- gtk_widget_show (GTK_WIDGET(view->view));
- gtk_widget_show (GTK_WIDGET(view->search));
-
- view->properties = bonobo_property_bag_new (get_prop, set_prop, view);
-
- bonobo_property_bag_add (view->properties,
- PROPERTY_FOLDER_URI, PROPERTY_FOLDER_URI_IDX,
- BONOBO_ARG_STRING, NULL, _("The URI that the Folder Browser will display"), 0);
-
- bonobo_control_set_properties (view->control,
- view->properties);
-
- gtk_signal_connect (GTK_OBJECT (view->view),
- "status_message",
- GTK_SIGNAL_FUNC(set_status_message),
- view);
-
- gtk_signal_connect (GTK_OBJECT (view->view),
- "command_state_change",
- GTK_SIGNAL_FUNC(update_command_state),
- view);
-
- view->uri = NULL;
-
- gtk_signal_connect (GTK_OBJECT (view->control), "activate",
- control_activate_cb, view);
-
- return view->control;
-}
-
-static BonoboObject *
-addressbook_factory (BonoboGenericFactory *Factory, void *closure)
-{
- return BONOBO_OBJECT (addressbook_factory_new_control ());
-}
-
-void
-addressbook_factory_init (void)
-{
- static BonoboGenericFactory *addressbook_control_factory = NULL;
-
- if (addressbook_control_factory != NULL)
- return;
-
- addressbook_control_factory = bonobo_generic_factory_new (
- "OAFIID:GNOME_Evolution_Addressbook_ControlFactory",
- addressbook_factory, NULL);
-
- if (addressbook_control_factory == NULL) {
- g_error ("I could not register a Addressbook factory.");
- }
-}
diff --git a/addressbook/gui/component/addressbook.h b/addressbook/gui/component/addressbook.h
deleted file mode 100644
index 717b40e150..0000000000
--- a/addressbook/gui/component/addressbook.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef __ADDRESSBOOK_H__
-#define __ADDRESSBOOK_H__
-
-#include <bonobo/bonobo-control.h>
-
-/* expand file:///foo/foo/ to file:///foo/foo/addressbook.db */
-char * addressbook_expand_uri (const char *uri);
-
-BonoboControl *addressbook_factory_new_control (void);
-void addressbook_factory_init (void);
-
-#endif /* __ADDRESSBOOK_H__ */
diff --git a/addressbook/gui/component/e-address-popup.c b/addressbook/gui/component/e-address-popup.c
deleted file mode 100644
index c291e95009..0000000000
--- a/addressbook/gui/component/e-address-popup.c
+++ /dev/null
@@ -1,1196 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * e-address-popup.c
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Developed by Jon Trowbridge <trow@ximian.com>
- */
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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.
- */
-
-/*
- * This file is too big and this widget is too complicated. Forgive me.
- */
-
-#include <config.h>
-#include "e-address-popup.h"
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-property-bag.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <gal/widgets/e-popup-menu.h>
-#include <gal/widgets/e-unicode.h>
-#include <addressbook/backend/ebook/e-book.h>
-#include <addressbook/backend/ebook/e-book-util.h>
-#include <addressbook/gui/contact-editor/e-contact-editor.h>
-#include <addressbook/gui/contact-editor/e-contact-quick-add.h>
-#include <addressbook/gui/widgets/e-minicard-widget.h>
-#include <addressbook/gui/widgets/e-addressbook-util.h>
-
-/*
- * Some general scaffolding for our widgets. Think of this as a really, really
- * lame implementation of a wizard (...which is still somewhat more general that
- * we really need it to be).
- */
-
-typedef struct _MiniWizard MiniWizard;
-struct _MiniWizard {
- GtkWidget *body;
-
- GtkWidget *vbox;
- GtkWidget *ok_button;
- GtkWidget *cancel_button;
-
- void (*ok_cb) (MiniWizard *, gpointer);
- void (*cleanup_cb) (gpointer);
- gpointer closure;
-
- void (*destroy_cb) (MiniWizard *, gpointer);
- gpointer destroy_closure;
-};
-
-static void
-mini_wizard_container_add (MiniWizard *wiz, GtkWidget *w)
-{
- GList *iter = gtk_container_children (GTK_CONTAINER (wiz->vbox));
- while (iter != NULL) {
- GtkWidget *oldw = (GtkWidget *) iter->data;
- iter = g_list_next (iter);
- gtk_container_remove (GTK_CONTAINER (wiz->vbox), oldw);
- gtk_widget_destroy (oldw);
- }
- gtk_container_add (GTK_CONTAINER (wiz->vbox), w);
-}
-
-static void
-mini_wizard_destroy (MiniWizard *wiz)
-{
- if (wiz->cleanup_cb)
- wiz->cleanup_cb (wiz->closure);
- wiz->cleanup_cb = NULL;
-
- if (wiz->destroy_cb)
- wiz->destroy_cb (wiz, wiz->destroy_closure);
-}
-
-static void
-mini_wizard_ok_cb (GtkWidget *b, gpointer closure)
-{
- MiniWizard *wiz = (MiniWizard *) closure;
-
- gpointer old_closure = wiz->closure;
- void (*old_cleanup) (gpointer) = wiz->cleanup_cb;
-
- wiz->cleanup_cb = NULL;
-
- if (wiz->ok_cb)
- wiz->ok_cb (wiz, wiz->closure);
-
- if (old_cleanup)
- old_cleanup (old_closure);
-
-}
-
-static void
-mini_wizard_cancel_cb (GtkWidget *b, gpointer closure)
-{
- mini_wizard_destroy ((MiniWizard *) closure);
-}
-
-static void
-mini_wizard_destroy_cb (GtkWidget *w, gpointer closure)
-{
- MiniWizard *wiz = (MiniWizard *) closure;
- if (wiz->cleanup_cb)
- wiz->cleanup_cb (wiz->closure);
- g_free (wiz);
-}
-
-static MiniWizard *
-mini_wizard_new (void)
-{
- MiniWizard *wiz = g_new (MiniWizard, 1);
- GtkWidget *hbox;
-
- wiz->body = gtk_vbox_new (FALSE, 2);
- wiz->vbox = gtk_vbox_new (FALSE, 2);
- wiz->ok_button = gnome_stock_button (GNOME_STOCK_BUTTON_OK);
- wiz->cancel_button = gnome_stock_button (GNOME_STOCK_BUTTON_CANCEL);
-
- wiz->ok_cb = NULL;
- wiz->cleanup_cb = NULL;
- wiz->closure = NULL;
-
- wiz->destroy_cb = NULL;
- wiz->destroy_closure = NULL;
-
- hbox = gtk_hbox_new (FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), wiz->ok_button, TRUE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), wiz->cancel_button, TRUE, FALSE, 2);
-
- gtk_box_pack_start (GTK_BOX (wiz->body), wiz->vbox, TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (wiz->body), gtk_hseparator_new (), FALSE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (wiz->body), hbox, FALSE, TRUE, 2);
-
- gtk_widget_show_all (wiz->body);
-
- gtk_signal_connect (GTK_OBJECT (wiz->ok_button),
- "clicked",
- GTK_SIGNAL_FUNC (mini_wizard_ok_cb),
- wiz);
- gtk_signal_connect (GTK_OBJECT (wiz->cancel_button),
- "clicked",
- GTK_SIGNAL_FUNC (mini_wizard_cancel_cb),
- wiz);
- gtk_signal_connect (GTK_OBJECT (wiz->body),
- "destroy",
- GTK_SIGNAL_FUNC (mini_wizard_destroy_cb),
- wiz);
-
- return wiz;
-
-}
-
-
-
-/*
- * This is the code for the UI thingie that lets you manipulate the e-mail
- * addresses (and *only* the e-mail addresses) associated with an existing
- * card.
- */
-
-#define EMPTY_ENTRY N_("(none)")
-
-typedef struct _EMailMenu EMailMenu;
-struct _EMailMenu {
- GtkWidget *option_menu;
- GList *options;
- gchar *current_selection;
-};
-
-static void
-email_menu_free (EMailMenu *menu)
-{
- if (menu == NULL)
- return;
-
- g_list_foreach (menu->options, (GFunc) g_free, NULL);
- g_list_free (menu->options);
- g_free (menu);
-}
-
-static EMailMenu *
-email_menu_new (void)
-{
- EMailMenu *menu = g_new (EMailMenu, 1);
-
- menu->option_menu = gtk_option_menu_new ();
- menu->options = NULL;
- menu->current_selection = NULL;
-
- gtk_option_menu_set_menu (GTK_OPTION_MENU (menu->option_menu), gtk_menu_new ());
-
- return menu;
-}
-
-static void
-menu_activate_cb (GtkWidget *w, gpointer closure)
-{
- EMailMenu *menu = (EMailMenu *) closure;
- gchar *addr = (gchar *) gtk_object_get_data (GTK_OBJECT (w), "addr");
-
- menu->current_selection = addr;
-}
-
-static void
-email_menu_add_option (EMailMenu *menu, const gchar *addr)
-{
- GtkWidget *menu_item;
- gchar *addr_cpy;
-
- g_return_if_fail (menu != NULL);
- if (addr == NULL)
- return;
-
- addr_cpy = g_strdup (addr);
- menu->options = g_list_append (menu->options, addr_cpy);
-
- menu_item = gtk_menu_item_new_with_label (addr);
- gtk_object_set_data (GTK_OBJECT (menu_item), "addr", addr_cpy);
- gtk_widget_show_all (menu_item);
- gtk_menu_append (GTK_MENU (gtk_option_menu_get_menu (GTK_OPTION_MENU (menu->option_menu))), menu_item);
-
- gtk_signal_connect (GTK_OBJECT (menu_item),
- "activate",
- menu_activate_cb,
- menu);
-}
-
-static void
-email_menu_add_options_from_card (EMailMenu *menu, ECard *card, const gchar *extra_addr)
-{
- ECardSimple *simple;
-
- g_return_if_fail (card && E_IS_CARD (card));
-
- simple = e_card_simple_new (card);
-
- /* If any of these three e-mail fields are NULL, email_menu_add_option will just
- return without doing anything. */
- email_menu_add_option (menu, e_card_simple_get_email (simple, E_CARD_SIMPLE_EMAIL_ID_EMAIL));
- email_menu_add_option (menu, e_card_simple_get_email (simple, E_CARD_SIMPLE_EMAIL_ID_EMAIL_2));
- email_menu_add_option (menu, e_card_simple_get_email (simple, E_CARD_SIMPLE_EMAIL_ID_EMAIL_3));
- email_menu_add_option (menu, extra_addr);
- email_menu_add_option (menu, EMPTY_ENTRY);
-
- gtk_object_unref (GTK_OBJECT (simple));
-}
-
-static void
-email_menu_set_option (EMailMenu *menu, const gchar *addr)
-{
- guint count = 0;
- GList *iter;
-
- g_return_if_fail (menu != NULL);
-
- if (addr == NULL) {
- email_menu_set_option (menu, EMPTY_ENTRY);
- return;
- }
-
- iter = menu->options;
- while (iter && strcmp (addr, (gchar *) iter->data)) {
- ++count;
- iter = g_list_next (iter);
- }
-
- if (iter) {
- gtk_option_menu_set_history (GTK_OPTION_MENU (menu->option_menu), count);
- menu->current_selection = (gchar *) iter->data;
- }
-}
-
-#ifdef UNDEFINED_FUNCTIONS_SHOULD_PLEASE_BE_INCLUDED
-static void
-email_menu_unset_option (EMailMenu *menu, const gchar *addr)
-{
- GList *iter;
-
- g_return_if_fail (menu != NULL);
- g_return_if_fail (addr != NULL);
-
- if (menu->current_selection == NULL || strcmp (addr, menu->current_selection))
- return;
-
- iter = menu->options;
- while (iter && strcmp (addr, (gchar *) iter->data)) {
- iter = g_list_next (iter);
- }
- if (iter) {
- iter = g_list_next (iter);
- if (iter) {
- email_menu_set_option (menu, (gchar *) iter->data);
- } else {
- email_menu_set_option (menu, EMPTY_ENTRY);
- }
- }
-}
-#endif
-
-
-
-typedef struct _EMailTable EMailTable;
-struct _EMailTable {
- GtkWidget *table;
- ECard *card;
- EMailMenu *primary;
- EMailMenu *email2;
- EMailMenu *email3;
-};
-
-static void
-email_table_cleanup_cb (gpointer closure)
-{
- EMailTable *et = (EMailTable *) closure;
-
- if (et == NULL)
- return;
-
- gtk_object_unref (GTK_OBJECT (et->card));
- email_menu_free (et->primary);
- email_menu_free (et->email2);
- email_menu_free (et->email3);
-
- g_free (et);
-}
-
-static void
-email_table_from_card (EMailTable *et)
-{
- ECardSimple *simple;
-
- g_return_if_fail (et != NULL);
-
- simple = e_card_simple_new (et->card);
- email_menu_set_option (et->primary, e_card_simple_get_email (simple, E_CARD_SIMPLE_EMAIL_ID_EMAIL));
- email_menu_set_option (et->email2, e_card_simple_get_email (simple, E_CARD_SIMPLE_EMAIL_ID_EMAIL_2));
- email_menu_set_option (et->email3, e_card_simple_get_email (simple, E_CARD_SIMPLE_EMAIL_ID_EMAIL_3));
- gtk_object_unref (GTK_OBJECT (simple));
-}
-
-static void
-email_table_to_card (EMailTable *et)
-{
- ECardSimple *simple;
- gchar *curr;
-
- g_return_if_fail (et != NULL);
-
- simple = e_card_simple_new (et->card);
-
- curr = et->primary->current_selection;
- if (curr && !strcmp (curr, _(EMPTY_ENTRY)))
- curr = NULL;
- e_card_simple_set_email (simple, E_CARD_SIMPLE_EMAIL_ID_EMAIL, curr);
-
- curr = et->email2->current_selection;
- if (curr && !strcmp (curr, _(EMPTY_ENTRY)))
- curr = NULL;
- e_card_simple_set_email (simple, E_CARD_SIMPLE_EMAIL_ID_EMAIL_2, curr);
-
- curr = et->email3->current_selection;
- if (curr && !strcmp (curr, _(EMPTY_ENTRY)))
- curr = NULL;
- e_card_simple_set_email (simple, E_CARD_SIMPLE_EMAIL_ID_EMAIL_3, curr);
-
- e_card_simple_sync_card (simple);
- gtk_object_unref (GTK_OBJECT (simple));
-}
-
-static void
-email_table_save_card_cb (EBook *book, gpointer closure)
-{
- ECard *card = E_CARD (closure);
-
- if (book) {
- e_book_commit_card (book, card, NULL, NULL);
- }
- gtk_object_unref (GTK_OBJECT (card));
-}
-
-/*
- * We have to do this in an idle function because of what might be a
- * re-entrancy problems with EBook.
- */
-static gint
-add_card_idle_cb (gpointer closure)
-{
- e_book_use_local_address_book (email_table_save_card_cb, closure);
- return 0;
-}
-
-static void
-email_table_ok_cb (MiniWizard *wiz, gpointer closure)
-{
- EMailTable *et = (EMailTable *) closure;
-
- email_table_to_card (et);
-
- gtk_object_ref (GTK_OBJECT (et->card));
- gtk_idle_add (add_card_idle_cb, et->card);
-
- mini_wizard_destroy (wiz);
-}
-
-static void
-email_table_init (MiniWizard *wiz, ECard *card, const gchar *extra_address)
-{
- EMailTable *et;
-
- gchar *name_str;
- gint xpad, ypad;
- GtkAttachOptions label_x_opts, label_y_opts;
- GtkAttachOptions menu_x_opts, menu_y_opts;
-
- g_return_if_fail (card && E_IS_CARD (card));
-
- et = g_new (EMailTable, 1);
-
- et->card = card;
- gtk_object_ref (GTK_OBJECT (et->card));
-
- et->table = gtk_table_new (4, 2, FALSE);
-
- et->primary = email_menu_new ();
- et->email2 = email_menu_new ();
- et->email3 = email_menu_new ();
-
- email_menu_add_options_from_card (et->primary, et->card, extra_address);
- email_menu_add_options_from_card (et->email2, et->card, extra_address);
- email_menu_add_options_from_card (et->email3, et->card, extra_address);
-
- email_table_from_card (et);
-
- label_x_opts = GTK_FILL;
- label_y_opts = GTK_FILL;
- menu_x_opts = GTK_EXPAND | GTK_FILL;
- menu_y_opts = GTK_EXPAND | GTK_FILL;
- xpad = 3;
- ypad = 3;
-
- name_str = e_card_name_to_string (et->card->name);
- gtk_table_attach (GTK_TABLE (et->table),
- gtk_label_new (name_str),
- 0, 2, 0, 1,
- label_x_opts, label_y_opts, xpad, ypad);
- g_free (name_str);
-
- gtk_table_attach (GTK_TABLE (et->table),
- gtk_label_new (_("Primary Email")),
- 0, 1, 1, 2,
- label_x_opts, label_y_opts, xpad, ypad);
-
- gtk_table_attach (GTK_TABLE (et->table),
- et->primary->option_menu,
- 1, 2, 1, 2,
- menu_x_opts, menu_y_opts, xpad, ypad);
-
- gtk_table_attach (GTK_TABLE (et->table),
- gtk_label_new (_("Email 2")),
- 0, 1, 2, 3,
- label_x_opts, label_y_opts, xpad, ypad);
-
- gtk_table_attach (GTK_TABLE (et->table),
- et->email2->option_menu,
- 1, 2, 2, 3,
- menu_x_opts, menu_y_opts, xpad, ypad);
-
- gtk_table_attach (GTK_TABLE (et->table),
- gtk_label_new (_("Email 3")),
- 0, 1, 3, 4,
- label_x_opts, label_y_opts, xpad, ypad);
-
- gtk_table_attach (GTK_TABLE (et->table),
- et->email3->option_menu,
- 1, 2, 3, 4,
- menu_x_opts, menu_y_opts, xpad, ypad);
-
- gtk_widget_show_all (et->primary->option_menu);
- gtk_widget_show_all (et->email2->option_menu);
- gtk_widget_show_all (et->email3->option_menu);
-
- gtk_widget_show_all (et->table);
- mini_wizard_container_add (wiz, et->table);
- wiz->ok_cb = email_table_ok_cb;
- wiz->cleanup_cb = email_table_cleanup_cb;
- wiz->closure = et;
-}
-
-/*
- * This code is for the little UI thing that lets you pick from a set of cards
- * and decide which one you want to add the e-mail address to.
- */
-
-typedef struct _CardPicker CardPicker;
-struct _CardPicker {
- GtkWidget *body;
- GtkWidget *clist;
- GList *cards;
- gchar *new_name;
- gchar *new_email;
-
- gint current_row;
-};
-
-static void
-card_picker_row_select_cb (GtkCList *clist, gint row, gint col, GdkEventButton *ev, gpointer closure)
-{
- MiniWizard *wiz = (MiniWizard *) closure;
- CardPicker *pick = (CardPicker *) wiz->closure;
- pick->current_row = row;
- gtk_widget_set_sensitive (wiz->ok_button, TRUE);
-}
-
-static void
-card_picker_row_unselect_cb (GtkCList *clist, gint row, gint col, GdkEventButton *ev, gpointer closure)
-{
- MiniWizard *wiz = (MiniWizard *) closure;
- CardPicker *pick = (CardPicker *) wiz->closure;
- pick->current_row = -1;
- gtk_widget_set_sensitive (wiz->ok_button, FALSE);
-}
-
-static void
-card_picker_ok_cb (MiniWizard *wiz, gpointer closure)
-{
- CardPicker *pick = (CardPicker *) closure;
- g_return_if_fail (pick->current_row >= 0);
-
- if (pick->current_row == 0) {
- e_contact_quick_add (pick->new_name, pick->new_email, NULL, NULL);
- mini_wizard_destroy (wiz);
- } else {
- ECard *card = (ECard *) g_list_nth_data (pick->cards, pick->current_row-1);
- email_table_init (wiz, card, pick->new_email);
- }
-}
-
-static void
-card_picker_cleanup_cb (gpointer closure)
-{
- CardPicker *pick = (CardPicker *) closure;
-
- g_list_foreach (pick->cards, (GFunc) gtk_object_unref, NULL);
- g_list_free (pick->cards);
-
- g_free (pick->new_name);
- g_free (pick->new_email);
-}
-
-static void
-card_picker_init (MiniWizard *wiz, const GList *cards, const gchar *new_name, const gchar *new_email)
-{
- CardPicker *pick;
- gchar *str;
- GtkWidget *w, *swin;
-
- pick = g_new (CardPicker, 1);
-
- pick->body = gtk_vbox_new (FALSE, 2);
-
- pick->clist = gtk_clist_new (1);
- gtk_clist_set_column_title (GTK_CLIST (pick->clist), 0, _("Select an Action"));
- gtk_clist_column_titles_show (GTK_CLIST (pick->clist));
- gtk_clist_set_selection_mode (GTK_CLIST (pick->clist), GTK_SELECTION_SINGLE);
-
- gtk_clist_freeze (GTK_CLIST (pick->clist));
-
- str = g_strdup_printf (_("Create a new contact \"%s\""), new_name);
- gtk_clist_append (GTK_CLIST (pick->clist), &str);
- g_free (str);
-
- pick->cards = NULL;
- while (cards) {
- ECard *card = (ECard *) cards->data;
- gchar *name_str = e_card_name_to_string (card->name);
-
- pick->cards = g_list_append (pick->cards, card);
- gtk_object_ref (GTK_OBJECT (card));
-
- str = g_strdup_printf (_("Add address to existing contact \"%s\""), name_str);
- gtk_clist_append (GTK_CLIST (pick->clist), &str);
- g_free (name_str);
- g_free (str);
-
- cards = g_list_next (cards);
- }
-
- gtk_clist_thaw (GTK_CLIST (pick->clist));
-
- pick->new_name = g_strdup (new_name);
- pick->new_email = g_strdup (new_email);
-
- pick->current_row = -1;
- gtk_widget_set_sensitive (wiz->ok_button, FALSE);
-
- /* Connect some signals & callbacks */
-
- wiz->ok_cb = card_picker_ok_cb;
- wiz->cleanup_cb = card_picker_cleanup_cb;
-
- gtk_signal_connect (GTK_OBJECT (pick->clist),
- "select-row",
- GTK_SIGNAL_FUNC (card_picker_row_select_cb),
- wiz);
- gtk_signal_connect (GTK_OBJECT (pick->clist),
- "unselect-row",
- GTK_SIGNAL_FUNC (card_picker_row_unselect_cb),
- wiz);
-
- /* Build our widget */
-
- w = gtk_label_new (new_email);
- gtk_box_pack_start (GTK_BOX (pick->body), w, FALSE, TRUE, 3);
-
- swin = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (swin), pick->clist);
-
- gtk_box_pack_start (GTK_BOX (pick->body), swin, TRUE, TRUE, 2);
- gtk_widget_show_all (pick->body);
-
-
- /* Put it in our mini-wizard */
-
- wiz->closure = pick;
- mini_wizard_container_add (wiz, pick->body);
-}
-
-/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */
-
-/*
- * The code for the actual EAddressPopup widget begins here.
- */
-
-/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */
-
-
-static GtkObjectClass *parent_class;
-
-static void e_address_popup_destroy (GtkObject *);
-static void e_address_popup_query (EAddressPopup *);
-
-
-static void
-e_address_popup_class_init (EAddressPopupClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
-
- parent_class = GTK_OBJECT_CLASS (gtk_type_class (gtk_event_box_get_type ()));
-
- object_class->destroy = e_address_popup_destroy;
-}
-
-static void
-e_address_popup_init (EAddressPopup *pop)
-{
- pop->transitory = TRUE;
-}
-
-static void
-e_address_popup_destroy (GtkObject *obj)
-{
- EAddressPopup *pop = E_ADDRESS_POPUP (obj);
-
- if (pop->card)
- gtk_object_unref (GTK_OBJECT (pop->card));
-
- if (pop->scheduled_refresh)
- gtk_idle_remove (pop->scheduled_refresh);
-
- g_free (pop->name);
- g_free (pop->email);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- GTK_OBJECT_CLASS (parent_class)->destroy (obj);
-}
-
-GtkType
-e_address_popup_get_type (void)
-{
- static GtkType pop_type = 0;
-
- if (!pop_type) {
- GtkTypeInfo pop_info = {
- "EAddressPopup",
- sizeof (EAddressPopup),
- sizeof (EAddressPopupClass),
- (GtkClassInitFunc) e_address_popup_class_init,
- (GtkObjectInitFunc) e_address_popup_init,
- NULL, NULL,
- (GtkClassInitFunc) NULL
- };
-
- pop_type = gtk_type_unique (gtk_event_box_get_type (), &pop_info);
- }
-
- return pop_type;
-}
-
-static void
-e_address_popup_refresh_names (EAddressPopup *pop)
-{
- if (pop->name_widget) {
- if (pop->name && *pop->name) {
- gchar *s = e_utf8_to_gtk_string (pop->name_widget, pop->name);
- gtk_label_set_text (GTK_LABEL (pop->name_widget), s);
- g_free (s);
- gtk_widget_show (pop->name_widget);
- } else {
- gtk_widget_hide (pop->name_widget);
- }
- }
-
- if (pop->email_widget) {
- if (pop->email && *pop->email) {
- gchar *s = e_utf8_to_gtk_string (pop->email_widget, pop->email);
- gtk_label_set_text (GTK_LABEL (pop->email_widget), s);
- g_free (s);
- gtk_widget_show (pop->email_widget);
- } else {
- gtk_widget_hide (pop->email_widget);
- }
- }
-
- e_address_popup_query (pop);
-}
-
-static gint
-refresh_idle_cb (gpointer ptr)
-{
- EAddressPopup *pop = E_ADDRESS_POPUP (ptr);
- e_address_popup_refresh_names (pop);
- pop->scheduled_refresh = 0;
- return 0;
-}
-
-static void
-e_address_popup_schedule_refresh (EAddressPopup *pop)
-{
- if (pop->scheduled_refresh == 0)
- pop->scheduled_refresh = gtk_idle_add (refresh_idle_cb, pop);
-}
-
-/* If we are handed something of the form "Foo <bar@bar.com>",
- do the right thing. */
-static gboolean
-e_address_popup_set_free_form (EAddressPopup *pop, const gchar *txt)
-{
- gchar *lt, *gt = NULL;
-
- g_return_val_if_fail (pop && E_IS_ADDRESS_POPUP (pop), FALSE);
-
- if (txt == NULL)
- return FALSE;
-
- lt = strchr (txt, '<');
- if (lt)
- gt = strchr (txt, '>');
-
- if (lt && gt && lt+1 < gt) {
- gchar *name = g_strndup (txt, lt-txt);
- gchar *email = g_strndup (lt+1, gt-lt-1);
- e_address_popup_set_name (pop, name);
- e_address_popup_set_email (pop, email);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-void
-e_address_popup_set_name (EAddressPopup *pop, const gchar *name)
-{
- g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop));
-
- /* We only allow the name to be set once. */
- if (pop->name)
- return;
-
- if (!e_address_popup_set_free_form (pop, name)) {
- pop->name = g_strdup (name);
- if (pop->name)
- g_strstrip (pop->name);
- }
-
- e_address_popup_schedule_refresh (pop);
-}
-
-void
-e_address_popup_set_email (EAddressPopup *pop, const gchar *email)
-{
- g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop));
-
- /* We only allow the e-mail to be set once. */
- if (pop->email)
- return;
-
- if (!e_address_popup_set_free_form (pop, email)) {
- pop->email = g_strdup (email);
- if (pop->email)
- g_strstrip (pop->email);
- }
-
- e_address_popup_schedule_refresh (pop);
-}
-
-void
-e_address_popup_construct (EAddressPopup *pop)
-{
- GtkWidget *vbox, *name_holder;
- GdkColor color = { 0x0, 0xffff, 0xffff, 0xffff };
-
- g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop));
-
- pop->main_vbox = gtk_vbox_new (FALSE, 0);
-
- /* Build Generic View */
-
- name_holder = gtk_event_box_new ();
- vbox = gtk_vbox_new (FALSE, 2);
- pop->name_widget = gtk_label_new ("");
- pop->email_widget = gtk_label_new ("");
-
- gtk_box_pack_start (GTK_BOX (vbox), pop->name_widget, TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (vbox), pop->email_widget, TRUE, TRUE, 2);
- gtk_container_add (GTK_CONTAINER (name_holder), GTK_WIDGET (vbox));
-
- if (gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (name_holder)), &color, FALSE, TRUE)) {
- GtkStyle *style = gtk_style_copy (gtk_widget_get_style (GTK_WIDGET (name_holder)));
- style->bg[0] = color;
- gtk_widget_set_style (GTK_WIDGET (name_holder), style);
- }
-
- pop->generic_view = gtk_frame_new (NULL);
- gtk_container_add (GTK_CONTAINER (pop->generic_view), name_holder);
- gtk_box_pack_start (GTK_BOX (pop->main_vbox), pop->generic_view, TRUE, TRUE, 0);
- gtk_widget_show_all (pop->generic_view);
-
- pop->query_msg = gtk_label_new (_("Querying Addressbook..."));
- gtk_box_pack_start (GTK_BOX (pop->main_vbox), pop->query_msg, TRUE, TRUE, 0);
- gtk_widget_show (pop->query_msg);
-
- /* Build Minicard View */
- pop->minicard_view = e_minicard_widget_new ();
- gtk_box_pack_start (GTK_BOX (pop->main_vbox), pop->minicard_view, TRUE, TRUE, 0);
-
-
- /* Final assembly */
-
- gtk_container_add (GTK_CONTAINER (pop), pop->main_vbox);
- gtk_widget_show (pop->main_vbox);
-
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 3);
- gtk_container_set_border_width (GTK_CONTAINER (pop), 2);
-}
-
-GtkWidget *
-e_address_popup_new (void)
-{
- EAddressPopup *pop = gtk_type_new (E_ADDRESS_POPUP_TYPE);
- e_address_popup_construct (pop);
- return GTK_WIDGET (pop);
-}
-
-static void
-contact_editor_cb (EBook *book, gpointer closure)
-{
- EAddressPopup *pop = E_ADDRESS_POPUP (closure);
- EContactEditor *ce = e_addressbook_show_contact_editor (book, pop->card, FALSE, TRUE);
- e_contact_editor_raise (ce);
-}
-
-static void
-edit_contact_info_cb (EAddressPopup *pop)
-{
- e_book_use_local_address_book (contact_editor_cb, pop);
- gtk_widget_destroy (GTK_WIDGET (pop));
-}
-
-static void
-e_address_popup_cardify (EAddressPopup *pop, ECard *card)
-{
- GtkWidget *b;
-
- g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop));
- g_return_if_fail (card && E_IS_CARD (card));
- g_return_if_fail (pop->card == NULL);
-
- pop->card = card;
- gtk_object_ref (GTK_OBJECT (pop->card));
-
- e_minicard_widget_set_card (E_MINICARD_WIDGET (pop->minicard_view), card);
- gtk_widget_show (pop->minicard_view);
- gtk_widget_hide (pop->generic_view);
-
- b = gtk_button_new_with_label (_("Edit Contact Info"));
- gtk_box_pack_start (GTK_BOX (pop->main_vbox), b, TRUE, TRUE, 0);
- gtk_signal_connect_object (GTK_OBJECT (b),
- "clicked",
- GTK_SIGNAL_FUNC (edit_contact_info_cb),
- GTK_OBJECT (pop));
- gtk_widget_show (b);
-}
-
-static void
-add_contacts_cb (EAddressPopup *pop)
-{
- if (pop->email && *pop->email) {
- if (pop->name && *pop->name)
- e_contact_quick_add (pop->name, pop->email, NULL, NULL);
- else
- e_contact_quick_add_free_form (pop->email, NULL, NULL);
-
- }
-
- gtk_widget_destroy (GTK_WIDGET (pop));
-}
-
-static void
-e_address_popup_no_matches (EAddressPopup *pop)
-{
- GtkWidget *b;
-
- g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop));
-
- b = gtk_button_new_with_label (_("Add to Contacts"));
- gtk_box_pack_start (GTK_BOX (pop->main_vbox), b, TRUE, TRUE, 0);
- gtk_signal_connect_object (GTK_OBJECT (b),
- "clicked",
- GTK_SIGNAL_FUNC (add_contacts_cb),
- GTK_OBJECT (pop));
- gtk_widget_show (b);
-}
-
-static void
-wizard_destroy_cb (MiniWizard *wiz, gpointer closure)
-{
- gtk_widget_destroy (GTK_WIDGET (closure));
-}
-
-static void
-popup_size_allocate_cb (GtkWidget *widget, GtkAllocation *alloc, gpointer user_data)
-{
- gint x, y, w, h, xmax, ymax;
-
- xmax = gdk_screen_width ();
- ymax = gdk_screen_height ();
-
- if (gtk_object_get_data (GTK_OBJECT (widget), "size_allocate") == NULL) {
- gdk_window_get_pointer (NULL, &x, &y, NULL);
- w = alloc->width;
- h = alloc->height;
- x = CLAMP (x - w/2, 0, xmax - w);
- y = CLAMP (y - h/2, 0, ymax - h);
- gtk_widget_set_uposition (widget, x, y);
- gtk_object_set_data (GTK_OBJECT (widget), "size_allocate", widget);
- }
-}
-
-static void
-e_address_popup_ambiguous_email_add (EAddressPopup *pop, const GList *cards)
-{
- MiniWizard *wiz = mini_wizard_new ();
- GtkWidget *win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- wiz->destroy_cb = wizard_destroy_cb;
- wiz->destroy_closure = win;
-
- gtk_window_set_title (GTK_WINDOW (win), _("Merge E-Mail Address"));
- gtk_signal_connect (GTK_OBJECT (win),
- "size_allocate",
- GTK_SIGNAL_FUNC (popup_size_allocate_cb),
- NULL);
-
- /* FIXME: This hard-wired size is evil. */
- gtk_widget_set_usize (win, 275, 170);
-
- card_picker_init (wiz, cards, pop->name, pop->email);
-
- gtk_widget_destroy (GTK_WIDGET (pop));
- gtk_container_add (GTK_CONTAINER (win), wiz->body);
- gtk_widget_show_all (win);
-}
-
-static void
-e_address_popup_multiple_matches (EAddressPopup *pop, const GList *cards)
-{
- pop->multiple_matches = TRUE;
-
- e_address_popup_ambiguous_email_add (pop, cards);
-}
-
-/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
-
-/*
- * Addressbook Query Fun
- */
-
-static void
-name_only_query_cb (EBook *book, EBookSimpleQueryStatus status, const GList *cards, gpointer closure)
-{
- EAddressPopup *pop;
-
- if (status != E_BOOK_SIMPLE_QUERY_STATUS_SUCCESS)
- return;
-
- pop = E_ADDRESS_POPUP (closure);
-
- pop->query_tag = 0;
-
- if (cards == NULL) {
- e_address_popup_no_matches (pop);
- } else {
- e_address_popup_ambiguous_email_add (pop, cards);
- }
-}
-
-static void
-query_cb (EBook *book, EBookSimpleQueryStatus status, const GList *cards, gpointer closure)
-{
- EAddressPopup *pop;
-
- if (status != E_BOOK_SIMPLE_QUERY_STATUS_SUCCESS)
- return;
-
- pop = E_ADDRESS_POPUP (closure);
-
- pop->query_tag = 0;
- gtk_widget_hide (pop->query_msg);
-
- if (cards == NULL) {
-
- /* Do a name-only query if:
- (1) The name is non-empty.
- (2) The e-mail is also non-empty (so that the query we just did wasn't actually a name-only query.
- */
- if (pop->name && *pop->name && pop->email && *pop->email) {
- pop->query_tag = e_book_name_and_email_query (book, pop->name, NULL, name_only_query_cb, pop);
- } else {
- e_address_popup_no_matches (pop);
- }
-
- } else {
- if (g_list_length ((GList *) cards) == 1)
- e_address_popup_cardify (pop, E_CARD (cards->data));
- else
- e_address_popup_multiple_matches (pop, cards);
- }
-}
-
-static void
-start_query (EBook *book, gpointer closure)
-{
- EAddressPopup *pop = E_ADDRESS_POPUP (closure);
-
- if (pop->query_tag)
- e_book_simple_query_cancel (book, pop->query_tag);
-
- pop->query_tag = e_book_name_and_email_query (book, pop->name, pop->email, query_cb, pop);
-}
-
-static void
-e_address_popup_query (EAddressPopup *pop)
-{
- g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop));
-
- e_book_use_local_address_book (start_query, pop);
-}
-
-/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
-
-enum {
- PROPERTY_NAME,
- PROPERTY_EMAIL,
- PROPERTY_TRANSITORY
-};
-
-static void
-set_prop (BonoboPropertyBag *bag, const BonoboArg *arg, guint arg_id, CORBA_Environment *ev, gpointer user_data)
-{
- EAddressPopup *pop = E_ADDRESS_POPUP (user_data);
-
- switch (arg_id) {
-
- case PROPERTY_NAME:
- e_address_popup_set_name (pop, BONOBO_ARG_GET_STRING (arg));
- break;
-
- case PROPERTY_EMAIL:
- e_address_popup_set_email (pop, BONOBO_ARG_GET_STRING (arg));
- break;
-
- default:
- g_assert_not_reached ();
- }
-}
-
-static void
-get_prop (BonoboPropertyBag *bag, BonoboArg *arg, guint arg_id, CORBA_Environment *ev, gpointer user_data)
-{
- EAddressPopup *pop = E_ADDRESS_POPUP (user_data);
-
- switch (arg_id) {
-
- case PROPERTY_NAME:
- BONOBO_ARG_SET_STRING (arg, pop->name);
- break;
-
- case PROPERTY_EMAIL:
- BONOBO_ARG_SET_STRING (arg, pop->email);
- break;
-
- case PROPERTY_TRANSITORY:
- BONOBO_ARG_SET_BOOLEAN (arg, pop->transitory);
- break;
-
- default:
- g_assert_not_reached ();
- }
-}
-
-static BonoboControl *
-e_address_popup_factory_new_control (void)
-{
- BonoboControl *control;
- BonoboPropertyBag *bag;
- GtkWidget *w;
-
- w = e_address_popup_new ();
- control = bonobo_control_new (w);
- gtk_widget_show (w);
-
- gtk_signal_connect_object (GTK_OBJECT (w),
- "destroy",
- GTK_SIGNAL_FUNC (bonobo_object_unref),
- GTK_OBJECT (control));
-
- bag = bonobo_property_bag_new (get_prop, set_prop, w);
- bonobo_property_bag_add (bag, "name", PROPERTY_NAME,
- BONOBO_ARG_STRING, NULL, NULL,
- BONOBO_PROPERTY_WRITEABLE | BONOBO_PROPERTY_READABLE);
-
- bonobo_property_bag_add (bag, "email", PROPERTY_EMAIL,
- BONOBO_ARG_STRING, NULL, NULL,
- BONOBO_PROPERTY_WRITEABLE | BONOBO_PROPERTY_READABLE);
-
- bonobo_property_bag_add (bag, "transitory", PROPERTY_TRANSITORY,
- BONOBO_ARG_BOOLEAN, NULL, NULL,
- BONOBO_PROPERTY_READABLE);
-
- bonobo_control_set_properties (control, bag);
- bonobo_object_unref (BONOBO_OBJECT (bag));
-
- return control;
-}
-
-static BonoboObject *
-e_address_popup_factory (BonoboGenericFactory *factory, gpointer user_data)
-{
- return BONOBO_OBJECT (e_address_popup_factory_new_control ());
-}
-
-void
-e_address_popup_factory_init (void)
-{
- static BonoboGenericFactory *factory = NULL;
-
- if (factory != NULL)
- return;
-
- factory = bonobo_generic_factory_new ("OAFIID:GNOME_Evolution_Addressbook_AddressPopupFactory",
- e_address_popup_factory, NULL);
-
- if (factory == NULL)
- g_error ("I could not register an AddressPopup factory.");
-}
diff --git a/addressbook/gui/component/e-address-popup.h b/addressbook/gui/component/e-address-popup.h
deleted file mode 100644
index 9cfde6cb28..0000000000
--- a/addressbook/gui/component/e-address-popup.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * e-address-popup.h
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Developed by Jon Trowbridge <trow@ximian.com>
- */
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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_ADDRESS_POPUP_H__
-#define __E_ADDRESS_POPUP_H__
-
-#include <gtk/gtk.h>
-#include <libgnome/gnome-defs.h>
-#include <addressbook/backend/ebook/e-card.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_ADDRESS_POPUP_TYPE (e_address_popup_get_type ())
-#define E_ADDRESS_POPUP(o) (GTK_CHECK_CAST ((o), E_ADDRESS_POPUP_TYPE, EAddressPopup))
-#define E_ADDRESS_POPUP_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), E_ADDRESS_POPUP_TYPE, EAddressPopupClass))
-#define E_IS_ADDRESS_POPUP(o) (GTK_CHECK_TYPE ((o), E_ADDRESS_POPUP_TYPE))
-#define E_IS_ADDRESS_POPUP_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_ADDRESS_POPUP_TYPE))
-
-typedef struct _EAddressPopup EAddressPopup;
-typedef struct _EAddressPopupClass EAddressPopupClass;
-
-struct _EAddressPopup {
- GtkEventBox parent;
-
- gchar *name;
- gchar *email;
-
- GtkWidget *name_widget;
- GtkWidget *email_widget;
- GtkWidget *query_msg;
-
- GtkWidget *main_vbox;
- GtkWidget *generic_view;
- GtkWidget *minicard_view;
-
- gboolean transitory;
-
- guint scheduled_refresh;
- guint query_tag;
- gboolean multiple_matches;
- ECard *card;
-};
-
-struct _EAddressPopupClass {
- GtkEventBoxClass parent_class;
-};
-
-GtkType e_address_popup_get_type (void);
-
-void e_address_popup_set_name (EAddressPopup *, const gchar *name);
-void e_address_popup_set_email (EAddressPopup *, const gchar *email);
-
-void e_address_popup_construct (EAddressPopup *);
-GtkWidget *e_address_popup_new (void);
-
-void e_address_popup_factory_init (void);
-
-END_GNOME_DECLS
-
-#endif /* __E_ADDRESS_POPUP_H__ */
-
diff --git a/addressbook/gui/component/e-address-widget.c b/addressbook/gui/component/e-address-widget.c
deleted file mode 100644
index 2f81c70b36..0000000000
--- a/addressbook/gui/component/e-address-widget.c
+++ /dev/null
@@ -1,577 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * e-address-widget.c
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Developed by Jon Trowbridge <trow@ximian.com>
- */
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <config.h>
-#include <ctype.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-property-bag.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <addressbook/gui/contact-editor/e-contact-quick-add.h>
-#include "e-address-widget.h"
-
-static void e_address_widget_class_init (EAddressWidgetClass *klass);
-static void e_address_widget_init (EAddressWidget *obj);
-static void e_address_widget_destroy (GtkObject *obj);
-
-static gint e_address_widget_button_press_handler (GtkWidget *w, GdkEventButton *ev);
-static void e_address_widget_popup (EAddressWidget *, GdkEventButton *ev);
-static void e_address_widget_schedule_query (EAddressWidget *);
-
-static GtkObjectClass *parent_class;
-
-static EBook *common_book = NULL; /* sort of lame */
-
-static gboolean doing_queries = FALSE;
-
-static void
-e_address_widget_class_init (EAddressWidgetClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
- parent_class = GTK_OBJECT_CLASS (gtk_type_class (gtk_event_box_get_type ()));
-
- object_class->destroy = e_address_widget_destroy;
-
- widget_class->button_press_event = e_address_widget_button_press_handler;
-}
-
-static void
-e_address_widget_init (EAddressWidget *addr)
-{
-
-}
-
-static void
-e_address_widget_destroy (GtkObject *obj)
-{
- EAddressWidget *addr = E_ADDRESS_WIDGET (obj);
-
- g_free (addr->name);
- g_free (addr->email);
-
- if (addr->query_tag)
- e_book_simple_query_cancel (common_book, addr->query_tag);
-
- if (addr->query_idle_tag)
- gtk_idle_remove (addr->query_idle_tag);
-}
-
-static gint
-e_address_widget_button_press_handler (GtkWidget *w, GdkEventButton *ev)
-{
- EAddressWidget *addr = E_ADDRESS_WIDGET (w);
- if (ev->button == 3 && ev->state == 0) {
- e_address_widget_popup (addr, ev);
- return TRUE;
- }
-
- return FALSE;
-}
-
-GtkType
-e_address_widget_get_type (void)
-{
- static GtkType aw_type = 0;
-
- if (!aw_type) {
- GtkTypeInfo aw_info = {
- "EAddressWidget",
- sizeof (EAddressWidget),
- sizeof (EAddressWidgetClass),
- (GtkClassInitFunc) e_address_widget_class_init,
- (GtkObjectInitFunc) e_address_widget_init,
- NULL, NULL, /* reserved... but for what sinister purpose? */
- (GtkClassInitFunc) NULL
- };
-
- aw_type = gtk_type_unique (gtk_event_box_get_type (), &aw_info);
- }
-
- return aw_type;
-}
-
-static void
-gtk_widget_visible (GtkWidget *w, gboolean x)
-{
- if (x)
- gtk_widget_show (w);
- else
- gtk_widget_hide (w);
-}
-
-static void
-e_address_widget_refresh (EAddressWidget *addr)
-{
- gchar *str;
- gboolean have_name, have_email;
-
- g_return_if_fail (addr && E_IS_ADDRESS_WIDGET (addr));
-
- have_name = addr->name && *addr->name;
- have_email = addr->email && *addr->email && (addr->card == NULL || !addr->known_email);
-
- gtk_label_set_text (GTK_LABEL (addr->name_widget), have_name ? addr->name : "");
- gtk_widget_visible (addr->name_widget, have_name);
- if (addr->card) {
- gint i, N = strlen (addr->name);
- gchar *pattern = g_malloc (N+1);
- for (i=0; i<N; ++i)
- pattern[i] = '_';
- pattern[i] = '\0';
- gtk_label_set_pattern (GTK_LABEL (addr->name_widget), pattern);
- g_free (pattern);
- } else {
- gtk_label_set_pattern (GTK_LABEL (addr->name_widget), "");
- }
-
- if (have_email) {
- str = g_strdup_printf (have_name ? "<%s>" : "%s", addr->email);
- gtk_label_set_text (GTK_LABEL (addr->email_widget), str);
- g_free (str);
- } else {
- gtk_label_set_text (GTK_LABEL (addr->email_widget), "");
- }
- gtk_widget_visible (addr->email_widget, have_email);
-
- gtk_widget_visible (addr->spacer, have_name && have_email);
-
- /* Launch a query to find the appropriate card, if necessary. */
- if (addr->card == NULL)
- e_address_widget_schedule_query (addr);
-}
-
-void
-e_address_widget_set_name (EAddressWidget *addr, const gchar *name)
-{
- g_return_if_fail (addr && E_IS_ADDRESS_WIDGET (addr));
-
- g_free (addr->name);
- addr->name = g_strdup (name);
-
- e_address_widget_refresh (addr);
-}
-
-void
-e_address_widget_set_email (EAddressWidget *addr, const gchar *email)
-{
- g_return_if_fail (addr && E_IS_ADDRESS_WIDGET (addr));
-
- g_free (addr->email);
- addr->email = g_strdup (email);
-
- e_address_widget_refresh (addr);
-}
-
-
-void
-e_address_widget_set_text (EAddressWidget *addr, const gchar *text)
-{
- g_return_if_fail (addr && E_IS_ADDRESS_WIDGET (addr));
-
- e_address_widget_set_email (addr, text); /* CRAP */
-}
-
-void
-e_address_widget_construct (EAddressWidget *addr)
-{
- GtkWidget *box;
-
- g_return_if_fail (addr && E_IS_ADDRESS_WIDGET (addr));
-
- box = gtk_hbox_new (FALSE, 2);
-
- addr->name_widget = gtk_label_new ("");
- addr->spacer = gtk_label_new (" ");
- addr->email_widget = gtk_label_new ("");
-
- gtk_box_pack_start (GTK_BOX (box), addr->name_widget, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (box), addr->spacer, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (box), addr->email_widget, FALSE, FALSE, 0);
-
- gtk_container_add (GTK_CONTAINER (addr), box);
-
- gtk_widget_show (box);
- gtk_widget_show (addr->name_widget);
- gtk_widget_show (addr->email_widget);
-}
-
-GtkWidget *
-e_address_widget_new (void)
-{
- EAddressWidget *addr = gtk_type_new (e_address_widget_get_type ());
- e_address_widget_construct (addr);
- return GTK_WIDGET (addr);
-}
-
-/*
- *
- * Cardification
- *
- */
-
-static void
-e_address_widget_cardify (EAddressWidget *addr, ECard *card, gboolean known_email)
-{
- if (addr->card != card || addr->known_email != known_email) {
-
- if (addr->card != card) {
- if (addr->card)
- gtk_object_unref (GTK_OBJECT (addr->card));
- addr->card = card;
- gtk_object_ref (GTK_OBJECT (addr->card));
- }
-
- addr->known_email = known_email;
-
- if (!(addr->name && *addr->name)) {
- gchar *s = e_card_name_to_string (card->name);
- e_address_widget_set_name (addr, s);
- g_free (s);
- }
-
- e_address_widget_refresh (addr);
- }
-}
-
-static void
-query_results_cb (EBook *book, EBookSimpleQueryStatus status, const GList *cards, gpointer user_data)
-{
- EAddressWidget *addr = user_data;
-
- if (g_list_length ((GList *) cards) == 1) {
- ECard *card = E_CARD (cards->data);
- e_address_widget_cardify (addr, card, TRUE);
- }
-
- addr->query_tag = 0;
-}
-
-static void
-e_address_widget_do_query (EAddressWidget *addr)
-{
- e_book_name_and_email_query (common_book, addr->name, addr->email, query_results_cb, addr);
-}
-
-static void
-book_ready_cb (EBook *book, EBookStatus status, gpointer user_data)
-{
- EAddressWidget *addr = E_ADDRESS_WIDGET (user_data);
-
- if (common_book == NULL) {
- common_book = book;
- gtk_object_ref (GTK_OBJECT (common_book));
- } else
- gtk_object_unref (GTK_OBJECT (book));
-
- e_address_widget_do_query (addr);
-}
-
-static gint
-query_idle_fn (gpointer ptr)
-{
- EAddressWidget *addr = E_ADDRESS_WIDGET (ptr);
-
- if (common_book) {
- e_address_widget_do_query (addr);
- } else {
- e_book_load_local_address_book (e_book_new (), book_ready_cb, addr);
- }
-
- addr->query_idle_tag = 0;
- return FALSE;
-}
-
-static void
-e_address_widget_schedule_query (EAddressWidget *addr)
-{
- if (addr->query_idle_tag || !doing_queries)
- return;
- addr->query_idle_tag = gtk_idle_add (query_idle_fn, addr);
-}
-
-/*
- *
- * Popup Menu
- *
- */
-
-#define ARBITRARY_UIINFO_LIMIT 64
-
-static gint
-popup_add_name_and_address (EAddressWidget *addr, GnomeUIInfo *uiinfo, gint i)
-{
- gboolean flag = FALSE;
-
- if (addr->name && *addr->name) {
- uiinfo[i].type = GNOME_APP_UI_ITEM;
- uiinfo[i].label = addr->name;
- ++i;
- flag = TRUE;
- }
-
- if (addr->email && *addr->email) {
- uiinfo[i].type = GNOME_APP_UI_ITEM;
- uiinfo[i].label = addr->email;
- ++i;
- flag = TRUE;
- }
-
- if (flag) {
- uiinfo[i].type = GNOME_APP_UI_SEPARATOR;
- ++i;
- }
-
- return i;
-}
-
-static void
-flip_queries_flag_cb (GtkWidget *w, gpointer user_data)
-{
- doing_queries = !doing_queries;
-}
-
-static gint
-popup_add_query_change (EAddressWidget *addr, GnomeUIInfo *uiinfo, gint i)
-{
- uiinfo[i].type = GNOME_APP_UI_SEPARATOR;
- ++i;
-
- uiinfo[i].type = GNOME_APP_UI_ITEM;
- uiinfo[i].label = doing_queries ? _("Disable Queries") : _("Enable Queries (Dangerous!)");
- uiinfo[i].moreinfo = flip_queries_flag_cb;
- ++i;
-
- return i;
-}
-
-
-static GtkWidget *
-popup_menu_card (EAddressWidget *addr)
-{
- GnomeUIInfo uiinfo[ARBITRARY_UIINFO_LIMIT];
- GtkWidget *pop;
- gint i=0;
- ECard *card = E_CARD (addr->card);
-
- g_return_val_if_fail (card != NULL, NULL);
-
- memset (uiinfo, 0, sizeof (uiinfo));
-
- i = popup_add_name_and_address (addr, uiinfo, i);
-
- uiinfo[i].type = GNOME_APP_UI_ITEM;
- uiinfo[i].label = _("Edit Contact Info");
- ++i;
-
- i = popup_add_query_change (addr, uiinfo, i);
-
- uiinfo[i].type = GNOME_APP_UI_ENDOFINFO;
- pop = gnome_popup_menu_new (uiinfo);
- return pop;
-}
-
-static void
-post_quick_add_cb (ECard *card, gpointer user_data)
-{
- e_address_widget_cardify (E_ADDRESS_WIDGET (user_data), card, TRUE);
-}
-
-static void
-add_contacts_cb (GtkWidget *w, gpointer user_data)
-{
- EAddressWidget *addr = E_ADDRESS_WIDGET (user_data);
-
- e_contact_quick_add (addr->name, addr->email, post_quick_add_cb, addr);
-}
-
-static GtkWidget *
-popup_menu_nocard (EAddressWidget *addr)
-{
- GnomeUIInfo uiinfo[ARBITRARY_UIINFO_LIMIT];
- GtkWidget *pop;
- gint i=0;
-
- memset (uiinfo, 0, sizeof (uiinfo));
-
- i = popup_add_name_and_address (addr, uiinfo, i);
-
- uiinfo[i].type = GNOME_APP_UI_ITEM;
- uiinfo[i].label = _("Add to Contacts");
- uiinfo[i].moreinfo = add_contacts_cb;
- ++i;
-
- i = popup_add_query_change (addr, uiinfo, i);
-
- uiinfo[i].type = GNOME_APP_UI_ENDOFINFO;
- pop = gnome_popup_menu_new (uiinfo);
- return pop;
-}
-
-static void
-e_address_widget_popup (EAddressWidget *addr, GdkEventButton *ev)
-{
- GtkWidget *pop;
-
- g_return_if_fail (addr && E_IS_ADDRESS_WIDGET (addr));
-
- pop = addr->card ? popup_menu_card (addr) : popup_menu_nocard (addr);
-
- if (pop)
- gnome_popup_menu_do_popup (pop, NULL, NULL, ev, addr);
-}
-
-/*
- *
- * Bonobo Control Magic
- *
- */
-
-enum {
- ADDRESS_PROPERTY_NAME,
- ADDRESS_PROPERTY_EMAIL,
- ADDRESS_PROPERTY_TEXT,
- ADDRESS_PROPERTY_BACKGROUND_RGB
-};
-
-
-static void
-get_prop (BonoboPropertyBag *bag, BonoboArg *arg, guint arg_id, CORBA_Environment *ev, gpointer user_data)
-{
- EAddressWidget *addr = E_ADDRESS_WIDGET (user_data);
-
- switch (arg_id) {
-
- case ADDRESS_PROPERTY_NAME:
- BONOBO_ARG_SET_STRING (arg, addr->name ? addr->name :"");
- break;
-
- case ADDRESS_PROPERTY_EMAIL:
- BONOBO_ARG_SET_STRING (arg, addr->email ? addr->email : "");
- break;
-
- case ADDRESS_PROPERTY_TEXT:
- BONOBO_ARG_SET_STRING (arg, "?");
- break;
- }
-}
-
-static void
-set_prop (BonoboPropertyBag *bag, const BonoboArg *arg, guint arg_id, CORBA_Environment *ev, gpointer user_data)
-{
- EAddressWidget *addr = E_ADDRESS_WIDGET (user_data);
-
- switch (arg_id) {
- case ADDRESS_PROPERTY_NAME:
- e_address_widget_set_name (addr, BONOBO_ARG_GET_STRING (arg));
- break;
-
- case ADDRESS_PROPERTY_EMAIL:
- e_address_widget_set_email (addr, BONOBO_ARG_GET_STRING (arg));
- break;
-
- case ADDRESS_PROPERTY_TEXT:
- e_address_widget_set_text (addr, BONOBO_ARG_GET_STRING (arg));
- break;
-
-
- case ADDRESS_PROPERTY_BACKGROUND_RGB:
- {
- gint bg = BONOBO_ARG_GET_INT (arg);
- GdkColor color;
-
- color.red = (bg & 0xff0000) >> 8;
- color.green = (bg & 0x00ff00);
- color.blue = (bg & 0x0000ff) << 8;
-
- if (gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (addr)), &color, FALSE, TRUE)) {
- GtkStyle *style = gtk_style_copy (gtk_widget_get_style (GTK_WIDGET (addr)));
- style->bg[0] = color;
- gtk_widget_set_style (GTK_WIDGET (addr), style);
- }
- }
-
- break;
- }
-}
-
-static BonoboControl *
-e_address_widget_factory_new_control (void)
-{
- BonoboControl *control;
- BonoboPropertyBag *bag;
- GtkWidget *w;
-
- w = e_address_widget_new ();
- gtk_widget_show (w);
-
- control = bonobo_control_new (w);
-
- bag = bonobo_property_bag_new (get_prop, set_prop, w);
- bonobo_property_bag_add (bag, "name", ADDRESS_PROPERTY_NAME,
- BONOBO_ARG_STRING, NULL, NULL,
- BONOBO_PROPERTY_READABLE | BONOBO_PROPERTY_WRITEABLE);
-
- bonobo_property_bag_add (bag, "email", ADDRESS_PROPERTY_EMAIL,
- BONOBO_ARG_STRING, NULL, NULL,
- BONOBO_PROPERTY_READABLE | BONOBO_PROPERTY_WRITEABLE);
-
- bonobo_property_bag_add (bag, "text", ADDRESS_PROPERTY_TEXT,
- BONOBO_ARG_STRING, NULL, NULL,
- BONOBO_PROPERTY_READABLE | BONOBO_PROPERTY_WRITEABLE);
-
- bonobo_property_bag_add (bag, "background_rgb", ADDRESS_PROPERTY_BACKGROUND_RGB,
- BONOBO_ARG_INT, NULL, NULL,
- BONOBO_PROPERTY_WRITEABLE);
-
- bonobo_control_set_properties (control, bag);
- bonobo_object_unref (BONOBO_OBJECT (bag));
-
- return control;
-}
-
-static BonoboObject *
-e_address_widget_factory (BonoboGenericFactory *factory, gpointer user_data)
-{
- return BONOBO_OBJECT (e_address_widget_factory_new_control ());
-}
-
-void
-e_address_widget_factory_init (void)
-{
- static BonoboGenericFactory *factory = NULL;
-
- if (factory != NULL)
- return;
-
- factory = bonobo_generic_factory_new ("OAFIID:GNOME_Evolution_Addressbook_AddressWidgetFactory",
- e_address_widget_factory, NULL);
-
- if (factory == NULL)
- g_error ("I could not register an AddressWidget factory.");
-}
-
diff --git a/addressbook/gui/component/e-address-widget.h b/addressbook/gui/component/e-address-widget.h
deleted file mode 100644
index 8cf425d5c9..0000000000
--- a/addressbook/gui/component/e-address-widget.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * e-address-widget.h
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Developed by Jon Trowbridge <trow@ximian.com>
- */
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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_ADDRESS_WIDGET_H__
-#define __E_ADDRESS_WIDGET_H__
-
-#include <gtk/gtkeventbox.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkobject.h>
-#include <gtk/gtkwidget.h>
-#include <libgnome/gnome-defs.h>
-#include <addressbook/backend/ebook/e-book.h>
-#include <addressbook/backend/ebook/e-book-util.h>
-#include <addressbook/backend/ebook/e-card.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_ADDRESS_WIDGET_TYPE (e_address_widget_get_type ())
-#define E_ADDRESS_WIDGET(o) (GTK_CHECK_CAST ((o), E_ADDRESS_WIDGET_TYPE, EAddressWidget))
-#define E_ADDRESS_WIDGET_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), E_ADDRESS_WIDGET_TYPE, EAddressWidgetClass))
-#define E_IS_ADDRESS_WIDGET(o) (GTK_CHECK_TYPE ((o), E_ADDRESS_WIDGET_TYPE))
-#define E_IS_ADDRESS_WIDGET_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_ADDRESS_WIDGET_TYPE))
-
-typedef struct _EAddressWidget EAddressWidget;
-typedef struct _EAddressWidgetClass EAddressWidgetClass;
-
-struct _EAddressWidget {
- GtkEventBox parent;
-
- gchar *name;
- gchar *email;
-
- GtkWidget *name_widget;
- GtkWidget *email_widget;
- GtkWidget *spacer;
-
- guint query_idle_tag;
- guint query_tag;
-
- ECard *card;
- gboolean known_email;
-};
-
-struct _EAddressWidgetClass {
- GtkEventBoxClass parent_class;
-};
-
-GtkType e_address_widget_get_type (void);
-
-void e_address_widget_set_name (EAddressWidget *, const gchar *name);
-void e_address_widget_set_email (EAddressWidget *, const gchar *email);
-void e_address_widget_set_text (EAddressWidget *, const gchar *text);
-
-void e_address_widget_construct (EAddressWidget *);
-GtkWidget *e_address_widget_new (void);
-
-
-void e_address_widget_factory_init (void);
-
-
-
-END_GNOME_DECLS
-
-#endif /* __E_ADDRESS_WIDGET_H__ */
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/addressbook/gui/component/e-cardlist-model.c b/addressbook/gui/component/e-cardlist-model.c
deleted file mode 100644
index dfdafeda58..0000000000
--- a/addressbook/gui/component/e-cardlist-model.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- *
- * Author:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * (C) 1999 Ximian, Inc.
- */
-
-#include <config.h>
-#include <gnome-xml/tree.h>
-#include <gnome-xml/parser.h>
-#include <gnome-xml/xmlmemory.h>
-#include "e-cardlist-model.h"
-
-#define PARENT_TYPE e_table_model_get_type()
-
-static void
-e_cardlist_model_destroy(GtkObject *object)
-{
- ECardlistModel *model = E_CARDLIST_MODEL(object);
- int i;
-
- for ( i = 0; i < model->data_count; i++ ) {
- gtk_object_unref(GTK_OBJECT(model->data[i]));
- }
- g_free(model->data);
-}
-
-/* This function returns the number of columns in our ETableModel. */
-static int
-e_cardlist_model_col_count (ETableModel *etc)
-{
- return E_CARD_SIMPLE_FIELD_LAST;
-}
-
-/* This function returns the number of rows in our ETableModel. */
-static int
-e_cardlist_model_row_count (ETableModel *etc)
-{
- ECardlistModel *e_cardlist_model = E_CARDLIST_MODEL(etc);
- return e_cardlist_model->data_count;
-}
-
-/* This function returns the value at a particular point in our ETableModel. */
-static void *
-e_cardlist_model_value_at (ETableModel *etc, int col, int row)
-{
- ECardlistModel *e_cardlist_model = E_CARDLIST_MODEL(etc);
- const char *value;
- if ( col >= E_CARD_SIMPLE_FIELD_LAST - 1|| row >= e_cardlist_model->data_count )
- return NULL;
- value = e_card_simple_get_const(e_cardlist_model->data[row],
- col + 1);
- return (void *)(value ? value : "");
-}
-
-/* This function sets the value at a particular point in our ETableModel. */
-static void
-e_cardlist_model_set_value_at (ETableModel *etc, int col, int row, const void *val)
-{
- ECardlistModel *e_cardlist_model = E_CARDLIST_MODEL(etc);
- ECard *card;
- if ( col >= E_CARD_SIMPLE_FIELD_LAST - 1|| row >= e_cardlist_model->data_count )
- return;
- e_card_simple_set(e_cardlist_model->data[row],
- col + 1,
- val);
- gtk_object_get(GTK_OBJECT(e_cardlist_model->data[row]),
- "card", &card,
- NULL);
-
- e_table_model_cell_changed(etc, col, row);
-}
-
-/* This function returns whether a particular cell is editable. */
-static gboolean
-e_cardlist_model_is_cell_editable (ETableModel *etc, int col, int row)
-{
- return TRUE;
-}
-
-/* This function duplicates the value passed to it. */
-static void *
-e_cardlist_model_duplicate_value (ETableModel *etc, int col, const void *value)
-{
- return g_strdup(value);
-}
-
-/* This function frees the value passed to it. */
-static void
-e_cardlist_model_free_value (ETableModel *etc, int col, void *value)
-{
- g_free(value);
-}
-
-static void *
-e_cardlist_model_initialize_value (ETableModel *etc, int col)
-{
- return g_strdup("");
-}
-
-static gboolean
-e_cardlist_model_value_is_empty (ETableModel *etc, int col, const void *value)
-{
- return !(value && *(char *)value);
-}
-
-static char *
-e_cardlist_model_value_to_string (ETableModel *etc, int col, const void *value)
-{
- return g_strdup(value);
-}
-
-void
-e_cardlist_model_add(ECardlistModel *model,
- ECard **cards,
- int count)
-{
- int i;
- model->data = g_realloc(model->data, model->data_count + count * sizeof(ECard *));
- for (i = 0; i < count; i++) {
- gboolean found = FALSE;
- const gchar *id = e_card_get_id(cards[i]);
- for ( i = 0; i < model->data_count; i++) {
- if ( !strcmp(e_card_simple_get_id(model->data[i]), id) ) {
- found = TRUE;
- break;
- }
- }
- if (!found) {
- gtk_object_ref(GTK_OBJECT(cards[i]));
- model->data[model->data_count++] = e_card_simple_new (cards[i]);
- e_table_model_row_inserted(E_TABLE_MODEL(model), model->data_count - 1);
- }
- }
-}
-
-void
-e_cardlist_model_remove(ECardlistModel *model,
- const char *id)
-{
- int i;
- for ( i = 0; i < model->data_count; i++) {
- if ( !strcmp(e_card_simple_get_id(model->data[i]), id) ) {
- gtk_object_unref(GTK_OBJECT(model->data[i]));
- memmove(model->data + i, model->data + i + 1, (model->data_count - i - 1) * sizeof (ECard *));
- e_table_model_row_deleted(E_TABLE_MODEL(model), i);
- }
- }
-}
-
-static void
-e_cardlist_model_class_init (GtkObjectClass *object_class)
-{
- ETableModelClass *model_class = (ETableModelClass *) object_class;
-
- object_class->destroy = e_cardlist_model_destroy;
-
- model_class->column_count = e_cardlist_model_col_count;
- model_class->row_count = e_cardlist_model_row_count;
- model_class->value_at = e_cardlist_model_value_at;
- model_class->set_value_at = e_cardlist_model_set_value_at;
- model_class->is_cell_editable = e_cardlist_model_is_cell_editable;
- model_class->duplicate_value = e_cardlist_model_duplicate_value;
- model_class->free_value = e_cardlist_model_free_value;
- model_class->initialize_value = e_cardlist_model_initialize_value;
- model_class->value_is_empty = e_cardlist_model_value_is_empty;
- model_class->value_to_string = e_cardlist_model_value_to_string;
-}
-
-static void
-e_cardlist_model_init (GtkObject *object)
-{
- ECardlistModel *model = E_CARDLIST_MODEL(object);
- model->data = NULL;
- model->data_count = 0;
-}
-
-ECard *
-e_cardlist_model_get(ECardlistModel *model,
- int row)
-{
- if (model->data && row < model->data_count) {
- ECard *card;
- gtk_object_get(GTK_OBJECT(model->data[row]),
- "card", &card,
- NULL);
- gtk_object_ref(GTK_OBJECT(card));
- return card;
- }
- return NULL;
-}
-
-GtkType
-e_cardlist_model_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ECardlistModel",
- sizeof (ECardlistModel),
- sizeof (ECardlistModelClass),
- (GtkClassInitFunc) e_cardlist_model_class_init,
- (GtkObjectInitFunc) e_cardlist_model_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-ETableModel *
-e_cardlist_model_new (void)
-{
- ECardlistModel *et;
-
- et = gtk_type_new (e_cardlist_model_get_type ());
-
- return E_TABLE_MODEL(et);
-}
diff --git a/addressbook/gui/component/e-cardlist-model.h b/addressbook/gui/component/e-cardlist-model.h
deleted file mode 100644
index 0b9a7a2265..0000000000
--- a/addressbook/gui/component/e-cardlist-model.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#ifndef _E_CARDLIST_MODEL_H_
-#define _E_CARDLIST_MODEL_H_
-
-#include <gal/e-table/e-table-model.h>
-#include <ebook/e-book.h>
-#include <ebook/e-book-view.h>
-#include <ebook/e-card-simple.h>
-
-#define E_CARDLIST_MODEL_TYPE (e_cardlist_model_get_type ())
-#define E_CARDLIST_MODEL(o) (GTK_CHECK_CAST ((o), E_CARDLIST_MODEL_TYPE, ECardlistModel))
-#define E_CARDLIST_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CARDLIST_MODEL_TYPE, ECardlistModelClass))
-#define E_IS_CARDLIST_MODEL(o) (GTK_CHECK_TYPE ((o), E_CARDLIST_MODEL_TYPE))
-#define E_IS_CARDLIST_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CARDLIST_MODEL_TYPE))
-
-typedef struct {
- ETableModel parent;
-
- /* item specific fields */
- ECardSimple **data;
- int data_count;
-} ECardlistModel;
-
-
-typedef struct {
- ETableModelClass parent_class;
-} ECardlistModelClass;
-
-
-GtkType e_cardlist_model_get_type (void);
-ETableModel *e_cardlist_model_new (void);
-
-/* Returns object with an extra ref count. */
-ECard *e_cardlist_model_get (ECardlistModel *model,
- int row);
-void e_cardlist_model_add (ECardlistModel *model,
- ECard **card,
- int count);
-void e_cardlist_model_remove (ECardlistModel *model,
- const char *id);
-
-#endif /* _E_CARDLIST_MODEL_H_ */
diff --git a/addressbook/gui/component/select-names/.cvsignore b/addressbook/gui/component/select-names/.cvsignore
deleted file mode 100644
index cd669499fa..0000000000
--- a/addressbook/gui/component/select-names/.cvsignore
+++ /dev/null
@@ -1,12 +0,0 @@
-.deps
-.libs
-.pure
-Makefile
-Makefile.in
-*.lo
-*.la
-Evolution-Addressbook-SelectNames-stubs.c
-Evolution-Addressbook-SelectNames-skels.c
-Evolution-Addressbook-SelectNames-common.c
-Evolution-Addressbook-SelectNames.h
-GNOME_Evolution_Addressbook_SelectNames.oaf
diff --git a/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl b/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl
deleted file mode 100644
index 244799deb2..0000000000
--- a/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode: IDL; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * CORBA interface for the SelectNames dialog.
- *
- * Authors:
- * Ettore Perazzoli <ettore@ximian.com>
- *
- * Copyright (C) 2000 Ximian, Inc.
- */
-
-#include <Bonobo.idl>
-
-module GNOME {
-module Evolution {
-module Addressbook {
-
- interface SelectNames : Bonobo::Unknown {
- struct Section {
- string id;
- string title;
- };
-
- typedef sequence<Section> SectionList;
-
- exception DuplicateID {};
- exception SectionNotFound {};
-
- void addSection (in string id, in string title)
- raises (DuplicateID);
- void addSectionWithLimit (in string id, in string title, in short limit)
- raises (DuplicateID);
-
- Bonobo::Control getEntryBySection (in string section_id)
- raises (SectionNotFound);
-
- void activateDialog (in string section_id);
- };
-
-
-};
-};
-};
diff --git a/addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.oaf.in b/addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.oaf.in
deleted file mode 100644
index 7f26e2aaed..0000000000
--- a/addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.oaf.in
+++ /dev/null
@@ -1,29 +0,0 @@
-<oaf_info>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_SelectNamesFactory"
- type="exe"
- location="evolution-addressbook">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string"
- _value="Factory for the Addressbook's name selection interface"/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_SelectNames"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_SelectNamesFactory">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution/Addressbook/SelectNames"/>
- </oaf_attribute>
-
- <oaf_attribute name="description" type="string"
- _value="Evolution's addressbook name selection interface."/>
-
-</oaf_server>
-
-</oaf_info> \ No newline at end of file
diff --git a/addressbook/gui/component/select-names/Makefile.am b/addressbook/gui/component/select-names/Makefile.am
deleted file mode 100644
index 5c7b37794b..0000000000
--- a/addressbook/gui/component/select-names/Makefile.am
+++ /dev/null
@@ -1,85 +0,0 @@
-# CORBA stuff
-
-IDLS = \
- Evolution-Addressbook-SelectNames.idl
-
-IDL_GENERATED = \
- Evolution-Addressbook-SelectNames.h \
- Evolution-Addressbook-SelectNames-common.c \
- Evolution-Addressbook-SelectNames-skels.c \
- Evolution-Addressbook-SelectNames-stubs.c
-
-Evolution-Addressbook-SelectNames-impl.o: Evolution-Addressbook-SelectNames.h
-
-$(IDL_GENERATED): $(IDLS)
- $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \
- $(srcdir)/Evolution-Addressbook-SelectNames.idl
-
-oafdir = $(datadir)/oaf
-
-oaf_in_files = GNOME_Evolution_Addressbook_SelectNames.oaf.in
-oaf_DATA = $(oaf_in_files:.oaf.in=.oaf)
-
-@XML_I18N_MERGE_OAF_RULE@
-
-
-INCLUDES = \
- -DG_LOG_DOMAIN=\"evolution-addressbook\" \
- $(EXTRA_GNOME_CFLAGS) \
- $(GNOME_INCLUDEDIR) \
- -I$(top_srcdir) \
- -I$(top_builddir) \
- -I$(top_srcdir)/shell \
- -I$(top_builddir)/shell \
- -I$(top_srcdir)/widgets/e-text \
- -I$(top_srcdir)/widgets/e-table \
- -I$(top_srcdir)/addressbook/gui/minicard \
- -I$(top_srcdir)/addressbook/gui/widgets \
- -I$(top_srcdir)/addressbook/contact-editor \
- -I$(top_srcdir)/addressbook/backend \
- -I$(top_builddir)/addressbook/backend \
- $(BONOBO_HTML_GNOME_CFLAGS) \
- -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
- -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \
- -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
- -DCAMEL_PROVIDERDIR=\""$(providerdir)"\"
-
-lib_LTLIBRARIES = libeselectnames.la
-
-libeselectnames_la_SOURCES = \
- $(IDL_GENERATED) \
- e-select-names-bonobo.c \
- e-select-names-bonobo.h \
- e-select-names-completion.c \
- e-select-names-completion.h \
- e-select-names-factory.c \
- e-select-names-factory.h \
- e-select-names-manager.c \
- e-select-names-manager.h \
- e-select-names-model.c \
- e-select-names-model.h \
- e-select-names-popup.c \
- e-select-names-popup.h \
- e-select-names-table-model.c \
- e-select-names-table-model.h \
- e-select-names-text-model.c \
- e-select-names-text-model.h \
- e-select-names.c \
- e-select-names.h
-
-gladedir = $(datadir)/evolution/glade
-glade_DATA = select-names.glade
-
-
-
-EXTRA_DIST = \
- $(glade_DATA) \
- $(oaf_in_files) \
- $(oaf_DATA) \
- $(IDLS)
-
-BUILT_SOURCES = $(IDL_GENERATED)
-CLEANFILES += $(BUILT_SOURCES)
-
-dist-hook:
- cd $(distdir); rm -f $(BUILT_SOURCES)
diff --git a/addressbook/gui/component/select-names/e-select-names-bonobo.c b/addressbook/gui/component/select-names/e-select-names-bonobo.c
deleted file mode 100644
index 25adf13a65..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-bonobo.c
+++ /dev/null
@@ -1,431 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-select-names-bonobo.c
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-select-names-bonobo.h"
-
-#include <bonobo/bonobo-property-bag.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-event-source.h>
-
-#include <gal/util/e-util.h>
-#include <gal/e-text/e-entry.h>
-
-#include "Evolution-Addressbook-SelectNames.h"
-
-#include "e-select-names-manager.h"
-#include "e-select-names-model.h"
-#include "e-select-names-text-model.h"
-#include "e-select-names-completion.h"
-
-
-
-#define PARENT_TYPE bonobo_object_get_type ()
-static BonoboObjectClass *parent_class = NULL;
-
-struct _ESelectNamesBonoboPrivate {
- ESelectNamesManager *manager;
- BonoboEventSource *event_source;
-};
-
-enum _EntryPropertyID {
- ENTRY_PROPERTY_ID_TEXT,
- ENTRY_PROPERTY_ID_DESTINATIONS,
- ENTRY_PROPERTY_ID_ALLOW_CONTACT_LISTS,
- ENTRY_PROPERTY_ID_ENTRY_CHANGED
-};
-typedef enum _EntryPropertyID EntryPropertyID;
-
-
-/* PropertyBag implementation for the entry widgets. */
-
-static void
-entry_get_property_fn (BonoboPropertyBag *bag,
- BonoboArg *arg,
- unsigned int arg_id,
- CORBA_Environment *ev,
- void *user_data)
-{
- GtkWidget *w;
-
- w = GTK_WIDGET (user_data);
-
- switch (arg_id) {
- case ENTRY_PROPERTY_ID_TEXT:
- {
- ESelectNamesModel *model;
- model = E_SELECT_NAMES_MODEL (gtk_object_get_data (GTK_OBJECT (w), "select_names_model"));
- g_assert (model != NULL);
-
- BONOBO_ARG_SET_STRING (arg, e_select_names_model_get_textification (model));
- break;
- }
-
- case ENTRY_PROPERTY_ID_DESTINATIONS:
- {
- ESelectNamesModel *model;
- char *text;
-
- model = E_SELECT_NAMES_MODEL (gtk_object_get_data (GTK_OBJECT (w), "select_names_model"));
- g_assert (model != NULL);
-
- text = e_select_names_model_export_destinationv (model);
- BONOBO_ARG_SET_STRING (arg, text);
- g_free (text);
- }
- break;
-
- case ENTRY_PROPERTY_ID_ALLOW_CONTACT_LISTS:
- {
- ESelectNamesCompletion *comp;
- comp = E_SELECT_NAMES_COMPLETION (gtk_object_get_data (GTK_OBJECT (w), "completion_handler"));
- g_assert (comp != NULL);
-
- BONOBO_ARG_SET_BOOLEAN (arg, e_select_names_completion_get_match_contact_lists (comp));
- break;
- }
-
- case ENTRY_PROPERTY_ID_ENTRY_CHANGED:
- /* This is a read-only property. */
- g_assert_not_reached ();
- break;
-
- default:
- break;
- }
-}
-
-static void
-entry_set_property_fn (BonoboPropertyBag *bag,
- const BonoboArg *arg,
- guint arg_id,
- CORBA_Environment *ev,
- gpointer user_data)
-{
- GtkWidget *w;
-
- w = GTK_WIDGET (user_data);
-
- switch (arg_id) {
-
- case ENTRY_PROPERTY_ID_TEXT:
- e_entry_set_text (E_ENTRY (w), BONOBO_ARG_GET_STRING (arg));
- break;
-
- case ENTRY_PROPERTY_ID_DESTINATIONS:
- {
- ESelectNamesModel *model;
- model = E_SELECT_NAMES_MODEL (gtk_object_get_data (GTK_OBJECT (w), "select_names_model"));
- g_assert (model != NULL);
-
- e_select_names_model_import_destinationv (model, BONOBO_ARG_GET_STRING (arg));
- break;
- }
-
- case ENTRY_PROPERTY_ID_ALLOW_CONTACT_LISTS:
- {
- ESelectNamesCompletion *comp;
- comp = E_SELECT_NAMES_COMPLETION (gtk_object_get_data (GTK_OBJECT (w), "completion_handler"));
- g_assert (comp != NULL);
-
- e_select_names_completion_set_match_contact_lists (comp, BONOBO_ARG_GET_BOOLEAN (arg));
- break;
- }
-
- case ENTRY_PROPERTY_ID_ENTRY_CHANGED:
- gtk_object_set_data (GTK_OBJECT (w), "entry_property_id_changed", GUINT_TO_POINTER (1));
- break;
-
- default:
- break;
- }
-}
-
-
-/* CORBA interface implementation. */
-
-static POA_GNOME_Evolution_Addressbook_SelectNames__vepv SelectNames_vepv;
-
-static POA_GNOME_Evolution_Addressbook_SelectNames *
-create_servant (void)
-{
- POA_GNOME_Evolution_Addressbook_SelectNames *servant;
- CORBA_Environment ev;
-
- servant = (POA_GNOME_Evolution_Addressbook_SelectNames *) g_new0 (BonoboObjectServant, 1);
- servant->vepv = &SelectNames_vepv;
-
- CORBA_exception_init (&ev);
-
- POA_GNOME_Evolution_Addressbook_SelectNames__init ((PortableServer_Servant) servant, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_free (servant);
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- CORBA_exception_free (&ev);
-
- return servant;
-}
-
-static void
-impl_SelectNames_add_section (PortableServer_Servant servant,
- const CORBA_char *id,
- const CORBA_char *title,
- CORBA_Environment *ev)
-{
- BonoboObject *bonobo_object;
- ESelectNamesBonobo *select_names;
- ESelectNamesBonoboPrivate *priv;
-
- bonobo_object = bonobo_object_from_servant (servant);
- select_names = E_SELECT_NAMES_BONOBO (bonobo_object);
- priv = select_names->priv;
-
- e_select_names_manager_add_section (priv->manager, id, title);
-}
-
-static void
-impl_SelectNames_add_section_with_limit (PortableServer_Servant servant,
- const CORBA_char *id,
- const CORBA_char *title,
- CORBA_short limit,
- CORBA_Environment *ev)
-{
- BonoboObject *bonobo_object;
- ESelectNamesBonobo *select_names;
- ESelectNamesBonoboPrivate *priv;
-
- bonobo_object = bonobo_object_from_servant (servant);
- select_names = E_SELECT_NAMES_BONOBO (bonobo_object);
- priv = select_names->priv;
-
- e_select_names_manager_add_section_with_limit (priv->manager, id, title, limit);
-}
-
-static void
-entry_changed (GtkWidget *widget, BonoboControl *control)
-{
- gboolean changed = GPOINTER_TO_UINT (gtk_object_get_data (GTK_OBJECT (widget), "entry_property_id_changed"));
-
- if (!changed)
- bonobo_control_set_property (control, "entry_changed", TRUE, NULL);
-}
-
-static Bonobo_Control
-impl_SelectNames_get_entry_for_section (PortableServer_Servant servant,
- const CORBA_char *section_id,
- CORBA_Environment *ev)
-{
- BonoboObject *bonobo_object;
- ESelectNamesBonobo *select_names;
- ESelectNamesBonoboPrivate *priv;
- GtkWidget *entry_widget;
- BonoboControl *control;
- BonoboPropertyBag *property_bag;
-
- bonobo_object = bonobo_object_from_servant (servant);
- select_names = E_SELECT_NAMES_BONOBO (bonobo_object);
- priv = select_names->priv;
-
- entry_widget = e_select_names_manager_create_entry (priv->manager, section_id);
- gtk_widget_show (entry_widget);
-
- if (entry_widget == NULL) {
- CORBA_exception_set (ev,
- CORBA_USER_EXCEPTION,
- ex_GNOME_Evolution_Addressbook_SelectNames_SectionNotFound,
- NULL);
- return CORBA_OBJECT_NIL;
- }
-
- control = bonobo_control_new (entry_widget);
-
- property_bag = bonobo_property_bag_new (entry_get_property_fn, entry_set_property_fn, entry_widget);
- bonobo_property_bag_add (property_bag, "text", ENTRY_PROPERTY_ID_TEXT,
- BONOBO_ARG_STRING, NULL, NULL,
- BONOBO_PROPERTY_READABLE | BONOBO_PROPERTY_WRITEABLE);
- bonobo_property_bag_add (property_bag, "destinations", ENTRY_PROPERTY_ID_DESTINATIONS,
- BONOBO_ARG_STRING, NULL, NULL,
- BONOBO_PROPERTY_READABLE | BONOBO_PROPERTY_WRITEABLE);
- bonobo_property_bag_add (property_bag, "allow_contact_lists", ENTRY_PROPERTY_ID_ALLOW_CONTACT_LISTS,
- BONOBO_ARG_BOOLEAN, NULL, NULL,
- BONOBO_PROPERTY_READABLE | BONOBO_PROPERTY_WRITEABLE);
- bonobo_property_bag_add (property_bag, "entry_changed", ENTRY_PROPERTY_ID_ENTRY_CHANGED,
- BONOBO_ARG_BOOLEAN, NULL, NULL,
- BONOBO_PROPERTY_WRITEABLE);
-
- bonobo_control_set_properties (control, property_bag);
-
- gtk_signal_connect (GTK_OBJECT (entry_widget), "changed",
- GTK_SIGNAL_FUNC (entry_changed), control);
-
- return CORBA_Object_duplicate (bonobo_object_corba_objref (BONOBO_OBJECT (control)), ev);
-}
-
-static void
-impl_SelectNames_activate_dialog (PortableServer_Servant servant,
- const CORBA_char *section_id,
- CORBA_Environment *ev)
-{
- BonoboObject *bonobo_object;
- ESelectNamesBonobo *select_names;
- ESelectNamesBonoboPrivate *priv;
-
- bonobo_object = bonobo_object_from_servant (servant);
- select_names = E_SELECT_NAMES_BONOBO (bonobo_object);
- priv = select_names->priv;
-
- e_select_names_manager_activate_dialog (priv->manager, section_id);
-}
-
-
-/* GtkObject methods. */
-
-static void
-impl_destroy (GtkObject *object)
-{
- ESelectNamesBonobo *select_names;
- ESelectNamesBonoboPrivate *priv;
-
- select_names = E_SELECT_NAMES_BONOBO (object);
- priv = select_names->priv;
-
- gtk_object_unref (GTK_OBJECT (priv->manager));
-
- g_free (priv);
-}
-
-
-static void
-corba_class_init ()
-{
- POA_GNOME_Evolution_Addressbook_SelectNames__vepv *vepv;
- POA_GNOME_Evolution_Addressbook_SelectNames__epv *epv;
- PortableServer_ServantBase__epv *base_epv;
-
- base_epv = g_new0 (PortableServer_ServantBase__epv, 1);
- base_epv->_private = NULL;
- base_epv->finalize = NULL;
- base_epv->default_POA = NULL;
-
- epv = g_new0 (POA_GNOME_Evolution_Addressbook_SelectNames__epv, 1);
- epv->addSection = impl_SelectNames_add_section;
- epv->addSectionWithLimit = impl_SelectNames_add_section_with_limit;
- epv->getEntryBySection = impl_SelectNames_get_entry_for_section;
- epv->activateDialog = impl_SelectNames_activate_dialog;
-
- vepv = &SelectNames_vepv;
- vepv->Bonobo_Unknown_epv = bonobo_object_get_epv ();
- vepv->GNOME_Evolution_Addressbook_SelectNames_epv = epv;
-}
-
-static void
-class_init (ESelectNamesBonoboClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS (klass);
- parent_class = gtk_type_class (bonobo_object_get_type ());
-
- object_class->destroy = impl_destroy;
-
- corba_class_init ();
-}
-
-static void
-manager_changed_cb (ESelectNamesManager *manager, const gchar *section_id, gint changed_working_copy, gpointer closure)
-{
- ESelectNamesBonobo *select_names = E_SELECT_NAMES_BONOBO (closure);
- BonoboArg *arg;
-
- arg = bonobo_arg_new (BONOBO_ARG_STRING);
- BONOBO_ARG_SET_STRING (arg, section_id);
-
- bonobo_event_source_notify_listeners_full (select_names->priv->event_source,
- "GNOME/Evolution",
- "changed",
- changed_working_copy ? "working_copy" : "model",
- arg, NULL);
-
- bonobo_arg_release (arg);
-}
-
-static void
-init (ESelectNamesBonobo *select_names)
-{
- ESelectNamesBonoboPrivate *priv;
-
- priv = g_new (ESelectNamesBonoboPrivate, 1);
-
- priv->manager = e_select_names_manager_new ();
- priv->event_source = NULL;
-
- gtk_signal_connect (GTK_OBJECT (priv->manager),
- "changed",
- GTK_SIGNAL_FUNC (manager_changed_cb),
- select_names);
-
- select_names->priv = priv;
-}
-
-
-void
-e_select_names_bonobo_construct (ESelectNamesBonobo *select_names,
- GNOME_Evolution_Addressbook_SelectNames corba_object)
-{
- g_return_if_fail (select_names != NULL);
- g_return_if_fail (E_IS_SELECT_NAMES_BONOBO (select_names));
-
- bonobo_object_construct (BONOBO_OBJECT (select_names), corba_object);
-
- g_assert (select_names->priv->event_source == NULL);
- select_names->priv->event_source = bonobo_event_source_new ();
- bonobo_object_add_interface (BONOBO_OBJECT (select_names), BONOBO_OBJECT (select_names->priv->event_source));
-}
-
-ESelectNamesBonobo *
-e_select_names_bonobo_new (void)
-{
- POA_GNOME_Evolution_Addressbook_SelectNames *servant;
- GNOME_Evolution_Addressbook_SelectNames corba_object;
- ESelectNamesBonobo *select_names;
-
- servant = create_servant ();
- if (servant == NULL)
- return NULL;
-
- select_names = gtk_type_new (e_select_names_bonobo_get_type ());
-
- corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (select_names), servant);
- e_select_names_bonobo_construct (select_names, corba_object);
-
- return select_names;
-}
-
-
-E_MAKE_TYPE (e_select_names_bonobo, "ESelectNamesBonobo", ESelectNamesBonobo, class_init, init, PARENT_TYPE)
diff --git a/addressbook/gui/component/select-names/e-select-names-bonobo.h b/addressbook/gui/component/select-names/e-select-names-bonobo.h
deleted file mode 100644
index 49043e1756..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-bonobo.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-select-names-bonobo.h
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef __E_SELECT_NAMES_BONOBO_H__
-#define __E_SELECT_NAMES_BONOBO_H__
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <bonobo/bonobo-object.h>
-
-#include "Evolution-Addressbook-SelectNames.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_TYPE_SELECT_NAMES_BONOBO (e_select_names_bonobo_get_type ())
-#define E_SELECT_NAMES_BONOBO(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SELECT_NAMES_BONOBO, ESelectNamesBonobo))
-#define E_SELECT_NAMES_BONOBO_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_BONOBO, ESelectNamesBonoboClass))
-#define E_IS_SELECT_NAMES_BONOBO(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SELECT_NAMES_BONOBO))
-#define E_IS_SELECT_NAMES_BONOBO_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_BONOBO))
-
-
-typedef struct _ESelectNamesBonobo ESelectNamesBonobo;
-typedef struct _ESelectNamesBonoboPrivate ESelectNamesBonoboPrivate;
-typedef struct _ESelectNamesBonoboClass ESelectNamesBonoboClass;
-
-struct _ESelectNamesBonobo {
- BonoboObject parent;
-
- ESelectNamesBonoboPrivate *priv;
-};
-
-struct _ESelectNamesBonoboClass {
- BonoboObjectClass parent_class;
-};
-
-
-GtkType e_select_names_bonobo_get_type (void);
-void e_select_names_bonobo_construct (ESelectNamesBonobo *select_names,
- GNOME_Evolution_Addressbook_SelectNames corba_object);
-ESelectNamesBonobo *e_select_names_bonobo_new (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __E_SELECT_NAMES_BONOBO_H__ */
diff --git a/addressbook/gui/component/select-names/e-select-names-completion.c b/addressbook/gui/component/select-names/e-select-names-completion.c
deleted file mode 100644
index 8222ae86ad..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-completion.c
+++ /dev/null
@@ -1,1189 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * e-select-names-completion.c
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Developed by Jon Trowbridge <trow@ximian.com>
- */
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <config.h>
-#include "e-select-names-completion.h"
-
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#include <gtk/gtksignal.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-util.h>
-
-#include <gal/unicode/gunicode.h>
-
-#include <addressbook/backend/ebook/e-book-util.h>
-#include <addressbook/backend/ebook/e-destination.h>
-#include <addressbook/backend/ebook/e-card-simple.h>
-
-
-struct _ESelectNamesCompletionPrivate {
-
- ESelectNamesModel *model;
-
- EBook *book;
- gboolean book_ready;
- gboolean cancelled;
-
- guint book_view_tag;
- EBookView *book_view;
-
- gchar *waiting_query;
- gint waiting_pos, waiting_limit;
- gchar *query_text;
-
- gchar *cached_query_text;
- GList *cached_cards;
-
- gboolean match_contact_lists;
- gboolean primary_only;
-};
-
-static void e_select_names_completion_class_init (ESelectNamesCompletionClass *);
-static void e_select_names_completion_init (ESelectNamesCompletion *);
-static void e_select_names_completion_destroy (GtkObject *object);
-
-static void e_select_names_completion_got_book_view_cb (EBook *book, EBookStatus status, EBookView *view, gpointer user_data);
-static void e_select_names_completion_card_added_cb (EBookView *, const GList *cards, gpointer user_data);
-static void e_select_names_completion_seq_complete_cb (EBookView *, gpointer user_data);
-
-static void e_select_names_completion_do_query (ESelectNamesCompletion *, const gchar *query_text, gint pos, gint limit);
-
-static void e_select_names_completion_begin (ECompletion *, const gchar *txt, gint pos, gint limit);
-static void e_select_names_completion_end (ECompletion *);
-static void e_select_names_completion_cancel (ECompletion *);
-
-static GtkObjectClass *parent_class;
-
-static FILE *out;
-
-/*
- *
- * Query builders
- *
- */
-
-typedef gchar *(*BookQuerySExp) (ESelectNamesCompletion *);
-typedef ECompletionMatch *(*BookQueryMatchTester) (ESelectNamesCompletion *, EDestination *);
-
-static void
-our_match_destroy (ECompletionMatch *match)
-{
- gtk_object_unref (GTK_OBJECT (match->user_data));
-}
-
-static ECompletionMatch *
-make_match (EDestination *dest, const gchar *menu_form, double score)
-{
- ECompletionMatch *match = g_new0 (ECompletionMatch, 1);
- ECard *card = e_destination_get_card (dest);
-
- e_completion_match_construct (match);
-
- e_completion_match_set_text (match, e_destination_get_name (dest), menu_form);
- match->sort_major = card ? floor (e_card_get_use_score (card)) : 0;
- match->score = score;
- match->sort_minor = e_destination_get_email_num (dest);
-
- match->user_data = dest;
- gtk_object_ref (GTK_OBJECT (dest));
-
- match->destroy = our_match_destroy;
-
- return match;
-}
-
-static void
-emailify_match (ECompletionMatch *match)
-{
- EDestination *dest = E_DESTINATION (match->user_data);
- ECard *card = e_destination_get_card (dest);
- const gchar *email = e_destination_get_email (dest);
- const gchar *menu_txt = e_completion_match_get_menu_text (match);
-
- if (card && email && !e_card_evolution_list (card)) {
-
- if (email
- && menu_txt
- && *menu_txt
- && *menu_txt != '<'
- && strstr (menu_txt, email) == NULL
- && menu_txt[strlen(menu_txt)-1] != '>') {
- gchar *tmp = g_strdup_printf ("%s <%s>", menu_txt, email);
- gchar *tmp2 = g_strdup (e_completion_match_get_match_text (match));
- e_completion_match_set_text (match, tmp2, tmp);
- g_free (tmp);
- g_free (tmp2);
- }
-
- match->sort_minor = e_destination_get_email_num (dest);
- }
-}
-
-/*
- * Nickname query
- */
-
-static gchar *
-sexp_nickname (ESelectNamesCompletion *comp)
-{
- return g_strdup_printf ("(beginswith \"nickname\" \"%s\")", comp->priv->query_text);
-
-}
-
-static ECompletionMatch *
-match_nickname (ESelectNamesCompletion *comp, EDestination *dest)
-{
- ECompletionMatch *match = NULL;
- gint len = strlen (comp->priv->query_text);
- ECard *card = e_destination_get_card (dest);
- double score;
-
- if (card->nickname
- && !g_utf8_strncasecmp (comp->priv->query_text, card->nickname, len)) {
- ECompletionMatch *match = g_new0 (ECompletionMatch, 1);
- gchar *name = e_card_name_to_string (card->name);
- gchar *str;
-
- score = len * 10; /* nickname gives 10 points per matching character */
- str = g_strdup_printf ("(%s) %s", card->nickname, name);
-
- match = make_match (dest, str, score);
- g_free (name);
- g_free (str);
- }
-
- return match;
-}
-
-/*
- * E-Mail Query
- */
-
-static gchar *
-sexp_email (ESelectNamesCompletion *comp)
-{
- return g_strdup_printf ("(beginswith \"email\" \"%s\")", comp->priv->query_text);
-}
-
-static ECompletionMatch *
-match_email (ESelectNamesCompletion *comp, EDestination *dest)
-{
- ECompletionMatch *match;
- gint len = strlen (comp->priv->query_text);
- ECard *card = e_destination_get_card (dest);
- const gchar *email = e_destination_get_email (dest);
- double score;
-
- if (email
- && !g_utf8_strncasecmp (comp->priv->query_text, email, len)
- && !e_destination_is_evolution_list (dest)) {
-
- gchar *name, *str;
-
- score = len * 2; /* 2 points for each matching character */
-
- name = e_card_name_to_string (card->name);
- if (name && *name)
- str = g_strdup_printf ("<%s> %s", email, name);
- else
- str = g_strdup (email);
-
- match = make_match (dest, str, score);
-
- g_free (name);
- g_free (str);
-
- return match;
- }
-
- return NULL;
-}
-
-/*
- * Name Query
- */
-
-static gchar *
-sexp_name (ESelectNamesCompletion *comp)
-{
- if (comp && comp->priv->query_text && *comp->priv->query_text) {
- gchar *cpy = g_strdup (comp->priv->query_text);
- gchar **strv;
- gchar *query;
- gint i, count=0;
-
- strv = g_strsplit (cpy, " ", 0);
- for (i=0; strv[i]; ++i) {
- ++count;
- g_strstrip (strv[i]);
- strv[i] = g_strdup_printf ("(contains \"full_name\" \"%s\")", strv[i]);
- }
-
- if (count == 1) {
- query = strv[0];
- strv[0] = NULL;
- } else {
- gchar *joined = g_strjoinv (" ", strv);
- query = g_strdup_printf ("(and %s)", joined);
- g_free (joined);
- }
-
- for (i=0; strv[i]; ++i)
- g_free (strv[i]);
- g_free (cpy);
- g_free (strv);
-
-
- return query;
- }
-
- return NULL;
-}
-
-enum {
- MATCHED_NOTHING = 0,
- MATCHED_GIVEN_NAME = 1<<0,
- MATCHED_ADDITIONAL_NAME = 1<<1,
- MATCHED_FAMILY_NAME = 1<<2
-};
-
-/*
- Match text against every substring in fragment that follows whitespace.
- This allows the fragment "de Icaza" to match against txt "ica".
-*/
-static gboolean
-match_name_fragment (const gchar *fragment, const gchar *txt)
-{
- gint len = strlen (txt);
-
- while (*fragment) {
- if (!g_utf8_strncasecmp (fragment, txt, len))
- return TRUE;
-
- while (*fragment && !isspace ((gint) *fragment))
- ++fragment;
- while (*fragment && isspace ((gint) *fragment))
- ++fragment;
- }
-
- return FALSE;
-}
-
-static ECompletionMatch *
-match_name (ESelectNamesCompletion *comp, EDestination *dest)
-{
- ECompletionMatch *final_match = NULL;
- gchar *menu_text = NULL;
- ECard *card;
- gchar *cpy, **strv;
- gint len, i, match_len = 0;
- gint match = 0, first_match = 0;
- double score = 0;
- gboolean have_given, have_additional, have_family;
-
- card = e_destination_get_card (dest);
-
- if (card->name == NULL)
- return NULL;
-
- cpy = g_strdup (comp->priv->query_text);
- strv = g_strsplit (cpy, " ", 0);
-
- for (i=0; strv[i] && !(match & MATCHED_NOTHING); ++i) {
- gint this_match = 0;
-
- g_strstrip (strv[i]);
- len = strlen (strv[i]);
-
- if (card->name->given
- && *card->name->given
- && !(match & MATCHED_GIVEN_NAME)
- && match_name_fragment (card->name->given, strv[i])) {
-
- this_match = MATCHED_GIVEN_NAME;
-
- }
- else if (card->name->additional
- && *card->name->additional
- && !(match & MATCHED_ADDITIONAL_NAME)
- && match_name_fragment (card->name->additional, strv[i])) {
-
- this_match = MATCHED_ADDITIONAL_NAME;
-
- } else if (card->name->family
- && *card->name->family
- && !(match & MATCHED_FAMILY_NAME)
- && match_name_fragment (card->name->family, strv[i])) {
-
- this_match = MATCHED_FAMILY_NAME;
- }
-
-
- if (this_match != MATCHED_NOTHING) {
- match_len += len;
- match |= this_match;
- if (first_match == 0)
- first_match = this_match;
- } else {
- match = first_match = 0;
- break;
- }
-
- }
-
- score = match_len * 3; /* three points per match character */
-
- if (card->nickname) {
- /* We massively boost the score if the nickname exists and is the same as one of the "real" names. This keeps the
- nickname from matching ahead of the real name for this card. */
- len = strlen (card->nickname);
- if ((card->name->given && !g_utf8_strncasecmp (card->name->given, card->nickname, MIN (strlen (card->name->given), len)))
- || (card->name->family && !g_utf8_strncasecmp (card->name->family, card->nickname, MIN (strlen (card->name->family), len)))
- || (card->name->additional && !g_utf8_strncasecmp (card->name->additional, card->nickname, MIN (strlen (card->name->additional), len))))
- score *= 100;
- }
-
- have_given = card->name->given && *card->name->given;
- have_additional = card->name->additional && *card->name->additional;
- have_family = card->name->family && *card->name->family;
-
- if (first_match != MATCHED_NOTHING && e_card_evolution_list (card)) {
-
- menu_text = e_card_name_to_string (card->name);
-
- } else if (first_match == MATCHED_GIVEN_NAME) {
-
- if (have_family)
- menu_text = g_strdup_printf ("%s %s", card->name->given, card->name->family);
- else
- menu_text = g_strdup_printf (card->name->given);
-
- } else if (first_match == MATCHED_ADDITIONAL_NAME) {
-
- if (have_family) {
-
- menu_text = g_strdup_printf ("%s, %s%s%s",
- card->name->family,
- have_given ? card->name->given : "",
- have_given ? " " : "",
- card->name->additional);
-
- } else {
-
- menu_text = g_strdup_printf ("%s%s%s",
- have_given ? card->name->given : "",
- have_given ? " " : "",
- card->name->additional);
-
- }
-
- } else if (first_match == MATCHED_FAMILY_NAME) {
-
- if (have_given)
- menu_text = g_strdup_printf ("%s, %s %s",
- card->name->family,
- card->name->given,
- have_additional ? card->name->additional : "");
- else
- menu_text = g_strdup_printf (card->name->family);
- }
-
- if (menu_text) {
- g_strstrip (menu_text);
- final_match = make_match (dest, menu_text, score);
- g_free (menu_text);
- }
-
- return final_match;
-}
-
-/*
- * Initials Query
- */
-
-static gchar *
-sexp_initials (ESelectNamesCompletion *comp)
-{
- return NULL;
-}
-
-static ECompletionMatch *
-match_initials (ESelectNamesCompletion *comp, EDestination *dest)
-{
- return NULL;
-}
-
-
-typedef struct _BookQuery BookQuery;
-struct _BookQuery {
- gboolean primary;
- BookQuerySExp builder;
- BookQueryMatchTester tester;
-};
-
-static BookQuery book_queries[] = {
- { TRUE, sexp_nickname, match_nickname},
- { TRUE, sexp_email, match_email },
- { TRUE, sexp_name, match_name },
- { FALSE, sexp_initials, match_initials }
-};
-static gint book_query_count = sizeof (book_queries) / sizeof (BookQuery);
-
-/*
- * Build up a big compound sexp corresponding to all of our queries.
- */
-static gchar *
-book_query_sexp (ESelectNamesCompletion *comp)
-{
- gint i, j, count = 0;
- gchar **queryv, *query;
-
- g_return_val_if_fail (comp && E_IS_SELECT_NAMES_COMPLETION (comp), NULL);
-
- if (! (comp->priv->query_text && *comp->priv->query_text))
- return NULL;
-
- if (comp->priv->primary_only) {
- for (i=0; i<book_query_count; ++i)
- if (book_queries[i].primary)
- ++count;
- } else {
- count = book_query_count;
- }
-
- queryv = g_new0 (gchar *, count+1);
- for (i=0, j=0; i<count; ++i) {
- queryv[j] = book_queries[i].builder (comp);
- if (queryv[j])
- ++j;
- }
-
- if (j == 0) {
- query = NULL;
- } else if (j == 1) {
- query = queryv[0];
- queryv[0] = NULL;
- } else {
- gchar *tmp = g_strjoinv (" ", queryv);
- query = g_strdup_printf ("(or %s)", tmp);
- g_free (tmp);
- }
-
- for (i=0; i<count; ++i)
- g_free (queryv[i]);
- g_free (queryv);
-
- return query;
-}
-
-/*
- * Sweep across all of our query rules and find the best score/match
- * string that applies to a given destination.
- */
-static ECompletionMatch *
-book_query_score (ESelectNamesCompletion *comp, EDestination *dest)
-{
- ECompletionMatch *best_match = NULL;
- gint i;
-
- g_return_val_if_fail (comp && E_IS_SELECT_NAMES_COMPLETION (comp), NULL);
- g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
-
- for (i=0; i<book_query_count; ++i) {
-
- ECompletionMatch *this_match = NULL;
-
- if (book_queries[i].primary || !comp->priv->primary_only) {
- if (book_queries[i].tester && e_destination_get_card (dest))
- this_match = book_queries[i].tester (comp, dest);
-
- if (this_match) {
- if (best_match == NULL || this_match->score > best_match->score) {
- e_completion_match_unref (best_match);
- best_match = this_match;
- } else {
- e_completion_match_unref (this_match);
- }
- }
- }
- }
-
- if (best_match)
- emailify_match (best_match);
-
- return best_match;
-}
-
-static void
-book_query_process_card_list (ESelectNamesCompletion *comp, const GList *cards)
-{
- while (cards) {
- ECard *card = E_CARD (cards->data);
-
- if (e_card_evolution_list (card)) {
-
- if (comp->priv->match_contact_lists) {
-
- EDestination *dest = e_destination_new ();
- ECompletionMatch *match;
- e_destination_set_card (dest, card, 0);
- match = book_query_score (comp, dest);
- if (match && match->score > 0) {
- e_completion_found_match (E_COMPLETION (comp), match);
- } else {
- e_completion_match_unref (match);
- }
- gtk_object_unref (GTK_OBJECT (dest));
-
- }
-
- } else if (card->email) {
- gint i;
- for (i=0; i<e_list_length (card->email); ++i) {
- EDestination *dest = e_destination_new ();
- const gchar *email;
- ECompletionMatch *match;
-
- e_destination_set_card (dest, card, i);
- email = e_destination_get_email (dest);
-
- if (email && *email) {
-
- match = book_query_score (comp, dest);
- if (match && match->score > 0) {
- e_completion_found_match (E_COMPLETION (comp), match);
- } else {
- e_completion_match_unref (match);
- }
-
- gtk_object_unref (GTK_OBJECT (dest));
- }
- }
- }
-
- cards = g_list_next (cards);
- }
-}
-
-#if 0
-static gchar *
-initials_query_match_cb (QueryInfo *qi, ECard *card, double *score)
-{
- gint len;
- gchar f='\0', m='\0', l='\0'; /* initials */
- gchar cf, cm, cl;
-
- len = strlen (qi->comp->priv->query_text);
-
- if (len == 2) {
-
- f = qi->comp->priv->query_text[0];
- m = '\0';
- l = qi->comp->priv->query_text[1];
-
- } else if (len == 3) {
-
- f = qi->comp->priv->query_text[0];
- m = qi->comp->priv->query_text[1];
- l = qi->comp->priv->query_text[2];
-
- } else {
- return NULL;
- }
-
- cf = card->name->given ? *card->name->given : '\0';
- cm = card->name->additional ? *card->name->additional : '\0';
- cl = card->name->family ? *card->name->family : '\0';
-
- if (f && isupper ((gint) f))
- f = tolower ((gint) f);
- if (m && isupper ((gint) m))
- m = tolower ((gint) m);
- if (l && isupper ((gint) l))
- l = tolower ((gint) l);
-
- if (cf && isupper ((gint) cf))
- cf = tolower ((gint) cf);
- if (cm && isupper ((gint) cm))
- cm = tolower ((gint) cm);
- if (cl && isupper ((gint) cl))
- cl = tolower ((gint) cl);
-
- if ((f == '\0' || (f == cf)) && (m == '\0' || (m == cm)) && (l == '\0' || (l == cl))) {
- if (score)
- *score = 3;
- if (m)
- return g_strdup_printf ("%s %s %s", card->name->given, card->name->additional, card->name->family);
- else
- return g_strdup_printf ("%s %s", card->name->given, card->name->family);
- }
-
- return NULL;
-}
-
-static gboolean
-start_initials_query (ESelectNamesCompletion *comp)
-{
- gint len;
- gchar *query;
-
- if (comp && comp->priv->query_text && *(comp->priv->query_text)) {
-
- len = strlen (comp->priv->query_text);
- if (len < 2 || len > 3)
- return FALSE;
-
- query = g_strdup_printf ("(contains \"x-evolution-any-field\" \"%c\")", *(comp->priv->query_text));
- query_info_start (comp, comp->priv->query_text, query, initials_query_match_cb);
- g_free (query);
- return TRUE;
- }
-
- return FALSE;
-}
-#endif
-
-
-/*
- *
- * ESelectNamesCompletion code
- *
- */
-
-
-GtkType
-e_select_names_completion_get_type (void)
-{
- static GtkType select_names_complete_type = 0;
-
- if (!select_names_complete_type) {
- GtkTypeInfo select_names_complete_info = {
- "ESelectNamesCompletion",
- sizeof (ESelectNamesCompletion),
- sizeof (ESelectNamesCompletionClass),
- (GtkClassInitFunc) e_select_names_completion_class_init,
- (GtkObjectInitFunc) e_select_names_completion_init,
- NULL, NULL, /* reserved */
- (GtkClassInitFunc) NULL
- };
-
- select_names_complete_type = gtk_type_unique (e_completion_get_type (), &select_names_complete_info);
- }
-
- return select_names_complete_type;
-}
-
-static void
-e_select_names_completion_class_init (ESelectNamesCompletionClass *klass)
-{
- GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
- ECompletionClass *completion_class = E_COMPLETION_CLASS (klass);
-
- parent_class = GTK_OBJECT_CLASS (gtk_type_class (e_completion_get_type ()));
-
- object_class->destroy = e_select_names_completion_destroy;
-
- completion_class->begin_completion = e_select_names_completion_begin;
- completion_class->end_completion = e_select_names_completion_end;
- completion_class->cancel_completion = e_select_names_completion_cancel;
-
- if (getenv ("EVO_DEBUG_SELECT_NAMES_COMPLETION")) {
- out = fopen ("/tmp/evo-debug-select-names-completion", "w");
- if (out)
- setvbuf (out, NULL, _IONBF, 0);
- }
-}
-
-static void
-e_select_names_completion_init (ESelectNamesCompletion *comp)
-{
- comp->priv = g_new0 (struct _ESelectNamesCompletionPrivate, 1);
- comp->priv->match_contact_lists = TRUE;
-}
-
-static void
-e_select_names_completion_destroy (GtkObject *object)
-{
- ESelectNamesCompletion *comp = E_SELECT_NAMES_COMPLETION (object);
-
- if (comp->priv->model)
- gtk_object_unref (GTK_OBJECT (comp->priv->model));
-
- if (comp->priv->book)
- gtk_object_unref (GTK_OBJECT (comp->priv->book));
-
- if (comp->priv->book_view)
- gtk_object_unref (GTK_OBJECT (comp->priv->book_view));
-
- g_free (comp->priv->waiting_query);
- g_free (comp->priv->query_text);
-
- g_free (comp->priv->cached_query_text);
- g_list_foreach (comp->priv->cached_cards, (GFunc)gtk_object_unref, NULL);
- g_list_free (comp->priv->cached_cards);
-
- g_free (comp->priv);
-
- if (parent_class->destroy)
- parent_class->destroy (object);
-}
-
-
-/*
- *
- * EBook/EBookView Callbacks & Query Stuff
- *
- */
-
-static gchar *
-clean_query_text (const gchar *s)
-{
- gchar *q = g_new (gchar, strlen(s)+1), *t;
-
- t = q;
- while (*s) {
- if (*s != ',' && *s != '"') {
- *t = *s;
- ++t;
- }
- ++s;
- }
- *t = '\0';
-
- return q;
-}
-
-static void
-e_select_names_completion_clear_cache (ESelectNamesCompletion *comp)
-{
- g_free (comp->priv->cached_query_text);
- comp->priv->cached_query_text = NULL;
-
- g_list_foreach (comp->priv->cached_cards, (GFunc)gtk_object_unref, NULL);
- g_list_free (comp->priv->cached_cards);
- comp->priv->cached_cards = NULL;
-}
-
-static void
-e_select_names_completion_got_book_view_cb (EBook *book, EBookStatus status, EBookView *view, gpointer user_data)
-{
- ESelectNamesCompletion *comp;
-
- if (status != E_BOOK_STATUS_SUCCESS)
- return;
-
- comp = E_SELECT_NAMES_COMPLETION (user_data);
-
- comp->priv->cancelled = FALSE;
-
- comp->priv->book_view_tag = 0;
-
- comp->priv->book_view = view;
- gtk_object_ref (GTK_OBJECT (view));
-
- gtk_signal_connect (GTK_OBJECT (view),
- "card_added",
- GTK_SIGNAL_FUNC (e_select_names_completion_card_added_cb),
- comp);
- gtk_signal_connect (GTK_OBJECT (view),
- "sequence_complete",
- GTK_SIGNAL_FUNC (e_select_names_completion_seq_complete_cb),
- comp);
-}
-
-static void
-e_select_names_completion_card_added_cb (EBookView *book_view, const GList *cards, gpointer user_data)
-{
- ESelectNamesCompletion *comp = E_SELECT_NAMES_COMPLETION (user_data);
-
- if (! comp->priv->cancelled)
- book_query_process_card_list (comp, cards);
-
- /* Save the list of matching cards. */
- while (cards) {
- comp->priv->cached_cards = g_list_prepend (comp->priv->cached_cards, cards->data);
- gtk_object_ref (GTK_OBJECT (cards->data));
- cards = g_list_next (cards);
- }
-}
-
-static void
-e_select_names_completion_seq_complete_cb (EBookView *book_view, gpointer user_data)
-{
- ESelectNamesCompletion *comp = E_SELECT_NAMES_COMPLETION (user_data);
-
- gtk_object_unref (GTK_OBJECT (comp->priv->book_view));
-
- comp->priv->book_view = NULL;
-
- g_free (comp->priv->query_text);
- comp->priv->query_text = NULL;
-
- if (out)
- fprintf (out, "ending search ");
- if (out && !e_completion_searching (E_COMPLETION (comp)))
- fprintf (out, "while not searching!");
- if (out)
- fprintf (out, "\n");
- e_completion_end_search (E_COMPLETION (comp)); /* That's all folks! */
-
- /* Need to launch a new completion if another one is pending. */
- if (comp->priv->waiting_query) {
- gchar *s = comp->priv->waiting_query;
- comp->priv->waiting_query = NULL;
- e_completion_begin_search (E_COMPLETION (comp), s, comp->priv->waiting_pos, comp->priv->waiting_limit);
- g_free (s);
- }
-}
-
-static void
-e_select_names_completion_stop_query (ESelectNamesCompletion *comp)
-{
- g_return_if_fail (comp && E_IS_SELECT_NAMES_COMPLETION (comp));
-
- if (out)
- fprintf (out, "stopping query\n");
-
- if (comp->priv->waiting_query) {
- if (out)
- fprintf (out, "stopped waiting query\n");
- g_free (comp->priv->waiting_query);
- comp->priv->waiting_query = NULL;
- }
-
- g_free (comp->priv->query_text);
- comp->priv->query_text = NULL;
-
- if (comp->priv->book_view_tag) {
- if (out)
- fprintf (out, "cancelled book view creation\n");
- e_book_cancel (comp->priv->book, comp->priv->book_view_tag);
- comp->priv->book_view_tag = 0;
- }
-
- if (comp->priv->book_view) {
- if (out)
- fprintf (out, "unrefed book view\n");
- gtk_object_unref (GTK_OBJECT (comp->priv->book_view));
- comp->priv->book_view = NULL;
- }
-
- /* Clear the cache, which may contain partial results. */
- e_select_names_completion_clear_cache (comp);
-
-}
-
-static void
-e_select_names_completion_start_query (ESelectNamesCompletion *comp, const gchar *query_text)
-{
- g_return_if_fail (comp && E_IS_SELECT_NAMES_COMPLETION (comp));
- g_return_if_fail (query_text);
-
- e_select_names_completion_stop_query (comp); /* Stop any prior queries. */
-
- if (comp->priv->book_ready) {
- gchar *sexp;
-
- g_free (comp->priv->query_text);
- comp->priv->query_text = g_strdup (query_text);
-
- g_free (comp->priv->cached_query_text);
- comp->priv->cached_query_text = g_strdup (query_text);
-
- sexp = book_query_sexp (comp);
- if (sexp && *sexp) {
-
- if (out)
- fprintf (out, "\n\n**** starting query: \"%s\"\n", comp->priv->query_text);
-
- comp->priv->book_view_tag = e_book_get_book_view (comp->priv->book, sexp,
- e_select_names_completion_got_book_view_cb, comp);
-
- if (! comp->priv->book_view_tag)
- g_warning ("Exception calling e_book_get_book_view");
-
- } else {
- g_free (comp->priv->query_text);
- comp->priv->query_text = NULL;
- }
- g_free (sexp);
-
- } else {
-
- comp->priv->waiting_query = g_strdup (query_text);
-
- }
-}
-
-static void
-e_select_names_completion_do_query (ESelectNamesCompletion *comp, const gchar *query_text, gint pos, gint limit)
-{
- gchar *clean;
- gboolean query_is_still_running, can_reuse_cached_cards;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (E_IS_SELECT_NAMES_COMPLETION (comp));
-
- clean = clean_query_text (query_text);
- if (! (clean && *clean)) {
- g_free (clean);
- e_completion_end_search (E_COMPLETION (comp));
- return;
- }
-
- query_is_still_running = comp->priv->book_view_tag || comp->priv->book_view;
-
- if (out) {
- fprintf (out, "do_query: %s => %s\n", query_text, clean);
- if (query_is_still_running)
- fprintf (out, "a query is still running!\n");
- }
- if (comp->priv->cached_query_text && out)
- fprintf (out, "cached: %s\n", comp->priv->cached_query_text);
-
- can_reuse_cached_cards = (comp->priv->cached_query_text
- && (strlen (comp->priv->cached_query_text) <= strlen (clean))
- && !g_utf8_strncasecmp (comp->priv->cached_query_text, clean, strlen (comp->priv->cached_query_text)));
-
-
- if (can_reuse_cached_cards) {
-
- if (out)
- fprintf (out, "can reuse cached card!\n");
-
- if (query_is_still_running) {
- g_free (comp->priv->waiting_query);
- comp->priv->waiting_query = clean;
- comp->priv->waiting_pos = pos;
- comp->priv->waiting_limit = limit;
- if (out)
- fprintf (out, "waiting for running query to complete: %s\n", comp->priv->waiting_query);
- return;
- }
-
- g_free (comp->priv->query_text);
- comp->priv->query_text = clean;
- if (out)
- fprintf (out, "using existing query info: %s (vs %s)\n", comp->priv->query_text, comp->priv->cached_query_text);
- comp->priv->cancelled = FALSE;
- book_query_process_card_list (comp, comp->priv->cached_cards);
- e_completion_end_search (E_COMPLETION (comp));
- return;
- }
-
- e_select_names_completion_start_query (comp, clean);
- g_free (clean);
-}
-
-
-/*
- *
- * Completion Search Override - a Framework for Christian-Resurrection-Holiday Edible-Chicken-Ova
- *
- */
-
-typedef struct _SearchOverride SearchOverride;
-struct _SearchOverride {
- const gchar *trigger;
- const gchar *text[4];
-};
-static SearchOverride override[] = {
- { "why?", { "\"I must create a system, or be enslaved by another man's.\"",
- " -- Wiliam Blake, \"Jerusalem\"",
- NULL } },
- { NULL, { NULL } } };
-
-static gboolean
-search_override_check (SearchOverride *over, const gchar *text)
-{
- /* The g_utf8_validate is needed because as of 2001-06-11,
- * EText doesn't translate from locale->UTF8 when you paste
- * into it.
- */
- if (over == NULL || text == NULL || !g_utf8_validate (text, -1, NULL))
- return FALSE;
-
- return !g_utf8_strcasecmp (over->trigger, text);
-}
-
-
-/*
- *
- * Completion Callbacks
- *
- */
-
-static void
-e_select_names_completion_begin (ECompletion *comp, const gchar *text, gint pos, gint limit)
-{
- ESelectNamesCompletion *selcomp = E_SELECT_NAMES_COMPLETION (comp);
- const gchar *str;
- gint index, j;
-
- g_return_if_fail (comp != NULL);
- g_return_if_fail (E_IS_SELECT_NAMES_COMPLETION (comp));
- g_return_if_fail (text != NULL);
-
- if (out) {
- fprintf (out, "\n\n**** requesting completion\n");
- fprintf (out, "text=\"%s\" pos=%d limit=%d\n", text, pos, limit);
- }
-
- e_select_names_model_text_pos (selcomp->priv->model, pos, &index, NULL, NULL);
- str = index >= 0 ? e_select_names_model_get_string (selcomp->priv->model, index) : NULL;
-
- if (out)
- fprintf (out, "index=%d str=\"%s\"\n", index, str);
-
- if (str == NULL || *str == '\0') {
- if (out)
- fprintf (out, "aborting empty query\n");
- e_completion_end_search (comp);
- return;
- }
-
- for (j=0; override[j].trigger; ++j) {
- if (search_override_check (&(override[j]), str)) {
- gint k;
-
- for (k=0; override[j].text[k]; ++k) {
- ECompletionMatch *match = g_new (ECompletionMatch, 1);
- e_completion_match_construct (match);
- e_completion_match_set_text (match, text, override[j].text[k]);
- match->score = 1 / (double) (k + 1);
- e_completion_found_match (comp, match);
- }
-
- e_completion_end_search (comp);
- return;
- }
- }
-
- e_select_names_completion_do_query (selcomp, str, pos, limit);
-}
-
-static void
-e_select_names_completion_end (ECompletion *comp)
-{
- g_return_if_fail (comp != NULL);
- g_return_if_fail (E_IS_COMPLETION (comp));
-
- if (out)
- fprintf (out, "completion ended\n");
-}
-
-static void
-e_select_names_completion_cancel (ECompletion *comp)
-{
- g_return_if_fail (comp != NULL);
- g_return_if_fail (E_IS_COMPLETION (comp));
-
- E_SELECT_NAMES_COMPLETION (comp)->priv->cancelled = TRUE;
-
- if (out)
- fprintf (out, "completion cancelled\n");
-}
-
-static void
-e_select_names_completion_book_ready (EBook *book, EBookStatus status, ESelectNamesCompletion *comp)
-{
- comp->priv->book_ready = TRUE;
-
- g_return_if_fail (book != NULL);
- g_return_if_fail (E_IS_BOOK (book));
- g_return_if_fail (comp != NULL);
- g_return_if_fail (E_IS_SELECT_NAMES_COMPLETION (comp));
-
- /* If waiting_query is non-NULL, someone tried to start a query before the book was ready.
- Now that it is, get started. */
- if (comp->priv->waiting_query) {
- e_select_names_completion_start_query (comp, comp->priv->waiting_query);
- g_free (comp->priv->waiting_query);
- comp->priv->waiting_query = NULL;
- }
-
- gtk_object_unref (GTK_OBJECT (comp)); /* post-async unref */
-}
-
-
-/*
- *
- * Our Pseudo-Constructor
- *
- */
-
-ECompletion *
-e_select_names_completion_new (EBook *book, ESelectNamesModel *model)
-{
- ESelectNamesCompletion *comp;
-
- g_return_val_if_fail (book == NULL || E_IS_BOOK (book), NULL);
- g_return_val_if_fail (model, NULL);
- g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), NULL);
-
- comp = (ESelectNamesCompletion *) gtk_type_new (e_select_names_completion_get_type ());
-
- if (book == NULL) {
-
- comp->priv->book = e_book_new ();
- gtk_object_ref (GTK_OBJECT (comp->priv->book));
- gtk_object_sink (GTK_OBJECT (comp->priv->book));
-
- comp->priv->book_ready = FALSE;
- gtk_object_ref (GTK_OBJECT (comp)); /* ref ourself before our async call */
- e_book_load_local_address_book (comp->priv->book, (EBookCallback) e_select_names_completion_book_ready, comp);
-
- } else {
- comp->priv->book = book;
- gtk_object_ref (GTK_OBJECT (comp->priv->book));
- comp->priv->book_ready = TRUE;
- }
-
- comp->priv->model = model;
- gtk_object_ref (GTK_OBJECT (model));
-
- return E_COMPLETION (comp);
-}
-
-gboolean
-e_select_names_completion_get_match_contact_lists (ESelectNamesCompletion *comp)
-{
- g_return_val_if_fail (E_IS_SELECT_NAMES_COMPLETION (comp), FALSE);
- return comp->priv->match_contact_lists;
-}
-
-
-void
-e_select_names_completion_set_match_contact_lists (ESelectNamesCompletion *comp, gboolean x)
-{
- g_return_if_fail (E_IS_SELECT_NAMES_COMPLETION (comp));
- comp->priv->match_contact_lists = x;
-}
diff --git a/addressbook/gui/component/select-names/e-select-names-completion.h b/addressbook/gui/component/select-names/e-select-names-completion.h
deleted file mode 100644
index cfa496ca69..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-completion.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * e-select-names-completion.h
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Developed by Jon Trowbridge <trow@ximian.com>
- */
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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_SELECT_NAMES_COMPLETION_H
-#define E_SELECT_NAMES_COMPLETION_H
-
-#include <gal/e-text/e-completion.h>
-#include <addressbook/backend/ebook/e-book.h>
-#include "e-select-names-model.h"
-
-BEGIN_GNOME_DECLS
-
-#define E_SELECT_NAMES_COMPLETION_TYPE (e_select_names_completion_get_type ())
-#define E_SELECT_NAMES_COMPLETION(o) (GTK_CHECK_CAST ((o), E_SELECT_NAMES_COMPLETION_TYPE, ESelectNamesCompletion))
-#define E_SELECT_NAMES_COMPLETION_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), E_SELECT_NAMES_COMPLETION_TYPE, ESelectNamesCompletionClass))
-#define E_IS_SELECT_NAMES_COMPLETION(o) (GTK_CHECK_TYPE ((o), E_SELECT_NAMES_COMPLETION_TYPE))
-#define E_IS_SELECT_NAMES_COMPLETION_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SELECT_NAMES_COMPLETION_TYPE))
-
-typedef struct _ESelectNamesCompletion ESelectNamesCompletion;
-typedef struct _ESelectNamesCompletionClass ESelectNamesCompletionClass;
-struct _ESelectNamesCompletionPrivate;
-
-struct _ESelectNamesCompletion {
- ECompletion parent;
-
- struct _ESelectNamesCompletionPrivate *priv;
-};
-
-struct _ESelectNamesCompletionClass {
- ECompletionClass parent_class;
-
-};
-
-GtkType e_select_names_completion_get_type (void);
-
-ECompletion *e_select_names_completion_new (EBook *, ESelectNamesModel *);
-
-gboolean e_select_names_completion_get_match_contact_lists (ESelectNamesCompletion *);
-void e_select_names_completion_set_match_contact_lists (ESelectNamesCompletion *, gboolean);
-
-END_GNOME_DECLS
-
-#endif /* E_SELECT_NAMES_COMPLETION_H */
-
diff --git a/addressbook/gui/component/select-names/e-select-names-factory.c b/addressbook/gui/component/select-names/e-select-names-factory.c
deleted file mode 100644
index 7f65110c2a..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-factory.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-select-names-factory.c
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <bonobo/bonobo-generic-factory.h>
-
-#include "e-select-names-bonobo.h"
-#include "e-select-names-factory.h"
-
-
-#define COMPONENT_FACTORY_ID "OAFIID:GNOME_Evolution_Addressbook_SelectNamesFactory"
-
-static BonoboGenericFactory *factory = NULL;
-
-
-static BonoboObject *
-factory_fn (BonoboGenericFactory *factory,
- void *closure)
-{
- return BONOBO_OBJECT (e_select_names_bonobo_new ());
-}
-
-
-gboolean
-e_select_names_factory_init (void)
-{
- if (factory != NULL)
- return TRUE;
-
- factory = bonobo_generic_factory_new (COMPONENT_FACTORY_ID, factory_fn, NULL);
-
- if (factory == NULL)
- return FALSE;
-
- return TRUE;
-}
diff --git a/addressbook/gui/component/select-names/e-select-names-factory.h b/addressbook/gui/component/select-names/e-select-names-factory.h
deleted file mode 100644
index dbdec8a182..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-factory.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* e-select-names-factory.h
- *
- * Copyright (C) 2000 Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef _E_SECELT_NAMES_FACTORY_H
-#define _E_SECELT_NAMES_FACTORY_H
-
-#include <glib.h>
-
-gboolean e_select_names_factory_init (void);
-
-#endif
diff --git a/addressbook/gui/component/select-names/e-select-names-manager.c b/addressbook/gui/component/select-names/e-select-names-manager.c
deleted file mode 100644
index 4481438327..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-manager.c
+++ /dev/null
@@ -1,512 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2000 Ximian, Inc.
- */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <gal/e-text/e-entry.h>
-
-#include "e-select-names-manager.h"
-#include "e-select-names-model.h"
-#include "e-select-names-text-model.h"
-#include "e-select-names.h"
-#include "e-select-names-completion.h"
-#include "e-select-names-popup.h"
-#include <addressbook/backend/ebook/e-destination.h>
-
-/* Object argument IDs */
-enum {
- ARG_0,
- ARG_CARD,
-};
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-static guint e_select_names_manager_signals[LAST_SIGNAL] = { 0 };
-
-
-typedef struct {
- char *id;
- char *title;
- ESelectNamesModel *model;
- ESelectNamesManager *manager;
- guint changed_handler;
-} ESelectNamesManagerSection;
-
-typedef struct {
- char *id;
- EEntry *entry;
-} ESelectNamesManagerEntry;
-
-static void e_select_names_manager_init (ESelectNamesManager *manager);
-static void e_select_names_manager_class_init (ESelectNamesManagerClass *klass);
-
-static void e_select_names_manager_destroy (GtkObject *object);
-static void e_select_names_manager_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_select_names_manager_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-
-/**
- * e_select_names_manager_get_type:
- * @void:
- *
- * Registers the &ESelectNamesManager class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &ESelectNamesManager class.
- **/
-GtkType
-e_select_names_manager_get_type (void)
-{
- static GtkType manager_type = 0;
-
- if (!manager_type) {
- GtkTypeInfo manager_info = {
- "ESelectNamesManager",
- sizeof (ESelectNamesManager),
- sizeof (ESelectNamesManagerClass),
- (GtkClassInitFunc) e_select_names_manager_class_init,
- (GtkObjectInitFunc) e_select_names_manager_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- manager_type = gtk_type_unique (gtk_object_get_type (), &manager_info);
- }
-
- return manager_type;
-}
-
-/**
- * e_select_names_manager_new:
- * @VCard: a string in vCard format
- *
- * Returns: a new #ESelectNamesManager that wraps the @VCard.
- */
-ESelectNamesManager *
-e_select_names_manager_new (void)
-{
- ESelectNamesManager *manager = E_SELECT_NAMES_MANAGER(gtk_type_new(e_select_names_manager_get_type()));
- return manager;
-}
-
-static void
-e_select_names_manager_class_init (ESelectNamesManagerClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS(klass);
-
- gtk_object_add_arg_type ("ESelectNamesManager::card",
- GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CARD);
-
- object_class->destroy = e_select_names_manager_destroy;
- object_class->get_arg = e_select_names_manager_get_arg;
- object_class->set_arg = e_select_names_manager_set_arg;
-
- e_select_names_manager_signals[CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ESelectNamesManagerClass, changed),
- gtk_marshal_NONE__POINTER_INT,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_POINTER,
- GTK_TYPE_INT);
- gtk_object_class_add_signals (object_class, e_select_names_manager_signals, LAST_SIGNAL);
-}
-
-/*
- * ESelectNamesManager lifecycle management and vcard loading/saving.
- */
-
-static void
-e_select_names_manager_destroy (GtkObject *object)
-{
- ESelectNamesManager *manager;
-
- manager = E_SELECT_NAMES_MANAGER (object);
-
- gtk_object_unref(GTK_OBJECT(manager->sections));
- gtk_object_unref(GTK_OBJECT(manager->entries));
-}
-
-
-/* Set_arg handler for the manager */
-static void
-e_select_names_manager_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ESelectNamesManager *manager;
-
- manager = E_SELECT_NAMES_MANAGER (object);
-
- switch (arg_id) {
- case ARG_CARD:
- break;
- default:
- return;
- }
-}
-
-/* Get_arg handler for the manager */
-static void
-e_select_names_manager_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ESelectNamesManager *manager;
-
- manager = E_SELECT_NAMES_MANAGER (object);
-
- switch (arg_id) {
- case ARG_CARD:
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void *
-section_copy(const void *sec, void *data)
-{
- const ESelectNamesManagerSection *section = sec;
- ESelectNamesManagerSection *newsec;
-
- static void section_model_changed_cb (ESelectNamesModel *, gpointer);
-
- newsec = g_new(ESelectNamesManagerSection, 1);
- newsec->id = g_strdup(section->id);
- newsec->title = g_strdup(section->title);
- newsec->model = section->model;
- newsec->manager = section->manager;
- newsec->changed_handler = gtk_signal_connect (GTK_OBJECT (newsec->model),
- "changed",
- GTK_SIGNAL_FUNC (section_model_changed_cb),
- newsec);
-
- if (newsec->model)
- gtk_object_ref(GTK_OBJECT(newsec->model));
- return newsec;
-}
-
-static void
-section_free(void *sec, void *data)
-{
- ESelectNamesManagerSection *section = sec;
- if (section->manager && section->changed_handler) {
- gtk_signal_disconnect (GTK_OBJECT (section->model), section->changed_handler);
- }
- g_free(section->id);
- g_free(section->title);
- if (section->model)
- gtk_object_unref(GTK_OBJECT(section->model));
- g_free(section);
-}
-
-static void *
-entry_copy(const void *ent, void *data)
-{
- const ESelectNamesManagerEntry *entry = ent;
- ESelectNamesManagerEntry *newent;
-
- newent = g_new(ESelectNamesManagerEntry, 1);
- newent->id = g_strdup(entry->id);
- newent->entry = entry->entry;
- if (newent->entry)
- gtk_object_ref(GTK_OBJECT(newent->entry));
- return newent;
-}
-
-static void
-entry_free(void *ent, void *data)
-{
- ESelectNamesManagerEntry *entry = ent;
- g_free(entry->id);
- if (entry->entry)
- gtk_object_unref(GTK_OBJECT(entry->entry));
- g_free(entry);
-}
-
-/**
- * e_select_names_manager_init:
- */
-static void
-e_select_names_manager_init (ESelectNamesManager *manager)
-{
- manager->sections = e_list_new(section_copy, section_free, manager);
- manager->entries = e_list_new(entry_copy, entry_free, manager);
-}
-
-static void
-section_model_changed_cb (ESelectNamesModel *model, gpointer closure)
-{
- ESelectNamesManagerSection *section = closure;
- gtk_signal_emit (GTK_OBJECT (section->manager),
- e_select_names_manager_signals[CHANGED],
- section->id,
- FALSE);
-}
-
-static void
-section_model_working_copy_changed_cb (ESelectNamesModel *model, gpointer closure)
-{
- ESelectNamesManagerSection *section = closure;
- gtk_signal_emit (GTK_OBJECT (section->manager),
- e_select_names_manager_signals[CHANGED],
- section->id,
- TRUE);
-}
-
-void
-e_select_names_manager_add_section (ESelectNamesManager *manager,
- const char *id,
- const char *title)
-{
- e_select_names_manager_add_section_with_limit (manager, id, title, -1);
-}
-
-void
-e_select_names_manager_add_section_with_limit (ESelectNamesManager *manager,
- const char *id,
- const char *title,
- gint limit)
-{
- ESelectNamesManagerSection *section;
-
- section = g_new(ESelectNamesManagerSection, 1);
- section->id = g_strdup(id);
- section->title = g_strdup(title);
-
- section->model = e_select_names_model_new();
- e_select_names_model_set_limit (section->model, limit);
-
- section->manager = manager;
-
- section->changed_handler = gtk_signal_connect (GTK_OBJECT (section->model),
- "changed",
- GTK_SIGNAL_FUNC (section_model_changed_cb),
- section);
-
- e_list_append(manager->sections, section);
- section_free(section, manager);
-}
-
-ESelectNamesModel *
-e_select_names_manager_get_source (ESelectNamesManager *manager, const char *id)
-{
- EIterator *iterator;
-
- g_return_val_if_fail (manager && E_IS_SELECT_NAMES_MANAGER (manager), NULL);
- g_return_val_if_fail (id, NULL);
-
- iterator = e_list_get_iterator (manager->sections);
- for (e_iterator_reset (iterator); e_iterator_is_valid (iterator); e_iterator_next (iterator)) {
- const ESelectNamesManagerSection *section = e_iterator_get (iterator);
- if (!strcmp (section->id, id)) {
- return section->model;
- }
- }
-
- return NULL;
-}
-
-static void
-entry_destroyed(EEntry *entry, ESelectNamesManager *manager)
-{
- if(!GTK_OBJECT_DESTROYED(manager)) {
- EIterator *iterator = e_list_get_iterator(manager->entries);
- for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
- const ESelectNamesManagerEntry *this_entry = e_iterator_get(iterator);
- if(entry == this_entry->entry) {
- e_iterator_delete(iterator);
- break;
- }
- }
- }
- gtk_object_unref(GTK_OBJECT(manager));
-}
-
-static void
-completion_handler (EEntry *entry, ECompletionMatch *match)
-{
- ESelectNamesModel *snm;
- EDestination *dest;
- gint i, pos, start_pos, len;
-
- if (match == NULL || match->user_data == NULL)
- return;
-
-
- snm = E_SELECT_NAMES_MODEL (gtk_object_get_data (GTK_OBJECT (entry), "select_names_model"));
- dest = E_DESTINATION (match->user_data);
-
- /* Sometimes I really long for garbage collection. Reference
- counting makes you feel 31337, but sometimes it is just a
- bitch. */
- gtk_object_ref (GTK_OBJECT (dest));
-
- pos = e_entry_get_position (entry);
- e_select_names_model_text_pos (snm, pos, &i, NULL, NULL);
- e_select_names_model_replace (snm, i, dest);
- e_select_names_model_name_pos (snm, i, &start_pos, &len);
- e_entry_set_position (entry, start_pos+len);
-}
-
-static void
-popup_cb (EEntry *entry, GdkEventButton *ev, gint pos, ESelectNamesModel *model)
-{
- e_select_names_popup (model, ev, pos);
-}
-
-GtkWidget *
-e_select_names_manager_create_entry (ESelectNamesManager *manager, const char *id)
-{
- ETextModel *model;
- EIterator *iterator;
- iterator = e_list_get_iterator(manager->sections);
- for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
- const ESelectNamesManagerSection *section = e_iterator_get(iterator);
- if (!strcmp(section->id, id)) {
- ESelectNamesManagerEntry *entry;
- EEntry *eentry;
- ECompletion *comp;
-
- eentry = E_ENTRY (e_entry_new ());
- gtk_object_set_data (GTK_OBJECT (eentry), "select_names_model", section->model);
-
- gtk_signal_connect (GTK_OBJECT (eentry),
- "popup",
- GTK_SIGNAL_FUNC (popup_cb),
- section->model);
-
- entry = g_new (ESelectNamesManagerEntry, 1);
- entry->entry = eentry;
- entry->id = (char *)id;
-
- model = e_select_names_text_model_new (section->model);
- e_list_append (manager->entries, entry);
- g_free(entry);
-
- comp = e_select_names_completion_new (NULL, section->model); /* NULL == use local addressbook */
- e_entry_enable_completion_full (eentry, comp, 50, completion_handler);
-
- gtk_object_set_data (GTK_OBJECT (eentry), "completion_handler", comp);
-
- gtk_object_set(GTK_OBJECT(eentry),
- "model", model,
- "editable", TRUE,
- "use_ellipsis", TRUE,
- "allow_newlines", FALSE,
- NULL);
- gtk_signal_connect(GTK_OBJECT(eentry), "destroy",
- GTK_SIGNAL_FUNC(entry_destroyed), manager);
- gtk_object_ref(GTK_OBJECT(manager));
- return GTK_WIDGET(eentry);
- }
- }
- return NULL;
-}
-
-static void
-e_select_names_clicked(ESelectNames *dialog, gint button, ESelectNamesManager *manager)
-{
- switch(button) {
- case 0: {
- EList *list = manager->sections;
- EIterator *iterator = e_list_get_iterator(list);
- for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
- ESelectNamesManagerSection *section = (void *) e_iterator_get(iterator);
- ESelectNamesModel *source = e_select_names_get_source(dialog, section->id);
- e_select_names_model_overwrite_copy (section->model, source);
- gtk_object_unref (GTK_OBJECT (source));
-
- }
- gtk_object_unref(GTK_OBJECT(iterator));
-
-#if 0
- list = manager->entries;
- iterator = e_list_get_iterator(list);
- for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
- ESelectNamesManagerEntry *entry = (void *) e_iterator_get(iterator);
- ESelectNamesModel *source = e_select_names_get_source(dialog, entry->id);
- if (source) {
- ETextModel *model = e_select_names_text_model_new(source);
- if (model) {
- gtk_object_set(GTK_OBJECT(entry->entry),
- "model", model,
- NULL);
- gtk_object_unref(GTK_OBJECT(source));
- }
- gtk_object_unref(GTK_OBJECT(model));
- }
- }
- gtk_object_unref(GTK_OBJECT(iterator));
-#endif
- break;
- }
- }
- gnome_dialog_close(GNOME_DIALOG(dialog));
-}
-
-void
-e_select_names_manager_activate_dialog (ESelectNamesManager *manager,
- const char *id)
-{
- EIterator *iterator;
-
- if (manager->names) {
- g_assert (GTK_WIDGET_REALIZED (GTK_WIDGET (manager->names)));
- e_select_names_set_default(manager->names, id);
- gdk_window_show (GTK_WIDGET (manager->names)->window);
- gdk_window_raise (GTK_WIDGET (manager->names)->window);
- } else {
- manager->names = E_SELECT_NAMES (e_select_names_new ());
-
- iterator = e_list_get_iterator(manager->sections);
- for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
- const ESelectNamesManagerSection *section = e_iterator_get(iterator);
- ESelectNamesModel *newmodel = e_select_names_model_duplicate(section->model);
- e_select_names_add_section(manager->names, section->id, section->title, newmodel);
- gtk_signal_connect (GTK_OBJECT (newmodel),
- "changed",
- GTK_SIGNAL_FUNC (section_model_working_copy_changed_cb),
- (gpointer)section); /* casting out const to avoid compiler warning */
- gtk_object_unref(GTK_OBJECT(newmodel));
- }
- e_select_names_set_default(manager->names, id);
- gtk_signal_connect(GTK_OBJECT(manager->names), "clicked",
- GTK_SIGNAL_FUNC(e_select_names_clicked), manager);
- gtk_signal_connect(GTK_OBJECT(manager->names), "destroy",
- GTK_SIGNAL_FUNC(gtk_widget_destroyed),
- &manager->names);
- gtk_widget_show(GTK_WIDGET(manager->names));
- }
-}
-
-#if 0
-/* Of type ECard */
-EList *
-e_select_names_manager_get_cards (ESelectNamesManager *manager,
- const char *id)
-{
- EIterator *iterator;
- iterator = e_list_get_iterator(manager->sections);
- for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
- const ESelectNamesManagerSection *section = e_iterator_get(iterator);
- if (!strcmp(section->id, id)) {
- return e_select_names_model_get_cards(section->model);
- }
- }
- return NULL;
-}
-#endif
diff --git a/addressbook/gui/component/select-names/e-select-names-manager.h b/addressbook/gui/component/select-names/e-select-names-manager.h
deleted file mode 100644
index 61779fb56a..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-manager.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2000 Ximian, Inc.
- */
-
-#ifndef __E_SELECT_NAMES_MANAGER_H__
-#define __E_SELECT_NAMES_MANAGER_H__
-
-#include <stdio.h>
-#include <time.h>
-#include <gtk/gtkobject.h>
-#include <e-util/e-list.h>
-#include "e-select-names.h"
-
-#define E_TYPE_SELECT_NAMES_MANAGER (e_select_names_manager_get_type ())
-#define E_SELECT_NAMES_MANAGER(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SELECT_NAMES_MANAGER, ESelectNamesManager))
-#define E_SELECT_NAMES_MANAGER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_MANAGER, ESelectNamesManagerClass))
-#define E_IS_SELECT_NAMES_MANAGER(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SELECT_NAMES_MANAGER))
-#define E_IS_SELECT_NAMES_MANAGER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_MANAGER))
-
-typedef struct _ESelectNamesManager ESelectNamesManager;
-typedef struct _ESelectNamesManagerClass ESelectNamesManagerClass;
-
-struct _ESelectNamesManager {
- GtkObject object;
-
- EList *sections;
- EList *entries;
-
- ESelectNames *names;
-};
-
-struct _ESelectNamesManagerClass {
- GtkObjectClass parent_class;
-
- void (*changed) (ESelectNamesManager *, const gchar *section_id, gint changed_working_copy);
-};
-
-ESelectNamesManager *e_select_names_manager_new (void);
-void e_select_names_manager_add_section (ESelectNamesManager *manager,
- const char *id,
- const char *title);
-void e_select_names_manager_add_section_with_limit (ESelectNamesManager *manager,
- const char *id,
- const char *title,
- gint limit);
-ESelectNamesModel *e_select_names_manager_get_source (ESelectNamesManager *manager,
- const char *id);
-GtkWidget *e_select_names_manager_create_entry (ESelectNamesManager *manager,
- const char *id);
-void e_select_names_manager_activate_dialog (ESelectNamesManager *manager,
- const char *id);
-
-#if 0
-/* Of type ECard */
-EList *e_select_names_manager_get_cards (ESelectNamesManager *manager,
- const char *id);
-#endif
-
-/* Standard Gtk function */
-GtkType e_select_names_manager_get_type (void);
-
-#endif /* ! __E_SELECT_NAMES_MANAGER_H__ */
diff --git a/addressbook/gui/component/select-names/e-select-names-model.c b/addressbook/gui/component/select-names/e-select-names-model.c
deleted file mode 100644
index dc383994d3..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-model.c
+++ /dev/null
@@ -1,694 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Jon Trowbidge <trow@ximian.com>
- *
- * Copyright (C) 2000, 2001 Ximian, Inc.
- */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gtk/gtkmarshal.h>
-#include <gtk/gtksignal.h>
-
-#include <gal/util/e-util.h>
-
-#include "e-select-names-model.h"
-#include "addressbook/backend/ebook/e-card-simple.h"
-
-#define SEPARATOR ", "
-#define SEPLEN 2
-
-
-enum {
- E_SELECT_NAMES_MODEL_CHANGED,
- E_SELECT_NAMES_MODEL_RESIZED,
- E_SELECT_NAMES_MODEL_LAST_SIGNAL
-};
-
-static guint e_select_names_model_signals[E_SELECT_NAMES_MODEL_LAST_SIGNAL] = { 0 };
-
-/* Object argument IDs */
-enum {
- ARG_0,
- ARG_CARD,
-};
-
-enum {
- NAME_DATA_BLANK,
- NAME_DATA_CARD,
- NAME_DATA_STRING
-};
-
-enum {
- NAME_FORMAT_GIVEN_FIRST,
- NAME_FORMAT_FAMILY_FIRST
-};
-
-struct _ESelectNamesModelPrivate {
- gchar *id;
- gchar *title;
-
- GList *data; /* of EDestination */
- gchar *text;
- gchar *addr_text;
-
- gint limit;
-};
-
-
-static void e_select_names_model_init (ESelectNamesModel *model);
-static void e_select_names_model_class_init (ESelectNamesModelClass *klass);
-
-static void e_select_names_model_destroy (GtkObject *object);
-static void e_select_names_model_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_select_names_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-
-GtkType
-e_select_names_model_get_type (void)
-{
- static GtkType model_type = 0;
-
- if (!model_type) {
- GtkTypeInfo model_info = {
- "ESelectNamesModel",
- sizeof (ESelectNamesModel),
- sizeof (ESelectNamesModelClass),
- (GtkClassInitFunc) e_select_names_model_class_init,
- (GtkObjectInitFunc) e_select_names_model_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- model_type = gtk_type_unique (gtk_object_get_type (), &model_info);
- }
-
- return model_type;
-}
-
-typedef void (*GtkSignal_NONE__INT_INT_INT) (GtkObject *object, gint arg1, gint arg2, gint arg3, gpointer user_data);
-static void
-local_gtk_marshal_NONE__INT_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkSignal_NONE__INT_INT_INT rfunc;
- rfunc = (GtkSignal_NONE__INT_INT_INT) func;
- (* rfunc) (object,
- GTK_VALUE_INT(args[0]),
- GTK_VALUE_INT(args[1]),
- GTK_VALUE_INT(args[2]),
- func_data);
-}
-
-
-static void
-e_select_names_model_class_init (ESelectNamesModelClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS(klass);
-
- e_select_names_model_signals[E_SELECT_NAMES_MODEL_CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ESelectNamesModelClass, changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_select_names_model_signals[E_SELECT_NAMES_MODEL_RESIZED] =
- gtk_signal_new ("resized",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ESelectNamesModelClass, resized),
- local_gtk_marshal_NONE__INT_INT_INT,
- GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_INT);
-
- gtk_object_class_add_signals (object_class, e_select_names_model_signals, E_SELECT_NAMES_MODEL_LAST_SIGNAL);
-
- gtk_object_add_arg_type ("ESelectNamesModel::card",
- GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CARD);
-
- klass->changed = NULL;
-
- object_class->destroy = e_select_names_model_destroy;
- object_class->get_arg = e_select_names_model_get_arg;
- object_class->set_arg = e_select_names_model_set_arg;
-}
-
-/**
- * e_select_names_model_init:
- */
-static void
-e_select_names_model_init (ESelectNamesModel *model)
-{
- model->priv = g_new0 (struct _ESelectNamesModelPrivate, 1);
-
- model->priv->limit = -1;
-}
-
-static void
-e_select_names_model_destroy (GtkObject *object)
-{
- ESelectNamesModel *model = E_SELECT_NAMES_MODEL (object);
-
- g_free (model->priv->title);
- g_free (model->priv->id);
-
- g_list_foreach (model->priv->data, (GFunc) gtk_object_unref, NULL);
- g_list_free (model->priv->data);
-
- g_free (model->priv->text);
- g_free (model->priv->addr_text);
-
- g_free (model->priv);
-
-}
-
-
-/* Set_arg handler for the model */
-static void
-e_select_names_model_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ESelectNamesModel *model;
-
- model = E_SELECT_NAMES_MODEL (object);
-
- switch (arg_id) {
- case ARG_CARD:
- break;
- default:
- return;
- }
-}
-
-/* Get_arg handler for the model */
-static void
-e_select_names_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ESelectNamesModel *model;
-
- model = E_SELECT_NAMES_MODEL (object);
-
- switch (arg_id) {
- case ARG_CARD:
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-
-static void
-e_select_names_model_changed (ESelectNamesModel *model)
-{
- g_free (model->priv->text);
- model->priv->text = NULL;
-
- g_free (model->priv->addr_text);
- model->priv->addr_text = NULL;
-
- gtk_signal_emit (GTK_OBJECT(model), e_select_names_model_signals[E_SELECT_NAMES_MODEL_CHANGED]);
-}
-
-/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
-
-ESelectNamesModel *
-e_select_names_model_new (void)
-{
- ESelectNamesModel *model;
- model = E_SELECT_NAMES_MODEL (gtk_type_new (e_select_names_model_get_type ()));
- return model;
-}
-
-ESelectNamesModel *
-e_select_names_model_duplicate (ESelectNamesModel *old)
-{
- ESelectNamesModel *model = E_SELECT_NAMES_MODEL(gtk_type_new(e_select_names_model_get_type()));
- GList *iter;
-
- model->priv->id = g_strdup (old->priv->id);
- model->priv->title = g_strdup (old->priv->title);
-
- for (iter = old->priv->data; iter != NULL; iter = g_list_next (iter)) {
- EDestination *dup = e_destination_copy (E_DESTINATION (iter->data));
- model->priv->data = g_list_append (model->priv->data, dup);
- }
-
- model->priv->limit = old->priv->limit;
-
- return model;
-}
-
-const gchar *
-e_select_names_model_get_textification (ESelectNamesModel *model)
-{
- g_return_val_if_fail (model != NULL, NULL);
- g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), NULL);
-
- if (model->priv->text == NULL) {
-
- if (model->priv->data == NULL) {
-
- model->priv->text = g_strdup ("");
-
- } else {
- gchar **strv = g_new0 (gchar *, g_list_length (model->priv->data)+1);
- gint i = 0;
- GList *iter = model->priv->data;
-
- while (iter) {
- EDestination *dest = E_DESTINATION (iter->data);
- strv[i] = (gchar *) e_destination_get_textrep (dest);
- ++i;
- iter = g_list_next (iter);
- }
-
- model->priv->text = g_strjoinv (SEPARATOR, strv);
-
- g_free (strv);
- }
- }
-
- return model->priv->text;
-}
-
-const gchar *
-e_select_names_model_get_address_text (ESelectNamesModel *model)
-{
- g_return_val_if_fail (model != NULL, NULL);
- g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), NULL);
-
- if (model->priv->addr_text == NULL) {
-
- if (model->priv->data == NULL) {
-
- model->priv->addr_text = g_strdup ("");
-
- } else {
- gchar **strv = g_new0 (gchar *, g_list_length (model->priv->data)+1);
- gint i = 0;
- GList *iter = model->priv->data;
-
- while (iter) {
- EDestination *dest = E_DESTINATION (iter->data);
- strv[i] = (gchar *) e_destination_get_address (dest);
- if (strv[i])
- ++i;
- iter = g_list_next (iter);
- }
-
- model->priv->addr_text = g_strjoinv (SEPARATOR, strv);
-
- g_free (strv);
- }
- }
-
- return model->priv->addr_text;
-}
-
-gint
-e_select_names_model_count (ESelectNamesModel *model)
-{
- g_return_val_if_fail (model != NULL, 0);
- g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), 0);
-
- return g_list_length (model->priv->data);
-}
-
-gint
-e_select_names_model_get_limit (ESelectNamesModel *model)
-{
- g_return_val_if_fail (model != NULL, 0);
- g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), 0);
-
- return model->priv->limit;
-}
-
-void
-e_select_names_model_set_limit (ESelectNamesModel *model, gint limit)
-{
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
-
- model->priv->limit = MAX (limit, -1);
-}
-
-gboolean
-e_select_names_model_at_limit (ESelectNamesModel *model)
-{
- g_return_val_if_fail (model != NULL, TRUE);
- g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), TRUE);
-
- return model->priv->limit >= 0 && g_list_length (model->priv->data) >= model->priv->limit;
-}
-
-const EDestination *
-e_select_names_model_get_destination (ESelectNamesModel *model, gint index)
-{
- g_return_val_if_fail (model && E_IS_SELECT_NAMES_MODEL (model), NULL);
- g_return_val_if_fail (0 <= index, NULL);
- g_return_val_if_fail (index < g_list_length (model->priv->data), NULL);
-
- return E_DESTINATION (g_list_nth_data (model->priv->data, index));
-}
-
-gchar *
-e_select_names_model_export_destinationv (ESelectNamesModel *model)
-{
- EDestination **destv;
- gchar *str;
- gint i, len = 0;
- GList *j;
- g_return_val_if_fail (model && E_IS_SELECT_NAMES_MODEL (model), NULL);
-
- len = g_list_length (model->priv->data);
- destv = g_new0 (EDestination *, len+1);
-
- for (i=0, j = model->priv->data; j != NULL; j = g_list_next (j)) {
- EDestination *dest = E_DESTINATION (j->data);
-
- if (dest)
- destv[i++] = dest;
- }
-
- str = e_destination_exportv (destv);
- g_free (destv);
-
- return str;
-}
-
-static
-void send_changed (EDestination *dest, ECard *card, gpointer closure)
-{
- ESelectNamesModel *model = closure;
- e_select_names_model_changed (model);
-}
-
-void
-e_select_names_model_import_destinationv (ESelectNamesModel *model,
- gchar *destinationv)
-{
- EDestination **destv;
- gint i;
-
- g_return_if_fail (model && E_IS_SELECT_NAMES_MODEL (model));
-
- destv = e_destination_importv (destinationv);
-
- e_select_names_model_delete_all (model);
-
- if (destv == NULL)
- return;
-
- for (i = 0; destv[i]; i++) {
- e_destination_use_card (destv[i], send_changed, model);
- e_select_names_model_append (model, destv[i]);
- }
- g_free (destv);
-}
-
-ECard *
-e_select_names_model_get_card (ESelectNamesModel *model, gint index)
-{
- const EDestination *dest;
-
- g_return_val_if_fail (model && E_IS_SELECT_NAMES_MODEL (model), NULL);
- g_return_val_if_fail (0 <= index, NULL);
- g_return_val_if_fail (index < g_list_length (model->priv->data), NULL);
-
- dest = e_select_names_model_get_destination (model, index);
- return dest ? e_destination_get_card (dest) : NULL;
-
-}
-
-const gchar *
-e_select_names_model_get_string (ESelectNamesModel *model, gint index)
-{
- const EDestination *dest;
-
- g_return_val_if_fail (model && E_IS_SELECT_NAMES_MODEL (model), NULL);
- g_return_val_if_fail (0 <= index, NULL);
- g_return_val_if_fail (index < g_list_length (model->priv->data), NULL);
-
- dest = e_select_names_model_get_destination (model, index);
-
- return dest ? e_destination_get_textrep (dest) : "";
-}
-
-void
-e_select_names_model_insert (ESelectNamesModel *model, gint index, EDestination *dest)
-{
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
- g_return_if_fail (0 <= index && index <= g_list_length (model->priv->data));
- g_return_if_fail (dest && E_IS_DESTINATION (dest));
-
- if (e_select_names_model_at_limit (model)) {
- /* FIXME: This is bad. */
- gtk_object_unref (GTK_OBJECT (dest));
- return;
- }
-
- model->priv->data = g_list_insert (model->priv->data, dest, index);
-
- gtk_object_ref (GTK_OBJECT (dest));
- gtk_object_sink (GTK_OBJECT (dest));
-
- e_select_names_model_changed (model);
-}
-
-void
-e_select_names_model_append (ESelectNamesModel *model, EDestination *dest)
-{
- g_return_if_fail (model && E_IS_SELECT_NAMES_MODEL (model));
- g_return_if_fail (dest && E_IS_DESTINATION (dest));
-
- if (e_select_names_model_at_limit (model)) {
- /* FIXME: This is bad. */
- gtk_object_unref (GTK_OBJECT (dest));
- return;
- }
-
- model->priv->data = g_list_append (model->priv->data, dest);
-
- gtk_object_ref (GTK_OBJECT (dest));
- gtk_object_sink (GTK_OBJECT (dest));
-
- e_select_names_model_changed (model);
-}
-
-void
-e_select_names_model_replace (ESelectNamesModel *model, gint index, EDestination *dest)
-{
- GList *node;
- const gchar *new_str, *old_str;
- gint old_strlen=0, new_strlen=0;
-
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
- g_return_if_fail (model->priv->data == NULL || (0 <= index && index < g_list_length (model->priv->data)));
- g_return_if_fail (dest && E_IS_DESTINATION (dest));
-
- new_str = e_destination_get_textrep (dest);
- new_strlen = new_str ? strlen (new_str) : 0;
-
- if (model->priv->data == NULL) {
-
- model->priv->data = g_list_append (model->priv->data, dest);
- gtk_object_ref (GTK_OBJECT (dest));
- gtk_object_sink (GTK_OBJECT (dest));
-
- } else {
-
- node = g_list_nth (model->priv->data, index);
-
- if (node->data != dest) {
-
- old_str = e_destination_get_textrep (E_DESTINATION (node->data));
- old_strlen = old_str ? strlen (old_str) : 0;
-
- gtk_object_unref (GTK_OBJECT (node->data));
-
- node->data = dest;
- gtk_object_ref (GTK_OBJECT (dest));
- gtk_object_sink (GTK_OBJECT (dest));
- }
- }
-
- e_select_names_model_changed (model);
-
- gtk_signal_emit (GTK_OBJECT (model), e_select_names_model_signals[E_SELECT_NAMES_MODEL_RESIZED],
- index, old_strlen, new_strlen);
-}
-
-void
-e_select_names_model_delete (ESelectNamesModel *model, gint index)
-{
- GList *node;
-
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
- g_return_if_fail (0 <= index && index < g_list_length (model->priv->data));
-
- node = g_list_nth (model->priv->data, index);
- gtk_object_unref (GTK_OBJECT (node->data));
-
- model->priv->data = g_list_remove_link (model->priv->data, node);
- g_list_free_1 (node);
-
- e_select_names_model_changed (model);
-}
-
-void
-e_select_names_model_clean (ESelectNamesModel *model)
-{
- GList *iter, *next;
- gboolean changed = FALSE;
-
- g_return_if_fail (model != NULL && E_IS_SELECT_NAMES_MODEL (model));
-
- iter = model->priv->data;
-
- while (iter) {
- EDestination *dest;
-
- next = g_list_next (iter);
- dest = iter->data ? E_DESTINATION (iter->data) : NULL;
-
- if (dest == NULL || e_destination_is_empty (dest)) {
- if (dest)
- gtk_object_unref (GTK_OBJECT (dest));
- model->priv->data = g_list_remove_link (model->priv->data, iter);
- g_list_free_1 (iter);
- changed = TRUE;
- }
-
- iter = next;
- }
-
- if (changed)
- e_select_names_model_changed (model);
-}
-
-void
-e_select_names_model_delete_all (ESelectNamesModel *model)
-{
- g_return_if_fail (model != NULL && E_IS_SELECT_NAMES_MODEL (model));
-
- g_list_foreach (model->priv->data, (GFunc) gtk_object_unref, NULL);
- g_list_free (model->priv->data);
- model->priv->data = NULL;
-
- e_select_names_model_changed (model);
-}
-
-void
-e_select_names_model_overwrite_copy (ESelectNamesModel *dest, ESelectNamesModel *src)
-{
- gint i, len;
-
- g_return_if_fail (dest && E_IS_SELECT_NAMES_MODEL (dest));
- g_return_if_fail (src && E_IS_SELECT_NAMES_MODEL (src));
-
- if (src == dest)
- return;
-
- e_select_names_model_delete_all (dest);
- len = e_select_names_model_count (src);
- for (i = 0; i < len; ++i) {
- const EDestination *d = e_select_names_model_get_destination (src, i);
- if (d)
- e_select_names_model_append (dest, e_destination_copy (d));
- }
-}
-
-void
-e_select_names_model_name_pos (ESelectNamesModel *model, gint index, gint *pos, gint *length)
-{
- gint rp = 0, i, len = 0;
- GList *iter;
- const gchar *str;
-
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
-
- i = 0;
- iter = model->priv->data;
- while (iter && i <= index) {
- rp += len + (i > 0 ? SEPLEN : 0);
- str = e_destination_get_textrep (E_DESTINATION (iter->data));
- len = str ? strlen (str) : 0;
- ++i;
- iter = g_list_next (iter);
- }
-
- if (i <= index) {
- rp = -1;
- len = 0;
- }
-
- if (pos)
- *pos = rp;
- if (length)
- *length = len;
-}
-
-void
-e_select_names_model_text_pos (ESelectNamesModel *model, gint pos, gint *index, gint *start_pos, gint *length)
-{
- GList *iter;
- const gchar *str;
- gint len = 0, i = 0, sp = 0, adj = 0;
-
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
-
- iter = model->priv->data;
-
- while (iter != NULL) {
- str = e_destination_get_textrep (E_DESTINATION (iter->data));
- len = str ? strlen (str) : 0;
-
- if (sp <= pos && pos <= sp + len + adj) {
- break;
- }
-
- sp += len + adj + 1;
- adj = 1;
- ++i;
-
- iter = g_list_next (iter);
- }
-
- if (i != 0)
- ++sp; /* skip past "magic space" */
-
- if (iter == NULL) {
-#if 0
- g_print ("text_pos ended NULL\n");
-#endif
- i = -1;
- sp = -1;
- len = 0;
- } else {
-#if 0
- g_print ("text_pos got index %d\n", i);
-#endif
- }
-
- if (index)
- *index = i;
- if (start_pos)
- *start_pos = sp;
- if (length)
- *length = len;
-}
diff --git a/addressbook/gui/component/select-names/e-select-names-model.h b/addressbook/gui/component/select-names/e-select-names-model.h
deleted file mode 100644
index b11e9503ec..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-model.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Jon Trowbridge <trow@ximian.com>
- *
- * Copyright (C) 2000, 2001 Ximian, Inc.
- */
-
-#ifndef __E_SELECT_NAMES_MODEL_H__
-#define __E_SELECT_NAMES_MODEL_H__
-
-#include <time.h>
-#include <gtk/gtkobject.h>
-#include <stdio.h>
-#include <e-util/e-list.h>
-#include <addressbook/backend/ebook/e-card.h>
-#include <addressbook/backend/ebook/e-destination.h>
-
-#define E_TYPE_SELECT_NAMES_MODEL (e_select_names_model_get_type ())
-#define E_SELECT_NAMES_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SELECT_NAMES_MODEL, ESelectNamesModel))
-#define E_SELECT_NAMES_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_MODEL, ESelectNamesModelClass))
-#define E_IS_SELECT_NAMES_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SELECT_NAMES_MODEL))
-#define E_IS_SELECT_NAMES_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_MODEL))
-
-typedef struct _ESelectNamesModel ESelectNamesModel;
-typedef struct _ESelectNamesModelClass ESelectNamesModelClass;
-struct _ESelectNamesModelPrivate;
-
-struct _ESelectNamesModel {
- GtkObject object;
-
- struct _ESelectNamesModelPrivate *priv;
-};
-
-struct _ESelectNamesModelClass {
- GtkObjectClass parent_class;
-
- void (*changed) (ESelectNamesModel *model);
- void (*resized) (ESelectNamesModel *model, gint index, gint old_len, gint new_len);
-};
-
-GtkType e_select_names_model_get_type (void);
-
-ESelectNamesModel *e_select_names_model_new (void);
-ESelectNamesModel *e_select_names_model_duplicate (ESelectNamesModel *old);
-
-const gchar *e_select_names_model_get_textification (ESelectNamesModel *model);
-const gchar *e_select_names_model_get_address_text (ESelectNamesModel *model);
-
-gint e_select_names_model_count (ESelectNamesModel *model);
-gint e_select_names_model_get_limit (ESelectNamesModel *model);
-void e_select_names_model_set_limit (ESelectNamesModel *model, gint limit);
-gboolean e_select_names_model_at_limit (ESelectNamesModel *model);
-
-const EDestination *e_select_names_model_get_destination (ESelectNamesModel *model, gint index);
-gchar *e_select_names_model_export_destinationv (ESelectNamesModel *model);
-void e_select_names_model_import_destinationv (ESelectNamesModel *model,
- gchar *destinationv);
-ECard *e_select_names_model_get_card (ESelectNamesModel *model, gint index);
-const gchar *e_select_names_model_get_string (ESelectNamesModel *model, gint index);
-
-void e_select_names_model_insert (ESelectNamesModel *model, gint index, EDestination *dest);
-void e_select_names_model_append (ESelectNamesModel *model, EDestination *dest);
-void e_select_names_model_replace (ESelectNamesModel *model, gint index, EDestination *dest);
-void e_select_names_model_delete (ESelectNamesModel *model, gint index);
-void e_select_names_model_delete_all (ESelectNamesModel *model);
-void e_select_names_model_overwrite_copy (ESelectNamesModel *dest, ESelectNamesModel *src);
-
-void e_select_names_model_clean (ESelectNamesModel *model);
-
-void e_select_names_model_name_pos (ESelectNamesModel *model, gint index, gint *pos, gint *length);
-void e_select_names_model_text_pos (ESelectNamesModel *model, gint pos, gint *index, gint *start_pos, gint *length);
-
-#endif /* ! __E_SELECT_NAMES_MODEL_H__ */
diff --git a/addressbook/gui/component/select-names/e-select-names-popup.c b/addressbook/gui/component/select-names/e-select-names-popup.c
deleted file mode 100644
index 61de3a3c1f..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-popup.c
+++ /dev/null
@@ -1,445 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * e-select-names-popup.c
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Developed by Jon Trowbridge <trow@ximian.com>
- */
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <config.h>
-
-#include <stdio.h>
-#include <string.h>
-
-#include <glib.h>
-#include <gtk/gtkcheckmenuitem.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-app.h>
-#include <libgnomeui/gnome-app-helper.h>
-#include <libgnomeui/gnome-popup-menu.h>
-
-#include <addressbook/backend/ebook/e-book-util.h>
-#include <addressbook/gui/contact-editor/e-contact-editor.h>
-#include <addressbook/gui/contact-editor/e-contact-quick-add.h>
-#include "e-addressbook-util.h"
-#include "e-select-names-popup.h"
-
-typedef struct _PopupInfo PopupInfo;
-struct _PopupInfo {
- ESelectNamesModel *model;
- const EDestination *dest;
- gint pos;
- gint index;
-};
-
-static PopupInfo *
-popup_info_new (ESelectNamesModel *model, const EDestination *dest, gint pos, gint index)
-{
- PopupInfo *info = g_new0 (PopupInfo, 1);
- info->model = model;
- info->dest = dest;
- info->pos = pos;
- info->index = index;
-
- if (model)
- gtk_object_ref (GTK_OBJECT (model));
-
- if (dest)
- gtk_object_ref (GTK_OBJECT (dest));
-
- return info;
-}
-
-static void
-popup_info_free (PopupInfo *info)
-{
- if (info) {
-
- if (info->model)
- gtk_object_unref (GTK_OBJECT (info->model));
-
- if (info->dest)
- gtk_object_unref (GTK_OBJECT (info->dest));
-
- g_free (info);
- }
-}
-
-static void
-popup_info_cleanup (GtkWidget *w, gpointer info)
-{
- popup_info_free ((PopupInfo *) info);
-}
-
-/* You are in a maze of twisty little callbacks, all alike... */
-
-static void
-make_contact_editor_cb (EBook *book, gpointer user_data)
-{
- if (book) {
- EDestination *dest = E_DESTINATION (user_data);
- EContactEditor *ce;
- ECard *card;
-
- card = (ECard *) e_destination_get_card (dest);
- ce = e_addressbook_show_contact_editor (book, card, FALSE, TRUE);
- e_contact_editor_raise (ce);
- gtk_object_unref (GTK_OBJECT (dest));
- }
-}
-
-static void
-edit_contact_info_cb (GtkWidget *w, gpointer user_data)
-{
- PopupInfo *info = (PopupInfo *) user_data;
- if (info == NULL)
- return;
-
- gtk_object_ref (GTK_OBJECT (info->dest));
- e_book_use_local_address_book (make_contact_editor_cb, (gpointer) info->dest);
-}
-
-static void
-change_email_num_cb (GtkWidget *w, gpointer user_data)
-{
- PopupInfo *info = (PopupInfo *) user_data;
- gint n;
- EDestination *dest;
-
- if (info == NULL)
- return;
-
- if (! GTK_CHECK_MENU_ITEM (w)->active)
- return;
-
- n = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (w), "number"));
-
- if (n != e_destination_get_email_num (info->dest)) {
- dest = e_destination_new ();
- e_destination_set_card (dest, e_destination_get_card (info->dest), n);
- e_select_names_model_replace (info->model, info->index, dest);
-
- }
-}
-
-static void
-remove_recipient_cb (GtkWidget *w, gpointer user_data)
-{
- PopupInfo *info = (PopupInfo *) user_data;
- e_select_names_model_delete (info->model, info->index);
-}
-
-static void
-add_remove_recipient (GnomeUIInfo *uiinfo, PopupInfo *info)
-{
- uiinfo->type = GNOME_APP_UI_ITEM;
- uiinfo->label = _("Remove");
- uiinfo->moreinfo = remove_recipient_cb;
-}
-
-static void
-remove_all_recipients_cb (GtkWidget *w, gpointer user_data)
-{
- PopupInfo *info = (PopupInfo *) user_data;
- e_select_names_model_delete_all (info->model);
-}
-
-static void
-add_remove_all_recipients (GnomeUIInfo *uiinfo, PopupInfo *info)
-{
- uiinfo->type = GNOME_APP_UI_ITEM;
- uiinfo->label = _("Remove All");
- uiinfo->moreinfo = remove_all_recipients_cb;
-}
-
-static void
-toggle_html_mail_cb (GtkWidget *w, gpointer user_data)
-{
- PopupInfo *info = (PopupInfo *) user_data;
- GtkCheckMenuItem *item = GTK_CHECK_MENU_ITEM (w);
- const EDestination *dest;
-
- if (info == NULL)
- return;
-
- dest = info->dest;
-
- item = GTK_CHECK_MENU_ITEM (item);
- e_destination_set_html_mail_pref ((EDestination *) dest, item->active);
-}
-
-static void
-add_html_mail (GnomeUIInfo *uiinfo, PopupInfo *info)
-{
- uiinfo->type = GNOME_APP_UI_TOGGLEITEM;
- uiinfo->label = _("Send HTML Mail?");
- uiinfo->moreinfo = toggle_html_mail_cb;
-}
-
-static void
-init_html_mail (GnomeUIInfo *uiinfo, PopupInfo *info)
-{
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (uiinfo->widget),
- e_destination_get_html_mail_pref (info->dest));
- gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (uiinfo->widget), TRUE);
-
-}
-
-/* Duplicate the string, mapping _ to __. This is to make sure that underscores in
- e-mail addresses don't get mistaken for keyboard accelerators. */
-static gchar *
-quote_label (const gchar *str)
-{
- gint len = str ? strlen (str) : -1;
- const gchar *c = str;
- gchar *d, *q;
-
- if (len < 0)
- return NULL;
-
- while (*c) {
- if (*c == '_')
- ++len;
- ++c;
- }
-
- q = g_new (gchar, len+1);
- c = str;
- d = q;
- while (*c) {
- *d = *c;
- if (*c == '_') {
- ++d;
- *d = '_';
- }
- ++c;
- ++d;
- }
- *d = '\0';
- return q;
-}
-
-#define ARBITRARY_UIINFO_LIMIT 64
-static GtkWidget *
-popup_menu_card (PopupInfo *info)
-{
- GnomeUIInfo uiinfo[ARBITRARY_UIINFO_LIMIT];
- GnomeUIInfo radioinfo[ARBITRARY_UIINFO_LIMIT];
- gboolean using_radio = FALSE;
- ECard *card;
- gint i=0;
- GtkWidget *pop;
- EIterator *iterator;
- gint html_toggle;
- gchar *name_label;
-
- /*
- * Build up our GnomeUIInfo array.
- */
-
- memset (uiinfo, 0, sizeof (uiinfo));
- memset (radioinfo, 0, sizeof (radioinfo));
-
- card = e_destination_get_card (info->dest);
-
- uiinfo[i].type = GNOME_APP_UI_ITEM;
- name_label = quote_label (e_destination_get_name (info->dest));
- uiinfo[i].label = name_label;
- ++i;
-
- uiinfo[i].type = GNOME_APP_UI_SEPARATOR;
- ++i;
-
- if (e_list_length (card->email) > 1) {
- gint j = 0;
-
- using_radio = TRUE;
-
- iterator = e_list_get_iterator (card->email);
- for (e_iterator_reset (iterator); e_iterator_is_valid (iterator); e_iterator_next (iterator)) {
- gchar *label = (gchar *)e_iterator_get (iterator);
-
- if (label && *label) {
- radioinfo[j].type = GNOME_APP_UI_ITEM;
- radioinfo[j].label = label;
- radioinfo[j].moreinfo = change_email_num_cb;
- ++j;
- }
- }
-
- radioinfo[j].type = GNOME_APP_UI_ENDOFINFO;
-
- uiinfo[i].type = GNOME_APP_UI_RADIOITEMS;
- uiinfo[i].moreinfo = radioinfo;
- ++i;
-
- } else {
- uiinfo[i].type = GNOME_APP_UI_ITEM;
- uiinfo[i].label = (gchar *) e_destination_get_email (info->dest);
- ++i;
- }
-
- uiinfo[i].type = GNOME_APP_UI_SEPARATOR;
- ++i;
-
- add_html_mail (&(uiinfo[i]), info);
- html_toggle = i;
- ++i;
-
- uiinfo[i].type = GNOME_APP_UI_ITEM;
- uiinfo[i].label = N_("Edit Contact Info");
- uiinfo[i].moreinfo = edit_contact_info_cb;
- ++i;
-
- add_remove_recipient (&(uiinfo[i]), info);
- ++i;
-
- add_remove_all_recipients (&(uiinfo[i]), info);
- ++i;
-
- uiinfo[i].type = GNOME_APP_UI_ENDOFINFO;
-
- /*
- * Now do something with it...
- */
-
- pop = gnome_popup_menu_new (uiinfo);
-
- if (using_radio) {
- gint n = e_destination_get_email_num (info->dest);
- gint j;
- for (j=0; radioinfo[j].type != GNOME_APP_UI_ENDOFINFO; ++j) {
- gtk_object_set_data (GTK_OBJECT (radioinfo[j].widget), "number", GINT_TO_POINTER (j));
- if (j == n)
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (radioinfo[n].widget), TRUE);
- }
- }
-
- init_html_mail (&(uiinfo[html_toggle]), info);
-
- g_free (name_label);
-
- return pop;
-}
-
-static void
-quick_add_cb (GtkWidget *w, gpointer user_data)
-{
- PopupInfo *info = (PopupInfo *) user_data;
- e_contact_quick_add_free_form (e_destination_get_address (info->dest), NULL, NULL);
-}
-
-static GtkWidget *
-popup_menu_nocard (PopupInfo *info)
-{
- GnomeUIInfo uiinfo[ARBITRARY_UIINFO_LIMIT];
- gint i=0;
- GtkWidget *pop;
- const gchar *str;
- gchar *name_label;
- gint html_toggle;
-
- memset (uiinfo, 0, sizeof (uiinfo));
-
- str = e_destination_get_name (info->dest);
- if (str == NULL)
- str = e_destination_get_email (info->dest);
- if (str == NULL)
- str = _("Unnamed Contact");
- name_label = quote_label (str);
-
- uiinfo[i].type = GNOME_APP_UI_ITEM;
- uiinfo[i].label = name_label;
- ++i;
-
- uiinfo[i].type = GNOME_APP_UI_SEPARATOR;
- ++i;
-
- add_html_mail (&(uiinfo[i]), info);
- html_toggle = i;
- ++i;
-
- uiinfo[i].type = GNOME_APP_UI_ITEM;
- uiinfo[i].label = _("Add to Contacts");
- uiinfo[i].moreinfo = quick_add_cb;
- ++i;
-
- add_remove_recipient (&(uiinfo[i]), info);
- ++i;
-
- add_remove_all_recipients (&(uiinfo[i]), info);
- ++i;
-
- uiinfo[i].type = GNOME_APP_UI_ENDOFINFO;
-
- pop = gnome_popup_menu_new (uiinfo);
-
- init_html_mail (&(uiinfo[html_toggle]), info);
-
- g_free (name_label);
-
- return pop;
-}
-
-void
-e_select_names_popup (ESelectNamesModel *model, GdkEventButton *ev, gint pos)
-{
- GtkWidget *popup;
- PopupInfo *info;
- const EDestination *dest;
- ECard *card;
- gint index;
-
- g_return_if_fail (model && E_IS_SELECT_NAMES_MODEL (model));
- g_return_if_fail (ev);
- g_return_if_fail (0 <= pos);
-
- e_select_names_model_text_pos (model, pos, &index, NULL, NULL);
- if (index < 0 || index >= e_select_names_model_count (model))
- return;
-
- dest = e_select_names_model_get_destination (model, index);
- if (e_destination_is_empty (dest))
- return;
-
- card = e_destination_get_card (dest);
-
- info = popup_info_new (model, dest, pos, index);
-
- popup = card ? popup_menu_card (info) : popup_menu_nocard (info);
-
- if (popup) {
- /* Clean up our info item after we've made our selection. */
- gtk_signal_connect (GTK_OBJECT (popup),
- "selection-done",
- GTK_SIGNAL_FUNC (popup_info_cleanup),
- info);
-
- gnome_popup_menu_do_popup (popup, NULL, NULL, ev, info);
-
- } else {
-
- popup_info_free (info);
-
- }
-}
diff --git a/addressbook/gui/component/select-names/e-select-names-popup.h b/addressbook/gui/component/select-names/e-select-names-popup.h
deleted file mode 100644
index cc93534181..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-popup.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * e-select-names-popup.h
- *
- * Copyright (C) 2001 Ximian, Inc.
- *
- * Developed by Jon Trowbridge <trow@ximian.com>
- */
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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_SELECT_NAMES_POPUP_H__
-#define __E_SELECT_NAMES_POPUP_H__
-
-#include "e-select-names-model.h"
-
-void e_select_names_popup (ESelectNamesModel *model, GdkEventButton *ev, gint pos);
-
-#endif /* __E_SELECT_NAMES_POPUP_H__ */
-
diff --git a/addressbook/gui/component/select-names/e-select-names-table-model.c b/addressbook/gui/component/select-names/e-select-names-table-model.c
deleted file mode 100644
index fee84ce071..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-table-model.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2000 Ximian, Inc.
- */
-
-#include <config.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <gtk/gtksignal.h>
-#include <gal/util/e-util.h>
-
-#include "e-select-names-table-model.h"
-#include "addressbook/backend/ebook/e-card-simple.h"
-
-/* Object argument IDs */
-enum {
- ARG_0,
- ARG_SOURCE,
-};
-
-static void e_select_names_table_model_init (ESelectNamesTableModel *model);
-static void e_select_names_table_model_class_init (ESelectNamesTableModelClass *klass);
-
-static void e_select_names_table_model_destroy (GtkObject *object);
-static void e_select_names_table_model_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_select_names_table_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-
-static void e_select_names_table_model_model_changed (ESelectNamesModel *source,
- ESelectNamesTableModel *model);
-
-
-static void
-e_select_names_table_model_add_source (ESelectNamesTableModel *model,
- ESelectNamesModel *source)
-{
- model->source = source;
- if (model->source)
- gtk_object_ref(GTK_OBJECT(model->source));
- model->source_changed_id = gtk_signal_connect(GTK_OBJECT(model->source), "changed",
- GTK_SIGNAL_FUNC(e_select_names_table_model_model_changed),
- model);
-}
-
-static void
-e_select_names_table_model_drop_source (ESelectNamesTableModel *model)
-{
- if (model->source_changed_id)
- gtk_signal_disconnect(GTK_OBJECT(model->source), model->source_changed_id);
- if (model->source)
- gtk_object_unref(GTK_OBJECT(model->source));
- model->source = NULL;
- model->source_changed_id = 0;
-}
-
-/**
- * e_select_names_table_model_get_type:
- * @void:
- *
- * Registers the &ESelectNamesTableModel class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &ESelectNamesTableModel class.
- **/
-GtkType
-e_select_names_table_model_get_type (void)
-{
- static GtkType model_type = 0;
-
- if (!model_type) {
- GtkTypeInfo model_info = {
- "ESelectNamesTableModel",
- sizeof (ESelectNamesTableModel),
- sizeof (ESelectNamesTableModelClass),
- (GtkClassInitFunc) e_select_names_table_model_class_init,
- (GtkObjectInitFunc) e_select_names_table_model_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- model_type = gtk_type_unique (e_table_model_get_type (), &model_info);
- }
-
- return model_type;
-}
-
-/**
- * e_select_names_table_model_new:
- * @VCard: a string in vCard format
- *
- * Returns: a new #ESelectNamesTableModel that wraps the @VCard.
- */
-ETableModel *
-e_select_names_table_model_new (ESelectNamesModel *source)
-{
- ETableModel *model = E_TABLE_MODEL(gtk_type_new(e_select_names_table_model_get_type()));
- gtk_object_set(GTK_OBJECT(model),
- "source", source,
- NULL);
- return model;
-}
-
-static void
-fill_in_info (ESelectNamesTableModel *model)
-{
- if (model->source) {
- int count = e_select_names_model_count (model->source);
- gint i;
-
- model->count = count;
- model->data = g_new(ESelectNamesTableModelData, count);
-
- for (i = 0; i < count; ++i) {
- const EDestination *dest = e_select_names_model_get_destination (model->source, i);
- ECard *card = dest ? e_destination_get_card (dest) : NULL;
-
- if (card) {
- ECardSimple *simple = e_card_simple_new(card);
- model->data[i].name = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_NAME_OR_ORG);
- if (model->data[i].name == 0)
- model->data[i].name = g_strdup("");
- model->data[i].email = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_EMAIL);
- if (model->data[i].email == 0)
- model->data[i].email = g_strdup("");
- gtk_object_unref(GTK_OBJECT(simple));
- } else {
- model->data[i].name = g_strdup (e_destination_get_name (dest));
- model->data[i].email = g_strdup (e_destination_get_email (dest));
- }
- }
- } else {
- model->count = 0;
- }
-}
-
-static void
-clear_info (ESelectNamesTableModel *model)
-{
- int i;
- for (i = 0; i < model->count; i++) {
- g_free(model->data[i].name);
- g_free(model->data[i].email);
- }
- g_free(model->data);
- model->data = NULL;
- model->count = -1;
-}
-
-/*
- * ESelectNamesTableModel lifecycle management and vcard loading/saving.
- */
-
-static void
-e_select_names_table_model_destroy (GtkObject *object)
-{
- ESelectNamesTableModel *model;
-
- model = E_SELECT_NAMES_TABLE_MODEL (object);
-
- e_select_names_table_model_drop_source (model);
- clear_info(model);
-}
-
-/* This function returns the number of columns in our ETableModel. */
-static int
-e_select_names_table_model_col_count (ETableModel *etc)
-{
- return 2;
-}
-
-/* This function returns the number of rows in our ETableModel. */
-static int
-e_select_names_table_model_row_count (ETableModel *etc)
-{
- ESelectNamesTableModel *e_select_names_table_model = E_SELECT_NAMES_TABLE_MODEL(etc);
- if (e_select_names_table_model->count == -1) {
- if (e_select_names_table_model->source) {
- fill_in_info(e_select_names_table_model);
- } else {
- return 0;
- }
- }
- return e_select_names_table_model->count;
-}
-
-/* This function returns the value at a particular point in our ETableModel. */
-static void *
-e_select_names_table_model_value_at (ETableModel *etc, int col, int row)
-{
- ESelectNamesTableModel *e_select_names_table_model = E_SELECT_NAMES_TABLE_MODEL(etc);
- if (e_select_names_table_model->data == NULL) {
- fill_in_info(e_select_names_table_model);
- }
- switch (col) {
- case 0:
- if (e_select_names_table_model->data[row].name == NULL) {
- fill_in_info(e_select_names_table_model);
- }
- return e_select_names_table_model->data[row].name;
- break;
- case 1:
- if (e_select_names_table_model->data[row].email == NULL) {
- fill_in_info(e_select_names_table_model);
- }
- return e_select_names_table_model->data[row].email;
- break;
- }
- return "";
-}
-
-/* This function sets the value at a particular point in our ETableModel. */
-static void
-e_select_names_table_model_set_value_at (ETableModel *etc, int col, int row, const void *val)
-{
-}
-
-/* This function returns whether a particular cell is editable. */
-static gboolean
-e_select_names_table_model_is_cell_editable (ETableModel *etc, int col, int row)
-{
- return FALSE;
-}
-
-/* This function duplicates the value passed to it. */
-static void *
-e_select_names_table_model_duplicate_value (ETableModel *etc, int col, const void *value)
-{
- return g_strdup(value);
-}
-
-/* This function frees the value passed to it. */
-static void
-e_select_names_table_model_free_value (ETableModel *etc, int col, void *value)
-{
- g_free(value);
-}
-
-static void *
-e_select_names_table_model_initialize_value (ETableModel *etc, int col)
-{
- return g_strdup("");
-}
-
-static gboolean
-e_select_names_table_model_value_is_empty (ETableModel *etc, int col, const void *value)
-{
- return !(value && *(char *)value);
-}
-
-static char *
-e_select_names_table_model_value_to_string (ETableModel *etc, int col, const void *value)
-{
- return g_strdup(value);
-}
-
-static void
-e_select_names_table_model_model_changed (ESelectNamesModel *source,
- ESelectNamesTableModel *model)
-{
- clear_info(model);
- e_table_model_changed(E_TABLE_MODEL(model));
-}
-
-/* Set_arg handler for the model */
-static void
-e_select_names_table_model_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ESelectNamesTableModel *model;
-
- model = E_SELECT_NAMES_TABLE_MODEL (object);
-
- switch (arg_id) {
- case ARG_SOURCE:
- e_select_names_table_model_drop_source (model);
- e_select_names_table_model_add_source (model, E_SELECT_NAMES_MODEL(GTK_VALUE_OBJECT (*arg)));
- break;
- default:
- return;
- }
-}
-
-/* Get_arg handler for the model */
-static void
-e_select_names_table_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ESelectNamesTableModel *model;
-
- model = E_SELECT_NAMES_TABLE_MODEL (object);
-
- switch (arg_id) {
- case ARG_SOURCE:
- GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(model->source);
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-/**
- * e_select_names_table_model_init:
- */
-static void
-e_select_names_table_model_init (ESelectNamesTableModel *model)
-{
- model->source = NULL;
- model->source_changed_id = 0;
-
- model->count = -1;
- model->data = NULL;
-}
-
-static void
-e_select_names_table_model_class_init (ESelectNamesTableModelClass *klass)
-{
- GtkObjectClass *object_class;
- ETableModelClass *table_model_class;
-
- object_class = GTK_OBJECT_CLASS(klass);
- table_model_class = E_TABLE_MODEL_CLASS(klass);
-
- gtk_object_add_arg_type ("ESelectNamesTableModel::source",
- GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_SOURCE);
-
- object_class->destroy = e_select_names_table_model_destroy;
- object_class->get_arg = e_select_names_table_model_get_arg;
- object_class->set_arg = e_select_names_table_model_set_arg;
-
- table_model_class->column_count = e_select_names_table_model_col_count;
- table_model_class->row_count = e_select_names_table_model_row_count;
- table_model_class->value_at = e_select_names_table_model_value_at;
- table_model_class->set_value_at = e_select_names_table_model_set_value_at;
- table_model_class->is_cell_editable = e_select_names_table_model_is_cell_editable;
- table_model_class->duplicate_value = e_select_names_table_model_duplicate_value;
- table_model_class->free_value = e_select_names_table_model_free_value;
- table_model_class->initialize_value = e_select_names_table_model_initialize_value;
- table_model_class->value_is_empty = e_select_names_table_model_value_is_empty;
- table_model_class->value_to_string = e_select_names_table_model_value_to_string;
-}
diff --git a/addressbook/gui/component/select-names/e-select-names-table-model.h b/addressbook/gui/component/select-names/e-select-names-table-model.h
deleted file mode 100644
index f917ff17d8..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-table-model.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2000 Ximian, Inc.
- */
-
-#ifndef __E_SELECT_NAMES_TABLE_MODEL_H__
-#define __E_SELECT_NAMES_TABLE_MODEL_H__
-
-#include <time.h>
-#include <stdio.h>
-#include <gtk/gtkobject.h>
-#include <gal/e-table/e-table-model.h>
-#include "e-select-names-model.h"
-
-#define E_TYPE_SELECT_NAMES_TABLE_MODEL (e_select_names_table_model_get_type ())
-#define E_SELECT_NAMES_TABLE_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SELECT_NAMES_TABLE_MODEL, ESelectNamesTableModel))
-#define E_SELECT_NAMES_TABLE_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_TABLE_MODEL, ESelectNamesTableModelClass))
-#define E_IS_SELECT_NAMES_TABLE_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SELECT_NAMES_TABLE_MODEL))
-#define E_IS_SELECT_NAMES_TABLE_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_TABLE_MODEL))
-
-typedef struct {
- char *name;
- char *email;
-} ESelectNamesTableModelData;
-
-typedef struct _ESelectNamesTableModel ESelectNamesTableModel;
-typedef struct _ESelectNamesTableModelClass ESelectNamesTableModelClass;
-
-struct _ESelectNamesTableModel {
- ETableModel parent;
-
- ESelectNamesModel *source;
- int source_changed_id;
-
- int count;
- ESelectNamesTableModelData *data; /* This is used as an array. */
-};
-
-struct _ESelectNamesTableModelClass {
- ETableModelClass parent_class;
-};
-
-ETableModel *e_select_names_table_model_new (ESelectNamesModel *source);
-
-/* Standard Gtk function */
-GtkType e_select_names_table_model_get_type (void);
-
-#endif /* ! __E_SELECT_NAMES_TABLE_MODEL_H__ */
diff --git a/addressbook/gui/component/select-names/e-select-names-text-model.c b/addressbook/gui/component/select-names/e-select-names-text-model.c
deleted file mode 100644
index 11b3b67323..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-text-model.c
+++ /dev/null
@@ -1,723 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Jon Trowbridge <trow@ximian.com>
- *
- * Copyright (C) 2000, 2001 Ximian, Inc.
- */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-
-#include <gal/e-text/e-text-model-repos.h>
-
-#include <addressbook/gui/contact-editor/e-contact-editor.h>
-#include "e-select-names-text-model.h"
-#include "e-addressbook-util.h"
-
-static FILE *out = NULL; /* stream for debugging spew */
-
-#define SEPLEN 2
-
-/* Object argument IDs */
-enum {
- ARG_0,
- ARG_SOURCE,
-};
-
-static void e_select_names_text_model_class_init (ESelectNamesTextModelClass *klass);
-static void e_select_names_text_model_init (ESelectNamesTextModel *model);
-static void e_select_names_text_model_destroy (GtkObject *object);
-static void e_select_names_text_model_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_select_names_text_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-
-static void e_select_names_text_model_set_source (ESelectNamesTextModel *model, ESelectNamesModel *source);
-
-static const gchar *e_select_names_text_model_get_text (ETextModel *model);
-static void e_select_names_text_model_set_text (ETextModel *model, const gchar *text);
-static void e_select_names_text_model_insert (ETextModel *model, gint position, const gchar *text);
-static void e_select_names_text_model_insert_length (ETextModel *model, gint position, const gchar *text, gint length);
-static void e_select_names_text_model_delete (ETextModel *model, gint position, gint length);
-
-static gint e_select_names_text_model_obj_count (ETextModel *model);
-static const gchar *e_select_names_text_model_get_nth_obj (ETextModel *model, gint n, gint *len);
-static void e_select_names_text_model_activate_obj (ETextModel *model, gint n);
-
-
-ETextModelClass *parent_class;
-#define PARENT_TYPE e_text_model_get_type()
-
-/**
- * e_select_names_text_model_get_type:
- * @void:
- *
- * Registers the &ESelectNamesTextModel class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &ESelectNamesTextModel class.
- **/
-GtkType
-e_select_names_text_model_get_type (void)
-{
- static GtkType model_type = 0;
-
- if (!model_type) {
- GtkTypeInfo model_info = {
- "ESelectNamesTextModel",
- sizeof (ESelectNamesTextModel),
- sizeof (ESelectNamesTextModelClass),
- (GtkClassInitFunc) e_select_names_text_model_class_init,
- (GtkObjectInitFunc) e_select_names_text_model_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- model_type = gtk_type_unique (PARENT_TYPE, &model_info);
- }
-
- return model_type;
-}
-
-static void
-e_select_names_text_model_class_init (ESelectNamesTextModelClass *klass)
-{
- GtkObjectClass *object_class;
- ETextModelClass *text_model_class;
-
- object_class = GTK_OBJECT_CLASS(klass);
- text_model_class = E_TEXT_MODEL_CLASS(klass);
-
- parent_class = gtk_type_class(PARENT_TYPE);
-
- gtk_object_add_arg_type ("ESelectNamesTextModel::source",
- GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_SOURCE);
-
- object_class->destroy = e_select_names_text_model_destroy;
- object_class->get_arg = e_select_names_text_model_get_arg;
- object_class->set_arg = e_select_names_text_model_set_arg;
-
- text_model_class->get_text = e_select_names_text_model_get_text;
- text_model_class->set_text = e_select_names_text_model_set_text;
- text_model_class->insert = e_select_names_text_model_insert;
- text_model_class->insert_length = e_select_names_text_model_insert_length;
- text_model_class->delete = e_select_names_text_model_delete;
-
- text_model_class->obj_count = e_select_names_text_model_obj_count;
- text_model_class->get_nth_obj = e_select_names_text_model_get_nth_obj;
- text_model_class->object_activated = e_select_names_text_model_activate_obj;
-
- if (getenv ("EVO_DEBUG_SELECT_NAMES_TEXT_MODEL")) {
- out = fopen ("/tmp/evo-debug-select-names-text-model", "w");
- if (out)
- setvbuf (out, NULL, _IONBF, 0);
- }
-}
-
-static void
-dump_model (ESelectNamesTextModel *text_model)
-{
- ESelectNamesModel *model = text_model->source;
- gint i;
-
- if (out == NULL)
- return;
-
- fprintf (out, "\n*** Model State: count=%d\n", e_select_names_model_count (model));
-
- for (i=0; i<e_select_names_model_count (model); ++i)
- fprintf (out, "[%d] \"%s\" %s\n", i,
- e_select_names_model_get_string (model, i),
- e_select_names_model_get_card (model, i) ? "<card>" : "");
- fprintf (out, "\n");
-}
-
-static void
-e_select_names_text_model_init (ESelectNamesTextModel *model)
-{
-}
-
-static void
-e_select_names_text_model_destroy (GtkObject *object)
-{
- ESelectNamesTextModel *model;
-
- model = E_SELECT_NAMES_TEXT_MODEL (object);
-
- e_select_names_text_model_set_source (model, NULL);
-
- if (GTK_OBJECT_CLASS(parent_class)->destroy)
- GTK_OBJECT_CLASS(parent_class)->destroy(object);
-}
-
-static void
-e_select_names_text_model_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ESelectNamesTextModel *model;
-
- model = E_SELECT_NAMES_TEXT_MODEL (object);
-
- switch (arg_id) {
- case ARG_SOURCE:
- e_select_names_text_model_set_source(model, E_SELECT_NAMES_MODEL (GTK_VALUE_OBJECT (*arg)));
- break;
- default:
- return;
- }
-}
-
-static void
-e_select_names_text_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ESelectNamesTextModel *model;
-
- model = E_SELECT_NAMES_TEXT_MODEL (object);
-
- switch (arg_id) {
- case ARG_SOURCE:
- GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(model->source);
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-resize_cb (ESelectNamesModel *source, gint index, gint old_len, gint new_len, ETextModel *model)
-{
- EReposDeleteShift repos_del;
- EReposInsertShift repos_ins;
- gint pos;
-
- e_select_names_model_name_pos (source, index, &pos, NULL);
-
- if (new_len < old_len) {
-
- repos_del.model = model;
- repos_del.pos = pos;
- repos_del.len = old_len - new_len;
- e_text_model_reposition (model, e_repos_delete_shift, &repos_del);
-
- } else if (old_len < new_len) {
-
- repos_ins.model = model;
- repos_ins.pos = pos;
- repos_ins.len = new_len - old_len;
- e_text_model_reposition (model, e_repos_insert_shift, &repos_ins);
-
- }
-}
-
-
-static void
-e_select_names_text_model_set_source (ESelectNamesTextModel *model,
- ESelectNamesModel *source)
-{
- if (source == model->source)
- return;
-
- if (model->source) {
- gtk_signal_disconnect (GTK_OBJECT (model->source), model->source_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (model->source), model->source_resize_id);
- gtk_object_unref (GTK_OBJECT (model->source));
- }
-
- model->source = source;
-
- if (model->source) {
- gtk_object_ref (GTK_OBJECT (model->source));
- model->source_changed_id = gtk_signal_connect_object (GTK_OBJECT(model->source),
- "changed",
- GTK_SIGNAL_FUNC (e_text_model_changed),
- GTK_OBJECT (model));
- model->source_resize_id = gtk_signal_connect (GTK_OBJECT(model->source),
- "resized",
- GTK_SIGNAL_FUNC (resize_cb),
- model);
- }
-}
-
-ETextModel *
-e_select_names_text_model_new (ESelectNamesModel *source)
-{
- ETextModel *model = E_TEXT_MODEL (gtk_type_new (e_select_names_text_model_get_type()));
- e_select_names_text_model_set_source (E_SELECT_NAMES_TEXT_MODEL (model), source);
- return model;
-}
-
-static const gchar *
-e_select_names_text_model_get_text (ETextModel *model)
-{
- ESelectNamesTextModel *snm = E_SELECT_NAMES_TEXT_MODEL(model);
-
- return snm ? e_select_names_model_get_textification (snm->source) : "";
-}
-
-static void
-e_select_names_text_model_set_text (ETextModel *model, const gchar *text)
-{
- ESelectNamesTextModel *snm = E_SELECT_NAMES_TEXT_MODEL(model);
-
- e_select_names_model_delete_all (snm->source);
- e_select_names_text_model_insert (model, 0, text);
-}
-
-static void
-e_select_names_text_model_insert (ETextModel *model, gint position, const gchar *text)
-{
- e_select_names_text_model_insert_length (model, position, text, strlen (text));
-}
-
-static void
-e_select_names_text_model_insert_length (ETextModel *model, gint pos, const gchar *text, gint length)
-{
- ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL (model)->source;
- gint i;
-
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_SELECT_NAMES_TEXT_MODEL (model));
-
- if (out) {
- gchar *tmp = g_strndup (text, length);
- fprintf (out, ">> insert \"%s\" (len=%d) at %d\n", tmp, length, pos);
- g_free (tmp);
- }
-
- pos = CLAMP (pos, 0, strlen (e_select_names_model_get_textification (source)));
-
- /* We want to control all cursor motions ourselves, rather than taking hints
- from the ESelectNamesModel. */
- gtk_signal_handler_block (GTK_OBJECT (source), E_SELECT_NAMES_TEXT_MODEL (model)->source_resize_id);
-
- /* We handle this one character at a time. */
-
- for (i = 0; i < length && text[i]; ++i) {
- gint index, start_pos, text_len;
- gboolean inside_quote = FALSE;
-
- if (out)
- fprintf (out, "processing [%c]\n", text[i]);
-
- e_select_names_model_text_pos (source, pos, &index, &start_pos, &text_len);
-
- if (out)
- fprintf (out, "index=%d start_pos=%d text_len=%d\n", index, start_pos, text_len);
-
- if (text[i] == ',' && index >= 0) { /* Is this a quoted or an unquoted comma we are dealing with? */
- const EDestination *dest = e_select_names_model_get_destination (source, index);
- if (dest) {
- const gchar *str = e_destination_get_textrep (dest);
- gint j;
- if (out)
- fprintf (out, "str=%s pos=%d\n", str, pos);
- for (j=0; j<pos-start_pos && str[j]; ++j)
- if (str[j] == '"') {
- inside_quote = !inside_quote;
- if (out)
- fprintf (out, "flip to %d at %d\n", start_pos+j, inside_quote);
- }
- }
- if (out)
- fprintf (out, inside_quote ? "inside quote\n" : "not inside quote\n");
- }
-
-
- if (text[i] == ',' && !inside_quote) {
-
- /* This is the case of hitting , first thing in an empty entry */
- if (index == -1) {
- EReposAbsolute repos;
-
- e_select_names_model_insert (source, 0, e_destination_new ());
- e_select_names_model_insert (source, 0, e_destination_new ());
-
- repos.model = model;
- repos.pos = -1; /* At end */
- e_text_model_reposition (model, e_repos_absolute, &repos);
-
-
- } else if (pos <= start_pos || pos == start_pos + text_len) {
- EReposInsertShift repos;
- gint ins_point = index;
-
- if (text_len != 0 && pos == start_pos + text_len)
- ++ins_point;
-
- /* Block adjacent blank cards. */
- if (! ((ins_point < e_select_names_model_count (source) &&
- (e_select_names_model_get_string (source, ins_point) == NULL))
- || (ins_point > 0 && (e_select_names_model_get_string (source, ins_point-1) == NULL)))) {
-
- e_select_names_model_insert (source, ins_point, e_destination_new ());
-
- repos.model = model;
- repos.pos = pos;
- repos.len = SEPLEN;
- e_text_model_reposition (model, e_repos_insert_shift, &repos);
- pos += SEPLEN;
- }
-
- } else {
- EReposInsertShift repos;
- gint offset = MAX (pos - start_pos, 0);
- const gchar *str = e_select_names_model_get_string (source, index);
- gchar *str1 = g_strndup (str, offset);
- gchar *str2 = g_strdup (str+offset);
- EDestination *d1 = e_destination_new (), *d2 = e_destination_new ();
-
- e_destination_set_raw (d1, str1);
- e_destination_set_raw (d2, str2);
-
- e_select_names_model_replace (source, index, d1);
- e_select_names_model_insert (source, index+1, d2);
-
- g_free (str1);
- g_free (str2);
-
- repos.model = model;
- repos.pos = pos;
- repos.len = SEPLEN;
- e_text_model_reposition (model, e_repos_insert_shift, &repos);
- pos += SEPLEN;
- }
-
- } else {
- EReposInsertShift repos;
- gint offset = MAX (pos - start_pos, 0);
- const gchar *str;
- gchar *new_str = NULL;
- gint this_length = 1;
- gboolean whitespace = isspace ((gint) text[i]);
-
- str = index >= 0 ? e_select_names_model_get_string (source, index) : NULL;
- if (str && *str) {
- if (pos <= start_pos) {
- if (whitespace) {
- /* swallow leading whitespace */
- this_length = 0;
- } else {
- /* Adjust for our "magic white space" */
- new_str = g_strdup_printf("%c%s%s", text[i], pos < start_pos ? " " : "", str);
- if (pos < start_pos)
- ++this_length;
- }
- } else {
- new_str = g_strdup_printf ("%.*s%c%s", offset, str, text[i], str + offset);
- }
- } else {
- if (whitespace) {
- /* swallow leading whitespace */
- this_length = 0;
- } else {
- new_str = g_strdup_printf ("%c", text[i]);
- }
- }
-
- if (new_str) {
-
- EDestination *dest = e_destination_new ();
- e_destination_set_raw (dest, new_str);
-
- e_select_names_model_replace (source, index, dest);
-
- if (this_length > 0) {
- repos.model = model;
- repos.pos = pos;
- repos.len = this_length;
- e_text_model_reposition (model, e_repos_insert_shift, &repos);
-
- pos += this_length;
- }
-
- g_free (new_str);
- }
- }
- }
-
- dump_model (E_SELECT_NAMES_TEXT_MODEL (model));
-
- gtk_signal_handler_unblock (GTK_OBJECT (source), E_SELECT_NAMES_TEXT_MODEL (model)->source_resize_id);
-}
-
-
-static void
-e_select_names_text_model_delete (ETextModel *model, gint pos, gint length)
-{
- ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL (model)->source;
- gint index, start_pos, text_len, offset;
-
- if (out) {
- const gchar *str = e_select_names_model_get_textification (source);
- gint i, len;
-
- fprintf (out, ">> delete %d at pos %d\n", length, pos);
-
- len = strlen (str);
- for (i=0; i<pos && i<len; ++i)
- fprintf (out, "%c", str[i]);
- fprintf (out, "[");
- for (i=pos; i<pos+length && i<len; ++i)
- fprintf (out, "%c", str[i]);
- fprintf (out, "]");
- for (i=pos+length; i<len; ++i)
- fprintf (out, "%c", str[i]);
- fprintf (out, "\n");
- }
-
- if (length < 0)
- return;
-
- e_select_names_model_text_pos (source, pos, &index, &start_pos, &text_len);
-
- if (out)
- fprintf (out, "index=%d, start_pos=%d, text_len=%d\n", index, start_pos, text_len);
-
- /* We want to control all cursor motions ourselves, rather than taking hints
- from the ESelectNamesModel. */
- gtk_signal_handler_block (GTK_OBJECT (source), E_SELECT_NAMES_TEXT_MODEL (model)->source_resize_id);
-
- /* First, we handle a few tricky cases. */
-
- if (pos < start_pos) {
- EReposAbsolute repos;
-
- repos.model = model;
- repos.pos = pos;
- e_text_model_reposition (model, e_repos_absolute, &repos);
-
- length -= start_pos - pos;
-
- if (length > 0)
- e_select_names_text_model_delete (model, start_pos, length);
- goto finished;
- }
-
- if (pos == start_pos + text_len) {
- /* We are positioned right at the end of an entry, possibly right in front of a comma. */
-
- if (index+1 < e_select_names_model_count (source)) {
- EReposDeleteShift repos;
- EDestination *new_dest;
- const gchar *str1 = e_select_names_model_get_string (source, index);
- const gchar *str2 = e_select_names_model_get_string (source, index+1);
- gchar *new_str;
-
- while (str1 && *str1 && isspace ((gint) *str1))
- ++str1;
- while (str2 && *str2 && isspace ((gint) *str2))
- ++str2;
-
- if (str1 && str2)
- new_str = g_strdup_printf ("%s %s", str1, str2);
- else if (str1)
- new_str = g_strdup (str1);
- else if (str2)
- new_str = g_strdup (str2);
- else
- new_str = g_strdup ("");
-
- if (out)
- fprintf (out, "joining \"%s\" and \"%s\" to \"%s\"\n", str1, str2, new_str);
-
- e_select_names_model_delete (source, index+1);
-
- new_dest = e_destination_new ();
- e_destination_set_raw (new_dest, new_str);
- e_select_names_model_replace (source, index, new_dest);
- g_free (new_str);
-
- repos.model = model;
- repos.pos = pos;
- repos.len = SEPLEN - 1;
-
- e_text_model_reposition (model, e_repos_delete_shift, &repos);
-
- if (length > 1)
- e_select_names_text_model_delete (model, pos, length-1);
- } else {
- /* If we are at the end of the last entry (which we must be if we end up in this block),
- we can just do nothing. So this else-block is here just to give us a place to
- put this comment. */
- }
-
- goto finished;
- }
-
- if (pos + length > start_pos + text_len) {
- /* Uh oh... our changes straddle two objects. */
-
- if (pos == start_pos) { /* Delete the whole thing */
- EReposDeleteShift repos;
-
- e_select_names_model_delete (source, index);
-
- if (out)
- fprintf (out, "deleted all of %d\n", index);
-
- repos.model = model;
- repos.pos = pos;
- repos.len = text_len + SEPLEN;
-
- e_text_model_reposition (model, e_repos_delete_shift, &repos);
-
- length -= text_len + SEPLEN;
- if (length > 0)
- e_select_names_text_model_delete (model, pos, length);
-
- } else {
- /* Delete right up to the end, and then call e_select_names_text_model_delete again
- to finish the job. */
- gint len1, len2;
-
- len1 = text_len - (pos - start_pos);
- len2 = length - len1;
-
- if (out)
- fprintf (out, "two-stage delete: %d, %d\n", len1, len2);
-
-
- e_select_names_text_model_delete (model, pos, len1);
- e_select_names_text_model_delete (model, pos, len2);
- }
-
- goto finished;
- }
-
- /* Our changes are confined to just one entry. */
- if (length > 0) {
- const gchar *str;
- gchar *new_str;
-
- offset = pos - start_pos;
-
- str = e_select_names_model_get_string (source, index);
- new_str = str ? g_strdup_printf ("%.*s%s", offset, str, str + offset + length) : NULL;
-
- if (new_str) {
- EReposDeleteShift repos;
- EDestination *dest;
-
- dest = e_destination_new ();
- e_destination_set_raw (dest, new_str);
- e_select_names_model_replace (source, index, dest);
-
- if (out)
- fprintf (out, "new_str: \"%s\"\n", new_str);
-
- g_free (new_str);
-
- repos.model = model;
- repos.pos = pos;
- repos.len = length;
-
- e_text_model_reposition (model, e_repos_delete_shift, &repos);
-
- } else {
- EReposDeleteShift repos;
-
- e_select_names_model_delete (source, index);
-
- if (out)
- fprintf (out, "deleted %d\n", index);
-
-
- repos.model = model;
- repos.pos = pos;
- repos.len = SEPLEN;
-
- e_text_model_reposition (model, e_repos_delete_shift, &repos);
- }
- }
-
- finished:
- gtk_signal_handler_unblock (GTK_OBJECT (source), E_SELECT_NAMES_TEXT_MODEL (model)->source_resize_id);
- dump_model (E_SELECT_NAMES_TEXT_MODEL (model));
-}
-
-static gint
-e_select_names_text_model_obj_count (ETextModel *model)
-{
- ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL (model)->source;
- gint i, count;
-
- count = i = e_select_names_model_count (source);
- while (i > 0) {
- const EDestination *dest;
- --i;
- dest = e_select_names_model_get_destination (source, i);
- if (e_destination_get_card (dest) == NULL)
- --count;
- }
-
- return count;
-}
-
-static gint
-nth_obj_index (ESelectNamesModel *source, gint n)
-{
- gint i, N;
-
- i = 0;
- N = e_select_names_model_count (source);
-
- do {
- const EDestination *dest = e_select_names_model_get_destination (source, i);
- if (e_destination_get_card (dest))
- --n;
- ++i;
- } while (n >= 0 && i < N);
-
- if (i <= N)
- --i;
- else
- i = -1;
-
- return i;
-}
-
-static const gchar *
-e_select_names_text_model_get_nth_obj (ETextModel *model, gint n, gint *len)
-{
- ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL (model)->source;
- const gchar *txt;
- gint i, pos;
-
- i = nth_obj_index (source, n);
- if (i < 0)
- return NULL;
-
- e_select_names_model_name_pos (source, i, &pos, len);
- if (pos < 0)
- return NULL;
-
- txt = e_select_names_model_get_textification (source);
- return txt + pos;
-}
-
-static void
-e_select_names_text_model_activate_obj (ETextModel *model, gint n)
-{
- ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL (model)->source;
- EContactEditor *contact_editor;
- ECard *card;
- gint i;
-
- i = nth_obj_index (source, n);
- g_return_if_fail (i >= 0);
-
- card = e_select_names_model_get_card (source, i);
- g_return_if_fail (card);
-
- /* present read-only contact editor when someone double clicks from here */
- contact_editor = e_addressbook_show_contact_editor (NULL, card, FALSE, FALSE);
- e_contact_editor_raise (contact_editor);
-}
-
-
-
diff --git a/addressbook/gui/component/select-names/e-select-names-text-model.h b/addressbook/gui/component/select-names/e-select-names-text-model.h
deleted file mode 100644
index 7a9e0a7396..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-text-model.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Jon Trowbridge <trow@ximian.com>
- *
- * Copyright (C) 2000, 2001 Ximian, Inc.
- */
-
-#ifndef __E_SELECT_NAMES_TEXT_MODEL_H__
-#define __E_SELECT_NAMES_TEXT_MODEL_H__
-
-#include <time.h>
-#include <stdio.h>
-#include <gtk/gtkobject.h>
-#include <gal/e-text/e-text-model.h>
-#include "e-select-names-model.h"
-
-#define E_TYPE_SELECT_NAMES_TEXT_MODEL (e_select_names_text_model_get_type ())
-#define E_SELECT_NAMES_TEXT_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SELECT_NAMES_TEXT_MODEL, ESelectNamesTextModel))
-#define E_SELECT_NAMES_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_TEXT_MODEL, ESelectNamesTextModelClass))
-#define E_IS_SELECT_NAMES_TEXT_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SELECT_NAMES_TEXT_MODEL))
-#define E_IS_SELECT_NAMES_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_TEXT_MODEL))
-
-typedef struct _ESelectNamesTextModel ESelectNamesTextModel;
-typedef struct _ESelectNamesTextModelClass ESelectNamesTextModelClass;
-
-struct _ESelectNamesTextModel {
- ETextModel parent;
-
- ESelectNamesModel *source;
- gint source_changed_id;
- gint source_resize_id;
-};
-
-struct _ESelectNamesTextModelClass {
- ETextModelClass parent_class;
-};
-
-ETextModel *e_select_names_text_model_new (ESelectNamesModel *source);
-
-/* Standard Gtk function */
-GtkType e_select_names_text_model_get_type (void);
-
-#endif /* ! __E_SELECT_NAMES_TEXT_MODEL_H__ */
diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c
deleted file mode 100644
index 9340bbce48..0000000000
--- a/addressbook/gui/component/select-names/e-select-names.c
+++ /dev/null
@@ -1,801 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-select-names.c
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <glib.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-stock.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
-
-#include <gal/e-table/e-table-simple.h>
-#include <gal/widgets/e-font.h>
-#include <gal/widgets/e-popup-menu.h>
-
-#include <addressbook/gui/widgets/e-addressbook-model.h>
-#include <addressbook/gui/widgets/e-addressbook-table-adapter.h>
-#include <addressbook/gui/component/e-cardlist-model.h>
-#include <addressbook/backend/ebook/e-book.h>
-#include <addressbook/gui/component/addressbook-component.h>
-#include <shell/evolution-shell-client.h>
-
-#include "e-select-names.h"
-#include <addressbook/backend/ebook/e-card-simple.h>
-#include "e-select-names-table-model.h"
-#include <gal/widgets/e-categories-master-list-combo.h>
-#include <e-util/e-categories-master-list-wombat.h>
-
-static void e_select_names_init (ESelectNames *card);
-static void e_select_names_class_init (ESelectNamesClass *klass);
-static void e_select_names_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_select_names_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_select_names_destroy (GtkObject *object);
-
-static GnomeDialogClass *parent_class = NULL;
-#define PARENT_TYPE gnome_dialog_get_type()
-
-/* The arguments we take */
-enum {
- ARG_0,
-};
-
-typedef struct {
- char *title;
- ETableModel *model;
- ESelectNamesModel *source;
- ESelectNames *names;
- GtkWidget *label;
-} ESelectNamesChild;
-
-GtkType
-e_select_names_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type) {
- static const GtkTypeInfo info =
- {
- "ESelectNames",
- sizeof (ESelectNames),
- sizeof (ESelectNamesClass),
- (GtkClassInitFunc) e_select_names_class_init,
- (GtkObjectInitFunc) e_select_names_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-static void
-e_select_names_class_init (ESelectNamesClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) klass;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->set_arg = e_select_names_set_arg;
- object_class->get_arg = e_select_names_get_arg;
- object_class->destroy = e_select_names_destroy;
-}
-
-#define SPEC "<ETableSpecification no-headers=\"true\" cursor-mode=\"line\"> \
- <ETableColumn model_col= \"%d\" _title=\"Name\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableState> \
- <column source=\"0\"/> \
- <grouping> <leaf column=\"0\" ascending=\"true\"/> </grouping> \
- </ETableState> \
-</ETableSpecification>"
-
-#define SPEC2 "<ETableSpecification no-headers=\"true\" cursor-mode=\"line\"> \
- <ETableColumn model_col= \"0\" _title=\"Name\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableState> \
- <column source=\"0\"/> \
- <grouping> <leaf column=\"0\" ascending=\"true\"/> </grouping> \
- </ETableState> \
-</ETableSpecification>"
-
-GtkWidget *e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int num1, int num2);
-
-static void
-set_book(EBook *book, EBookStatus status, EAddressbookModel *model)
-{
- gtk_object_set(GTK_OBJECT(model),
- "book", book,
- NULL);
- gtk_object_unref(GTK_OBJECT(book));
- gtk_object_unref(GTK_OBJECT(model));
-}
-
-static void
-addressbook_model_set_uri(EAddressbookModel *model, char *uri)
-{
- EBook *book;
- book = e_book_new();
- gtk_object_ref(GTK_OBJECT(model));
- e_book_load_uri(book, uri, (EBookCallback) set_book, model);
-}
-
-static void
-real_add_address_cb (int model_row,
- gpointer closure)
-{
- ESelectNamesChild *child = closure;
- ESelectNames *names = child->names;
- ECard *card = e_addressbook_model_get_card(E_ADDRESSBOOK_MODEL(names->model), model_row);
- EDestination *dest = e_destination_new ();
-
- e_destination_set_card (dest, card, 0);
-
- e_select_names_model_append (child->source, dest);
- e_select_names_model_clean (child->source);
-
- gtk_object_unref(GTK_OBJECT(card));
-}
-
-static void
-real_add_address(ESelectNames *names, ESelectNamesChild *child)
-{
- e_table_selected_row_foreach(e_table_scrolled_get_table(names->table),
- real_add_address_cb, child);
-}
-
-static void
-add_address(ETable *table, int row, int col, GdkEvent *event, ESelectNames *names)
-{
- ESelectNamesChild *child;
-
- child = g_hash_table_lookup(names->children, names->def);
- if (child) {
- real_add_address(names, child);
- }
-}
-
-GtkWidget *
-e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int num1, int num2)
-{
- ETableModel *adapter;
- EAddressbookModel *model;
- GtkWidget *table;
- char *filename;
- char *uri;
- char *spec;
-
- model = e_addressbook_model_new ();
- adapter = E_TABLE_MODEL (e_addressbook_table_adapter_new(model));
-
- filename = gnome_util_prepend_user_home("evolution/local/Contacts/addressbook.db");
- uri = g_strdup_printf("file://%s", filename);
-
- addressbook_model_set_uri(model, uri);
-
- g_free(uri);
- g_free(filename);
-
- gtk_object_set(GTK_OBJECT(model),
- "editable", FALSE,
- "query", "(contains \"email\" \"\")",
- NULL);
-
- spec = g_strdup_printf(SPEC, E_CARD_SIMPLE_FIELD_NAME_OR_ORG);
- table = e_table_scrolled_new (adapter, NULL, spec, NULL);
- g_free(spec);
-
- gtk_object_set_data(GTK_OBJECT(table), "adapter", adapter);
- gtk_object_set_data(GTK_OBJECT(table), "model", model);
-
- return table;
-}
-
-typedef struct {
- char *description;
- char *display_name;
- char *physical_uri;
-
-} ESelectNamesFolder;
-
-static void
-e_select_names_folder_free(ESelectNamesFolder *e_folder)
-{
- g_free(e_folder->description );
- g_free(e_folder->display_name);
- g_free(e_folder->physical_uri);
- g_free(e_folder);
-}
-
-static void
-e_select_names_option_activated(GtkWidget *widget, ESelectNames *e_select_names)
-{
- ESelectNamesFolder *e_folder = gtk_object_get_data (GTK_OBJECT (widget), "EsnChoiceFolder");
- gchar *uri;
-
- uri = g_strdup_printf ("%s/addressbook.db", e_folder->physical_uri);
- addressbook_model_set_uri(e_select_names->model, uri);
- g_free (uri);
-}
-
-typedef struct {
- ESelectNames *names;
- GtkWidget *menu;
-} NamesAndMenu;
-
-static void
-add_menu_item (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- GtkWidget *menu;
- GtkWidget *item;
- ESelectNamesFolder *e_folder;
- NamesAndMenu *nnm;
- ESelectNames *e_select_names;
-
- nnm = user_data;
- e_folder = value;
- menu = nnm->menu;
- e_select_names = nnm->names;
-
- item = gtk_menu_item_new_with_label (e_folder->display_name);
- gtk_menu_append (GTK_MENU (menu), item);
- gtk_object_set_data (GTK_OBJECT (item), "EsnChoiceFolder", e_folder);
-
- gtk_signal_connect (GTK_OBJECT (item), "activate",
- GTK_SIGNAL_FUNC (e_select_names_option_activated),
- e_select_names);
-}
-
-static void
-update_option_menu(ESelectNames *e_select_names)
-{
- GtkWidget *menu;
- GtkWidget *option;
-
- option = glade_xml_get_widget (e_select_names->gui,
- "optionmenu-folder");
- if (option) {
- NamesAndMenu nnm;
- menu = gtk_menu_new ();
-
- nnm.names = e_select_names;
- nnm.menu = menu;
-
- g_hash_table_foreach (e_select_names->folders,
- add_menu_item,
- &nnm);
-
- gtk_widget_show_all (menu);
-
- gtk_option_menu_set_menu (GTK_OPTION_MENU (option),
- menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (option), 0);
- gtk_widget_set_sensitive (option, TRUE);
- }
-}
-
-static void
-new_folder (EvolutionStorageListener *storage_listener,
- const char *path,
- const GNOME_Evolution_Folder *folder,
- ESelectNames *e_select_names)
-{
- if (!strcmp(folder->type, "contacts")) {
- ESelectNamesFolder *e_folder = g_new(ESelectNamesFolder, 1);
- e_folder->description = g_strdup(folder->description );
- e_folder->display_name = g_strdup(folder->display_name);
- e_folder->physical_uri = g_strdup(folder->physical_uri);
- g_hash_table_insert(e_select_names->folders,
- g_strdup(path), e_folder);
- update_option_menu(e_select_names);
- }
-}
-
-static void
-update_folder (EvolutionStorageListener *storage_listener,
- const char *path,
- const char *display_name,
- ESelectNames *e_select_names)
-{
- ESelectNamesFolder *e_folder = g_hash_table_lookup(e_select_names->folders, path);
- if (e_folder) {
- g_free(e_folder->display_name);
- e_folder->display_name = g_strdup(e_folder->display_name);
- update_option_menu(e_select_names);
- }
-}
-
-static void
-removed_folder (EvolutionStorageListener *storage_listener,
- const char *path,
- ESelectNames *e_select_names)
-{
- ESelectNamesFolder *e_folder;
- char *orig_path;
-
- if (g_hash_table_lookup_extended(e_select_names->folders, path, (void **) &orig_path, (void **) &e_folder)) {
- g_hash_table_remove(e_select_names->folders, path);
- e_select_names_folder_free(e_folder);
- g_free(orig_path);
- update_option_menu(e_select_names);
- }
-}
-
-static void
-update_query (GtkWidget *button, ESelectNames *e_select_names)
-{
- char *category = "";
- char *search = "";
- char *query;
- char *q_array[4];
- int i;
- if (e_select_names->categories_entry) {
- category = gtk_entry_get_text (GTK_ENTRY (e_select_names->categories_entry));
- }
- if (e_select_names->search_entry) {
- search = gtk_entry_get_text (GTK_ENTRY (e_select_names->search_entry));
- }
- i = 0;
- q_array[i++] = "(contains \"email\" \"\")";
- if (category && *category)
- q_array[i++] = g_strdup_printf ("(is \"category\" \"%s\")", category);
- if (search && *search)
- q_array[i++] = g_strdup_printf ("(contains \"x-evolution-any-field\" \"%s\")", search);
- q_array[i++] = NULL;
- if (i > 2) {
- char *temp = g_strjoinv (" ", q_array);
- query = g_strdup_printf ("(and %s)", temp);
- g_free (temp);
- } else {
- query = g_strdup (q_array[0]);
- }
- gtk_object_set (GTK_OBJECT (e_select_names->model),
- "query", query,
- NULL);
- for (i = 1; q_array[i]; i++) {
- g_free (q_array[i]);
- }
- g_free (query);
-}
-
-static void
-e_select_names_hookup_shell_listener (ESelectNames *e_select_names)
-{
- GNOME_Evolution_Storage storage;
- GNOME_Evolution_StorageListener listener;
- CORBA_Environment ev;
-
- CORBA_exception_init(&ev);
-
- storage = (GNOME_Evolution_Storage) (evolution_shell_client_get_local_storage(addressbook_component_get_shell_client()));
- e_select_names->listener = evolution_storage_listener_new();
-
- listener = evolution_storage_listener_corba_objref(e_select_names->listener);
-
- /* This should really never happen, but a bug report (ximian #5193) came in w/ a backtrace suggesting that it did in
- fact happen to someone, so the best we can do is try to avoid crashing in this case. */
- if (storage == CORBA_OBJECT_NIL) {
- GtkWidget *oh_shit;
-
- oh_shit = gnome_error_dialog (_("Unable to get local storage. This should never happen."));
- gtk_widget_show (oh_shit);
- return;
- }
-
- gtk_signal_connect(GTK_OBJECT(e_select_names->listener), "new_folder",
- GTK_SIGNAL_FUNC(new_folder), e_select_names);
- gtk_signal_connect(GTK_OBJECT(e_select_names->listener), "update_folder",
- GTK_SIGNAL_FUNC(update_folder), e_select_names);
- gtk_signal_connect(GTK_OBJECT(e_select_names->listener), "removed_folder",
- GTK_SIGNAL_FUNC(removed_folder), e_select_names);
-
- GNOME_Evolution_Storage_addListener(storage, listener, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_select_names_init: Exception adding listener to "
- "remote GNOME_Evolution_Storage interface.\n");
- CORBA_exception_free (&ev);
- return;
- }
-
- bonobo_object_release_unref(storage, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning ("e_select_names_init: Exception unref'ing "
- "remote GNOME_Evolution_Storage interface.\n");
- CORBA_exception_free (&ev);
- return;
- }
-
- CORBA_exception_free(&ev);
-}
-
-GtkWidget *e_select_names_create_categories (gchar *name,
- gchar *string1, gchar *string2,
- gint int1, gint int2);
-
-GtkWidget *
-e_select_names_create_categories (gchar *name,
- gchar *string1, gchar *string2,
- gint int1, gint int2)
-{
- ECategoriesMasterList *ecml;
- GtkWidget *combo;
-
- ecml = e_categories_master_list_wombat_new ();
- combo = e_categories_master_list_combo_new (ecml);
- gtk_object_unref (GTK_OBJECT (ecml));
-
- return combo;
-}
-
-static void
-e_select_names_init (ESelectNames *e_select_names)
-{
- GladeXML *gui;
- GtkWidget *widget;
-
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/select-names.glade", NULL);
- e_select_names->gui = gui;
-
- e_select_names->children = g_hash_table_new(g_str_hash, g_str_equal);
- e_select_names->child_count = 0;
- e_select_names->def = NULL;
-
- widget = glade_xml_get_widget(gui, "table-top");
- if (!widget) {
- return;
- }
- gtk_widget_ref(widget);
- gtk_widget_unparent(widget);
- gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(e_select_names)->vbox), widget, TRUE, TRUE, 0);
- gtk_widget_unref(widget);
-
- gnome_dialog_append_buttons(GNOME_DIALOG(e_select_names),
- GNOME_STOCK_BUTTON_OK,
- GNOME_STOCK_BUTTON_CANCEL,
- NULL);
-
- gtk_window_set_policy(GTK_WINDOW(e_select_names), FALSE, TRUE, FALSE);
-
- e_select_names->table = E_TABLE_SCROLLED(glade_xml_get_widget(gui, "table-source"));
- e_select_names->model = gtk_object_get_data(GTK_OBJECT(e_select_names->table), "model");
- e_select_names->adapter = gtk_object_get_data(GTK_OBJECT(e_select_names->table), "adapter");
-
- e_select_names->categories = glade_xml_get_widget (gui, "custom-categories");
- if (e_select_names->categories && !GTK_IS_COMBO (e_select_names->categories))
- e_select_names->categories = NULL;
- if (e_select_names->categories) {
- e_select_names->categories_entry = GTK_COMBO (e_select_names->categories)->entry;
- } else
- e_select_names->categories_entry = NULL;
- e_select_names->search_entry = glade_xml_get_widget (gui, "entry-find");
- if (e_select_names->search_entry && !GTK_IS_ENTRY (e_select_names->search_entry))
- e_select_names->search_entry = NULL;
- if (e_select_names->search_entry)
- gtk_signal_connect(GTK_OBJECT(e_select_names->search_entry), "activate",
- GTK_SIGNAL_FUNC(update_query), e_select_names);
- if (e_select_names->categories_entry)
- gtk_signal_connect(GTK_OBJECT(e_select_names->categories_entry), "changed",
- GTK_SIGNAL_FUNC(update_query), e_select_names);
-
- e_select_names->folders = g_hash_table_new(g_str_hash, g_str_equal);
-
- e_select_names_hookup_shell_listener (e_select_names);
-
- gtk_signal_connect (GTK_OBJECT (e_table_scrolled_get_table (e_select_names->table)), "double_click",
- GTK_SIGNAL_FUNC (add_address), e_select_names);
-}
-
-static void e_select_names_child_free(char *key, ESelectNamesChild *child, ESelectNames *e_select_names)
-{
- g_free(child->title);
- gtk_object_unref(GTK_OBJECT(child->model));
- gtk_object_unref(GTK_OBJECT(child->source));
- g_free(key);
-}
-
-static void
-e_select_names_destroy (GtkObject *object) {
- ESelectNames *e_select_names = E_SELECT_NAMES(object);
-
- gtk_signal_disconnect_by_data(GTK_OBJECT(e_select_names->listener), e_select_names);
- gtk_object_unref(GTK_OBJECT(e_select_names->listener));
-
- gtk_object_unref(GTK_OBJECT(e_select_names->gui));
- g_hash_table_foreach(e_select_names->children, (GHFunc) e_select_names_child_free, e_select_names);
- g_hash_table_destroy(e_select_names->children);
-
- g_free(e_select_names->def);
-}
-
-GtkWidget*
-e_select_names_new (void)
-{
- GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_select_names_get_type ()));
- return widget;
-}
-
-static void
-e_select_names_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ESelectNames *editor;
-
- editor = E_SELECT_NAMES (o);
-
- switch (arg_id){
- default:
- return;
- }
-}
-
-static void
-e_select_names_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ESelectNames *e_select_names;
-
- e_select_names = E_SELECT_NAMES (object);
-
- switch (arg_id) {
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-button_clicked(GtkWidget *button, ESelectNamesChild *child)
-{
- real_add_address(child->names, child);
-}
-
-static void
-remove_address(ETable *table, int row, int col, GdkEvent *event, ESelectNamesChild *child)
-{
- e_select_names_model_delete (child->source, row);
-}
-
-struct _RightClickData {
- ETable *table;
- ESelectNamesChild *child;
-};
-typedef struct _RightClickData RightClickData;
-
-static GSList *selected_rows = NULL;
-
-static void
-etable_selection_foreach_cb (int row, void *data)
-{
- /* Build a list of rows in reverse order, then remove them,
- necessary because otherwise it'll start trying to delete
- rows out of index in ETableModel */
- selected_rows = g_slist_prepend (selected_rows,
- GINT_TO_POINTER (row));
-}
-
-static void
-selected_rows_foreach_cb (void *row, void *data)
-{
- ESelectNamesChild *child = data;
-
- e_select_names_model_delete (child->source, GPOINTER_TO_INT (row));
-}
-
-static void
-remove_cb (GtkWidget *widget, void *data)
-{
- RightClickData *rcdata = (RightClickData *)data;
-
- /* Build a list of selected rows */
- e_table_selected_row_foreach (rcdata->table,
- etable_selection_foreach_cb,
- rcdata->child);
-
- /* Now process the list we made, removing each selected row */
- g_slist_foreach (selected_rows,
- (GFunc)selected_rows_foreach_cb,
- rcdata->child);
-
- /* Free everything we've created */
- g_free (rcdata);
- g_slist_free (selected_rows);
- selected_rows = NULL;
-}
-
-static void
-section_right_click_cb (ETable *table, gint row, gint col, GdkEvent *event, ESelectNamesChild *child)
-{
- EPopupMenu right_click_menu[] = {
- { N_("Remove"), NULL,
- GTK_SIGNAL_FUNC (remove_cb), NULL, 0 },
- { NULL, NULL, NULL, 0 }
- };
-
- RightClickData *rcdata = g_new0 (RightClickData, 1);
- rcdata->table = table;
- rcdata->child = child;
-
- e_popup_menu_run (right_click_menu, event, 0, 0,
- rcdata);
-}
-
-void
-e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, ESelectNamesModel *source)
-{
- ESelectNamesChild *child;
- GtkWidget *button;
- GtkWidget *alignment;
- GtkWidget *label;
- GtkTable *table;
- char *label_text;
-
- ETableModel *model;
- GtkWidget *etable;
-
- if (g_hash_table_lookup(e_select_names->children, id)) {
- return;
- }
-
- table = GTK_TABLE(glade_xml_get_widget (e_select_names->gui, "table-recipients"));
-
- child = g_new(ESelectNamesChild, 1);
-
- child->names = e_select_names;
- child->title = g_strdup(_(name));
-
- e_select_names->child_count++;
-
- alignment = gtk_alignment_new(0, 0, 1, 0);
-
- button = gtk_button_new ();
-
- label_text = g_strconcat (child->title, " ->", NULL);
- label = gtk_label_new (label_text);
- g_free (label_text);
- gtk_container_add (GTK_CONTAINER (button), label);
- child->label = label;
-
- gtk_container_add(GTK_CONTAINER(alignment), button);
- gtk_widget_show_all(alignment);
- gtk_signal_connect(GTK_OBJECT(button), "clicked",
- GTK_SIGNAL_FUNC(button_clicked), child);
- gtk_table_attach(table, alignment,
- 0, 1,
- e_select_names->child_count,
- e_select_names->child_count + 1,
- GTK_FILL, GTK_FILL,
- 0, 0);
-
- model = e_select_names_table_model_new(source);
- etable = e_table_scrolled_new (model, NULL, SPEC2, NULL);
-
- gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(etable))), "right_click",
- GTK_SIGNAL_FUNC(section_right_click_cb), child);
- gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(etable))), "double_click",
- GTK_SIGNAL_FUNC(remove_address), child);
-
- child->model = model;
- child->source = source;
- gtk_object_ref(GTK_OBJECT(child->model));
- gtk_object_ref(GTK_OBJECT(child->source));
-
- gtk_widget_show(etable);
-
- gtk_table_attach(table, etable,
- 1, 2,
- e_select_names->child_count,
- e_select_names->child_count + 1,
- GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND,
- 0, 0);
-
- g_hash_table_insert(e_select_names->children, g_strdup(id), child);
-}
-
-static void *
-card_copy(const void *value, void *closure)
-{
- gtk_object_ref(GTK_OBJECT(value));
- return (void *)value;
-}
-
-static void
-card_free(void *value, void *closure)
-{
- gtk_object_unref(GTK_OBJECT(value));
-}
-
-EList *
-e_select_names_get_section(ESelectNames *e_select_names, char *id)
-{
- ESelectNamesChild *child;
- int i;
- int rows;
- EList *list;
-
- child = g_hash_table_lookup(e_select_names->children, id);
- if (!child)
- return NULL;
- rows = e_table_model_row_count(child->model);
-
- list = e_list_new(card_copy, card_free, NULL);
- for (i = 0; i < rows; i++) {
- ECard *card = e_cardlist_model_get(E_CARDLIST_MODEL(child->model), i);
- e_list_append(list, card);
- gtk_object_unref(GTK_OBJECT(card));
- }
- return list;
-}
-
-ESelectNamesModel *
-e_select_names_get_source(ESelectNames *e_select_names,
- char *id)
-{
- ESelectNamesChild *child = g_hash_table_lookup(e_select_names->children, id);
- if (child) {
- if (child->source)
- gtk_object_ref(GTK_OBJECT(child->source));
- return child->source;
- } else
- return NULL;
-}
-
-void
-e_select_names_set_default (ESelectNames *e_select_names,
- const char *id)
-{
- ESelectNamesChild *child;
-
- if (e_select_names->def) {
- child = g_hash_table_lookup(e_select_names->children, e_select_names->def);
- if (child)
- gtk_widget_restore_default_style(child->label);
- }
-
- g_free(e_select_names->def);
- e_select_names->def = g_strdup(id);
-
- if (e_select_names->def) {
- child = g_hash_table_lookup(e_select_names->children, e_select_names->def);
- if (child) {
- EFont *efont;
- GdkFont *gdkfont;
- GtkStyle *style, *oldstyle;
-
- oldstyle = gtk_widget_get_style(child->label);
- style = gtk_style_copy(oldstyle);
-
- efont = e_font_from_gdk_font(style->font);
- gdkfont = e_font_to_gdk_font(efont, E_FONT_BOLD);
- e_font_unref(efont);
-
- gdk_font_ref(gdkfont);
- gdk_font_unref(style->font);
- style->font = gdkfont;
-
- gtk_widget_set_style(child->label, style);
-
- gtk_style_unref(oldstyle);
- }
- }
-}
diff --git a/addressbook/gui/component/select-names/e-select-names.h b/addressbook/gui/component/select-names/e-select-names.h
deleted file mode 100644
index 918dbc5794..0000000000
--- a/addressbook/gui/component/select-names/e-select-names.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-select-names.h
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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_SELECT_NAMES_H__
-#define __E_SELECT_NAMES_H__
-
-#include <glib.h>
-#include <gtk/gtkwidget.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-util.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <glade/glade.h>
-#include <gal/e-table/e-table.h>
-#include <gal/e-table/e-table-scrolled.h>
-
-#include <addressbook/gui/widgets/e-addressbook-model.h>
-
-#include "e-select-names-model.h"
-#include "e-util/e-list.h"
-#include "shell/evolution-storage-listener.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* ESelectNames - A dialog displaying information about a contact.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- */
-
-#define E_SELECT_NAMES_TYPE (e_select_names_get_type ())
-#define E_SELECT_NAMES(obj) (GTK_CHECK_CAST ((obj), E_SELECT_NAMES_TYPE, ESelectNames))
-#define E_SELECT_NAMES_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_SELECT_NAMES_TYPE, ESelectNamesClass))
-#define E_IS_SELECT_NAMES(obj) (GTK_CHECK_TYPE ((obj), E_SELECT_NAMES_TYPE))
-#define E_IS_SELECT_NAMES_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_SELECT_NAMES_TYPE))
-
-typedef struct _ESelectNames ESelectNames;
-typedef struct _ESelectNamesClass ESelectNamesClass;
-
-struct _ESelectNames
-{
- GnomeDialog parent;
-
- /* item specific fields */
- GladeXML *gui;
-
- GHashTable *children; /* Of type char * to ESelectNamesChild */
- int child_count;
- ETableScrolled *table;
- ETableModel *adapter;
- EAddressbookModel *model;
- GtkWidget *categories;
- GtkWidget *categories_entry;
- GtkWidget *search_entry;
- EvolutionStorageListener *listener;
- GHashTable *folders;
- char *def;
-};
-
-struct _ESelectNamesClass
-{
- GnomeDialogClass parent_class;
-};
-
-
-GtkWidget *e_select_names_new (void);
-GtkType e_select_names_get_type (void);
-
-void e_select_names_add_section (ESelectNames *e_select_names,
- char *name,
- char *id,
- ESelectNamesModel *source);
-ESelectNamesModel *e_select_names_get_source (ESelectNames *e_select_names,
- char *id);
-void e_select_names_set_default (ESelectNames *e_select_names,
- const char *id);
-/* Returns a ref counted list of addresses. */
-EList *e_select_names_get_section (ESelectNames *e_select_names,
- char *id);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_SELECT_NAMES_H__ */
diff --git a/addressbook/gui/component/select-names/recipient.glade b/addressbook/gui/component/select-names/recipient.glade
deleted file mode 100644
index b60972d094..0000000000
--- a/addressbook/gui/component/select-names/recipient.glade
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>Recipient</name>
- <program_name>recipient</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <use_widget_names>True</use_widget_names>
- <output_main_file>False</output_main_file>
- <output_support_files>False</output_support_files>
- <output_build_files>False</output_build_files>
- <gnome_help_support>True</gnome_help_support>
-</project>
-
-<widget>
- <class>GtkWindow</class>
- <name>window1</name>
- <visible>False</visible>
- <title>window1</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox-top</name>
- <homogeneous>False</homogeneous>
- <spacing>4</spacing>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment1</name>
- <xalign>1.08033e-07</xalign>
- <yalign>0</yalign>
- <xscale>1</xscale>
- <yscale>0</yscale>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>text-button</name>
- <can_focus>True</can_focus>
- <label>-&gt;</label>
- </widget>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/addressbook/gui/component/select-names/select-names.glade b/addressbook/gui/component/select-names/select-names.glade
deleted file mode 100644
index e15a70b4ad..0000000000
--- a/addressbook/gui/component/select-names/select-names.glade
+++ /dev/null
@@ -1,320 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>Select-names</name>
- <program_name>select-names</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <output_main_file>False</output_main_file>
- <output_support_files>False</output_support_files>
- <output_build_files>False</output_build_files>
-</project>
-
-<widget>
- <class>GnomeDialog</class>
- <name>dialog-top</name>
- <visible>False</visible>
- <title>Select Names</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area1</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button1</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button3</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkTable</class>
- <name>table-top</name>
- <rows>7</rows>
- <columns>2</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>6</row_spacing>
- <column_spacing>6</column_spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>table-source</name>
- <creation_function>e_addressbook_create_ebook_table</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Sat, 10 Jun 2000 22:02:57 GMT</last_modification_time>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>6</top_attach>
- <bottom_attach>7</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkTable</class>
- <name>table-recipients</name>
- <rows>1</rows>
- <columns>2</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>4</row_spacing>
- <column_spacing>4</column_spacing>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>6</top_attach>
- <bottom_attach>7</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkAccelLabel</class>
- <name>accellabel2</name>
- <label>Message Recipients</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkOptionMenu</class>
- <name>optionmenu-folder</name>
- <can_focus>True</can_focus>
- <has_focus>True</has_focus>
- <items></items>
- <initial_choice>0</initial_choice>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label3</name>
- <label>Select name from _folder:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-find</focus_target>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label2</name>
- <label>_Category:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>custom-categories</focus_target>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label1</name>
- <label>_Search</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-find</focus_target>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-find</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>6</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>Custom</class>
- <name>custom-categories</name>
- <can_focus>True</can_focus>
- <creation_function>e_select_names_create_categories</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Wed, 27 Jun 2001 01:47:01 GMT</last_modification_time>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/addressbook/gui/contact-editor/.cvsignore b/addressbook/gui/contact-editor/.cvsignore
deleted file mode 100644
index 6fd0b5075c..0000000000
--- a/addressbook/gui/contact-editor/.cvsignore
+++ /dev/null
@@ -1,8 +0,0 @@
-.deps
-.libs
-.pure
-Makefile
-Makefile.in
-*.lo
-*.la
-contact-editor-test
diff --git a/addressbook/gui/contact-editor/Makefile.am b/addressbook/gui/contact-editor/Makefile.am
deleted file mode 100644
index 19598eeb7b..0000000000
--- a/addressbook/gui/contact-editor/Makefile.am
+++ /dev/null
@@ -1,65 +0,0 @@
-INCLUDES = \
- $(BONOBO_GNOME_CFLAGS) \
- $(EXTRA_GNOME_CFLAGS) \
- -I$(top_srcdir) \
- -I$(top_srcdir)/addressbook/ \
- -I$(top_srcdir)/addressbook/backend \
- -I$(top_srcdir)/addressbook/gui/merging \
- -I$(top_srcdir)/widgets/e-table \
- -I$(top_builddir)/shell \
- -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
- -DDATADIR=\""$(datadir)"\" \
- -DEVOLUTION_DATADIR=\""$(datadir)"\" \
- -DEVOLUTIONDIR=\""$(evolutiondir)"\" \
- -DG_LOG_DOMAIN=\"contact-editor\"
-
-noinst_LIBRARIES = \
- libecontacteditor.a
-
-libecontacteditor_a_SOURCES = \
- 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-save-as.c \
- e-contact-save-as.h \
- e-contact-quick-add.c \
- e-contact-quick-add.h
-
-# noinst_PROGRAMS = \
-# contact-editor-test
-
-# contact_editor_test_SOURCES = \
-# test-editor.c
-
-# contact_editor_test_LDADD = \
-# libecontacteditor.a \
-# $(top_builddir)/e-util/libeutil.la \
-# $(top_builddir)/addressbook/printing/libecontactprint.a \
-# $(top_builddir)/addressbook/backend/ebook/libebook.la \
-# $(top_builddir)/e-util/ename/libename.la \
-# $(top_builddir)/libversit/libversit.la \
-# $(GNOMEGNORBA_LIBS) \
-# $(BONOBO_GNOME_LIBS) \
-# $(top_builddir)/widgets/misc/libemiscwidgets.a \
-# $(top_builddir)/e-util/libeutil.la \
-# $(GNOME_PRINT_LIBS) \
-# $(EXTRA_GNOME_LIBS)
-
-evolutiondir = $(datadir)/evolution
-
-evolution_DATA = arrow.png
-
-gladedir = $(datadir)/evolution/glade
-
-glade_DATA = \
- contact-editor.glade \
- fulladdr.glade \
- fullname.glade \
- file-exists.glade \
- e-contact-editor-confirm-delete.glade
-
-EXTRA_DIST = $(evolution_DATA) \
- $(glade_DATA)
diff --git a/addressbook/gui/contact-editor/arrow.png b/addressbook/gui/contact-editor/arrow.png
deleted file mode 100644
index b102356c78..0000000000
--- a/addressbook/gui/contact-editor/arrow.png
+++ /dev/null
Binary files differ
diff --git a/addressbook/gui/contact-editor/contact-editor.glade b/addressbook/gui/contact-editor/contact-editor.glade
deleted file mode 100644
index a483d57d52..0000000000
--- a/addressbook/gui/contact-editor/contact-editor.glade
+++ /dev/null
@@ -1,2334 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>Contact-editor</name>
- <program_name>contact-editor</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <use_widget_names>True</use_widget_names>
- <output_main_file>False</output_main_file>
- <output_support_files>False</output_support_files>
- <output_build_files>False</output_build_files>
- <backup_source_files>False</backup_source_files>
-</project>
-
-<widget>
- <class>GnomeDialog</class>
- <name>dialog2</name>
- <border_width>2</border_width>
- <visible>False</visible>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>False</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox2</name>
- <homogeneous>False</homogeneous>
- <spacing>4</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area2</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button28</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button29</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button30</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkTable</class>
- <name>table2</name>
- <rows>2</rows>
- <columns>2</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>0</row_spacing>
- <column_spacing>2</column_spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry2</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>0</left_attach>
- <right_attach>2</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>2</spacing>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button31</name>
- <border_width>2</border_width>
- <can_focus>True</can_focus>
- <label>_Add</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button32</name>
- <border_width>2</border_width>
- <can_focus>True</can_focus>
- <label>_Delete</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow1</name>
- <height>200</height>
- <hscrollbar_policy>GTK_POLICY_ALWAYS</hscrollbar_policy>
- <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
- <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
- <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkCList</class>
- <name>clist1</name>
- <can_focus>True</can_focus>
- <columns>1</columns>
- <column_widths>80</column_widths>
- <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
- <show_titles>True</show_titles>
- <shadow_type>GTK_SHADOW_NONE</shadow_type>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>CList:title</child_name>
- <name>label20</name>
- <label>Phone Types</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
-</widget>
-
-<widget>
- <class>GnomeDialog</class>
- <name>dialog-add-phone</name>
- <visible>False</visible>
- <title>New phone type</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>False</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>vbox2</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>hbuttonbox1</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button43</name>
- <can_default>True</can_default>
- <has_default>True</has_default>
- <can_focus>True</can_focus>
- <label>_Add</label>
- <stock_pixmap>GNOME_STOCK_PIXMAP_ADD</stock_pixmap>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button44</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame-add-phone</name>
- <border_width>4</border_width>
- <label>New phone type</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment9</name>
- <border_width>9</border_width>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xscale>1</xscale>
- <yscale>1</yscale>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-add-phone</name>
- <can_focus>True</can_focus>
- <has_focus>True</has_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- </widget>
- </widget>
- </widget>
- </widget>
-</widget>
-
-<widget>
- <class>GnomeApp</class>
- <name>contact editor</name>
- <visible>False</visible>
- <title>Contact Editor</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <enable_layout_config>True</enable_layout_config>
-
- <widget>
- <class>GnomeDock</class>
- <child_name>GnomeApp:dock</child_name>
- <name>dock1</name>
- <allow_floating>True</allow_floating>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkNotebook</class>
- <child_name>GnomeDock:contents</child_name>
- <name>notebook-contact-editor</name>
- <can_focus>True</can_focus>
- <show_tabs>True</show_tabs>
- <show_border>True</show_border>
- <tab_pos>GTK_POS_TOP</tab_pos>
- <scrollable>False</scrollable>
- <tab_hborder>2</tab_hborder>
- <tab_vborder>2</tab_vborder>
- <popup_enable>False</popup_enable>
-
- <widget>
- <class>GtkTable</class>
- <name>table-contact-editor-general</name>
- <border_width>7</border_width>
- <rows>14</rows>
- <columns>8</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>4</row_spacing>
- <column_spacing>4</column_spacing>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-phone1</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>7</left_attach>
- <right_attach>8</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-phone2</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>7</left_attach>
- <right_attach>8</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-phone3</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>7</left_attach>
- <right_attach>8</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-phone4</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>7</left_attach>
- <right_attach>8</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkText</class>
- <name>text-address</name>
- <width>1</width>
- <height>1</height>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text></text>
- <child>
- <left_attach>7</left_attach>
- <right_attach>8</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>9</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-fullname</name>
- <can_focus>True</can_focus>
- <label>_Full Name...</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <left_attach>1</left_attach>
- <right_attach>3</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkAccelLabel</class>
- <name>accellabel-fileas</name>
- <label>File As:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>3</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkAccelLabel</class>
- <name>accellabel-web</name>
- <label>Web page address:</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>3</right_attach>
- <top_attach>8</top_attach>
- <bottom_attach>9</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment3</name>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
- <xscale>0</xscale>
- <yscale>1</yscale>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>6</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button-email1</name>
- <relief>GTK_RELIEF_NORMAL</relief>
-
- <widget>
- <class>Placeholder</class>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment5</name>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
- <xscale>0</xscale>
- <yscale>0</yscale>
- <child>
- <left_attach>6</left_attach>
- <right_attach>7</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button-phone4</name>
- <relief>GTK_RELIEF_NORMAL</relief>
-
- <widget>
- <class>Placeholder</class>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment7</name>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
- <xscale>0</xscale>
- <yscale>0</yscale>
- <child>
- <left_attach>6</left_attach>
- <right_attach>7</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button-phone2</name>
- <relief>GTK_RELIEF_NORMAL</relief>
-
- <widget>
- <class>Placeholder</class>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment8</name>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
- <xscale>0</xscale>
- <yscale>0</yscale>
- <child>
- <left_attach>6</left_attach>
- <right_attach>7</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button-phone1</name>
- <relief>GTK_RELIEF_NORMAL</relief>
-
- <widget>
- <class>Placeholder</class>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkHSeparator</class>
- <name>hseparator4</name>
- <child>
- <left_attach>4</left_attach>
- <right_attach>8</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
- <xpad>0</xpad>
- <ypad>2</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment6</name>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
- <xscale>0</xscale>
- <yscale>0</yscale>
- <child>
- <left_attach>6</left_attach>
- <right_attach>7</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button-phone3</name>
- <relief>GTK_RELIEF_NORMAL</relief>
-
- <widget>
- <class>Placeholder</class>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-fullname</name>
- <has_default>True</has_default>
- <can_focus>True</can_focus>
- <has_focus>True</has_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>3</left_attach>
- <right_attach>4</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-jobtitle</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>3</left_attach>
- <right_attach>4</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-company</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>3</left_attach>
- <right_attach>4</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-email1</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>3</left_attach>
- <right_attach>4</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>6</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-web</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>3</left_attach>
- <right_attach>4</right_attach>
- <top_attach>8</top_attach>
- <bottom_attach>9</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkHSeparator</class>
- <name>hseparator5</name>
- <child>
- <left_attach>0</left_attach>
- <right_attach>4</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
- <xpad>0</xpad>
- <ypad>2</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkCombo</class>
- <name>combo-file-as</name>
- <value_in_list>False</value_in_list>
- <ok_if_empty>True</ok_if_empty>
- <case_sensitive>True</case_sensitive>
- <use_arrows>True</use_arrows>
- <use_arrows_always>False</use_arrows_always>
- <items></items>
- <child>
- <left_attach>3</left_attach>
- <right_attach>4</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
-
- <widget>
- <class>GtkEntry</class>
- <child_name>GtkCombo:entry</child_name>
- <name>entry-file-as</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- </widget>
- </widget>
-
- <widget>
- <class>GtkHSeparator</class>
- <name>hseparator6</name>
- <child>
- <left_attach>0</left_attach>
- <right_attach>4</right_attach>
- <top_attach>7</top_attach>
- <bottom_attach>8</bottom_attach>
- <xpad>0</xpad>
- <ypad>2</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment10</name>
- <xalign>0.5</xalign>
- <yalign>0</yalign>
- <xscale>1</xscale>
- <yscale>1</yscale>
- <child>
- <left_attach>3</left_attach>
- <right_attach>4</right_attach>
- <top_attach>6</top_attach>
- <bottom_attach>7</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>True</xshrink>
- <yshrink>True</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>checkbutton-htmlmail</name>
- <label>Wants to receive _HTML mail</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- </widget>
- </widget>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment4</name>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
- <xscale>0</xscale>
- <yscale>0</yscale>
- <child>
- <left_attach>6</left_attach>
- <right_attach>7</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>6</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button-address</name>
- <relief>GTK_RELIEF_NORMAL</relief>
-
- <widget>
- <class>Placeholder</class>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkEventBox</class>
- <name>eventbox1</name>
- <child>
- <left_attach>5</left_attach>
- <right_attach>6</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-phone1</name>
- <label>_Business</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
- </widget>
-
- <widget>
- <class>GtkEventBox</class>
- <name>eventbox2</name>
- <child>
- <left_attach>5</left_attach>
- <right_attach>6</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-phone2</name>
- <label>_Home</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-phone2</focus_target>
- </widget>
- </widget>
-
- <widget>
- <class>GtkEventBox</class>
- <name>eventbox3</name>
- <child>
- <left_attach>5</left_attach>
- <right_attach>6</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-phone3</name>
- <label>Business _Fax</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-phone3</focus_target>
- </widget>
- </widget>
-
- <widget>
- <class>GtkEventBox</class>
- <name>eventbox4</name>
- <child>
- <left_attach>5</left_attach>
- <right_attach>6</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-phone4</name>
- <label>_Mobile</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-phone4</focus_target>
- </widget>
- </widget>
-
- <widget>
- <class>GtkEventBox</class>
- <name>eventbox5</name>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>6</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-email1</name>
- <label>Primary Email</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-email1</focus_target>
- </widget>
- </widget>
-
- <widget>
- <class>GtkEventBox</class>
- <name>eventbox-business</name>
- <child>
- <left_attach>5</left_attach>
- <right_attach>6</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>6</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-address</name>
- <label>B_usiness</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>text-address</focus_target>
- </widget>
- </widget>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment2</name>
- <xalign>0</xalign>
- <yalign>0</yalign>
- <xscale>0</xscale>
- <yscale>0</yscale>
- <child>
- <left_attach>7</left_attach>
- <right_attach>8</right_attach>
- <top_attach>9</top_attach>
- <bottom_attach>10</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>checkbutton-mailingaddress</name>
- <visible>False</visible>
- <label>_This is the mailing address</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- </widget>
- </widget>
-
- <widget>
- <class>GtkHSeparator</class>
- <name>hseparator9</name>
- <child>
- <left_attach>0</left_attach>
- <right_attach>4</right_attach>
- <top_attach>11</top_attach>
- <bottom_attach>12</bottom_attach>
- <xpad>0</xpad>
- <ypad>2</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkHSeparator</class>
- <name>hseparator10</name>
- <child>
- <left_attach>4</left_attach>
- <right_attach>8</right_attach>
- <top_attach>11</top_attach>
- <bottom_attach>12</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment-contacts</name>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xscale>1</xscale>
- <yscale>0</yscale>
- <child>
- <left_attach>1</left_attach>
- <right_attach>3</right_attach>
- <top_attach>12</top_attach>
- <bottom_attach>13</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button-contacts</name>
- <can_focus>True</can_focus>
- <label>_Contacts...</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- </widget>
- </widget>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment15</name>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xscale>1</xscale>
- <yscale>0</yscale>
- <child>
- <left_attach>7</left_attach>
- <right_attach>8</right_attach>
- <top_attach>12</top_attach>
- <bottom_attach>13</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-categories</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- </widget>
- </widget>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment16</name>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xscale>1</xscale>
- <yscale>0</yscale>
- <child>
- <left_attach>5</left_attach>
- <right_attach>7</right_attach>
- <top_attach>12</top_attach>
- <bottom_attach>13</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button-categories</name>
- <can_focus>True</can_focus>
- <label>Ca_tegories...</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- </widget>
- </widget>
-
- <widget>
- <class>GtkEventBox</class>
- <name>eventbox7</name>
- <child>
- <left_attach>1</left_attach>
- <right_attach>3</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-jobtitle</name>
- <label>_Job title:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-jobtitle</focus_target>
- </widget>
- </widget>
-
- <widget>
- <class>Custom</class>
- <name>custom1</name>
- <creation_function>e_create_image_widget</creation_function>
- <string1>malehead.png</string1>
- <string2></string2>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Thu, 18 May 2000 12:19:47 GMT</last_modification_time>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>Custom</class>
- <name>custom2</name>
- <creation_function>e_create_image_widget</creation_function>
- <string1>cellphone.png</string1>
- <string2></string2>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Thu, 18 May 2000 12:20:02 GMT</last_modification_time>
- <child>
- <left_attach>4</left_attach>
- <right_attach>5</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>Custom</class>
- <name>custom3</name>
- <creation_function>e_create_image_widget</creation_function>
- <string1>envelope.png</string1>
- <string2></string2>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Thu, 18 May 2000 12:19:51 GMT</last_modification_time>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>7</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>Custom</class>
- <name>custom4</name>
- <creation_function>e_create_image_widget</creation_function>
- <string1>house.png</string1>
- <string2></string2>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Thu, 18 May 2000 12:20:06 GMT</last_modification_time>
- <child>
- <left_attach>4</left_attach>
- <right_attach>5</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>10</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>Custom</class>
- <name>custom5</name>
- <creation_function>e_create_image_widget</creation_function>
- <string1>evolution-contacts-plain.png</string1>
- <string2></string2>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Thu, 18 May 2000 12:19:59 GMT</last_modification_time>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>12</top_attach>
- <bottom_attach>14</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>Custom</class>
- <name>custom6</name>
- <creation_function>e_create_image_widget</creation_function>
- <string1>briefcase.png</string1>
- <string2></string2>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Thu, 18 May 2000 12:20:09 GMT</last_modification_time>
- <child>
- <left_attach>4</left_attach>
- <right_attach>5</right_attach>
- <top_attach>12</top_attach>
- <bottom_attach>14</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>Custom</class>
- <name>custom10</name>
- <creation_function>e_create_image_widget</creation_function>
- <string1>globe.png</string1>
- <string2></string2>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Thu, 18 May 2000 12:19:56 GMT</last_modification_time>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>8</top_attach>
- <bottom_attach>10</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-company</name>
- <label>Organi_zation:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-company</focus_target>
- <child>
- <left_attach>1</left_attach>
- <right_attach>3</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-fulladdr</name>
- <can_focus>True</can_focus>
- <label>_Address...</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <left_attach>5</left_attach>
- <right_attach>7</right_attach>
- <top_attach>6</top_attach>
- <bottom_attach>7</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment17</name>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xscale>1</xscale>
- <yscale>0</yscale>
- <child>
- <left_attach>3</left_attach>
- <right_attach>4</right_attach>
- <top_attach>12</top_attach>
- <bottom_attach>13</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkTable</class>
- <name>table-contacts</name>
- <rows>1</rows>
- <columns>1</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>0</row_spacing>
- <column_spacing>0</column_spacing>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>Notebook:tab</child_name>
- <name>label15</name>
- <label>General</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
-
- <widget>
- <class>GtkTable</class>
- <name>table-contact-editor-details</name>
- <border_width>7</border_width>
- <rows>9</rows>
- <columns>6</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>4</row_spacing>
- <column_spacing>4</column_spacing>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-department</name>
- <label>_Department:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-department</focus_target>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-office</name>
- <label>_Office:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-office</focus_target>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-profession</name>
- <label>_Profession:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-profession</focus_target>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-nickname</name>
- <label>_Nickname:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-nickname</focus_target>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-spouse</name>
- <label>_Spouse:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-spouse</focus_target>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>6</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-birthday</name>
- <label>_Birthday:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>3</left_attach>
- <right_attach>4</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-assistant</name>
- <label>_Assistant's name:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-assistant</focus_target>
- <child>
- <left_attach>3</left_attach>
- <right_attach>4</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-manager</name>
- <label>_Manager's Name:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-manager</focus_target>
- <child>
- <left_attach>3</left_attach>
- <right_attach>4</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-anniversary</name>
- <label>Anni_versary:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>3</left_attach>
- <right_attach>4</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>6</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-spouse</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>6</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-department</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-office</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-profession</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-nickname</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-assistant</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>4</left_attach>
- <right_attach>6</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-manager</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>4</left_attach>
- <right_attach>6</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkHSeparator</class>
- <name>hseparator7</name>
- <child>
- <left_attach>0</left_attach>
- <right_attach>6</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>2</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-comments</name>
- <label>No_tes:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>7</top_attach>
- <bottom_attach>8</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkHSeparator</class>
- <name>hseparator8</name>
- <child>
- <left_attach>0</left_attach>
- <right_attach>6</right_attach>
- <top_attach>6</top_attach>
- <bottom_attach>7</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>Custom</class>
- <name>custom7</name>
- <creation_function>e_create_image_widget</creation_function>
- <string1>briefcase.png</string1>
- <string2></string2>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Thu, 18 May 2000 12:20:13 GMT</last_modification_time>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>Custom</class>
- <name>custom8</name>
- <creation_function>e_create_image_widget</creation_function>
- <string1>malehead.png</string1>
- <string2></string2>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Thu, 18 May 2000 12:20:16 GMT</last_modification_time>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>6</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow2</name>
- <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
- <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
- <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
- <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
- <child>
- <left_attach>1</left_attach>
- <right_attach>6</right_attach>
- <top_attach>8</top_attach>
- <bottom_attach>9</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkText</class>
- <name>text-comments</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text></text>
- </widget>
- </widget>
-
- <widget>
- <class>Custom</class>
- <name>custom9</name>
- <creation_function>e_create_image_widget</creation_function>
- <string1>globe.png</string1>
- <string2></string2>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Thu, 18 May 2000 12:20:19 GMT</last_modification_time>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>7</top_attach>
- <bottom_attach>9</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>Custom</class>
- <name>dateedit-birthday</name>
- <creation_function>e_contact_editor_create_date</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Tue, 05 Jun 2001 02:36:27 GMT</last_modification_time>
- <child>
- <left_attach>4</left_attach>
- <right_attach>6</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>Custom</class>
- <name>dateedit-anniversary</name>
- <creation_function>e_contact_editor_create_date</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Tue, 05 Jun 2001 02:36:32 GMT</last_modification_time>
- <child>
- <left_attach>4</left_attach>
- <right_attach>6</right_attach>
- <top_attach>5</top_attach>
- <bottom_attach>6</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>Notebook:tab</child_name>
- <name>label16</name>
- <label>Details</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GnomeAppBar</class>
- <child_name>GnomeApp:appbar</child_name>
- <name>appbar1</name>
- <has_progress>True</has_progress>
- <has_status>True</has_status>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
-</widget>
-
-</GTK-Interface>
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 1fe9337503..0000000000
--- a/addressbook/gui/contact-editor/e-contact-editor-address.c
+++ /dev/null
@@ -1,243 +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 <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <libgnomeui/gnome-stock.h>
-#include <gal/widgets/e-unicode.h>
-#include <e-contact-editor-address.h>
-
-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_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_contact_editor_address_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_contact_editor_address_destroy (GtkObject *object);
-
-static void fill_in_info(EContactEditorAddress *editor);
-static void extract_info(EContactEditorAddress *editor);
-
-static GnomeDialogClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_ADDRESS,
- ARG_IS_READ_ONLY
-};
-
-GtkType
-e_contact_editor_address_get_type (void)
-{
- static GtkType contact_editor_address_type = 0;
-
- if (!contact_editor_address_type)
- {
- static const GtkTypeInfo contact_editor_address_info =
- {
- "EContactEditorAddress",
- sizeof (EContactEditorAddress),
- sizeof (EContactEditorAddressClass),
- (GtkClassInitFunc) e_contact_editor_address_class_init,
- (GtkObjectInitFunc) e_contact_editor_address_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- contact_editor_address_type = gtk_type_unique (gnome_dialog_get_type (), &contact_editor_address_info);
- }
-
- return contact_editor_address_type;
-}
-
-static void
-e_contact_editor_address_class_init (EContactEditorAddressClass *klass)
-{
- GtkObjectClass *object_class;
- GnomeDialogClass *dialog_class;
-
- object_class = (GtkObjectClass*) klass;
- dialog_class = (GnomeDialogClass *) klass;
-
- parent_class = gtk_type_class (gnome_dialog_get_type ());
-
- gtk_object_add_arg_type ("EContactEditorAddress::address", GTK_TYPE_POINTER,
- GTK_ARG_READWRITE, ARG_ADDRESS);
- gtk_object_add_arg_type ("EContactEditorAddress::editable", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_IS_READ_ONLY);
-
- object_class->set_arg = e_contact_editor_address_set_arg;
- object_class->get_arg = e_contact_editor_address_get_arg;
- object_class->destroy = e_contact_editor_address_destroy;
-}
-
-static void
-e_contact_editor_address_init (EContactEditorAddress *e_contact_editor_address)
-{
- GladeXML *gui;
- GtkWidget *widget;
-
- gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_address),
- GNOME_STOCK_BUTTON_OK);
-
- gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_address),
- GNOME_STOCK_BUTTON_CANCEL);
-
- gtk_window_set_policy(GTK_WINDOW(e_contact_editor_address), FALSE, TRUE, FALSE);
-
- e_contact_editor_address->address = NULL;
-
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/fulladdr.glade", NULL);
- e_contact_editor_address->gui = gui;
-
- widget = glade_xml_get_widget(gui, "table-checkaddress");
- gtk_widget_ref(widget);
- gtk_container_remove(GTK_CONTAINER(widget->parent), widget);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (e_contact_editor_address)->vbox), widget, TRUE, TRUE, 0);
- gtk_widget_unref(widget);
-}
-
-void
-e_contact_editor_address_destroy (GtkObject *object)
-{
- EContactEditorAddress *e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS(object);
-
- if (e_contact_editor_address->gui)
- gtk_object_unref(GTK_OBJECT(e_contact_editor_address->gui));
- e_card_delivery_address_free(e_contact_editor_address->address);
-}
-
-GtkWidget*
-e_contact_editor_address_new (const ECardDeliveryAddress *address)
-{
- GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_address_get_type ()));
- gtk_object_set (GTK_OBJECT(widget),
- "address", address,
- NULL);
- return widget;
-}
-
-static void
-e_contact_editor_address_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- EContactEditorAddress *e_contact_editor_address;
-
- e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS (o);
-
- switch (arg_id){
- case ARG_ADDRESS:
- if (e_contact_editor_address->address)
- e_card_delivery_address_free(e_contact_editor_address->address);
- e_contact_editor_address->address = e_card_delivery_address_copy(GTK_VALUE_POINTER (*arg));
- fill_in_info(e_contact_editor_address);
- break;
- case ARG_IS_READ_ONLY: {
- int i;
- char *entry_names[] = {
- "entry-street",
- "entry-city",
- "entry-ext",
- "entry-po",
- "entry-region",
- "combo-country",
- "entry-code",
- NULL
- };
- e_contact_editor_address->editable = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
- for (i = 0; entry_names[i] != NULL; i ++) {
- gtk_widget_set_sensitive (glade_xml_get_widget(e_contact_editor_address->gui, entry_names[i]), e_contact_editor_address->editable);
- }
- break;
- }
- }
-}
-
-static void
-e_contact_editor_address_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EContactEditorAddress *e_contact_editor_address;
-
- e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS (object);
-
- switch (arg_id) {
- case ARG_ADDRESS:
- extract_info(e_contact_editor_address);
- GTK_VALUE_POINTER (*arg) = e_card_delivery_address_copy(e_contact_editor_address->address);
- break;
- case ARG_IS_READ_ONLY:
- GTK_VALUE_BOOL (*arg) = e_contact_editor_address->editable ? TRUE : FALSE;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-fill_in_field(EContactEditorAddress *editor, char *field, char *string)
-{
- GtkEditable *editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, field));
- if (editable) {
- e_utf8_gtk_editable_set_text(editable, string);
- }
-}
-
-static void
-fill_in_info(EContactEditorAddress *editor)
-{
- 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);
- }
-}
-
-static char *
-extract_field(EContactEditorAddress *editor, char *field)
-{
- GtkEditable *editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, field));
- if (editable)
- return e_utf8_gtk_editable_get_text(editable);
- else
- return NULL;
-}
-
-static void
-extract_info(EContactEditorAddress *editor)
-{
- 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");
-}
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 f4031bea2f..0000000000
--- a/addressbook/gui/contact-editor/e-contact-editor-address.h
+++ /dev/null
@@ -1,78 +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 <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <libgnomeui/gnome-dialog.h>
-#include <glade/glade.h>
-#include <ebook/e-card.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* 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_CONTACT_EDITOR_ADDRESS_TYPE (e_contact_editor_address_get_type ())
-#define E_CONTACT_EDITOR_ADDRESS(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_ADDRESS_TYPE, EContactEditorAddress))
-#define E_CONTACT_EDITOR_ADDRESS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_ADDRESS_TYPE, EContactEditorAddressClass))
-#define E_IS_CONTACT_EDITOR_ADDRESS(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_ADDRESS_TYPE))
-#define E_IS_CONTACT_EDITOR_ADDRESS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_ADDRESS_TYPE))
-
-
-typedef struct _EContactEditorAddress EContactEditorAddress;
-typedef struct _EContactEditorAddressClass EContactEditorAddressClass;
-
-struct _EContactEditorAddress
-{
- GnomeDialog parent;
-
- /* item specific fields */
- ECardDeliveryAddress *address;
-
- guint editable : 1;
-
- GladeXML *gui;
-};
-
-struct _EContactEditorAddressClass
-{
- GnomeDialogClass parent_class;
-};
-
-
-GtkWidget *e_contact_editor_address_new(const ECardDeliveryAddress *name);
-GtkType e_contact_editor_address_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_CONTACT_EDITOR_ADDRESS_H__ */
diff --git a/addressbook/gui/contact-editor/e-contact-editor-confirm-delete.glade b/addressbook/gui/contact-editor/e-contact-editor-confirm-delete.glade
deleted file mode 100644
index b91a040d46..0000000000
--- a/addressbook/gui/contact-editor/e-contact-editor-confirm-delete.glade
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>e-contact-editor-confirm-delete</name>
- <program_name>e-contact-editor-confirm-delete</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <use_widget_names>True</use_widget_names>
- <output_main_file>False</output_main_file>
- <output_support_files>False</output_support_files>
- <output_build_files>False</output_build_files>
- <gnome_help_support>True</gnome_help_support>
-</project>
-
-<widget>
- <class>GnomeMessageBox</class>
- <name>confirm-dialog</name>
- <message_box_type>GNOME_MESSAGE_BOX_QUESTION</message_box_type>
- <message>Are you sure you want
-to delete this contact?</message>
- <title>Delete Contact?</title>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>False</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>True</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area1</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button1</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button2</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
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 cf97854956..0000000000
--- a/addressbook/gui/contact-editor/e-contact-editor-fullname.c
+++ /dev/null
@@ -1,243 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-contact-editor-fullname.c
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <libgnomeui/gnome-stock.h>
-#include <gal/widgets/e-unicode.h>
-#include "e-contact-editor-fullname.h"
-
-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_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_contact_editor_fullname_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_contact_editor_fullname_destroy (GtkObject *object);
-
-static void fill_in_info(EContactEditorFullname *editor);
-static void extract_info(EContactEditorFullname *editor);
-
-static GnomeDialogClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_NAME,
- ARG_IS_READ_ONLY
-};
-
-GtkType
-e_contact_editor_fullname_get_type (void)
-{
- static GtkType contact_editor_fullname_type = 0;
-
- if (!contact_editor_fullname_type)
- {
- static const GtkTypeInfo contact_editor_fullname_info =
- {
- "EContactEditorFullname",
- sizeof (EContactEditorFullname),
- sizeof (EContactEditorFullnameClass),
- (GtkClassInitFunc) e_contact_editor_fullname_class_init,
- (GtkObjectInitFunc) e_contact_editor_fullname_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- contact_editor_fullname_type = gtk_type_unique (gnome_dialog_get_type (), &contact_editor_fullname_info);
- }
-
- return contact_editor_fullname_type;
-}
-
-static void
-e_contact_editor_fullname_class_init (EContactEditorFullnameClass *klass)
-{
- GtkObjectClass *object_class;
- GnomeDialogClass *dialog_class;
-
- object_class = (GtkObjectClass*) klass;
- dialog_class = (GnomeDialogClass *) klass;
-
- parent_class = gtk_type_class (gnome_dialog_get_type ());
-
- gtk_object_add_arg_type ("EContactEditorFullname::name", GTK_TYPE_POINTER,
- GTK_ARG_READWRITE, ARG_NAME);
-
- gtk_object_add_arg_type ("EContactEditorFullname::editable", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_IS_READ_ONLY);
-
- object_class->set_arg = e_contact_editor_fullname_set_arg;
- object_class->get_arg = e_contact_editor_fullname_get_arg;
- object_class->destroy = e_contact_editor_fullname_destroy;
-}
-
-static void
-e_contact_editor_fullname_init (EContactEditorFullname *e_contact_editor_fullname)
-{
- GladeXML *gui;
- GtkWidget *widget;
-
- gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_fullname),
- GNOME_STOCK_BUTTON_OK);
-
- gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_fullname),
- GNOME_STOCK_BUTTON_CANCEL);
-
- gtk_window_set_policy(GTK_WINDOW(e_contact_editor_fullname), TRUE, TRUE, FALSE);
-
- e_contact_editor_fullname->name = NULL;
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/fullname.glade", NULL);
- e_contact_editor_fullname->gui = gui;
-
- widget = glade_xml_get_widget(gui, "table-checkfullname");
- gtk_widget_ref(widget);
- gtk_container_remove(GTK_CONTAINER(widget->parent), widget);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (e_contact_editor_fullname)->vbox), widget, TRUE, TRUE, 0);
- gtk_widget_unref(widget);
-}
-
-void
-e_contact_editor_fullname_destroy (GtkObject *object)
-{
- EContactEditorFullname *e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME(object);
-
- if (e_contact_editor_fullname->gui)
- gtk_object_unref(GTK_OBJECT(e_contact_editor_fullname->gui));
- e_card_name_free(e_contact_editor_fullname->name);
-}
-
-GtkWidget*
-e_contact_editor_fullname_new (const ECardName *name)
-{
- GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_fullname_get_type ()));
- gtk_object_set (GTK_OBJECT(widget),
- "name", name,
- NULL);
- return widget;
-}
-
-static void
-e_contact_editor_fullname_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- EContactEditorFullname *e_contact_editor_fullname;
-
- e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME (o);
-
- switch (arg_id){
- case ARG_NAME:
- if (e_contact_editor_fullname->name)
- e_card_name_free(e_contact_editor_fullname->name);
- e_contact_editor_fullname->name = e_card_name_copy(GTK_VALUE_POINTER (*arg));
- fill_in_info(e_contact_editor_fullname);
- break;
- case ARG_IS_READ_ONLY: {
- int i;
- char *entry_names[] = {
- "combo-title",
- "combo-suffix",
- "entry-first",
- "entry-middle",
- "entry-last",
- NULL
- };
- e_contact_editor_fullname->editable = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
- for (i = 0; entry_names[i] != NULL; i ++) {
- gtk_widget_set_sensitive (glade_xml_get_widget(e_contact_editor_fullname->gui,
- entry_names[i]),
- e_contact_editor_fullname->editable);
- }
- break;
- }
- }
-}
-
-static void
-e_contact_editor_fullname_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EContactEditorFullname *e_contact_editor_fullname;
-
- e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME (object);
-
- switch (arg_id) {
- case ARG_NAME:
- extract_info(e_contact_editor_fullname);
- GTK_VALUE_POINTER (*arg) = e_card_name_copy(e_contact_editor_fullname->name);
- break;
- case ARG_IS_READ_ONLY:
- GTK_VALUE_BOOL (*arg) = e_contact_editor_fullname->editable ? TRUE : FALSE;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- 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)
- e_utf8_gtk_entry_set_text(entry, string);
- else
- gtk_entry_set_text(entry, "");
- }
-}
-
-static void
-fill_in_info(EContactEditorFullname *editor)
-{
- ECardName *name = editor->name;
- if (name) {
- fill_in_field(editor, "entry-title", name->prefix);
- 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->suffix);
- }
-}
-
-static char *
-extract_field(EContactEditorFullname *editor, char *field)
-{
- GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, field));
- if (entry)
- return e_utf8_gtk_entry_get_text(entry);
- else
- return NULL;
-}
-
-static void
-extract_info(EContactEditorFullname *editor)
-{
- ECardName *name = editor->name;
- if (!name) {
- name = e_card_name_new();
- editor->name = name;
- }
-
- name->prefix = 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->suffix = 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 82411c0606..0000000000
--- a/addressbook/gui/contact-editor/e-contact-editor-fullname.h
+++ /dev/null
@@ -1,78 +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 <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <libgnomeui/gnome-dialog.h>
-#include <glade/glade.h>
-#include <ebook/e-card.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* 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_CONTACT_EDITOR_FULLNAME_TYPE (e_contact_editor_fullname_get_type ())
-#define E_CONTACT_EDITOR_FULLNAME(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_FULLNAME_TYPE, EContactEditorFullname))
-#define E_CONTACT_EDITOR_FULLNAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_FULLNAME_TYPE, EContactEditorFullnameClass))
-#define E_IS_CONTACT_EDITOR_FULLNAME(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_FULLNAME_TYPE))
-#define E_IS_CONTACT_EDITOR_FULLNAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_FULLNAME_TYPE))
-
-
-typedef struct _EContactEditorFullname EContactEditorFullname;
-typedef struct _EContactEditorFullnameClass EContactEditorFullnameClass;
-
-struct _EContactEditorFullname
-{
- GnomeDialog parent;
-
- /* item specific fields */
- ECardName *name;
- GladeXML *gui;
-
- /* Whether the dialog will accept modifications */
- guint editable : 1;
-};
-
-struct _EContactEditorFullnameClass
-{
- GnomeDialogClass parent_class;
-};
-
-
-GtkWidget *e_contact_editor_fullname_new(const ECardName *name);
-GtkType e_contact_editor_fullname_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_CONTACT_EDITOR_FULLNAME_H__ */
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 ae1ef0ff95..0000000000
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ /dev/null
@@ -1,2448 +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 <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <time.h>
-#include <gtk/gtkcheckbutton.h>
-#include <gtk/gtkcheckmenuitem.h>
-#include <gtk/gtkcombo.h>
-#include <gtk/gtktext.h>
-#include <libgnomeui/gnome-popup-menu.h>
-#include <libgnome/gnome-i18n.h>
-
-#include <bonobo/bonobo-ui-container.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gdk-pixbuf/gnome-canvas-pixbuf.h>
-#include <gal/widgets/e-categories.h>
-#include <gal/widgets/e-gui-utils.h>
-#include <gal/widgets/e-unicode.h>
-#include <gal/e-text/e-entry.h>
-
-#include <e-util/e-categories-master-list-wombat.h>
-
-#include "addressbook/printing/e-contact-print.h"
-#include "addressbook/printing/e-contact-print-envelope.h"
-#include "e-util/e-gui-utils.h"
-#include "widgets/misc/e-dateedit.h"
-#include "shell/evolution-shell-component-utils.h"
-
-#include "e-card-merging.h"
-
-#include "e-contact-editor.h"
-#include "e-contact-editor-address.h"
-#include "e-contact-editor-fullname.h"
-#include "e-contact-save-as.h"
-
-/* Signal IDs */
-enum {
- CARD_ADDED,
- CARD_MODIFIED,
- CARD_DELETED,
- EDITOR_CLOSED,
- LAST_SIGNAL
-};
-
-static void e_contact_editor_init (EContactEditor *card);
-static void e_contact_editor_class_init (EContactEditorClass *klass);
-static void e_contact_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_contact_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_contact_editor_destroy (GtkObject *object);
-
-#if 0
-static GtkWidget *e_contact_editor_build_dialog(EContactEditor *editor, gchar *entry_id, gchar *label_id, gchar *title, GList **list, GnomeUIInfo **info);
-#endif
-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 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_fields(EContactEditor *editor);
-static void set_address_field(EContactEditor *editor, int result);
-static void add_field_callback(GtkWidget *widget, EContactEditor *editor);
-static void command_state_changed (EContactEditor *ce);
-static void widget_changed (GtkWidget *widget, EContactEditor *editor);
-static void close_dialog (EContactEditor *ce);
-
-static GtkObjectClass *parent_class = NULL;
-
-static guint contact_editor_signals[LAST_SIGNAL];
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_BOOK,
- ARG_CARD,
- ARG_IS_NEW_CARD,
- ARG_EDITABLE,
- ARG_WRITABLE_FIELDS
-};
-
-enum {
- DYNAMIC_LIST_EMAIL,
- DYNAMIC_LIST_PHONE,
- DYNAMIC_LIST_ADDRESS
-};
-
-GtkType
-e_contact_editor_get_type (void)
-{
- static GtkType contact_editor_type = 0;
-
- if (!contact_editor_type)
- {
- static const GtkTypeInfo contact_editor_info =
- {
- "EContactEditor",
- sizeof (EContactEditor),
- sizeof (EContactEditorClass),
- (GtkClassInitFunc) e_contact_editor_class_init,
- (GtkObjectInitFunc) e_contact_editor_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- contact_editor_type = gtk_type_unique (GTK_TYPE_OBJECT, &contact_editor_info);
- }
-
- return contact_editor_type;
-}
-
-typedef void (*GtkSignal_NONE__INT_OBJECT) (GtkObject * object,
- gint arg1,
- GtkObject *arg2,
- gpointer user_data);
-
-static void
-e_marshal_NONE__INT_OBJECT (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_NONE__INT_OBJECT rfunc;
- rfunc = (GtkSignal_NONE__INT_OBJECT) func;
- (*rfunc) (object,
- GTK_VALUE_INT (args[0]),
- GTK_VALUE_OBJECT (args[1]),
- func_data);
-}
-
-static void
-e_contact_editor_class_init (EContactEditorClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) klass;
-
- parent_class = gtk_type_class (GTK_TYPE_OBJECT);
-
- gtk_object_add_arg_type ("EContactEditor::book", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_BOOK);
- gtk_object_add_arg_type ("EContactEditor::card", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_CARD);
- gtk_object_add_arg_type ("EContactEditor::is_new_card", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_IS_NEW_CARD);
- gtk_object_add_arg_type ("EContactEditor::writable_fields", GTK_TYPE_POINTER,
- GTK_ARG_READWRITE, ARG_WRITABLE_FIELDS);
- gtk_object_add_arg_type ("EContactEditor::editable", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_EDITABLE);
-
- contact_editor_signals[CARD_ADDED] =
- gtk_signal_new ("card_added",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EContactEditorClass, card_added),
- e_marshal_NONE__INT_OBJECT,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_INT, GTK_TYPE_OBJECT);
-
- contact_editor_signals[CARD_MODIFIED] =
- gtk_signal_new ("card_modified",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EContactEditorClass, card_modified),
- e_marshal_NONE__INT_OBJECT,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_INT, GTK_TYPE_OBJECT);
-
- contact_editor_signals[CARD_DELETED] =
- gtk_signal_new ("card_deleted",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EContactEditorClass, card_deleted),
- e_marshal_NONE__INT_OBJECT,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_INT, GTK_TYPE_OBJECT);
-
- contact_editor_signals[EDITOR_CLOSED] =
- gtk_signal_new ("editor_closed",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EContactEditorClass, editor_closed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, contact_editor_signals, LAST_SIGNAL);
-
- object_class->set_arg = e_contact_editor_set_arg;
- object_class->get_arg = e_contact_editor_get_arg;
- object_class->destroy = e_contact_editor_destroy;
-}
-
-static void
-_replace_button(EContactEditor *editor, gchar *button_xml, gchar *image, GtkSignalFunc func)
-{
- GladeXML *gui = editor->gui;
- GtkWidget *button = glade_xml_get_widget(gui, button_xml);
- GtkWidget *pixmap;
- gchar *image_temp;
- if (button && GTK_IS_BUTTON(button)) {
- image_temp = g_strdup_printf("%s/%s", EVOLUTIONDIR, image);
- pixmap = e_create_image_widget(NULL, image_temp, NULL, 0, 0);
- gtk_container_add(GTK_CONTAINER(button),
- pixmap);
- g_free(image_temp);
- gtk_widget_show(pixmap);
- gtk_signal_connect(GTK_OBJECT(button), "button_press_event", func, editor);
- }
-}
-
-static void
-_replace_buttons(EContactEditor *editor)
-{
- _replace_button(editor, "button-phone1", "arrow.png", _phone_arrow_pressed);
- _replace_button(editor, "button-phone2", "arrow.png", _phone_arrow_pressed);
- _replace_button(editor, "button-phone3", "arrow.png", _phone_arrow_pressed);
- _replace_button(editor, "button-phone4", "arrow.png", _phone_arrow_pressed);
- _replace_button(editor, "button-address", "arrow.png", _address_arrow_pressed);
- _replace_button(editor, "button-email1", "arrow.png", _email_arrow_pressed);
-}
-
-static void
-wants_html_changed (GtkWidget *widget, EContactEditor *editor)
-{
- gboolean wants_html;
- gtk_object_get(GTK_OBJECT(widget),
- "active", &wants_html,
- NULL);
- gtk_object_set(GTK_OBJECT(editor->card),
- "wants_html", wants_html,
- NULL);
-
- widget_changed (widget, editor);
-}
-
-static void
-phone_entry_changed (GtkWidget *widget, EContactEditor *editor)
-{
- int which;
- gchar *string;
- GtkEntry *entry = GTK_ENTRY(widget);
- ECardPhone *phone;
-
- 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;
- string = e_utf8_gtk_entry_get_text(entry);
- phone = e_card_phone_new();
- phone->number = string;
- e_card_simple_set_phone(editor->simple, editor->phone_choice[which - 1], phone);
-#if 0
- phone->number = NULL;
-#endif
- e_card_phone_free(phone);
- set_fields(editor);
-
- widget_changed (widget, editor);
-}
-
-static void
-email_entry_changed (GtkWidget *widget, EContactEditor *editor)
-{
- gchar *string;
- GtkEntry *entry = GTK_ENTRY(widget);
-
- string = e_utf8_gtk_entry_get_text(entry);
-
- e_card_simple_set_email(editor->simple, editor->email_choice, string);
-
- g_free (string);
-
- widget_changed (widget, editor);
-}
-
-static void
-address_text_changed (GtkWidget *widget, EContactEditor *editor)
-{
- GtkEditable *editable = GTK_EDITABLE(widget);
- ECardAddrLabel *address;
-
- if (editor->address_choice == -1)
- return;
-
- address = e_card_address_label_new();
-
- address->data = e_utf8_gtk_editable_get_chars(editable, 0, -1);
-
- e_card_simple_set_address(editor->simple, editor->address_choice, address);
- e_card_address_label_free(address);
-
- widget_changed (widget, editor);
-}
-
-/* This function tells you whether name_to_style will make sense. */
-static gboolean
-style_makes_sense(const ECardName *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 ECardName *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;
- ECardName *name = editor->name;
- int i;
- int style;
-
- if (!(file_as && GTK_IS_ENTRY(file_as)))
- return -1;
-
- filestring = e_utf8_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 = e_utf8_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);
- string = e_utf8_to_gtk_string (widget, u);
- g_free (u);
- if (string) strings = g_list_append(strings, string);
- }
- }
-
- 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);
- e_utf8_gtk_entry_set_text(file_as, string);
- g_free(string);
- }
-}
-
-static void
-name_entry_changed (GtkWidget *widget, EContactEditor *editor)
-{
- int style = 0;
- char *string;
-
- style = file_as_get_style(editor);
-
- e_card_name_free(editor->name);
-
- string = e_utf8_gtk_entry_get_text (GTK_ENTRY(widget));
- editor->name = e_card_name_from_string(string);
- g_free (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 = e_utf8_gtk_entry_get_text(GTK_ENTRY(widget));
-
- file_as_set_style(editor, style);
-
- widget_changed (widget, 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))
- gtk_signal_connect(GTK_OBJECT(widget), "changed",
- phone_entry_changed, editor);
-}
-
-static void
-widget_changed (GtkWidget *widget, EContactEditor *editor)
-{
- if (!editor->changed) {
- editor->changed = TRUE;
- command_state_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");
- widget = glade_xml_get_widget(editor->gui, "entry-email1");
- if (widget && GTK_IS_ENTRY(widget)) {
- gtk_signal_connect(GTK_OBJECT(widget), "changed",
- email_entry_changed, editor);
- }
- widget = glade_xml_get_widget(editor->gui, "text-address");
- if (widget && GTK_IS_TEXT(widget)) {
- gtk_signal_connect(GTK_OBJECT(widget), "changed",
- address_text_changed, editor);
- }
- widget = glade_xml_get_widget(editor->gui, "entry-fullname");
- if (widget && GTK_IS_ENTRY(widget)) {
- gtk_signal_connect(GTK_OBJECT(widget), "changed",
- name_entry_changed, editor);
- }
- widget = glade_xml_get_widget(editor->gui, "entry-company");
- if (widget && GTK_IS_ENTRY(widget)) {
- gtk_signal_connect(GTK_OBJECT(widget), "changed",
- company_entry_changed, editor);
- }
- widget = glade_xml_get_widget(editor->gui, "entry-categories");
- if (widget && GTK_IS_ENTRY(widget)) {
- gtk_signal_connect(GTK_OBJECT(widget), "changed",
- widget_changed, editor);
- }
- widget = glade_xml_get_widget(editor->gui, "entry-jobtitle");
- if (widget && GTK_IS_ENTRY(widget)) {
- gtk_signal_connect(GTK_OBJECT(widget), "changed",
- widget_changed, editor);
- }
- widget = glade_xml_get_widget(editor->gui, "entry-file-as");
- if (widget && GTK_IS_ENTRY(widget)) {
- gtk_signal_connect(GTK_OBJECT(widget), "changed",
- widget_changed, editor);
- }
- widget = glade_xml_get_widget(editor->gui, "entry-manager");
- if (widget && GTK_IS_ENTRY(widget)) {
- gtk_signal_connect(GTK_OBJECT(widget), "changed",
- widget_changed, editor);
- }
- widget = glade_xml_get_widget(editor->gui, "entry-assistant");
- if (widget && GTK_IS_ENTRY(widget)) {
- gtk_signal_connect(GTK_OBJECT(widget), "changed",
- widget_changed, editor);
- }
- widget = glade_xml_get_widget(editor->gui, "entry-office");
- if (widget && GTK_IS_ENTRY(widget)) {
- gtk_signal_connect(GTK_OBJECT(widget), "changed",
- widget_changed, editor);
- }
- widget = glade_xml_get_widget(editor->gui, "entry-department");
- if (widget && GTK_IS_ENTRY(widget)) {
- gtk_signal_connect(GTK_OBJECT(widget), "changed",
- widget_changed, editor);
- }
- widget = glade_xml_get_widget(editor->gui, "entry-profession");
- if (widget && GTK_IS_ENTRY(widget)) {
- gtk_signal_connect(GTK_OBJECT(widget), "changed",
- widget_changed, editor);
- }
- widget = glade_xml_get_widget(editor->gui, "entry-nickname");
- if (widget && GTK_IS_ENTRY(widget)) {
- gtk_signal_connect(GTK_OBJECT(widget), "changed",
- widget_changed, editor);
- }
- widget = glade_xml_get_widget(editor->gui, "entry-spouse");
- if (widget && GTK_IS_ENTRY(widget)) {
- gtk_signal_connect(GTK_OBJECT(widget), "changed",
- widget_changed, editor);
- }
- widget = glade_xml_get_widget(editor->gui, "text-comments");
- if (widget && GTK_IS_TEXT(widget)) {
- gtk_signal_connect(GTK_OBJECT(widget), "changed",
- widget_changed, editor);
- }
- widget = glade_xml_get_widget(editor->gui, "dateedit-birthday");
- if (widget && E_IS_DATE_EDIT(widget)) {
- gtk_signal_connect(GTK_OBJECT(widget), "changed",
- widget_changed, editor);
- }
- widget = glade_xml_get_widget(editor->gui, "dateedit-anniversary");
- if (widget && E_IS_DATE_EDIT(widget)) {
- gtk_signal_connect(GTK_OBJECT(widget), "changed",
- widget_changed, editor);
- }
-
-}
-
-static void
-full_name_clicked(GtkWidget *button, EContactEditor *editor)
-{
- GnomeDialog *dialog = GNOME_DIALOG(e_contact_editor_fullname_new(editor->name));
- int result;
-
- gtk_object_set (GTK_OBJECT (dialog),
- "editable", editor->editable,
- NULL);
- gtk_widget_show(GTK_WIDGET(dialog));
- result = gnome_dialog_run (dialog);
-
- if (result == 0) {
- ECardName *name;
- GtkWidget *fname_widget;
- int style = 0;
-
- gtk_object_get(GTK_OBJECT(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_card_name_to_string(name);
- e_utf8_gtk_entry_set_text(GTK_ENTRY(fname_widget), full_name);
- g_free(full_name);
- }
-
- e_card_name_free(editor->name);
- editor->name = e_card_name_copy(name);
-
- file_as_set_style(editor, style);
- }
- gtk_object_unref(GTK_OBJECT(dialog));
-}
-
-static void
-full_addr_clicked(GtkWidget *button, EContactEditor *editor)
-{
- GnomeDialog *dialog;
- int result;
- const ECardDeliveryAddress *address;
-
- address = e_card_simple_get_delivery_address(editor->simple, editor->address_choice);
-
- dialog = GNOME_DIALOG(e_contact_editor_address_new(address));
- gtk_object_set (GTK_OBJECT (dialog),
- "editable", editor->editable,
- NULL);
- gtk_widget_show(GTK_WIDGET(dialog));
-
- result = gnome_dialog_run (dialog);
- if (result == 0) {
- ECardDeliveryAddress *new_address;
- GtkWidget *address_widget;
-
- gtk_object_get(GTK_OBJECT(dialog),
- "address", &new_address,
- NULL);
-
- address_widget = glade_xml_get_widget(editor->gui, "text-address");
- if (address_widget && GTK_IS_EDITABLE(address_widget)) {
- char *string = e_card_delivery_address_to_string(new_address);
- e_utf8_gtk_editable_set_text(GTK_EDITABLE(address_widget), string);
- g_free(string);
- } else {
- ECardAddrLabel *address = e_card_delivery_address_to_label(new_address);
- e_card_simple_set_address(editor->simple, editor->address_choice, address);
- e_card_address_label_free(address);
- }
-
- e_card_simple_set_delivery_address(editor->simple, editor->address_choice, new_address);
-
- e_card_delivery_address_free(new_address);
- }
- gtk_object_unref(GTK_OBJECT(dialog));
-}
-
-static void
-categories_clicked(GtkWidget *button, EContactEditor *editor)
-{
- char *categories = NULL;
- GnomeDialog *dialog;
- int result;
- GtkWidget *entry = glade_xml_get_widget(editor->gui, "entry-categories");
- ECategoriesMasterList *ecml;
- if (entry && GTK_IS_ENTRY(entry))
- categories = e_utf8_gtk_entry_get_text(GTK_ENTRY(entry));
- else if (editor->card)
- gtk_object_get(GTK_OBJECT(editor->card),
- "categories", &categories,
- NULL);
- dialog = GNOME_DIALOG(e_categories_new(categories));
- ecml = e_categories_master_list_wombat_new ();
- gtk_object_set(GTK_OBJECT(dialog),
- "header", _("This contact belongs to these categories:"),
- "ecml", ecml,
- NULL);
- gtk_object_unref (GTK_OBJECT (ecml));
- gtk_widget_show(GTK_WIDGET(dialog));
- result = gnome_dialog_run (dialog);
- g_free (categories);
- if (result == 0) {
- gtk_object_get(GTK_OBJECT(dialog),
- "categories", &categories,
- NULL);
- if (entry && GTK_IS_ENTRY(entry))
- e_utf8_gtk_entry_set_text(GTK_ENTRY(entry), categories);
- else
- gtk_object_set(GTK_OBJECT(editor->card),
- "categories", categories,
- NULL);
- g_free(categories);
- }
- gtk_object_destroy(GTK_OBJECT(dialog));
-}
-
-static void
-ensure_select_names_contact (EContactEditor *editor)
-{
- if (editor->select_names_contacts == NULL) {
- editor->select_names_contacts = e_select_names_manager_new ();
- e_select_names_manager_add_section (editor->select_names_contacts,
- "contacts",
- "Related Contacts");
- }
-}
-
-static void
-contacts_clicked (GtkWidget *button, EContactEditor *editor)
-{
- ensure_select_names_contact (editor);
- e_select_names_manager_activate_dialog (editor->select_names_contacts,
- "contacts");
-}
-
-static void
-add_lists (EContactEditor *editor)
-{
- GtkWidget *table = glade_xml_get_widget (editor->gui, "table-contacts");
- if (table && GTK_IS_TABLE (table)) {
- GtkWidget *entry;
-
- ensure_select_names_contact (editor);
- entry = e_select_names_manager_create_entry (editor->select_names_contacts,
- "contacts");
- gtk_signal_connect(GTK_OBJECT(entry), "changed",
- widget_changed, editor);
- gtk_table_attach_defaults (GTK_TABLE (table), entry, 0, 1, 0, 1);
- gtk_widget_show (entry);
- }
-}
-
-
-typedef struct {
- EContactEditor *ce;
- gboolean should_close;
-} EditorCloseStruct;
-
-static void
-card_added_cb (EBook *book, EBookStatus status, const char *id, EditorCloseStruct *ecs)
-{
- EContactEditor *ce = ecs->ce;
- gboolean should_close = ecs->should_close;
-
- g_free (ecs);
-
- gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[CARD_ADDED],
- status, ce->card);
-
- if (status == E_BOOK_STATUS_SUCCESS) {
- ce->is_new_card = FALSE;
-
- if (should_close)
- close_dialog (ce);
- }
-}
-
-static void
-card_modified_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs)
-{
- EContactEditor *ce = ecs->ce;
- gboolean should_close = ecs->should_close;
-
- g_free (ecs);
-
- gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[CARD_MODIFIED],
- status, ce->card);
-
- if (status == E_BOOK_STATUS_SUCCESS) {
- if (should_close)
- close_dialog (ce);
- }
-}
-
-/* Emits the signal to request saving a card */
-static void
-save_card (EContactEditor *ce, gboolean should_close)
-{
- extract_info (ce);
- e_card_simple_sync_card (ce->simple);
-
- if (ce->book) {
- EditorCloseStruct *ecs = g_new(EditorCloseStruct, 1);
-
- ecs->ce = ce;
- ecs->should_close = should_close;
-
- if (ce->is_new_card)
- e_card_merging_book_add_card (ce->book, ce->card, GTK_SIGNAL_FUNC(card_added_cb), ecs);
- else
- e_card_merging_book_commit_card (ce->book, ce->card, GTK_SIGNAL_FUNC(card_modified_cb), ecs);
- }
-}
-
-/* Closes the dialog box and emits the appropriate signals */
-static void
-close_dialog (EContactEditor *ce)
-{
- g_assert (ce->app != NULL);
-
- gtk_widget_destroy (ce->app);
- ce->app = NULL;
-
- gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[EDITOR_CLOSED]);
-}
-
-/* Menu callbacks */
-
-/* File/Save callback */
-static void
-file_save_cb (GtkWidget *widget, gpointer data)
-{
- EContactEditor *ce;
-
- ce = E_CONTACT_EDITOR (data);
- save_card (ce, FALSE);
-}
-
-/* File/Close callback */
-static void
-file_close_cb (GtkWidget *widget, gpointer data)
-{
- EContactEditor *ce;
-
- ce = E_CONTACT_EDITOR (data);
- close_dialog (ce);
-}
-
-static void
-file_save_as_cb (GtkWidget *widget, gpointer data)
-{
- EContactEditor *ce;
- ECard *card;
-
- ce = E_CONTACT_EDITOR (data);
-
- extract_info (ce);
- e_card_simple_sync_card (ce->simple);
-
- card = ce->card;
- e_contact_save_as("Save as VCard", card);
-}
-
-static void
-file_send_as_cb (GtkWidget *widget, gpointer data)
-{
- EContactEditor *ce;
- ECard *card;
-
- ce = E_CONTACT_EDITOR (data);
-
- extract_info (ce);
- e_card_simple_sync_card (ce->simple);
-
- card = ce->card;
- e_card_send(card, E_CARD_DISPOSITION_AS_ATTACHMENT);
-}
-
-static void
-file_send_to_cb (GtkWidget *widget, gpointer data)
-{
- EContactEditor *ce;
- ECard *card;
-
- ce = E_CONTACT_EDITOR (data);
-
- extract_info (ce);
- e_card_simple_sync_card (ce->simple);
-
- card = ce->card;
- e_card_send(card, E_CARD_DISPOSITION_AS_TO);
-}
-
-gboolean
-e_contact_editor_confirm_delete(GtkWindow *parent)
-{
- GnomeDialog *dialog;
- GladeXML *gui;
- int result;
-
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/e-contact-editor-confirm-delete.glade", NULL);
-
- dialog = GNOME_DIALOG(glade_xml_get_widget(gui, "confirm-dialog"));
-
- gnome_dialog_set_parent(dialog, parent);
-
- result = gnome_dialog_run_and_close(dialog);
-
- gtk_object_unref(GTK_OBJECT(gui));
-
- return !result;
-}
-
-static void
-card_deleted_cb (EBook *book, EBookStatus status, EContactEditor *ce)
-{
- gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[CARD_DELETED],
- status, ce->card);
-}
-
-static void
-delete_cb (GtkWidget *widget, gpointer data)
-{
- EContactEditor *ce = E_CONTACT_EDITOR (data);
- ECard *card = ce->card;
- ECardSimple *simple = ce->simple;
-
- gtk_object_ref(GTK_OBJECT(card));
- gtk_object_ref(GTK_OBJECT(simple));
-
- if (e_contact_editor_confirm_delete(GTK_WINDOW(ce->app))) {
-
- extract_info (ce);
- e_card_simple_sync_card (simple);
-
- if (!ce->is_new_card && ce->book)
- e_book_remove_card (ce->book, card, GTK_SIGNAL_FUNC(card_deleted_cb), ce);
- }
-
- gtk_object_unref(GTK_OBJECT(card));
- gtk_object_unref(GTK_OBJECT(simple));
-}
-
-/* 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);
- e_card_simple_sync_card (ce->simple);
-
- gtk_widget_show(e_contact_print_card_dialog_new(ce->card));
-}
-
-/* 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));
-}
-
-/* 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_card (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),
- BONOBO_UI_UNSAFE_VERB ("ContactEditorPrintEnvelope", print_envelope_cb),
- /* 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/ContactEditorSaveAs", "save-as-16.png"),
- E_PIXMAP ("/commands/ContactEditorPrint", "print.xpm"),
- E_PIXMAP ("/commands/ContactEditorPrintEnvelope", "print.xpm"),
-
- 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, EVOLUTION_DATADIR,
- "evolution-contact-editor.xml",
- "evolution-contact-editor");
-
- 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);
-
- 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 = g_list_reverse(list);
- e_container_change_tab_order(GTK_CONTAINER(container), list);
- g_list_free(list);
-
- list = NULL;
- list = add_to_tab_order(list, gui, "entry-email1");
- list = add_to_tab_order(list, gui, "entry-web");
- list = add_to_tab_order(list, gui, "text-address");
- list = add_to_tab_order(list, gui, "alignment-contacts");
- 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;
-
- 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_card_name_new();
- e_contact_editor->company = g_strdup("");
-
- e_contact_editor->email_choice = 0;
- e_contact_editor->phone_choice[0] = E_CARD_SIMPLE_PHONE_ID_BUSINESS;
- e_contact_editor->phone_choice[1] = E_CARD_SIMPLE_PHONE_ID_HOME;
- e_contact_editor->phone_choice[2] = E_CARD_SIMPLE_PHONE_ID_BUSINESS_FAX;
- e_contact_editor->phone_choice[3] = E_CARD_SIMPLE_PHONE_ID_MOBILE;
- e_contact_editor->address_choice = 0;
-
- e_contact_editor->arbitrary_fields = NULL;
-
- e_contact_editor->simple = e_card_simple_new(NULL);
-
- e_contact_editor->card = NULL;
- e_contact_editor->changed = FALSE;
-
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/contact-editor.glade", NULL);
- e_contact_editor->gui = gui;
-
- setup_tab_order(gui);
-
- e_contact_editor->app = glade_xml_get_widget (gui, "contact editor");
-
- e_container_foreach_leaf (GTK_CONTAINER (e_contact_editor->app),
- (GtkCallback) add_field_callback,
- e_contact_editor);
-
- _replace_buttons(e_contact_editor);
- add_lists (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))
- gtk_signal_connect(GTK_OBJECT(wants_html), "toggled",
- wants_html_changed, e_contact_editor);
-
- widget = glade_xml_get_widget(e_contact_editor->gui, "button-fullname");
- if (widget && GTK_IS_BUTTON(widget))
- gtk_signal_connect(GTK_OBJECT(widget), "clicked",
- full_name_clicked, e_contact_editor);
-
- widget = glade_xml_get_widget(e_contact_editor->gui, "button-fulladdr");
- if (widget && GTK_IS_BUTTON(widget))
- gtk_signal_connect(GTK_OBJECT(widget), "clicked",
- full_addr_clicked, e_contact_editor);
-
- widget = glade_xml_get_widget(e_contact_editor->gui, "button-categories");
- if (widget && GTK_IS_BUTTON(widget))
- gtk_signal_connect(GTK_OBJECT(widget), "clicked",
- categories_clicked, e_contact_editor);
-
- widget = glade_xml_get_widget(e_contact_editor->gui, "button-contacts");
- if (widget && GTK_IS_BUTTON(widget))
- gtk_signal_connect(GTK_OBJECT(widget), "clicked",
- contacts_clicked, e_contact_editor);
-
-
- /* Construct the app */
- bonobo_win = bonobo_window_new ("contact-editor-dialog", "Contact Editor");
-
- /* FIXME: The sucking bit */
- {
- GtkWidget *contents;
-
- contents = gnome_dock_get_client_area (
- GNOME_DOCK (GNOME_APP (e_contact_editor->app)->dock));
- if (!contents) {
- g_message ("contact_editor_construct(): Could not get contents");
- return;
- }
- gtk_widget_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_ui_container_new ();
- bonobo_ui_container_set_win (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)));
-
- create_ui (e_contact_editor);
-
- /* Connect to the deletion of the dialog */
-
- gtk_signal_connect (GTK_OBJECT (e_contact_editor->app), "delete_event",
- GTK_SIGNAL_FUNC (app_delete_event_cb), e_contact_editor);
-}
-
-void
-e_contact_editor_destroy (GtkObject *object) {
- EContactEditor *e_contact_editor = E_CONTACT_EDITOR(object);
-
- if (e_contact_editor->writable_fields) {
- gtk_object_unref(GTK_OBJECT(e_contact_editor->writable_fields));
- }
- 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);
- }
- if (e_contact_editor->email_info) {
- g_free(e_contact_editor->email_info);
- }
- if (e_contact_editor->email_popup) {
- gtk_widget_unref(e_contact_editor->email_popup);
- }
-
- 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);
- }
- if (e_contact_editor->phone_info) {
- g_free(e_contact_editor->phone_info);
- }
- if (e_contact_editor->phone_popup) {
- gtk_widget_unref(e_contact_editor->phone_popup);
- }
-
- 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);
- }
- if (e_contact_editor->address_info) {
- g_free(e_contact_editor->address_info);
- }
- if (e_contact_editor->address_popup) {
- gtk_widget_unref(e_contact_editor->address_popup);
- }
-
- if (e_contact_editor->simple)
- gtk_object_unref(GTK_OBJECT(e_contact_editor->simple));
-
- if (e_contact_editor->book)
- gtk_object_unref(GTK_OBJECT(e_contact_editor->book));
-
- if (e_contact_editor->name)
- e_card_name_free(e_contact_editor->name);
-
- g_free (e_contact_editor->company);
-
- gtk_object_unref(GTK_OBJECT(e_contact_editor->gui));
-}
-
-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_card) ? "1" : "0", NULL);
-}
-
-static void
-supported_fields_cb (EBook *book, EBookStatus status,
- EList *fields, EContactEditor *ce)
-{
- gtk_object_set (GTK_OBJECT (ce),
- "writable_fields", fields,
- NULL);
-
- e_contact_editor_show (ce);
-
- command_state_changed (ce);
-}
-
-EContactEditor *
-e_contact_editor_new (EBook *book,
- ECard *card,
- gboolean is_new_card,
- gboolean editable)
-{
- EContactEditor *ce;
-
- ce = E_CONTACT_EDITOR (gtk_type_new (E_CONTACT_EDITOR_TYPE));
-
- gtk_object_set (GTK_OBJECT (ce),
- "book", book,
- "card", card,
- "is_new_card", is_new_card,
- "editable", editable,
- NULL);
-
- if (book)
- e_book_get_supported_fields (book, (EBookFieldsCallback)supported_fields_cb, ce);
-
- return ce;
-}
-
-static void
-e_contact_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- EContactEditor *editor;
-
- editor = E_CONTACT_EDITOR (o);
-
- switch (arg_id){
- case ARG_BOOK:
- if (editor->book)
- gtk_object_unref(GTK_OBJECT(editor->book));
- editor->book = E_BOOK(GTK_VALUE_OBJECT (*arg));
- gtk_object_ref (GTK_OBJECT (editor->book));
- /* XXX more here about editable/etc. */
- break;
- case ARG_CARD:
- if (editor->card)
- gtk_object_unref(GTK_OBJECT(editor->card));
- editor->card = e_card_duplicate(E_CARD(GTK_VALUE_OBJECT (*arg)));
- gtk_object_set(GTK_OBJECT(editor->simple),
- "card", editor->card,
- NULL);
- fill_in_info(editor);
- editor->changed = FALSE;
- break;
-
- case ARG_IS_NEW_CARD:
- editor->is_new_card = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
- break;
-
- case ARG_EDITABLE: {
- gboolean new_value = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
- gboolean changed = (editor->editable != new_value);
-
- editor->editable = new_value;
-
- if (changed) {
- set_editable (editor);
- command_state_changed (editor);
- }
- break;
- }
- case ARG_WRITABLE_FIELDS:
- if (editor->writable_fields)
- gtk_object_unref(GTK_OBJECT(editor->writable_fields));
- editor->writable_fields = GTK_VALUE_POINTER (*arg);
- if (editor->writable_fields)
- gtk_object_ref (GTK_OBJECT (editor->writable_fields));
- else
- editor->writable_fields = e_list_new(NULL, NULL, NULL);
- enable_writable_fields (editor);
- break;
- }
-}
-
-static void
-e_contact_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EContactEditor *e_contact_editor;
-
- e_contact_editor = E_CONTACT_EDITOR (object);
-
- switch (arg_id) {
- case ARG_BOOK:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_contact_editor->book);
- break;
-
- case ARG_CARD:
- e_card_simple_sync_card(e_contact_editor->simple);
- extract_info(e_contact_editor);
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_contact_editor->card);
- break;
-
- case ARG_IS_NEW_CARD:
- GTK_VALUE_BOOL (*arg) = e_contact_editor->is_new_card ? TRUE : FALSE;
- break;
-
- case ARG_EDITABLE:
- GTK_VALUE_BOOL (*arg) = e_contact_editor->editable ? TRUE : FALSE;
- break;
-
- case ARG_WRITABLE_FIELDS:
- if (e_contact_editor->writable_fields)
- GTK_VALUE_POINTER (*arg) = e_list_duplicate (e_contact_editor->writable_fields);
- else
- GTK_VALUE_POINTER (*arg) = NULL;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-_popup_position(GtkMenu *menu,
- gint *x,
- gint *y,
- gpointer data)
-{
- GtkWidget *button = GTK_WIDGET(data);
- GtkRequisition request;
- int mh, mw;
- gdk_window_get_origin (button->window, x, y);
- *x += button->allocation.width;
- *y += button->allocation.height;
-
- 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;
-}
-
-static gint
-_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor, GtkWidget *popup, GList **list, GnomeUIInfo **info, gchar *label, gchar *entry, gchar *dialog_title)
-{
- gint menu_item;
- gtk_signal_emit_stop_by_name(GTK_OBJECT(widget), "button_press_event");
- gtk_widget_realize(popup);
- menu_item = gnome_popup_menu_do_popup_modal(popup, _popup_position, widget, button, editor);
- if ( menu_item != -1 ) {
-#if 0
- if (menu_item == g_list_length (*list)) {
- e_contact_editor_build_dialog(editor, entry, label, dialog_title, list, info);
- } else {
-#endif
- GtkWidget *label_widget = glade_xml_get_widget(editor->gui, label);
- if (label_widget && GTK_IS_LABEL(label_widget)) {
- gtk_object_set(GTK_OBJECT(label_widget),
- "label", _(g_list_nth_data(*list, menu_item)),
- NULL);
- }
-#if 0
- }
-#endif
- }
- 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)
-{
- int i;
-
- if (editor->phone_list == NULL) {
- static char *info[] = {
- N_("Assistant"),
- N_("Business"),
- N_("Business 2"),
- N_("Business Fax"),
- N_("Callback"),
- N_("Car"),
- N_("Company"),
- N_("Home"),
- N_("Home 2"),
- N_("Home Fax"),
- N_("ISDN"),
- N_("Mobile"),
- N_("Other"),
- N_("Other Fax"),
- N_("Pager"),
- N_("Primary"),
- N_("Radio"),
- N_("Telex"),
- N_("TTY/TDD")
- };
-
- for (i = 0; i < sizeof(info) / sizeof(info[0]); i++) {
- editor->phone_list = g_list_append(editor->phone_list, g_strdup(info[i]));
- }
- }
- if (editor->phone_info == NULL) {
- e_contact_editor_build_ui_info(editor->phone_list, &editor->phone_info);
-
- if ( editor->phone_popup )
- gtk_widget_unref(editor->phone_popup);
-
- editor->phone_popup = gnome_popup_menu_new(editor->phone_info);
- }
-}
-
-static void
-e_contact_editor_build_email_ui (EContactEditor *editor)
-{
- int i;
-
- if (editor->email_list == NULL) {
- static char *info[] = {
- N_("Primary Email"),
- N_("Email 2"),
- N_("Email 3")
- };
-
- for (i = 0; i < sizeof(info) / sizeof(info[0]); i++) {
- editor->email_list = g_list_append(editor->email_list, g_strdup(info[i]));
- }
- }
- if (editor->email_info == NULL) {
- e_contact_editor_build_ui_info(editor->email_list, &editor->email_info);
-
- if ( editor->email_popup )
- gtk_widget_unref(editor->email_popup);
-
- editor->email_popup = gnome_popup_menu_new(editor->email_info);
- }
-}
-
-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 )
- gtk_widget_unref(editor->address_popup);
-
- editor->address_popup = gnome_popup_menu_new(editor->address_info);
- }
-}
-#if 0
-static void
-_dialog_clicked(GtkWidget *dialog, gint button, EContactEditor *editor)
-{
- GtkWidget *label = gtk_object_get_data(GTK_OBJECT(dialog),
- "e_contact_editor_label");
-
- GtkWidget *dialog_entry = gtk_object_get_data(GTK_OBJECT(dialog),
- "e_contact_editor_dialog_entry");
-
- GList **list = gtk_object_get_data(GTK_OBJECT(dialog),
- "e_contact_editor_list");
- GList **info = gtk_object_get_data(GTK_OBJECT(dialog),
- "e_contact_editor_info");
- switch (button) {
- case 0:
- if (label && GTK_IS_LABEL(label)) {
- gtk_object_set(GTK_OBJECT(label),
- "label", gtk_entry_get_text(GTK_ENTRY(dialog_entry)),
- NULL);
- *list = g_list_append(*list, e_utf8_gtk_entry_get_text(GTK_ENTRY(dialog_entry)));
- g_free(*info);
- *info = NULL;
- }
- break;
- }
- gnome_dialog_close(GNOME_DIALOG(dialog));
-}
-
-static void
-_dialog_destroy(EContactEditor *editor, GtkWidget *dialog)
-{
- gnome_dialog_close(GNOME_DIALOG(dialog));
-}
-
-static GtkWidget *
-e_contact_editor_build_dialog(EContactEditor *editor, gchar *entry_id, gchar *label_id, gchar *title, GList **list, GnomeUIInfo **info)
-{
- GtkWidget *dialog_entry = gtk_entry_new();
- GtkWidget *entry = glade_xml_get_widget(editor->gui, entry_id);
- GtkWidget *label = glade_xml_get_widget(editor->gui, label_id);
-
- GtkWidget *dialog = gnome_dialog_new(title,
- NULL);
-
- gtk_container_add(GTK_CONTAINER(GNOME_DIALOG(dialog)->vbox),
- gtk_widget_new (gtk_frame_get_type(),
- "border_width", 4,
- "label", title,
- "child", gtk_widget_new(gtk_alignment_get_type(),
- "child", dialog_entry,
- "xalign", .5,
- "yalign", .5,
- "xscale", 1.0,
- "yscale", 1.0,
- "border_width", 9,
- NULL),
- NULL));
-
- gnome_dialog_append_button_with_pixmap(GNOME_DIALOG(dialog),
- "Add",
- GNOME_STOCK_PIXMAP_ADD);
- gnome_dialog_append_button(GNOME_DIALOG(dialog), GNOME_STOCK_BUTTON_CANCEL);
- gnome_dialog_set_default(GNOME_DIALOG(dialog), 0);
-
- gtk_signal_connect(GTK_OBJECT(dialog), "clicked",
- _dialog_clicked, editor);
- gtk_signal_connect_while_alive(GTK_OBJECT(editor), "destroy",
- _dialog_destroy, GTK_OBJECT(dialog), GTK_OBJECT(dialog));
-
- gtk_object_set_data(GTK_OBJECT(dialog),
- "e_contact_editor_entry", entry);
- gtk_object_set_data(GTK_OBJECT(dialog),
- "e_contact_editor_label", label);
- gtk_object_set_data(GTK_OBJECT(dialog),
- "e_contact_editor_dialog_entry", dialog_entry);
- gtk_object_set_data(GTK_OBJECT(dialog),
- "e_contact_editor_list", list);
- gtk_object_set_data(GTK_OBJECT(dialog),
- "e_contact_editor_info", info);
-
- gtk_widget_show_all(dialog);
- return dialog;
-}
-#endif
-
-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 < E_CARD_SIMPLE_PHONE_ID_LAST; i++) {
- const ECardPhone *phone = e_card_simple_get_phone(editor->simple, i);
- gboolean checked;
- checked = phone && phone->number && *phone->number;
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(editor->phone_info[i].widget),
- checked);
- gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(editor->phone_info[i].widget),
- TRUE);
- }
-
- result = _arrow_pressed (widget, button, editor, editor->phone_popup, &editor->phone_list, &editor->phone_info, label, entry, "Add new phone number type");
-
- if (result != -1) {
- editor->phone_choice[which - 1] = result;
- set_fields(editor);
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, label), TRUE);
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, entry), 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 < E_CARD_SIMPLE_EMAIL_ID_LAST; i++) {
- const char *string = e_card_simple_get_email(editor->simple, i);
- gboolean checked;
- checked = string && *string;
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(editor->email_info[i].widget),
- checked);
- gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(editor->email_info[i].widget),
- TRUE);
- }
-
- result = _arrow_pressed (widget, button, editor, editor->email_popup, &editor->email_list, &editor->email_info, "label-email1", "entry-email1", "Add new Email type");
-
- if (result != -1) {
- editor->email_choice = result;
- set_fields(editor);
-
- /* make sure the buttons/entry is/are sensitive */
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "label-email1"), TRUE);
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "entry-email1"), editor->editable);
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "checkbutton-htmlmail"), editor->editable);
- }
-}
-
-static void
-_address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor)
-{
- 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);
- gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(editor->address_info[i].widget),
- TRUE);
- }
-
- result = _arrow_pressed (widget, button, editor, editor->address_popup, &editor->address_list, &editor->address_info, "label-address", "text-address", "Add new Address type");
-
- if (result != -1) {
- set_address_field(editor, result);
-
- /* make sure the buttons/entry is/are sensitive */
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "label-address"), TRUE);
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "button-fulladdr"), editor->editable);
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "text-address"), editor->editable);
- }
-}
-
-static void
-set_field(GtkEntry *entry, const char *string)
-{
- char *oldstring = e_utf8_gtk_entry_get_text(entry);
- if (!string)
- string = "";
- if (strcmp(string, oldstring))
- e_utf8_gtk_entry_set_text(entry, string);
- g_free (oldstring);
-}
-
-static void
-set_phone_field(GtkWidget *entry, const ECardPhone *phone)
-{
- set_field(GTK_ENTRY(entry), phone ? phone->number : "");
-}
-
-static void
-set_fields(EContactEditor *editor)
-{
- GtkWidget *entry;
-
- entry = glade_xml_get_widget(editor->gui, "entry-phone1");
- if (entry && GTK_IS_ENTRY(entry))
- set_phone_field(entry, e_card_simple_get_phone(editor->simple, editor->phone_choice[0]));
-
- entry = glade_xml_get_widget(editor->gui, "entry-phone2");
- if (entry && GTK_IS_ENTRY(entry))
- set_phone_field(entry, e_card_simple_get_phone(editor->simple, editor->phone_choice[1]));
-
- entry = glade_xml_get_widget(editor->gui, "entry-phone3");
- if (entry && GTK_IS_ENTRY(entry))
- set_phone_field(entry, e_card_simple_get_phone(editor->simple, editor->phone_choice[2]));
-
- entry = glade_xml_get_widget(editor->gui, "entry-phone4");
- if (entry && GTK_IS_ENTRY(entry))
- set_phone_field(entry, e_card_simple_get_phone(editor->simple, editor->phone_choice[3]));
-
- entry = glade_xml_get_widget(editor->gui, "entry-email1");
- if (entry && GTK_IS_ENTRY(entry))
- set_field(GTK_ENTRY(entry), e_card_simple_get_email(editor->simple, editor->email_choice));
-
- set_address_field(editor, -1);
-}
-
-static void
-set_address_field(EContactEditor *editor, int result)
-{
- GtkWidget *widget;
-
- widget = glade_xml_get_widget(editor->gui, "text-address");
-
- if (widget && GTK_IS_TEXT(widget)) {
- int position;
- GtkEditable *editable;
- const ECardAddrLabel *address;
-
- if (result == -1)
- result = editor->address_choice;
- editor->address_choice = -1;
-
- position = 0;
- editable = GTK_EDITABLE(widget);
- gtk_editable_delete_text(editable, 0, -1);
- address = e_card_simple_get_address(editor->simple, result);
- if (address && address->data) {
- gchar *u = e_utf8_to_gtk_string ((GtkWidget *) editable, address->data);
- gtk_editable_insert_text(editable, u, strlen(u), &position);
- g_free (u);
- }
-
- editor->address_choice = result;
- }
-}
-
-static void
-add_field_callback(GtkWidget *widget, EContactEditor *editor)
-{
- const char *name;
- int i;
- static const char *builtins[] = {
- "entry-fullname",
- "entry-web",
- "entry-company",
- "entry-department",
- "entry-office",
- "entry-jobtitle",
- "entry-profession",
- "entry-manager",
- "entry-assistant",
- "entry-nickname",
- "entry-spouse",
- "text-comments",
- "entry-categories",
- "entry-contacts",
- "entry-file-as",
- "dateedit-anniversary",
- "dateedit-birthday",
- "entry-phone1",
- "entry-phone2",
- "entry-phone3",
- "entry-phone4",
- "entry-email1",
- "text-address",
- "checkbutton-mailingaddress",
- "checkbutton-htmlmail",
- NULL
- };
- name = glade_get_widget_name(widget);
- if (name) {
- for (i = 0; builtins[i]; i++) {
- if (!strcmp(name, builtins[i]))
- return;
- }
- if (GTK_IS_ENTRY(widget) || GTK_IS_TEXT(widget)) {
- editor->arbitrary_fields = g_list_prepend(editor->arbitrary_fields, g_strdup(name));
- }
- }
-}
-
-static struct {
- char *id;
- char *key;
-} field_mapping [] = {
- { "entry-fullname", "full_name" },
- { "entry-web", "url" },
- { "entry-company", "org" },
- { "entry-department", "org_unit" },
- { "entry-office", "office" },
- { "entry-jobtitle", "title" },
- { "entry-profession", "role" },
- { "entry-manager", "manager" },
- { "entry-assistant", "assistant" },
- { "entry-nickname", "nickname" },
- { "entry-spouse", "spouse" },
- { "text-comments", "note" },
- { "entry-categories", "categories" },
-};
-
-static void
-fill_in_field(EContactEditor *editor, char *id, char *value)
-{
- GtkWidget *widget = glade_xml_get_widget(editor->gui, id);
- if (widget && GTK_IS_EDITABLE(widget)) {
- int position = 0;
- GtkEditable *editable = GTK_EDITABLE(widget);
- gtk_editable_delete_text(editable, 0, -1);
- if (value) {
- gchar *u = e_utf8_to_gtk_string ((GtkWidget *) editable, value);
- gtk_editable_insert_text(editable, u, strlen(u), &position);
- g_free (u);
- }
- }
-}
-
-static void
-fill_in_card_field(EContactEditor *editor, ECard *card, char *id, char *key)
-{
- char *string;
- gtk_object_get(GTK_OBJECT(card),
- key, &string,
- NULL);
- fill_in_field(editor, id, string);
-}
-
-static void
-fill_in_single_field(EContactEditor *editor, char *name)
-{
- ECardSimple *simple = editor->simple;
- GtkWidget *widget = glade_xml_get_widget(editor->gui, name);
- if (widget && GTK_IS_EDITABLE(widget)) {
- int position = 0;
- GtkEditable *editable = GTK_EDITABLE(widget);
- const ECardArbitrary *arbitrary;
-
- gtk_editable_delete_text(editable, 0, -1);
- arbitrary = e_card_simple_get_arbitrary(simple,
- name);
- if (arbitrary && arbitrary->value) {
- gchar *u = e_utf8_to_gtk_string ((GtkWidget *) editable, arbitrary->value);
- gtk_editable_insert_text(editable, u, strlen(u), &position);
- g_free (u);
- }
- }
-}
-
-static void
-disable_widget_foreach (char *key, GtkWidget *widget, gpointer closure)
-{
- gtk_widget_set_sensitive (widget, FALSE);
-}
-
-static struct {
- char *widget_name;
- ECardSimpleField field_id;
- gboolean desensitize_for_read_only;
-} widget_field_mappings[] = {
- { "entry-web", E_CARD_SIMPLE_FIELD_URL, TRUE },
- { "accellabel-web", E_CARD_SIMPLE_FIELD_URL },
-
- { "entry-jobtitle", E_CARD_SIMPLE_FIELD_TITLE, TRUE },
- { "label-jobtitle", E_CARD_SIMPLE_FIELD_TITLE },
-
- { "entry-company", E_CARD_SIMPLE_FIELD_ORG, TRUE },
- { "label-company", E_CARD_SIMPLE_FIELD_ORG },
-
- { "combo-file-as", E_CARD_SIMPLE_FIELD_FILE_AS, TRUE },
- { "entry-file-as", E_CARD_SIMPLE_FIELD_FILE_AS, TRUE },
- { "accellabel-fileas", E_CARD_SIMPLE_FIELD_FILE_AS },
-
- { "label-department", E_CARD_SIMPLE_FIELD_ORG_UNIT },
- { "entry-department", E_CARD_SIMPLE_FIELD_ORG_UNIT, TRUE },
-
- { "label-office", E_CARD_SIMPLE_FIELD_OFFICE },
- { "entry-office", E_CARD_SIMPLE_FIELD_OFFICE, TRUE },
-
- { "label-profession", E_CARD_SIMPLE_FIELD_ROLE },
- { "entry-profession", E_CARD_SIMPLE_FIELD_ROLE, TRUE },
-
- { "label-manager", E_CARD_SIMPLE_FIELD_MANAGER },
- { "entry-manager", E_CARD_SIMPLE_FIELD_MANAGER, TRUE },
-
- { "label-assistant", E_CARD_SIMPLE_FIELD_ASSISTANT },
- { "entry-assistant", E_CARD_SIMPLE_FIELD_ASSISTANT, TRUE },
-
- { "label-nickname", E_CARD_SIMPLE_FIELD_NICKNAME },
- { "entry-nickname", E_CARD_SIMPLE_FIELD_NICKNAME, TRUE },
-
- { "label-spouse", E_CARD_SIMPLE_FIELD_SPOUSE },
- { "entry-spouse", E_CARD_SIMPLE_FIELD_SPOUSE, TRUE },
-
- { "label-birthday", E_CARD_SIMPLE_FIELD_BIRTH_DATE },
- { "dateedit-birthday", E_CARD_SIMPLE_FIELD_BIRTH_DATE, TRUE },
-
- { "label-anniversary", E_CARD_SIMPLE_FIELD_ANNIVERSARY },
- { "dateedit-anniversary", E_CARD_SIMPLE_FIELD_ANNIVERSARY, TRUE },
-
- { "label-comments", E_CARD_SIMPLE_FIELD_NOTE },
- { "text-comments", E_CARD_SIMPLE_FIELD_NOTE, TRUE },
-
- { "button-fullname", E_CARD_SIMPLE_FIELD_FULL_NAME },
- { "entry-fullname", E_CARD_SIMPLE_FIELD_FULL_NAME, TRUE },
-
- { "button-categories", E_CARD_SIMPLE_FIELD_CATEGORIES, TRUE },
- { "entry-categories", E_CARD_SIMPLE_FIELD_CATEGORIES, 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;
- ECardSimple *simple;
- ECard *card;
- char *widget_name;
-
- if (!fields)
- return;
-
- card = e_card_new ("");
- simple = e_card_simple_new (card);
-
- 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 < E_CARD_SIMPLE_PHONE_ID_LAST; i ++)
- g_hash_table_insert (dropdown_hash,
- (char*)e_card_simple_get_ecard_field(simple, e_card_simple_map_phone_to_field (i)),
- editor->phone_info[i].widget);
- e_contact_editor_build_email_ui (editor);
- for (i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i ++)
- g_hash_table_insert (dropdown_hash,
- (char*)e_card_simple_get_ecard_field(simple, e_card_simple_map_email_to_field (i)),
- editor->email_info[i].widget);
- 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);
-
- /* 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 adress button */
- for (i = 0; i < 4; i ++) {
- widget_name = g_strdup_printf ("label-phone%d", i+1);
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, widget_name), FALSE);
- g_free (widget_name);
- widget_name = g_strdup_printf ("entry-phone%d", i+1);
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, widget_name), FALSE);
- g_free (widget_name);
- }
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "label-email1"), FALSE);
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "entry-email1"), FALSE);
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "checkbutton-htmlmail"), FALSE);
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "label-address"), FALSE);
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "button-fulladdr"), FALSE);
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "text-address"), 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);
-
- if (widget) {
- gtk_widget_set_sensitive (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);
- }
-
- /* 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_card_simple_get_ecard_field (simple, e_card_simple_map_email_to_field(editor->email_choice)))) {
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "label-email1"), TRUE);
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "entry-email1"), editor->editable);
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "checkbutton-htmlmail"), TRUE);
- }
- else if (!strcmp (field, e_card_simple_get_ecard_field (simple, e_card_simple_map_address_to_field(editor->address_choice)))) {
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "label-address"), TRUE);
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "button-fulladdr"), editor->editable);
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, "text-address"), editor->editable);
- }
- else for (i = 0; i < 4; i ++) {
- if (!strcmp (field, e_card_simple_get_ecard_field (simple, e_card_simple_map_phone_to_field(editor->phone_choice[i])))) {
- widget_name = g_strdup_printf ("label-phone%d", i+1);
- gtk_widget_set_sensitive (glade_xml_get_widget (editor->gui, widget_name), TRUE);
- g_free (widget_name);
- widget_name = g_strdup_printf ("entry-phone%d", i+1);
- gtk_widget_set_sensitive (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 = g_hash_table_lookup (supported_hash,
- e_card_simple_get_ecard_field (simple,
- widget_field_mappings[i].field_id)) != NULL;
- gtk_widget_set_sensitive (glade_xml_get_widget(editor->gui,
- widget_field_mappings[i].widget_name), enabled);
- }
-
- g_hash_table_destroy (dropdown_hash);
- g_hash_table_destroy (supported_hash);
- gtk_object_unref (GTK_OBJECT(simple));
- gtk_object_unref (GTK_OBJECT(card));
-}
-
-static void
-set_editable (EContactEditor *editor)
-{
- int i;
- char *label, *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)
- gtk_widget_set_sensitive (glade_xml_get_widget(editor->gui,
- widget_field_mappings[i].widget_name), editor->editable);
- }
-
- /* handle the phone dropdown entries */
- for (i = 0; i < 4; i ++) {
- label = g_strdup_printf ("label-phone%d", i+1);
- entry = g_strdup_printf ("entry-phone%d", i+1);
-
- if (GTK_WIDGET_IS_SENSITIVE (glade_xml_get_widget (editor->gui, label)))
- gtk_widget_set_sensitive (glade_xml_get_widget(editor->gui,
- entry), editor->editable);
-
- g_free (label);
- g_free (entry);
- }
-
- /* handle the email dropdown entry */
- label = "label-email1";
- entry = "entry-email1";
- if (GTK_WIDGET_IS_SENSITIVE (glade_xml_get_widget (editor->gui, label))) {
- gtk_widget_set_sensitive (glade_xml_get_widget(editor->gui,
- entry), editor->editable);
- gtk_widget_set_sensitive (glade_xml_get_widget(editor->gui,
- "checkbutton-htmlmail"), editor->editable);
- }
-
- /* handle the address dropdown entry */
- label = "label-address";
- entry = "text-address";
- if (GTK_WIDGET_IS_SENSITIVE (glade_xml_get_widget (editor->gui, label)))
- gtk_widget_set_sensitive (glade_xml_get_widget(editor->gui,
- entry), editor->editable);
-}
-
-static void
-fill_in_info(EContactEditor *editor)
-{
- ECard *card = editor->card;
- if (card) {
- char *file_as;
- char *related_contacts;
- ECardName *name;
- const ECardDate *anniversary;
- const ECardDate *bday;
- int i;
- GtkWidget *widget;
- GList *list;
- gboolean wants_html, wants_html_set;
-
- gtk_object_get(GTK_OBJECT(card),
- "file_as", &file_as,
- "related_contacts", &related_contacts,
- "name", &name,
- "anniversary", &anniversary,
- "birth_date", &bday,
- "wants_html_set", &wants_html_set,
- "wants_html", &wants_html,
- NULL);
-
- for (i = 0; i < sizeof(field_mapping) / sizeof(field_mapping[0]); i++) {
- fill_in_card_field(editor, card, field_mapping[i].id, field_mapping[i].key);
- }
-
- for (list = editor->arbitrary_fields; list; list = list->next) {
- fill_in_single_field(editor, list->data);
- }
-
- if (wants_html_set) {
- GtkWidget *widget = glade_xml_get_widget(editor->gui, "checkbutton-htmlmail");
- if (widget && GTK_IS_CHECK_BUTTON(widget)) {
- gtk_object_set(GTK_OBJECT(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);
-
- e_card_name_free(editor->name);
- editor->name = e_card_name_copy(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);
- }
-
- if (editor->select_names_contacts && related_contacts && *related_contacts) {
- ESelectNamesModel *model = e_select_names_manager_get_source (editor->select_names_contacts,
- "contacts");
- e_select_names_model_import_destinationv (model, related_contacts);
- }
-
- set_fields(editor);
- }
-}
-
-static void
-extract_field(EContactEditor *editor, ECard *card, char *editable_id, char *key)
-{
- GtkWidget *widget = glade_xml_get_widget(editor->gui, editable_id);
- if (widget && GTK_IS_EDITABLE(widget)) {
- GtkEditable *editable = GTK_EDITABLE(widget);
- char *string = e_utf8_gtk_editable_get_chars(editable, 0, -1);
-
- if (string && *string)
- gtk_object_set(GTK_OBJECT(card),
- key, string,
- NULL);
- else
- gtk_object_set(GTK_OBJECT(card),
- key, NULL,
- NULL);
-
- if (string) g_free(string);
- }
-}
-
-static void
-extract_single_field(EContactEditor *editor, char *name)
-{
- GtkWidget *widget = glade_xml_get_widget(editor->gui, name);
- ECardSimple *simple = editor->simple;
- if (widget && GTK_IS_EDITABLE(widget)) {
- GtkEditable *editable = GTK_EDITABLE(widget);
- char *string = e_utf8_gtk_editable_get_chars(editable, 0, -1);
-
- if (string && *string)
- e_card_simple_set_arbitrary(simple,
- name,
- NULL,
- string);
- else
- e_card_simple_set_arbitrary(simple,
- name,
- NULL,
- NULL);
- if (string) g_free(string);
- }
-}
-
-static void
-extract_info(EContactEditor *editor)
-{
- ECard *card = editor->card;
- if (card) {
- ECardDate anniversary;
- ECardDate bday;
- int i;
- GtkWidget *widget;
- GList *list;
-
- widget = glade_xml_get_widget(editor->gui, "entry-file-as");
- if (widget && GTK_IS_EDITABLE(widget)) {
- GtkEditable *editable = GTK_EDITABLE(widget);
- char *string = e_utf8_gtk_editable_get_chars(editable, 0, -1);
-
- if (string && *string)
- gtk_object_set(GTK_OBJECT(card),
- "file_as", string,
- NULL);
-
- if (string) g_free(string);
- }
-
- for (i = 0; i < sizeof(field_mapping) / sizeof(field_mapping[0]); i++) {
- extract_field(editor, card, field_mapping[i].id, field_mapping[i].key);
- }
-
- for (list = editor->arbitrary_fields; list; list = list->next) {
- extract_single_field(editor, list->data);
- }
-
- if (editor->select_names_contacts) {
- ESelectNamesModel *model = e_select_names_manager_get_source (editor->select_names_contacts,
- "contacts");
- char *string = e_select_names_model_export_destinationv (model);
- if (string && *string)
- gtk_object_set (GTK_OBJECT (card),
- "related_contacts", string,
- NULL);
- else
- gtk_object_set (GTK_OBJECT (card),
- "related_contacts", NULL,
- NULL);
- g_free (string);
- }
-
- if (editor->name)
- gtk_object_set(GTK_OBJECT(card),
- "name", editor->name,
- NULL);
-
- 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);
- gtk_object_set(GTK_OBJECT(card),
- "anniversary", &anniversary,
- NULL);
- } else
- gtk_object_set(GTK_OBJECT(card),
- "anniversary", NULL,
- 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);
- gtk_object_set(GTK_OBJECT(card),
- "birth_date", &bday,
- NULL);
- } else
- gtk_object_set(GTK_OBJECT(card),
- "birth_date", NULL,
- NULL);
- }
- }
-}
-
-/**
- * e_contact_editor_raise:
- * @config: The %EContactEditor object.
- *
- * Raises the dialog associated with this %EContactEditor object.
- */
-void
-e_contact_editor_raise (EContactEditor *editor)
-{
- 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);
- return widget;
-}
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 5f9ac77435..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 <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <libgnomeui/gnome-app.h>
-#include <libgnomeui/gnome-app-helper.h>
-#include <bonobo/bonobo-ui-component.h>
-#include <glade/glade.h>
-
-#include "addressbook/gui/component/select-names/e-select-names-manager.h"
-#include "addressbook/backend/ebook/e-book.h"
-#include "addressbook/backend/ebook/e-card.h"
-#include "addressbook/backend/ebook/e-card-simple.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* 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_CONTACT_EDITOR_TYPE (e_contact_editor_get_type ())
-#define E_CONTACT_EDITOR(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_TYPE, EContactEditor))
-#define E_CONTACT_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_TYPE, EContactEditorClass))
-#define E_IS_CONTACT_EDITOR(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_TYPE))
-#define E_IS_CONTACT_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_TYPE))
-
-
-typedef struct _EContactEditor EContactEditor;
-typedef struct _EContactEditorClass EContactEditorClass;
-
-struct _EContactEditor
-{
- GtkObject object;
-
- /* item specific fields */
- EBook *book;
- ECard *card;
- ECardSimple *simple;
-
- /* 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;
-
- ESelectNamesManager *select_names_contacts;
-
- ECardName *name;
- char *company;
-
- ECardSimpleEmailId email_choice;
- ECardSimplePhoneId phone_choice[4];
- ECardSimpleAddressId address_choice;
-
- GList *arbitrary_fields;
-
- /* Whether we are editing a new card or an existing one */
- guint is_new_card : 1;
-
- /* Whether the card has been changed since bringing up the contact editor */
- guint changed : 1;
-
- /* Whether the contact editor will accept modifications */
- guint editable : 1;
-
- EList *writable_fields;
-};
-
-struct _EContactEditorClass
-{
- GtkObjectClass parent_class;
-
- /* Notification signals */
-
- void (* card_added) (EContactEditor *ce, EBookStatus status, ECard *card);
- void (* card_modified) (EContactEditor *ce, EBookStatus status, ECard *card);
- void (* card_deleted) (EContactEditor *ce, EBookStatus status, ECard *card);
- void (* editor_closed) (EContactEditor *ce);
-};
-
-EContactEditor *e_contact_editor_new (EBook *book,
- ECard *card,
- gboolean is_new_card,
- gboolean editable);
-GtkType 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);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#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 096f038dd7..0000000000
--- a/addressbook/gui/contact-editor/e-contact-quick-add.c
+++ /dev/null
@@ -1,416 +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 <trow@ximian.com>
- */
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <config.h>
-#include <ctype.h>
-#include <glib.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtktable.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-app.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-stock.h>
-#include <gal/widgets/e-unicode.h>
-#include <addressbook/backend/ebook/e-book.h>
-#include <addressbook/backend/ebook/e-book-util.h>
-#include <addressbook/backend/ebook/e-card.h>
-#include "e-contact-editor.h"
-#include "e-contact-quick-add.h"
-#include "e-card-merging.h"
-
-typedef struct _QuickAdd QuickAdd;
-struct _QuickAdd {
- gchar *name;
- gchar *email;
- ECard *card;
-
- 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->card = e_card_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_message ("freeing %s / %s", qa->name, qa->email);
- g_free (qa->name);
- g_free (qa->email);
- gtk_object_unref (GTK_OBJECT (qa->card));
- g_free (qa);
- }
- }
-}
-
-static void
-quick_add_set_name (QuickAdd *qa, const gchar *name)
-{
- ECardSimple *simple;
-
- g_free (qa->name);
- qa->name = g_strdup (name);
-
- simple = e_card_simple_new (qa->card);
- e_card_simple_set (simple, E_CARD_SIMPLE_FIELD_FULL_NAME, name);
- e_card_simple_sync_card (simple);
- gtk_object_unref (GTK_OBJECT (simple));
-}
-
-static void
-quick_add_set_email (QuickAdd *qa, const gchar *email)
-{
- ECardSimple *simple;
-
- g_free (qa->email);
- qa->email = g_strdup (email);
-
- simple = e_card_simple_new (qa->card);
- e_card_simple_set (simple, E_CARD_SIMPLE_FIELD_EMAIL, email);
- e_card_simple_sync_card (simple);
- gtk_object_unref (GTK_OBJECT (simple));
-}
-
-static void
-merge_cb (EBook *book, gpointer closure)
-{
- QuickAdd *qa = (QuickAdd *) closure;
-
- if (book != NULL) {
- e_card_merging_book_add_card (book, qa->card, NULL, NULL);
- if (qa->cb)
- qa->cb (qa->card, qa->closure);
- } else {
- /* Something went wrong. */
- if (qa->cb)
- qa->cb (NULL, qa->closure);
- }
-
- quick_add_unref (qa);
-}
-
-static void
-quick_add_merge_card (QuickAdd *qa)
-{
- quick_add_ref (qa);
- e_book_use_local_address_book (merge_cb, qa);
-}
-
-
-/*
- * Raise a contact editor with all fields editable, and hook up all signals accordingly.
- */
-
-static void
-card_added_cb (EContactEditor *ce, EBookStatus status, ECard *card, gpointer closure)
-{
- QuickAdd *qa = (QuickAdd *) closure;
-
- if (qa->cb)
- qa->cb (qa->card, qa->closure);
-
- quick_add_unref (qa);
-}
-
-static void
-editor_closed_cb (GtkWidget *w, gpointer closure)
-{
- QuickAdd *qa = (QuickAdd *) closure;
- g_warning ("editor_closed_cb");
- quick_add_unref (qa);
- gtk_object_unref (GTK_OBJECT (w));
-}
-
-static void
-ce_have_book (EBook *book, gpointer closure)
-{
- QuickAdd *qa = (QuickAdd *) closure;
-
- if (book == NULL) {
- g_warning ("Couldn't open local address book.");
- quick_add_unref (qa);
- } else {
- EContactEditor *contact_editor = e_contact_editor_new (book, qa->card, TRUE, FALSE /* XXX */);
-
- gtk_signal_connect (GTK_OBJECT (contact_editor),
- "card_added",
- GTK_SIGNAL_FUNC (card_added_cb),
- qa);
- gtk_signal_connect (GTK_OBJECT (contact_editor),
- "editor_closed",
- GTK_SIGNAL_FUNC (editor_closed_cb),
- qa);
- }
-}
-
-static void
-edit_card (QuickAdd *qa)
-{
- e_book_use_local_address_book (ce_have_book, qa);
-}
-
-static void
-clicked_cb (GtkWidget *w, gint button, gpointer closure)
-{
- QuickAdd *qa = (QuickAdd *) closure;
-
- /* Get data out of entries. */
- if (button == 0 || button == 1) {
- 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 = e_utf8_from_gtk_string (qa->name_entry, tmp);
- g_free (tmp);
- }
-
- if (qa->email_entry) {
- gchar *tmp;
- tmp = gtk_editable_get_chars (GTK_EDITABLE (qa->email_entry), 0, -1);
- email = e_utf8_from_gtk_string (qa->email_entry, tmp);
- g_free (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 == 0) {
-
- /* OK */
- quick_add_merge_card (qa);
-
- } else if (button == 1) {
-
- /* EDIT FULL */
- edit_card (qa);
-
- } else {
- /* CANCEL */
- quick_add_unref (qa);
- }
-
-}
-
-static GtkWidget *
-build_quick_add_dialog (QuickAdd *qa)
-{
- GtkWidget *dialog;
- GtkTable *table;
- const gint xpad=1, ypad=1;
-
- g_return_val_if_fail (qa != NULL, NULL);
-
- dialog = gnome_dialog_new (_("Contact Quick-Add"),
- GNOME_STOCK_BUTTON_OK,
- _("Edit Full"),
- GNOME_STOCK_BUTTON_CANCEL,
- NULL);
-
- gtk_signal_connect (GTK_OBJECT (dialog),
- "clicked",
- clicked_cb,
- qa);
-
- qa->name_entry = gtk_entry_new ();
- if (qa->name) {
- gchar *str = e_utf8_to_gtk_string (qa->name_entry, qa->name);
- gtk_entry_set_text (GTK_ENTRY (qa->name_entry), str);
- g_free (str);
- }
-
-
- qa->email_entry = gtk_entry_new ();
- if (qa->email) {
- gchar *str = e_utf8_to_gtk_string (qa->email_entry, qa->email);
- gtk_entry_set_text (GTK_ENTRY (qa->email_entry), str);
- g_free (str);
- }
-
- table = GTK_TABLE (gtk_table_new (2, 2, FALSE));
-
- gtk_table_attach (table, gtk_label_new (_("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 (_("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_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox),
- GTK_WIDGET (table),
- TRUE, TRUE, 0);
- gtk_widget_show_all (GTK_WIDGET (table));
-
-
- return dialog;
-}
-
-void
-e_contact_quick_add (const gchar *name, const gchar *email,
- EContactQuickAddCallback cb, gpointer closure)
-{
- QuickAdd *qa;
- GtkWidget *dialog;
-
- /* We need to have *something* to work with. */
- if (name == NULL && email == NULL) {
- if (cb)
- cb (NULL, closure);
- return;
- }
-
- 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);
-}
-
-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 name */
- if (name && *name)
- g_strstrip (name);
-
- /* 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 e01256a163..0000000000
--- a/addressbook/gui/contact-editor/e-contact-quick-add.h
+++ /dev/null
@@ -1,41 +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 <trow@ximian.com>
- */
-
-/*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <addressbook/backend/ebook/e-card.h>
-
-typedef void (*EContactQuickAddCallback) (ECard *new_card, 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/e-contact-save-as.c b/addressbook/gui/contact-editor/e-contact-save-as.c
deleted file mode 100644
index 35247edbfc..0000000000
--- a/addressbook/gui/contact-editor/e-contact-save-as.c
+++ /dev/null
@@ -1,152 +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 <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <unistd.h>
-#include <fcntl.h>
-#include <gtk/gtkfilesel.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtk.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <gal/util/e-util.h>
-#include <libgnome/gnome-i18n.h>
-#include "e-contact-save-as.h"
-#include <errno.h>
-
-static int file_exists(GtkFileSelection *filesel, const char *filename);
-
-typedef struct {
- GtkFileSelection *filesel;
- char *vcard;
-} SaveAsInfo;
-
-static void
-save_it(GtkWidget *widget, SaveAsInfo *info)
-{
- gint error = 0;
- gint response = 0;
-
- const char *filename = gtk_file_selection_get_filename (info->filesel);
-
- error = e_write_file (filename, info->vcard, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC);
-
- if (error == EEXIST) {
- response = file_exists(info->filesel, filename);
- switch (response) {
- case 0 : /* Overwrite */
- e_write_file(filename, info->vcard, O_WRONLY | O_CREAT | O_TRUNC);
- break;
- case 1 : /* cancel */
- break;
- }
- }
-
- g_free (info->vcard);
- gtk_widget_destroy(GTK_WIDGET(info->filesel));
- g_free(info);
-}
-
-static void
-close_it(GtkWidget *widget, SaveAsInfo *info)
-{
- g_free (info->vcard);
- gtk_widget_destroy (GTK_WIDGET (info->filesel));
- g_free (info);
-}
-
-static void
-delete_it(GtkWidget *widget, SaveAsInfo *info)
-{
- g_free (info->vcard);
- g_free (info);
-}
-
-void
-e_contact_save_as(char *title, ECard *card)
-{
- GtkFileSelection *filesel;
- SaveAsInfo *info = g_new(SaveAsInfo, 1);
-
- filesel = GTK_FILE_SELECTION(gtk_file_selection_new(title));
-
- info->filesel = filesel;
- info->vcard = e_card_get_vcard(card);
-
- gtk_signal_connect(GTK_OBJECT(filesel->ok_button), "clicked",
- save_it, info);
- gtk_signal_connect(GTK_OBJECT(filesel->cancel_button), "clicked",
- close_it, info);
- gtk_signal_connect(GTK_OBJECT(filesel), "delete_event",
- delete_it, info);
- gtk_widget_show(GTK_WIDGET(filesel));
-}
-
-void
-e_contact_list_save_as(char *title, GList *list)
-{
- GtkFileSelection *filesel;
- SaveAsInfo *info = g_new(SaveAsInfo, 1);
-
- filesel = GTK_FILE_SELECTION(gtk_file_selection_new(title));
-
- info->filesel = filesel;
- info->vcard = e_card_list_get_vcard (list);
-
- gtk_signal_connect(GTK_OBJECT(filesel->ok_button), "clicked",
- save_it, info);
- gtk_signal_connect(GTK_OBJECT(filesel->cancel_button), "clicked",
- close_it, info);
- gtk_signal_connect(GTK_OBJECT(filesel), "delete_event",
- delete_it, info);
- gtk_widget_show(GTK_WIDGET(filesel));
-}
-
-static int
-file_exists(GtkFileSelection *filesel, const char *filename)
-{
- GnomeDialog *dialog = NULL;
- GtkWidget *label;
- GladeXML *gui = NULL;
- int result = 0;
- char *string;
-
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/file-exists.glade", NULL);
- dialog = GNOME_DIALOG(glade_xml_get_widget(gui, "dialog-exists"));
- gtk_widget_ref(GTK_WIDGET(dialog));
-
- label = glade_xml_get_widget (gui, "label-exists");
- if (GTK_IS_LABEL (label)) {
- string = g_strdup_printf (_("%s already exists\nDo you want to overwrite it?"), filename);
- gtk_label_set_text (GTK_LABEL (label), string);
- g_free (string);
- }
-
- gnome_dialog_set_parent(dialog, GTK_WINDOW(filesel));
-
- gtk_widget_show (GTK_WIDGET (dialog));
- result = gnome_dialog_run_and_close(dialog);
-
- gtk_widget_unref(GTK_WIDGET(dialog));
- gtk_widget_destroy(GTK_WIDGET(dialog));
- g_free(gui);
-
- return result;
-}
diff --git a/addressbook/gui/contact-editor/e-contact-save-as.h b/addressbook/gui/contact-editor/e-contact-save-as.h
deleted file mode 100644
index 75bd6ce957..0000000000
--- a/addressbook/gui/contact-editor/e-contact-save-as.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-contact-save-as.h
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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_SAVE_AS_H__
-#define __E_CONTACT_SAVE_AS_H__
-
-#include <glade/glade.h>
-#include "addressbook/backend/ebook/e-card.h"
-#include "addressbook/backend/ebook/e-card-simple.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-void
-e_contact_save_as(gchar *title, ECard *card);
-void
-e_contact_list_save_as(gchar *title, GList *list);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_CONTACT_EDITOR_H__ */
diff --git a/addressbook/gui/contact-editor/file-exists.glade b/addressbook/gui/contact-editor/file-exists.glade
deleted file mode 100644
index 7c457cb892..0000000000
--- a/addressbook/gui/contact-editor/file-exists.glade
+++ /dev/null
@@ -1,95 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>File_exists.glade</name>
- <program_name>file_exists.glade</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
-</project>
-
-<widget>
- <class>GnomeDialog</class>
- <name>dialog-exists</name>
- <visible>False</visible>
- <title>Confirm Overwrite</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>False</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area1</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button1</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Overwrite</label>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button3</name>
- <can_default>True</can_default>
- <has_default>True</has_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-exists</name>
- <label>Don't bother translating this string. It's not used.</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/addressbook/gui/contact-editor/fulladdr.glade b/addressbook/gui/contact-editor/fulladdr.glade
deleted file mode 100644
index 46d1a180b6..0000000000
--- a/addressbook/gui/contact-editor/fulladdr.glade
+++ /dev/null
@@ -1,475 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>fulladdr</name>
- <program_name>fulladdr</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <use_widget_names>True</use_widget_names>
- <output_main_file>False</output_main_file>
- <output_support_files>False</output_support_files>
- <output_build_files>False</output_build_files>
-</project>
-
-<widget>
- <class>GnomeDialog</class>
- <name>dialog-checkaddress</name>
- <visible>False</visible>
- <title>Check Address</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>True</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>vbox-container</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>hbuttonbox1</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button1</name>
- <can_default>True</can_default>
- <has_default>True</has_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button2</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkTable</class>
- <name>table-checkaddress</name>
- <border_width>8</border_width>
- <rows>4</rows>
- <columns>4</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>6</row_spacing>
- <column_spacing>6</column_spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label2</name>
- <label>_Address:</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-street</focus_target>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label4</name>
- <label>_City:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-city</focus_target>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-city</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-ext</name>
- <width>100</width>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label8</name>
- <label>_PO Box:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-po</focus_target>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label3</name>
- <label>Address _2:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-ext</focus_target>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-po</name>
- <width>100</width>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>3</left_attach>
- <right_attach>4</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-street</name>
- <can_focus>True</can_focus>
- <has_focus>True</has_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>1</left_attach>
- <right_attach>4</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label5</name>
- <label>_State/Province:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-region</focus_target>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-region</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkCombo</class>
- <name>combo-country</name>
- <width>100</width>
- <value_in_list>False</value_in_list>
- <ok_if_empty>True</ok_if_empty>
- <case_sensitive>False</case_sensitive>
- <use_arrows>True</use_arrows>
- <use_arrows_always>False</use_arrows_always>
- <items>USA
-Canada
-Finland
-</items>
- <child>
- <left_attach>3</left_attach>
- <right_attach>4</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkEntry</class>
- <child_name>GtkCombo:entry</child_name>
- <name>entry-country</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- </widget>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-code</name>
- <width>100</width>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>3</left_attach>
- <right_attach>4</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label6</name>
- <label>_ZIP Code:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-code</focus_target>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label7</name>
- <label>Countr_y:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>1</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-country</focus_target>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/addressbook/gui/contact-editor/fullname.glade b/addressbook/gui/contact-editor/fullname.glade
deleted file mode 100644
index 17be70647c..0000000000
--- a/addressbook/gui/contact-editor/fullname.glade
+++ /dev/null
@@ -1,389 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>fullname</name>
- <program_name>fullname</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <use_widget_names>True</use_widget_names>
- <output_main_file>False</output_main_file>
- <output_support_files>False</output_support_files>
- <output_build_files>False</output_build_files>
-</project>
-
-<widget>
- <class>GnomeDialog</class>
- <name>dialog-checkfullname</name>
- <visible>False</visible>
- <title>Check Full Name</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>True</modal>
- <allow_shrink>True</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>vbox-container</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>hbuttonbox1</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button1</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button2</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkTable</class>
- <name>table-checkfullname</name>
- <border_width>8</border_width>
- <rows>5</rows>
- <columns>3</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>6</row_spacing>
- <column_spacing>21</column_spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkCombo</class>
- <name>combo-title</name>
- <value_in_list>False</value_in_list>
- <ok_if_empty>True</ok_if_empty>
- <case_sensitive>False</case_sensitive>
- <use_arrows>True</use_arrows>
- <use_arrows_always>False</use_arrows_always>
- <items>
-Mr.
-Mrs.
-Ms.
-Miss
-Dr.
-</items>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
-
- <widget>
- <class>GtkEntry</class>
- <child_name>GtkCombo:entry</child_name>
- <name>entry-title</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- </widget>
- </widget>
-
- <widget>
- <class>GtkCombo</class>
- <name>combo-suffix</name>
- <value_in_list>False</value_in_list>
- <ok_if_empty>True</ok_if_empty>
- <case_sensitive>False</case_sensitive>
- <use_arrows>True</use_arrows>
- <use_arrows_always>False</use_arrows_always>
- <items>
-Sr.
-Jr.
-I
-II
-III
-Esq.
-</items>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
-
- <widget>
- <class>GtkEntry</class>
- <child_name>GtkCombo:entry</child_name>
- <name>entry-suffix</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- </widget>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-first</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>1</left_attach>
- <right_attach>3</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-middle</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>1</left_attach>
- <right_attach>3</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-last</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>1</left_attach>
- <right_attach>3</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label2</name>
- <label>_First:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-first</focus_target>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label1</name>
- <label>_Title:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-title</focus_target>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label3</name>
- <label>_Middle:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-middle</focus_target>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label5</name>
- <label>_Last:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-last</focus_target>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label4</name>
- <label>_Suffix:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-suffix</focus_target>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/addressbook/gui/contact-editor/test-editor.c b/addressbook/gui/contact-editor/test-editor.c
deleted file mode 100644
index 4842a93bf2..0000000000
--- a/addressbook/gui/contact-editor/test-editor.c
+++ /dev/null
@@ -1,145 +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 <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <stdlib.h>
-#include <gtk/gtkmain.h>
-#include <libgnomeui/gnome-app.h>
-#include <libgnomeui/gnome-init.h>
-#include <glade/glade.h>
-#include "e-contact-editor.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--;
- gtk_object_unref (GTK_OBJECT (ce));
-
- if (count == 0)
- exit (0);
-}
-
-#if 0
-static void about_callback( GtkWidget *widget, gpointer data )
-{
-
- const gchar *authors[] =
- {
- "Christopher James Lahey <clahey@umich.edu>",
- 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;
-
- /* bindtextdomain (PACKAGE, GNOMELOCALEDIR);
- textdomain (PACKAGE);*/
-
- gnome_init( "Contact Editor Test", VERSION, argc, argv);
-
- glade_gnome_init ();
-
- cardstr = NULL;
- if (argc == 2)
- cardstr = read_file (argv [1]);
-
- if (cardstr == NULL)
- cardstr = TEST_VCARD;
-
- ce = e_contact_editor_new (e_card_new (cardstr), TRUE, NULL, FALSE);
- gtk_signal_connect (GTK_OBJECT (ce), "editor_closed",
- GTK_SIGNAL_FUNC (editor_closed_cb), NULL);
-
- ce = e_contact_editor_new (e_card_new (cardstr), TRUE, NULL, FALSE);
- gtk_signal_connect (GTK_OBJECT (ce), "editor_closed",
- GTK_SIGNAL_FUNC (editor_closed_cb), NULL);
-
- gtk_main();
-
- /* Not reached. */
- return 0;
-}
diff --git a/addressbook/gui/contact-list-editor/.cvsignore b/addressbook/gui/contact-list-editor/.cvsignore
deleted file mode 100644
index e440fafdac..0000000000
--- a/addressbook/gui/contact-list-editor/.cvsignore
+++ /dev/null
@@ -1,3 +0,0 @@
-Makefile.in
-Makefile
-.deps
diff --git a/addressbook/gui/contact-list-editor/Makefile.am b/addressbook/gui/contact-list-editor/Makefile.am
deleted file mode 100644
index 1164f2c594..0000000000
--- a/addressbook/gui/contact-list-editor/Makefile.am
+++ /dev/null
@@ -1,30 +0,0 @@
-INCLUDES = \
- $(BONOBO_GNOME_CFLAGS) \
- $(EXTRA_GNOME_CFLAGS) \
- -I$(top_srcdir) \
- -I$(top_srcdir)/addressbook/ \
- -I$(top_srcdir)/addressbook/backend \
- -I$(top_srcdir)/addressbook/gui/merging \
- -I$(top_srcdir)/addressbook/gui/contact-editor \
- -I$(top_builddir)/shell \
- -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
- -DDATADIR=\""$(datadir)"\" \
- -DEVOLUTION_DATADIR=\""$(datadir)"\" \
- -DEVOLUTIONDIR=\""$(evolutiondir)"\" \
- -DG_LOG_DOMAIN=\"contact-list-editor\"
-
-noinst_LIBRARIES = \
- libecontactlisteditor.a
-
-libecontactlisteditor_a_SOURCES = \
- e-contact-list-editor.c \
- e-contact-list-editor.h \
- e-contact-list-model.c \
- e-contact-list-model.h
-
-gladedir = $(datadir)/evolution/glade
-
-glade_DATA = \
- contact-list-editor.glade
-
-EXTRA_DIST = $(glade_DATA)
diff --git a/addressbook/gui/contact-list-editor/contact-list-editor.glade b/addressbook/gui/contact-list-editor/contact-list-editor.glade
deleted file mode 100644
index 92c6aa013f..0000000000
--- a/addressbook/gui/contact-list-editor/contact-list-editor.glade
+++ /dev/null
@@ -1,272 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>contact-list-editor</name>
- <program_name>contact-list-editor</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
-</project>
-
-<widget>
- <class>GnomeApp</class>
- <name>contact list editor</name>
- <title>contact-list-editor</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <default_width>426</default_width>
- <default_height>304</default_height>
- <allow_shrink>True</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <enable_layout_config>True</enable_layout_config>
-
- <widget>
- <class>GnomeDock</class>
- <child_name>GnomeApp:dock</child_name>
- <name>dock1</name>
- <allow_floating>True</allow_floating>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDock:contents</child_name>
- <name>vbox8</name>
- <border_width>3</border_width>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox6</name>
- <border_width>3</border_width>
- <homogeneous>False</homogeneous>
- <spacing>3</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label10</name>
- <label>List _name:</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <default_focus_target>list-name-entry</default_focus_target>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>list-name-entry</name>
- <can_focus>True</can_focus>
- <has_focus>True</has_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
-
- <widget>
- <class>Custom</class>
- <name>custom7</name>
- <creation_function>e_create_image_widget</creation_function>
- <string1>evolution-contacts-plain.png</string1>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Sat, 23 Jun 2001 05:59:21 GMT</last_modification_time>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame3</name>
- <border_width>3</border_width>
- <label>Members</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox7</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox9</name>
- <border_width>3</border_width>
- <homogeneous>False</homogeneous>
- <spacing>3</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label11</name>
- <label>Type an email address or drag a contact into the list below:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>email-entry</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>Custom</class>
- <name>contact-list-table</name>
- <creation_function>e_contact_list_editor_create_table</creation_function>
- <string1></string1>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Sat, 23 Jun 2001 06:00:16 GMT</last_modification_time>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>visible-addrs-checkbutton</name>
- <can_focus>True</can_focus>
- <label>_Hide addresses when sending mail to this list</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox10</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label12</name>
- <label>
-</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkVButtonBox</class>
- <name>vbuttonbox4</name>
- <layout_style>GTK_BUTTONBOX_START</layout_style>
- <spacing>0</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>add-email-button</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>_Add</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>remove-button</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>_Remove</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
deleted file mode 100644
index c6f8cab132..0000000000
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ /dev/null
@@ -1,843 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-contact-list-editor.c
- * Copyright (C) 2001 Ximian, Inc.
- * Author: Chris Toshok <toshok@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <glib.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <bonobo/bonobo-ui-container.h>
-#include <bonobo/bonobo-ui-util.h>
-#include <gal/e-table/e-table-scrolled.h>
-#include <gal/widgets/e-unicode.h>
-
-#include "e-contact-editor.h"
-#include "e-contact-list-editor.h"
-#include "e-contact-list-model.h"
-
-/* Signal IDs */
-enum {
- LIST_ADDED,
- LIST_MODIFIED,
- LIST_DELETED,
- EDITOR_CLOSED,
- LAST_SIGNAL
-};
-
-static void e_contact_list_editor_init (EContactListEditor *editor);
-static void e_contact_list_editor_class_init (EContactListEditorClass *klass);
-static void e_contact_list_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_contact_list_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_contact_list_editor_destroy (GtkObject *object);
-
-static void create_ui (EContactListEditor *ce);
-static void set_editable (EContactListEditor *editor);
-static void command_state_changed (EContactListEditor *editor);
-static void close_dialog (EContactListEditor *cle);
-static void extract_info(EContactListEditor *editor);
-static void fill_in_info(EContactListEditor *editor);
-
-static void add_email_cb (GtkWidget *w, EContactListEditor *editor);
-static void remove_entry_cb (GtkWidget *w, EContactListEditor *editor);
-static void list_name_changed_cb (GtkWidget *w, EContactListEditor *editor);
-static void visible_addrs_toggled_cb (GtkWidget *w, EContactListEditor *editor);
-
-static gint app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data);
-static gboolean table_drag_drop_cb (ETable *table, int row, int col, GdkDragContext *context,
- gint x, gint y, guint time, EContactListEditor *editor);
-static gboolean table_drag_motion_cb (ETable *table, int row, int col, GdkDragContext *context,
- gint x, gint y, guint time, EContactListEditor *editor);
-static void table_drag_data_received_cb (ETable *table, int row, int col,
- GdkDragContext *context,
- gint x, gint y,
- GtkSelectionData *selection_data, guint info, guint time,
- EContactListEditor *editor);
-
-static GtkObjectClass *parent_class = NULL;
-
-static guint contact_list_editor_signals[LAST_SIGNAL];
-
-enum DndTargetType {
- DND_TARGET_TYPE_VCARD,
-};
-#define VCARD_TYPE "text/x-vcard"
-static GtkTargetEntry drag_types[] = {
- { VCARD_TYPE, 0, DND_TARGET_TYPE_VCARD },
-};
-static const int num_drag_types = sizeof (drag_types) / sizeof (drag_types[0]);
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_BOOK,
- ARG_CARD,
- ARG_IS_NEW_LIST,
- ARG_EDITABLE
-};
-
-GtkType
-e_contact_list_editor_get_type (void)
-{
- static GtkType contact_list_editor_type = 0;
-
- if (!contact_list_editor_type)
- {
- static const GtkTypeInfo contact_list_editor_info =
- {
- "EContactListEditor",
- sizeof (EContactListEditor),
- sizeof (EContactListEditorClass),
- (GtkClassInitFunc) e_contact_list_editor_class_init,
- (GtkObjectInitFunc) e_contact_list_editor_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- contact_list_editor_type = gtk_type_unique (GTK_TYPE_OBJECT, &contact_list_editor_info);
- }
-
- return contact_list_editor_type;
-}
-
-
-typedef void (*GtkSignal_NONE__INT_OBJECT) (GtkObject * object,
- gint arg1,
- GtkObject *arg2,
- gpointer user_data);
-
-static void
-e_marshal_NONE__INT_OBJECT (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_NONE__INT_OBJECT rfunc;
- rfunc = (GtkSignal_NONE__INT_OBJECT) func;
- (*rfunc) (object,
- GTK_VALUE_INT (args[0]),
- GTK_VALUE_OBJECT (args[1]),
- func_data);
-}
-
-static void
-e_contact_list_editor_class_init (EContactListEditorClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) klass;
-
- parent_class = gtk_type_class (GTK_TYPE_OBJECT);
-
- gtk_object_add_arg_type ("EContactListEditor::book", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_BOOK);
- gtk_object_add_arg_type ("EContactListEditor::card", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_CARD);
- gtk_object_add_arg_type ("EContactListEditor::is_new_list", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_IS_NEW_LIST);
- gtk_object_add_arg_type ("EContactListEditor::editable", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_EDITABLE);
-
- contact_list_editor_signals[LIST_ADDED] =
- gtk_signal_new ("list_added",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EContactListEditorClass, list_added),
- e_marshal_NONE__INT_OBJECT,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_INT, GTK_TYPE_OBJECT);
-
- contact_list_editor_signals[LIST_MODIFIED] =
- gtk_signal_new ("list_modified",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EContactListEditorClass, list_modified),
- e_marshal_NONE__INT_OBJECT,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_INT, GTK_TYPE_OBJECT);
-
- contact_list_editor_signals[LIST_DELETED] =
- gtk_signal_new ("list_deleted",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EContactListEditorClass, list_deleted),
- e_marshal_NONE__INT_OBJECT,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_INT, GTK_TYPE_OBJECT);
-
- contact_list_editor_signals[EDITOR_CLOSED] =
- gtk_signal_new ("editor_closed",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EContactListEditorClass, editor_closed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, contact_list_editor_signals, LAST_SIGNAL);
-
- object_class->set_arg = e_contact_list_editor_set_arg;
- object_class->get_arg = e_contact_list_editor_get_arg;
- object_class->destroy = e_contact_list_editor_destroy;
-}
-
-static void
-e_contact_list_editor_init (EContactListEditor *editor)
-{
- GladeXML *gui;
- GtkWidget *bonobo_win;
- BonoboUIContainer *container;
-
- editor->card = NULL;
- editor->changed = FALSE;
- editor->editable = TRUE;
- editor->is_new_list = FALSE;
-
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/contact-list-editor.glade", NULL);
- editor->gui = gui;
-
- editor->app = glade_xml_get_widget (gui, "contact list editor");
-
- editor->table = glade_xml_get_widget (gui, "contact-list-table");
- editor->model = gtk_object_get_data (GTK_OBJECT(editor->table), "model");
-
- editor->add_button = glade_xml_get_widget (editor->gui, "add-email-button");
- editor->remove_button = glade_xml_get_widget (editor->gui, "remove-button");
-
- editor->email_entry = glade_xml_get_widget (gui, "email-entry");
- editor->list_name_entry = glade_xml_get_widget (gui, "list-name-entry");
-
- editor->visible_addrs_checkbutton = glade_xml_get_widget (gui, "visible-addrs-checkbutton");
-
- /* Construct the app */
- bonobo_win = bonobo_window_new ("contact-list-editor", _("Contact List Editor"));
-
- /* FIXME: The sucking bit */
- {
- GtkWidget *contents;
-
- contents = gnome_dock_get_client_area (
- GNOME_DOCK (GNOME_APP (editor->app)->dock));
- if (!contents) {
- g_message ("contact_list_editor_construct(): Could not get contents");
- return;
- }
- gtk_widget_ref (contents);
- gtk_container_remove (GTK_CONTAINER (contents->parent), contents);
- bonobo_window_set_contents (BONOBO_WINDOW (bonobo_win), contents);
- gtk_widget_destroy (editor->app);
- editor->app = bonobo_win;
- }
-
- /* Build the menu and toolbar */
-
- container = bonobo_ui_container_new ();
- bonobo_ui_container_set_win (container, BONOBO_WINDOW (editor->app));
-
- editor->uic = bonobo_ui_component_new_default ();
- if (!editor->uic) {
- g_message ("e_contact_list_editor_init(): eeeeek, could not create the UI handler!");
- return;
- }
- bonobo_ui_component_set_container (editor->uic,
- bonobo_object_corba_objref (
- BONOBO_OBJECT (container)));
-
- create_ui (editor);
-
- /* connect signals */
- gtk_signal_connect (GTK_OBJECT(editor->add_button),
- "clicked", GTK_SIGNAL_FUNC(add_email_cb), editor);
- gtk_signal_connect (GTK_OBJECT(editor->email_entry),
- "activate", GTK_SIGNAL_FUNC(add_email_cb), editor);
- gtk_signal_connect (GTK_OBJECT(editor->remove_button),
- "clicked", GTK_SIGNAL_FUNC(remove_entry_cb), editor);
- gtk_signal_connect (GTK_OBJECT(editor->list_name_entry),
- "changed", GTK_SIGNAL_FUNC(list_name_changed_cb), editor);
- gtk_signal_connect (GTK_OBJECT(editor->visible_addrs_checkbutton),
- "toggled", GTK_SIGNAL_FUNC(visible_addrs_toggled_cb), editor);
-
- e_table_drag_dest_set (e_table_scrolled_get_table (E_TABLE_SCROLLED (editor->table)),
- 0, drag_types, num_drag_types, GDK_ACTION_LINK);
-
- gtk_signal_connect (GTK_OBJECT(e_table_scrolled_get_table (E_TABLE_SCROLLED (editor->table))),
- "table_drag_motion", GTK_SIGNAL_FUNC(table_drag_motion_cb), editor);
- gtk_signal_connect (GTK_OBJECT(e_table_scrolled_get_table (E_TABLE_SCROLLED (editor->table))),
- "table_drag_drop", GTK_SIGNAL_FUNC(table_drag_drop_cb), editor);
- gtk_signal_connect (GTK_OBJECT(e_table_scrolled_get_table (E_TABLE_SCROLLED (editor->table))),
- "table_drag_data_received", GTK_SIGNAL_FUNC(table_drag_data_received_cb), editor);
-
- command_state_changed (editor);
-
- /* Connect to the deletion of the dialog */
-
- gtk_signal_connect (GTK_OBJECT (editor->app), "delete_event",
- GTK_SIGNAL_FUNC (app_delete_event_cb), editor);
-}
-
-static void
-e_contact_list_editor_destroy (GtkObject *object)
-{
-}
-
-typedef struct {
- EContactListEditor *cle;
- gboolean should_close;
-} EditorCloseStruct;
-
-static void
-list_added_cb (EBook *book, EBookStatus status, const char *id, EditorCloseStruct *ecs)
-{
- EContactListEditor *cle = ecs->cle;
- gboolean should_close = ecs->should_close;
-
- g_free (ecs);
-
- gtk_signal_emit (GTK_OBJECT (cle), contact_list_editor_signals[LIST_ADDED],
- status, cle->card);
-
- if (status == E_BOOK_STATUS_SUCCESS) {
- cle->is_new_list = FALSE;
-
- if (should_close)
- close_dialog (cle);
- }
-}
-
-static void
-list_modified_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs)
-{
- EContactListEditor *cle = ecs->cle;
- gboolean should_close = ecs->should_close;
-
- g_free (ecs);
-
- gtk_signal_emit (GTK_OBJECT (cle), contact_list_editor_signals[LIST_MODIFIED],
- status, cle->card);
-
- if (status == E_BOOK_STATUS_SUCCESS) {
- if (should_close)
- close_dialog (cle);
- }
-}
-
-static void
-save_card (EContactListEditor *cle, gboolean should_close)
-{
- extract_info (cle);
-
- if (cle->book) {
- EditorCloseStruct *ecs = g_new(EditorCloseStruct, 1);
-
- ecs->cle = cle;
- ecs->should_close = should_close;
-
- if (cle->is_new_list)
- e_book_add_card (cle->book, cle->card, GTK_SIGNAL_FUNC(list_added_cb), ecs);
- else
- e_book_commit_card (cle->book, cle->card, GTK_SIGNAL_FUNC(list_modified_cb), ecs);
- }
-}
-
-static void
-file_close_cb (GtkWidget *widget, gpointer data)
-{
- EContactListEditor *cle = E_CONTACT_LIST_EDITOR (data);
-
- close_dialog (cle);
-}
-
-static void
-file_save_cb (GtkWidget *widget, gpointer data)
-{
- EContactListEditor *cle = E_CONTACT_LIST_EDITOR (data);
-
- save_card (cle, FALSE);
-}
-
-static void
-tb_save_and_close_cb (GtkWidget *widget, gpointer data)
-{
- EContactListEditor *cle = E_CONTACT_LIST_EDITOR (data);
- save_card (cle, TRUE);
-}
-
-static void
-list_deleted_cb (EBook *book, EBookStatus status, EContactListEditor *cle)
-{
- gtk_signal_emit (GTK_OBJECT (cle), contact_list_editor_signals[LIST_DELETED],
- status, cle->card);
-}
-
-static void
-delete_cb (GtkWidget *widget, gpointer data)
-{
- EContactListEditor *cle = E_CONTACT_LIST_EDITOR (data);
- ECard *card = cle->card;
-
- gtk_object_ref(GTK_OBJECT(card));
-
- if (e_contact_editor_confirm_delete(GTK_WINDOW(cle->app))) {
-
- extract_info (cle);
-
- if (!cle->is_new_list)
- e_book_remove_card (cle->book, card, GTK_SIGNAL_FUNC(list_deleted_cb), cle);
- }
-
- gtk_object_unref(GTK_OBJECT(card));
-}
-
-static
-BonoboUIVerb verbs [] = {
- BONOBO_UI_UNSAFE_VERB ("ContactListEditorSave", file_save_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactListEditorSaveClose", tb_save_and_close_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactListEditorDelete", delete_cb),
-#if 0
- BONOBO_UI_UNSAFE_VERB ("ContactEditorSaveAs", file_save_as_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactEditorSendAs", file_send_as_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactEditorSendTo", file_send_to_cb),
-#endif
- BONOBO_UI_UNSAFE_VERB ("ContactListEditorClose", file_close_cb),
- BONOBO_UI_VERB_END
-};
-
-static void
-create_ui (EContactListEditor *ce)
-{
- bonobo_ui_component_add_verb_list_with_data (
- ce->uic, verbs, ce);
-
- bonobo_ui_util_set_ui (ce->uic, EVOLUTION_DATADIR,
- "evolution-contact-list-editor.xml",
- "evolution-contact-list-editor");
-}
-
-EContactListEditor *
-e_contact_list_editor_new (EBook *book,
- ECard *list_card,
- gboolean is_new_list,
- gboolean editable)
-{
- EContactListEditor *ce;
-
- ce = E_CONTACT_LIST_EDITOR (gtk_type_new (E_CONTACT_LIST_EDITOR_TYPE));
-
- gtk_object_set (GTK_OBJECT (ce),
- "book", book,
- "card", list_card,
- "is_new_list", is_new_list,
- "editable", editable,
- NULL);
-
- return ce;
-}
-
-static void
-e_contact_list_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- EContactListEditor *editor;
-
- editor = E_CONTACT_LIST_EDITOR (o);
-
- switch (arg_id){
- case ARG_BOOK:
- if (editor->book)
- gtk_object_unref(GTK_OBJECT(editor->book));
- editor->book = E_BOOK(GTK_VALUE_OBJECT (*arg));
- gtk_object_ref (GTK_OBJECT (editor->book));
- /* XXX more here about editable/etc. */
- break;
- case ARG_CARD:
- if (editor->card)
- gtk_object_unref(GTK_OBJECT(editor->card));
- editor->card = e_card_duplicate(E_CARD(GTK_VALUE_OBJECT (*arg)));
- fill_in_info(editor);
- editor->changed = FALSE;
- command_state_changed (editor);
- break;
-
- case ARG_IS_NEW_LIST: {
- gboolean new_value = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
- gboolean changed = (editor->is_new_list != new_value);
-
- editor->is_new_list = new_value;
-
- if (changed)
- command_state_changed (editor);
- break;
- }
-
- case ARG_EDITABLE: {
- gboolean new_value = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
- gboolean changed = (editor->editable != new_value);
-
- editor->editable = new_value;
-
- if (changed) {
- set_editable (editor);
- command_state_changed (editor);
- }
- break;
- }
-
- }
-}
-
-static void
-e_contact_list_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EContactListEditor *editor;
-
- editor = E_CONTACT_LIST_EDITOR (object);
-
- switch (arg_id) {
- case ARG_BOOK:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(editor->book);
- break;
-
- case ARG_CARD:
- extract_info(editor);
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(editor->card);
- break;
-
- case ARG_IS_NEW_LIST:
- GTK_VALUE_BOOL (*arg) = editor->is_new_list ? TRUE : FALSE;
- break;
-
- case ARG_EDITABLE:
- GTK_VALUE_BOOL (*arg) = editor->editable ? TRUE : FALSE;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-void
-e_contact_list_editor_show (EContactListEditor *editor)
-{
- gtk_widget_show (editor->app);
-}
-
-void
-e_contact_list_editor_raise (EContactListEditor *editor)
-{
- gdk_window_raise (GTK_WIDGET (editor->app)->window);
-}
-
-#define SPEC "<ETableSpecification no-headers=\"true\" cursor-mode=\"line\" selection-mode=\"single\"> \
- <ETableColumn model_col= \"0\" _title=\"Contact\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\" /> \
- <ETableState> \
- <column source=\"0\"/> \
- <grouping> </grouping> \
- </ETableState> \
-</ETableSpecification>"
-
-GtkWidget *
-e_contact_list_editor_create_table(gchar *name,
- gchar *string1, gchar *string2,
- gint int1, gint int2);
-
-GtkWidget *
-e_contact_list_editor_create_table(gchar *name,
- gchar *string1, gchar *string2,
- gint int1, gint int2)
-{
-
- ETableModel *model;
- GtkWidget *table;
-
- model = e_contact_list_model_new ();
-
- table = e_table_scrolled_new (model, NULL, SPEC, NULL);
-
- gtk_object_set_data(GTK_OBJECT(table), "model", model);
-
- return table;
-}
-
-static void
-add_email_cb (GtkWidget *w, EContactListEditor *editor)
-{
- char *text = gtk_entry_get_text (GTK_ENTRY(editor->email_entry));
-
- if (text && *text)
- e_contact_list_model_add_email (E_CONTACT_LIST_MODEL(editor->model), text);
-
- gtk_entry_set_text (GTK_ENTRY(editor->email_entry), "");
-
- if (!editor->changed) {
- editor->changed = TRUE;
- command_state_changed (editor);
- }
-}
-
-static void
-remove_row (int model_row, EContactListEditor *editor)
-{
- e_contact_list_model_remove_row (E_CONTACT_LIST_MODEL (editor->model), model_row);
-}
-
-static void
-remove_entry_cb (GtkWidget *w, EContactListEditor *editor)
-{
- e_table_selected_row_foreach (e_table_scrolled_get_table(E_TABLE_SCROLLED(editor->table)),
- (EForeachFunc)remove_row, editor);
- if (!editor->changed) {
- editor->changed = TRUE;
- command_state_changed (editor);
- }
-}
-
-static void
-list_name_changed_cb (GtkWidget *w, EContactListEditor *editor)
-{
- if (!editor->changed) {
- editor->changed = TRUE;
- command_state_changed (editor);
- }
-}
-
-static void
-visible_addrs_toggled_cb (GtkWidget *w, EContactListEditor *editor)
-{
- if (!editor->changed) {
- editor->changed = TRUE;
- command_state_changed (editor);
- }
-}
-
-static void
-set_editable (EContactListEditor *editor)
-{
- gtk_widget_set_sensitive (editor->email_entry, editor->editable);
- gtk_widget_set_sensitive (editor->list_name_entry, editor->editable);
- gtk_widget_set_sensitive (editor->add_button, editor->editable);
- gtk_widget_set_sensitive (editor->remove_button, editor->editable);
- gtk_widget_set_sensitive (editor->table, editor->editable);
-}
-
-/* Closes the dialog box and emits the appropriate signals */
-static void
-close_dialog (EContactListEditor *cle)
-{
- g_assert (cle->app != NULL);
-
- gtk_widget_destroy (cle->app);
- cle->app = NULL;
-
- gtk_signal_emit (GTK_OBJECT (cle), contact_list_editor_signals[EDITOR_CLOSED]);
-}
-
-/* Callback used when the editor is destroyed */
-static gint
-app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
-{
- EContactListEditor *ce;
-
- ce = E_CONTACT_LIST_EDITOR (data);
-
- close_dialog (ce);
- return TRUE;
-}
-
-static gboolean
-table_drag_motion_cb (ETable *table, int row, int col,
- GdkDragContext *context,
- gint x, gint y, guint time, EContactListEditor *editor)
-{
- GList *p;
-
- for (p = context->targets; p != NULL; p = p->next) {
- char *possible_type;
-
- possible_type = gdk_atom_name ((GdkAtom) p->data);
- if (!strcmp (possible_type, VCARD_TYPE)) {
- g_free (possible_type);
- gdk_drag_status (context, GDK_ACTION_LINK, time);
- return TRUE;
- }
-
- g_free (possible_type);
- }
-
- return FALSE;
-}
-
-static gboolean
-table_drag_drop_cb (ETable *table, int row, int col,
- GdkDragContext *context,
- gint x, gint y, guint time, EContactListEditor *editor)
-{
- if (context->targets != NULL) {
- gtk_drag_get_data (GTK_WIDGET (table), context,
- GPOINTER_TO_INT (context->targets->data),
- time);
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-table_drag_data_received_cb (ETable *table, int row, int col,
- GdkDragContext *context,
- gint x, gint y,
- GtkSelectionData *selection_data,
- guint info, guint time, EContactListEditor *editor)
-{
- char *target_type;
-
- target_type = gdk_atom_name (selection_data->target);
-
- if (!strcmp (target_type, VCARD_TYPE)) {
- GList *card_list = e_card_load_cards_from_string (selection_data->data);
- GList *c;
-
- for (c = card_list; c; c = c->next) {
- ECard *ecard = c->data;
-
- if (!e_card_evolution_list (ecard)) {
- ECardSimple *simple = e_card_simple_new (ecard);
-
- e_contact_list_model_add_card (E_CONTACT_LIST_MODEL (editor->model),
- simple);
-
- gtk_object_unref (GTK_OBJECT (simple));
- }
- }
- g_list_foreach (card_list, (GFunc)gtk_object_unref, NULL);
- g_list_free (card_list);
- }
-}
-
-static void
-command_state_changed (EContactListEditor *editor)
-{
- bonobo_ui_component_set_prop (editor->uic,
- "/commands/ContactListEditorSaveClose",
- "sensitive",
- editor->changed && editor->editable ? "1" : "0", NULL);
-
- bonobo_ui_component_set_prop (editor->uic,
- "/commands/ContactListEditorSave",
- "sensitive",
- editor->changed && editor->editable ? "1" : "0", NULL);
-
- bonobo_ui_component_set_prop (editor->uic,
- "/commands/ContactListEditorDelete",
- "sensitive",
- editor->editable && !editor->is_new_list ? "1" : "0", NULL);
-}
-
-static void
-extract_info(EContactListEditor *editor)
-{
- ECard *card = editor->card;
- if (card) {
- int i;
- EList *email_list;
- EIterator *email_iter;
- char *string = e_utf8_gtk_editable_get_chars(GTK_EDITABLE (editor->list_name_entry), 0, -1);
-
- if (string && *string)
- gtk_object_set(GTK_OBJECT(card),
- "file_as", string,
- "full_name", string,
- NULL);
-
- g_free (string);
-
-
- gtk_object_set (GTK_OBJECT(card),
- "list", GINT_TO_POINTER (TRUE),
- "list_show_addresses",
- GINT_TO_POINTER (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(editor->visible_addrs_checkbutton))),
- NULL);
-
- gtk_object_get (GTK_OBJECT(card),
- "email", &email_list,
- NULL);
-
- /* clear the email list */
- email_iter = e_list_get_iterator (email_list);
- e_iterator_last (email_iter);
- while (e_iterator_is_valid (E_ITERATOR (email_iter))) {
- e_iterator_delete (E_ITERATOR (email_iter));
- }
- gtk_object_unref (GTK_OBJECT (email_iter));
-
- /* then refill it from the contact list model */
- for (i = 0; i < e_table_model_row_count (editor->model); i ++) {
- const EDestination *dest = e_contact_list_model_get_destination (E_CONTACT_LIST_MODEL (editor->model), i);
- gchar *dest_xml = e_destination_export (dest);
- if (dest_xml) {
- e_list_append (email_list, dest_xml);
- }
- g_free (dest_xml);
- }
- }
-}
-
-static void
-fill_in_info(EContactListEditor *editor)
-{
- if (editor->card) {
- char *file_as;
- gboolean show_addresses = FALSE;
- gboolean is_evolution_list = FALSE;
- EList *email_list;
- EIterator *email_iter;
-
- gtk_object_get (GTK_OBJECT (editor->card),
- "file_as", &file_as,
- "email", &email_list,
- "list", &is_evolution_list,
- "list_show_addresses", &show_addresses,
- NULL);
-
- gtk_editable_delete_text (GTK_EDITABLE (editor->list_name_entry), 0, -1);
- if (file_as) {
- int position = 0;
- gchar *u = e_utf8_to_gtk_string (editor->list_name_entry, file_as);
- gtk_editable_insert_text (GTK_EDITABLE (editor->list_name_entry), u, strlen (u), &position);
- g_free (u);
- }
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(editor->visible_addrs_checkbutton), show_addresses);
-
- e_contact_list_model_remove_all (E_CONTACT_LIST_MODEL (editor->model));
-
- email_iter = e_list_get_iterator (email_list);
-
- while (e_iterator_is_valid (email_iter)) {
- const char *dest_xml = e_iterator_get (email_iter);
- EDestination *dest;
-
- g_message ("incoming xml: [%s]", dest_xml);
- dest = e_destination_import (dest_xml);
-
- if (dest != NULL) {
- e_contact_list_model_add_destination (E_CONTACT_LIST_MODEL (editor->model), dest);
- }
-
- e_iterator_next (email_iter);
- }
- }
-}
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.h b/addressbook/gui/contact-list-editor/e-contact-list-editor.h
deleted file mode 100644
index 6c67fc6468..0000000000
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-contact-list-editor.h
- * Copyright (C) 2001 Ximian, Inc.
- * Author: Chris Toshok <toshok@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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_LIST_EDITOR_H__
-#define __E_CONTACT_LIST_EDITOR_H__
-
-#include <libgnomeui/gnome-app.h>
-#include <libgnomeui/gnome-app-helper.h>
-#include <bonobo/bonobo-ui-component.h>
-#include <glade/glade.h>
-#include <gal/e-table/e-table-model.h>
-
-#include "addressbook/backend/ebook/e-book.h"
-#include "addressbook/backend/ebook/e-card.h"
-#include "addressbook/backend/ebook/e-card-simple.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_CONTACT_LIST_EDITOR_TYPE (e_contact_list_editor_get_type ())
-#define E_CONTACT_LIST_EDITOR(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_LIST_EDITOR_TYPE, EContactListEditor))
-#define E_CONTACT_LIST_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_LIST_EDITOR_TYPE, EContactListEditorClass))
-#define E_IS_CONTACT_LIST_EDITOR(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_LIST_EDITOR_TYPE))
-#define E_IS_CONTACT_LIST_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_LIST_EDITOR_TYPE))
-
-
-typedef struct _EContactListEditor EContactListEditor;
-typedef struct _EContactListEditorClass EContactListEditorClass;
-
-struct _EContactListEditor
-{
- GtkObject object;
-
- /* item specific fields */
- EBook *book;
- ECard *card;
-
- /* UI handler */
- BonoboUIComponent *uic;
-
- GladeXML *gui;
- GtkWidget *app;
-
- GtkWidget *table;
- ETableModel *model;
- GtkWidget *email_entry;
- GtkWidget *list_name_entry;
- GtkWidget *add_button;
- GtkWidget *remove_button;
- GtkWidget *visible_addrs_checkbutton;
-
- /* Whether we are editing a new card or an existing one */
- guint is_new_list : 1;
-
- /* Whether the card has been changed since bringing up the contact editor */
- guint changed : 1;
-
- /* Whether the contact editor will accept modifications */
- guint editable : 1;
-};
-
-struct _EContactListEditorClass
-{
- GtkObjectClass parent_class;
-
- /* Notification signals */
-
- void (* list_added) (EContactListEditor *cle, EBookStatus status, ECard *card);
- void (* list_modified) (EContactListEditor *cle, EBookStatus status, ECard *card);
- void (* list_deleted) (EContactListEditor *cle, EBookStatus status, ECard *card);
- void (* editor_closed) (EContactListEditor *cle);
-};
-
-EContactListEditor *e_contact_list_editor_new (EBook *book,
- ECard *list_card,
- gboolean is_new_list,
- gboolean editable);
-GtkType e_contact_list_editor_get_type (void);
-void e_contact_list_editor_show (EContactListEditor *editor);
-void e_contact_list_editor_raise (EContactListEditor *editor);
-
-gboolean e_contact_list_editor_confirm_delete (GtkWindow *parent);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_CONTACT_LIST_EDITOR_H__ */
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-model.c b/addressbook/gui/contact-list-editor/e-contact-list-model.c
deleted file mode 100644
index c4321c2820..0000000000
--- a/addressbook/gui/contact-list-editor/e-contact-list-model.c
+++ /dev/null
@@ -1,253 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#include <config.h>
-#include "e-contact-list-model.h"
-
-#define PARENT_TYPE e_table_model_get_type()
-static ETableModelClass *parent_class;
-
-#define COLS 1
-
-/* This function returns the number of columns in our ETableModel. */
-static int
-contact_list_col_count (ETableModel *etc)
-{
- return COLS;
-}
-
-/* This function returns the number of rows in our ETableModel. */
-static int
-contact_list_row_count (ETableModel *etc)
-{
- EContactListModel *model = E_CONTACT_LIST_MODEL (etc);
- return model->data_count;
-}
-
-/* This function returns the value at a particular point in our ETableModel. */
-static void *
-contact_list_value_at (ETableModel *etc, int col, int row)
-{
- EContactListModel *model = E_CONTACT_LIST_MODEL (etc);
-
- return (void *) e_destination_get_address (model->data[row]);
-}
-
-/* This function sets the value at a particular point in our ETableModel. */
-static void
-contact_list_set_value_at (ETableModel *etc, int col, int row, const void *val)
-{
- /* nothing */
-}
-
-/* This function returns whether a particular cell is editable. */
-static gboolean
-contact_list_is_cell_editable (ETableModel *etc, int col, int row)
-{
- return FALSE;
-}
-
-/* This function duplicates the value passed to it. */
-static void *
-contact_list_duplicate_value (ETableModel *etc, int col, const void *value)
-{
- return g_strdup(value);
-}
-
-/* This function frees the value passed to it. */
-static void
-contact_list_free_value (ETableModel *etc, int col, void *value)
-{
- g_free(value);
-}
-
-static void *
-contact_list_initialize_value (ETableModel *etc, int col)
-{
- return g_strdup("");
-}
-
-static gboolean
-contact_list_value_is_empty (ETableModel *etc, int col, const void *value)
-{
- return !(value && *(char *)value);
-}
-
-static char *
-contact_list_value_to_string (ETableModel *etc, int col, const void *value)
-{
- return g_strdup(value);
-}
-
-static void
-contact_list_model_destroy (GtkObject *o)
-{
- EContactListModel *model = E_CONTACT_LIST_MODEL (o);
- int i;
-
- for (i = 0; i < model->data_count; i ++) {
- gtk_object_unref (GTK_OBJECT (model->data[i]));
- }
- g_free (model->data);
-
- model->data_count = 0;
- model->data_alloc = 0;
-}
-
-static void
-e_contact_list_model_class_init (GtkObjectClass *object_class)
-{
- ETableModelClass *model_class = (ETableModelClass *) object_class;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->destroy = contact_list_model_destroy;
-
- model_class->column_count = contact_list_col_count;
- model_class->row_count = contact_list_row_count;
- model_class->value_at = contact_list_value_at;
- model_class->set_value_at = contact_list_set_value_at;
- model_class->is_cell_editable = contact_list_is_cell_editable;
- model_class->duplicate_value = contact_list_duplicate_value;
- model_class->free_value = contact_list_free_value;
- model_class->initialize_value = contact_list_initialize_value;
- model_class->value_is_empty = contact_list_value_is_empty;
- model_class->value_to_string = contact_list_value_to_string;
-}
-
-static void
-e_contact_list_model_init (GtkObject *object)
-{
- EContactListModel *model = E_CONTACT_LIST_MODEL(object);
-
- model->data_alloc = 10;
- model->data_count = 0;
- model->data = g_new (EDestination*, model->data_alloc);
-}
-
-GtkType
-e_contact_list_model_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "EContactListModel",
- sizeof (EContactListModel),
- sizeof (EContactListModelClass),
- (GtkClassInitFunc) e_contact_list_model_class_init,
- (GtkObjectInitFunc) e_contact_list_model_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-void
-e_contact_list_model_construct (EContactListModel *model)
-{
-}
-
-ETableModel *
-e_contact_list_model_new ()
-{
- EContactListModel *model;
-
- model = gtk_type_new (e_contact_list_model_get_type ());
-
- e_contact_list_model_construct (model);
-
- return E_TABLE_MODEL(model);
-}
-
-void
-e_contact_list_model_add_destination (EContactListModel *model, EDestination *dest)
-{
- g_return_if_fail (E_IS_CONTACT_LIST_MODEL (model));
- g_return_if_fail (E_IS_DESTINATION (dest));
-
- if (model->data_count + 1 >= model->data_alloc) {
- model->data_alloc *= 2;
- model->data = g_renew (EDestination*, model->data, model->data_alloc);
- }
-
- model->data[model->data_count ++] = dest;
- gtk_object_ref (GTK_OBJECT (dest));
- gtk_object_sink (GTK_OBJECT (dest));
-
- e_table_model_changed (E_TABLE_MODEL (model));
-}
-
-void
-e_contact_list_model_add_email (EContactListModel *model,
- const char *email)
-{
- EDestination *new_dest;
-
- g_return_if_fail (E_IS_CONTACT_LIST_MODEL (model));
- g_return_if_fail (email != NULL);
-
- new_dest = e_destination_new ();
- e_destination_set_email (new_dest, email);
-
- e_contact_list_model_add_destination (model, new_dest);
-}
-
-void
-e_contact_list_model_add_card (EContactListModel *model,
- ECardSimple *simple)
-{
- EDestination *new_dest;
-
- g_return_if_fail (E_IS_CONTACT_LIST_MODEL (model));
- g_return_if_fail (E_IS_CARD_SIMPLE (simple));
-
- new_dest = e_destination_new ();
- e_destination_set_card (new_dest, simple->card, 0); /* Hard-wired for default e-mail */
-
- e_contact_list_model_add_destination (model, new_dest);
-}
-
-void
-e_contact_list_model_remove_row (EContactListModel *model, int row)
-{
- g_return_if_fail (E_IS_CONTACT_LIST_MODEL (model));
- g_return_if_fail (0 <= row && row < model->data_count);
-
- gtk_object_unref (GTK_OBJECT (model->data[row]));
- memmove (model->data + row, model->data + row + 1, sizeof (EDestination*) * (model->data_count - row - 1));
- model->data_count --;
-
- e_table_model_changed (E_TABLE_MODEL (model));
-}
-
-void
-e_contact_list_model_remove_all (EContactListModel *model)
-{
- int i;
-
- g_return_if_fail (E_IS_CONTACT_LIST_MODEL (model));
-
- for (i = 0; i < model->data_count; i ++) {
- gtk_object_unref (GTK_OBJECT (model->data[i]));
- model->data[i] = NULL;
- }
-
- model->data_count = 0;
-
- e_table_model_changed (E_TABLE_MODEL (model));
-}
-
-
-const EDestination *
-e_contact_list_model_get_destination (EContactListModel *model, int row)
-{
- g_return_val_if_fail (E_IS_CONTACT_LIST_MODEL (model), NULL);
- g_return_val_if_fail (0 <= row && row < model->data_count, NULL);
-
- return model->data[row];
-}
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-model.h b/addressbook/gui/contact-list-editor/e-contact-list-model.h
deleted file mode 100644
index 1c2d6ac8d0..0000000000
--- a/addressbook/gui/contact-list-editor/e-contact-list-model.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#ifndef _E_CONTACT_LIST_MODEL_H_
-#define _E_CONTACT_LIST_MODEL_H_
-
-#include <gal/e-table/e-table-model.h>
-#include "addressbook/backend/ebook/e-book.h"
-#include "addressbook/backend/ebook/e-book-view.h"
-#include "addressbook/backend/ebook/e-card-simple.h"
-#include "addressbook/backend/ebook/e-destination.h"
-
-#define E_CONTACT_LIST_MODEL_TYPE (e_contact_list_model_get_type ())
-#define E_CONTACT_LIST_MODEL(o) (GTK_CHECK_CAST ((o), E_CONTACT_LIST_MODEL_TYPE, EContactListModel))
-#define E_CONTACT_LIST_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CONTACT_LIST_MODEL_TYPE, EContactListModelClass))
-#define E_IS_CONTACT_LIST_MODEL(o) (GTK_CHECK_TYPE ((o), E_CONTACT_LIST_MODEL_TYPE))
-#define E_IS_CONTACT_LIST_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CONTACT_LIST_MODEL_TYPE))
-
-typedef struct _EContactListModel EContactListModel;
-typedef struct _EContactListModelClass EContactListModelClass;
-
-struct _EContactListModel {
- ETableModel parent;
-
- EDestination **data;
- int data_count;
- int data_alloc;
-};
-
-
-struct _EContactListModelClass {
- ETableModelClass parent_class;
-};
-
-
-GtkType e_contact_list_model_get_type (void);
-void e_contact_list_model_construct (EContactListModel *model);
-ETableModel *e_contact_list_model_new (void);
-
-void e_contact_list_model_add_destination (EContactListModel *model, EDestination *dest);
-void e_contact_list_model_add_email (EContactListModel *model, const char *email);
-void e_contact_list_model_add_card (EContactListModel *model, ECardSimple *simple);
-
-void e_contact_list_model_remove_row (EContactListModel *model, int row);
-void e_contact_list_model_remove_all (EContactListModel *model);
-
-const EDestination *e_contact_list_model_get_destination (EContactListModel *model, int row);
-
-#endif /* _E_CONTACT_LIST_MODEL_H_ */
diff --git a/addressbook/gui/merging/.cvsignore b/addressbook/gui/merging/.cvsignore
deleted file mode 100644
index 09980ae6ba..0000000000
--- a/addressbook/gui/merging/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-.deps
-.libs
-Makefile
-Makefile.in
-*.lo
-*.la
diff --git a/addressbook/gui/merging/Makefile.am b/addressbook/gui/merging/Makefile.am
deleted file mode 100644
index 5a00726f26..0000000000
--- a/addressbook/gui/merging/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-INCLUDES = \
- -DG_LOG_DOMAIN=\"e-card-gui\" \
- -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
- -DEVOLUTION_DATADIR=\""$(datadir)"\" \
- -I$(top_srcdir) \
- -I$(top_srcdir)/addressbook/backend/ebook \
- $(BONOBO_GNOME_CFLAGS) \
- $(EXTRA_GNOME_CFLAGS)
-
-noinst_LIBRARIES = \
- libecardmerging.a
-
-libecardmerging_a_SOURCES = \
- e-card-merging.c \
- e-card-merging.h
-
-
-gladedir = $(datadir)/evolution/glade
-glade_DATA = e-card-duplicate-detected.glade \
- e-card-merging-book-commit-duplicate-detected.glade
-
-EXTRA_DIST = \
- $(glade_DATA)
diff --git a/addressbook/gui/merging/e-card-duplicate-detected.glade b/addressbook/gui/merging/e-card-duplicate-detected.glade
deleted file mode 100644
index bc6624e8fd..0000000000
--- a/addressbook/gui/merging/e-card-duplicate-detected.glade
+++ /dev/null
@@ -1,255 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>e-card-duplicate-detected</name>
- <program_name>e-card-duplicate-detected</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <use_widget_names>True</use_widget_names>
- <output_main_file>False</output_main_file>
- <output_support_files>False</output_support_files>
- <output_build_files>False</output_build_files>
- <gnome_help_support>True</gnome_help_support>
-</project>
-
-<widget>
- <class>GnomeDialog</class>
- <name>dialog-duplicate-contact</name>
- <title>Duplicate Contact Detected</title>
- <type>GTK_WINDOW_POPUP</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area1</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button3</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Add Anyway</label>
- <stock_pixmap>GNOME_STOCK_PIXMAP_ADD</stock_pixmap>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button4</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkTable</class>
- <name>table1</name>
- <rows>5</rows>
- <columns>2</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>6</row_spacing>
- <column_spacing>6</column_spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>custom-old-card</name>
- <creation_function>e_card_merging_create_old_card</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Fri, 08 Jun 2001 01:33:22 GMT</last_modification_time>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label1</name>
- <label>The name or email address of this contact already exists
-in this folder. Would you like to add it anyway?</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label3</name>
- <label>Original Contact:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label4</name>
- <label>New Contact:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>Custom</class>
- <name>custom-new-card</name>
- <creation_function>e_card_merging_create_old_card</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Fri, 08 Jun 2001 01:33:22 GMT</last_modification_time>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment1</name>
- <xalign>0.5</xalign>
- <yalign>0</yalign>
- <xscale>1</xscale>
- <yscale>0</yscale>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>5</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>custom2</name>
- <creation_function>e_create_image_widget</creation_function>
- <string1>malehead.png</string1>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Fri, 08 Jun 2001 00:18:39 GMT</last_modification_time>
- </widget>
- </widget>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/addressbook/gui/merging/e-card-merging-book-commit-duplicate-detected.glade b/addressbook/gui/merging/e-card-merging-book-commit-duplicate-detected.glade
deleted file mode 100644
index 2008fb7757..0000000000
--- a/addressbook/gui/merging/e-card-merging-book-commit-duplicate-detected.glade
+++ /dev/null
@@ -1,255 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>e-card-merging-book-commit-duplicate-detected</name>
- <program_name>e-card-merging-book-commit-duplicate-detected</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <use_widget_names>True</use_widget_names>
- <output_main_file>False</output_main_file>
- <output_support_files>False</output_support_files>
- <output_build_files>False</output_build_files>
- <gnome_help_support>True</gnome_help_support>
-</project>
-
-<widget>
- <class>GnomeDialog</class>
- <name>dialog-duplicate-contact</name>
- <title>Duplicate Contact Detected</title>
- <type>GTK_WINDOW_POPUP</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area1</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button3</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>_Change Anyway</label>
- <stock_pixmap>GNOME_STOCK_PIXMAP_ADD</stock_pixmap>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button4</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkTable</class>
- <name>table1</name>
- <rows>5</rows>
- <columns>2</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>6</row_spacing>
- <column_spacing>6</column_spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>custom-old-card</name>
- <creation_function>e_card_merging_create_old_card</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Fri, 08 Jun 2001 01:33:22 GMT</last_modification_time>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label1</name>
- <label>The changed email or name of this contact already
-exists in this folder. Would you like to add it anyway?</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label3</name>
- <label>Conflicting Contact:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label4</name>
- <label>Changed Contact:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>Custom</class>
- <name>custom-new-card</name>
- <creation_function>e_card_merging_create_old_card</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Fri, 08 Jun 2001 01:33:22 GMT</last_modification_time>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment1</name>
- <xalign>0.5</xalign>
- <yalign>0</yalign>
- <xscale>1</xscale>
- <yscale>0</yscale>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>5</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>custom2</name>
- <creation_function>e_create_image_widget</creation_function>
- <string1>malehead.png</string1>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Fri, 08 Jun 2001 00:18:39 GMT</last_modification_time>
- </widget>
- </widget>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/addressbook/gui/merging/e-card-merging.c b/addressbook/gui/merging/e-card-merging.c
deleted file mode 100644
index d18c14f5bf..0000000000
--- a/addressbook/gui/merging/e-card-merging.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Code for checking for duplicates when doing ECard work.
- *
- * Author:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * Copyright 2001, Ximian, Inc.
- */
-
-#include <config.h>
-
-#include "e-card-merging.h"
-#include <libgnomeui/gnome-dialog.h>
-#include "e-card-compare.h"
-#include <glade/glade.h>
-#include <gtk/gtksignal.h>
-#include "addressbook/gui/widgets/e-minicard-widget.h"
-
-typedef enum {
- E_CARD_MERGING_ADD,
- E_CARD_MERGING_COMMIT
-} ECardMergingOpType;
-
-typedef struct {
- ECardMergingOpType op;
- EBook *book;
- ECard *card;
- EBookIdCallback id_cb;
- EBookCallback cb;
- gpointer closure;
-} ECardMergingLookup;
-
-static void
-doit (ECardMergingLookup *lookup)
-{
- if (lookup->op == E_CARD_MERGING_ADD)
- e_book_add_card (lookup->book, lookup->card, lookup->id_cb, lookup->closure);
- else if (lookup->op == E_CARD_MERGING_COMMIT)
- e_book_commit_card (lookup->book, lookup->card, lookup->cb, lookup->closure);
-}
-
-static void
-cancelit (ECardMergingLookup *lookup)
-{
- if (lookup->op == E_CARD_MERGING_ADD) {
- if (lookup->id_cb)
- lookup->id_cb (lookup->book, E_BOOK_STATUS_CANCELLED, NULL, lookup->closure);
- } else if (lookup->op == E_CARD_MERGING_COMMIT) {
- if (lookup->cb)
- lookup->cb (lookup->book, E_BOOK_STATUS_CANCELLED, lookup->closure);
- }
-}
-
-static void
-clicked (GnomeDialog *dialog, int button, ECardMergingLookup *lookup)
-{
- switch (button) {
- case 0:
- doit (lookup);
- break;
- case 1:
- cancelit (lookup);
- break;
- }
- g_free (lookup);
- gnome_dialog_close (dialog);
-}
-
-static void
-match_query_callback (ECard *card, ECard *match, ECardMatchType type, gpointer closure)
-{
- ECardMergingLookup *lookup = closure;
- if ((gint) type <= (gint) E_CARD_MATCH_VAGUE) {
- doit (lookup);
- g_free (lookup);
- } else {
- GladeXML *ui;
-
- GtkWidget *widget;
-
- if (lookup->op == E_CARD_MERGING_ADD)
- ui = glade_xml_new (EVOLUTION_GLADEDIR "/e-card-duplicate-detected.glade", NULL);
- else if (lookup->op == E_CARD_MERGING_COMMIT)
- ui = glade_xml_new (EVOLUTION_GLADEDIR "/e-card-merging-book-commit-duplicate-detected.glade", NULL);
- else {
- doit (lookup);
- g_free (lookup);
- return;
- }
-
- widget = glade_xml_get_widget (ui, "custom-old-card");
- gtk_object_set (GTK_OBJECT (widget),
- "card", match,
- NULL);
-
- widget = glade_xml_get_widget (ui, "custom-new-card");
- gtk_object_set (GTK_OBJECT (widget),
- "card", card,
- NULL);
-
- widget = glade_xml_get_widget (ui, "dialog-duplicate-contact");
-
- gtk_signal_connect (GTK_OBJECT (widget), "clicked",
- GTK_SIGNAL_FUNC (clicked), lookup);
- }
-}
-
-gboolean
-e_card_merging_book_add_card (EBook *book,
- ECard *card,
- EBookIdCallback cb,
- gpointer closure)
-{
- ECardMergingLookup *lookup;
- lookup = g_new (ECardMergingLookup, 1);
-
- lookup->op = E_CARD_MERGING_ADD;
- lookup->book = book;
- lookup->card = card;
- lookup->id_cb = cb;
- lookup->closure = closure;
-
- e_card_locate_match_full (book, card, NULL, match_query_callback, lookup);
- return TRUE;
-}
-
-gboolean
-e_card_merging_book_commit_card (EBook *book,
- ECard *card,
- EBookCallback cb,
- gpointer closure)
-{
- ECardMergingLookup *lookup;
- GList *avoid;
- lookup = g_new (ECardMergingLookup, 1);
-
- lookup->op = E_CARD_MERGING_COMMIT;
- lookup->book = book;
- lookup->card = card;
- lookup->cb = cb;
- lookup->closure = closure;
-
- avoid = g_list_append (NULL, card);
-
- e_card_locate_match_full (book, card, avoid, match_query_callback, lookup);
-
- g_list_free (avoid);
-
- return TRUE;
-}
-
-GtkWidget *
-e_card_merging_create_old_card(gchar *name,
- gchar *string1, gchar *string2,
- gint int1, gint int2);
-
-GtkWidget *
-e_card_merging_create_old_card(gchar *name,
- gchar *string1, gchar *string2,
- gint int1, gint int2)
-{
- return e_minicard_widget_new ();
-}
diff --git a/addressbook/gui/merging/e-card-merging.h b/addressbook/gui/merging/e-card-merging.h
deleted file mode 100644
index c4d9483beb..0000000000
--- a/addressbook/gui/merging/e-card-merging.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * The Evolution addressbook client object.
- *
- * Author:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * Copyright 2001, Ximian, Inc.
- */
-
-#ifndef __E_CARD_MERGING_H__
-#define __E_CARD_MERGING_H__
-
-#include <libgnome/gnome-defs.h>
-
-#include <addressbook/backend/ebook/e-book.h>
-
-BEGIN_GNOME_DECLS
-
-gboolean e_card_merging_book_add_card (EBook *book,
- ECard *card,
- EBookIdCallback cb,
- gpointer closure);
-gboolean e_card_merging_book_commit_card (EBook *book,
- ECard *card,
- EBookCallback cb,
- gpointer closure);
-
-END_GNOME_DECLS
-
-#endif /* ! __E_CARD_MERGING_H__ */
diff --git a/addressbook/gui/search/.cvsignore b/addressbook/gui/search/.cvsignore
deleted file mode 100644
index d6c55c7345..0000000000
--- a/addressbook/gui/search/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-.deps
-.libs
-.pure
-Makefile
-Makefile.in
-*.lo
-*.la
diff --git a/addressbook/gui/search/Makefile.am b/addressbook/gui/search/Makefile.am
deleted file mode 100644
index d5f3602bbb..0000000000
--- a/addressbook/gui/search/Makefile.am
+++ /dev/null
@@ -1,24 +0,0 @@
-ruledir = $(datadir)/evolution
-rule_DATA = addresstypes.xml
-
-EXTRA_DIST = addresstypes.xml
-
-INCLUDES = \
- -DG_LOG_DOMAIN=\"e-addressbook-search\" \
- -I$(top_srcdir) \
- -I$(top_srcdir)/addressbook/backend \
- -I$(top_builddir)/addressbook/backend \
- -I$(top_srcdir)/addressbook/contact-editor \
- -I$(top_srcdir)/widgets/e-text \
- -I$(top_srcdir)/widgets/misc \
- -I$(top_builddir)/shell \
- -DSEARCH_RULE_DIR=\"$(ruledir)\" \
- $(BONOBO_GNOME_CFLAGS) \
- $(EXTRA_GNOME_CFLAGS)
-
-noinst_LIBRARIES = \
- libeaddressbooksearch.a
-
-libeaddressbooksearch_a_SOURCES = \
- e-addressbook-search-dialog.c \
- e-addressbook-search-dialog.h
diff --git a/addressbook/gui/search/addresstypes.xml b/addressbook/gui/search/addresstypes.xml
deleted file mode 100644
index 4ee23af613..0000000000
--- a/addressbook/gui/search/addresstypes.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0"?>
-<filterdescription>
-<partset>
- <part name="name">
- <title>Name</title>
- <input type="optionlist" name="name-type">
- <option value="contains">
- <title>contains</title>
- <code>(contains "full_name" ${name})</code>
- </option>
- <option value="not contains">
- <title>does not contain</title>
- <code>(not (contains "full_name" ${name}))</code>
- </option>
- <option value="is">
- <title>is</title>
- <code>(is "full_name" ${name})))</code>
- </option>
- <option value="is not">
- <title>is not</title>
- <code>(not (is "full_name" ${name}))</code>
- </option>
- <option value="begin">
- <title>begins with</title>
- <code>(beginswith "full_name" ${name})</code>
- </option>
- <option value="end">
- <title>ends in</title>
- <code>(endswith "full_name" ${name})</code>
- </option>
- </input>
- <input type="string" name="name"/>
- </part>
- <part name="email">
- <title>Email</title>
- <input type="optionlist" name="email-type">
- <option value="contains">
- <title>contains</title>
- <code>(contains "email" ${email})</code>
- </option>
- <option value="not contains">
- <title>does not contain</title>
- <code>(not (contains "email" ${email}))</code>
- </option>
- <option value="is">
- <title>is</title>
- <code>(is "email" ${email})</code>
- </option>
- <option value="is not">
- <title>is not</title>
- <code>(not (is "email" ${email}))</code>
- </option>
- </input>
- <input type="address" name="email"/>
- </part>
- <part name="category">
- <title>Category</title>
- <input type="optionlist" name="category-type">
- <option value="contains">
- <title>contains</title>
- <code>(contains "category" ${category})</code>
- </option>
- <option value="not contains">
- <title>does not contain</title>
- <code>(not (contains "category" ${category}))</code>
- </option>
- <option value="is">
- <title>is</title>
- <code>(is "category" ${category})</code>
- </option>
- <option value="is not">
- <title>is not</title>
- <code>(not (is "category" ${category}))</code>
- </option>
- </input>
- <input type="string" name="category"/>
- </part>
- <part name="sexp">
- <title>Expression</title>
- <input type="code" name="code"/>
- </part>
-</partset>
-</filterdescription>
diff --git a/addressbook/gui/search/e-addressbook-search-dialog.c b/addressbook/gui/search/e-addressbook-search-dialog.c
deleted file mode 100644
index 5450fb5b73..0000000000
--- a/addressbook/gui/search/e-addressbook-search-dialog.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-addressbook-search-dialog.c
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <gtk/gtkbox.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtksignal.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-stock.h>
-#include <gal/widgets/e-canvas.h>
-#include <gal/widgets/e-scroll-frame.h>
-
-#include "e-addressbook-search-dialog.h"
-#include "addressbook/gui/widgets/e-minicard-view-widget.h"
-
-
-static void e_addressbook_search_dialog_init (EAddressbookSearchDialog *widget);
-static void e_addressbook_search_dialog_class_init (EAddressbookSearchDialogClass *klass);
-static void e_addressbook_search_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_addressbook_search_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_addressbook_search_dialog_destroy (GtkObject *object);
-
-static ECanvasClass *parent_class = NULL;
-
-#define PARENT_TYPE (gnome_dialog_get_type())
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_BOOK,
-};
-
-GtkType
-e_addressbook_search_dialog_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type)
- {
- static const GtkTypeInfo info =
- {
- "EAddressbookSearchDialog",
- sizeof (EAddressbookSearchDialog),
- sizeof (EAddressbookSearchDialogClass),
- (GtkClassInitFunc) e_addressbook_search_dialog_class_init,
- (GtkObjectInitFunc) e_addressbook_search_dialog_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-static void
-e_addressbook_search_dialog_class_init (EAddressbookSearchDialogClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) klass;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- gtk_object_add_arg_type ("EAddressbookSearchDialog::book", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_BOOK);
-
- object_class->set_arg = e_addressbook_search_dialog_set_arg;
- object_class->get_arg = e_addressbook_search_dialog_get_arg;
- object_class->destroy = e_addressbook_search_dialog_destroy;
-}
-
-static GtkWidget *
-get_widget (EAddressbookSearchDialog *view)
-{
- FilterPart *part;
-
- view->context = rule_context_new();
- /* FIXME: hide this in a class */
- rule_context_add_part_set(view->context, "partset", filter_part_get_type(),
- rule_context_add_part, rule_context_next_part);
- rule_context_load(view->context, SEARCH_RULE_DIR "/addresstypes.xml", "");
- view->rule = filter_rule_new();
- part = rule_context_next_part(view->context, NULL);
- if (part == NULL) {
- g_warning("Problem loading search for addressbook no parts to load");
- return gtk_entry_new();
- } else {
- filter_rule_add_part(view->rule, filter_part_clone(part));
- return filter_rule_get_widget(view->rule, view->context);
- }
-}
-
-static char *
-get_query (EAddressbookSearchDialog *view)
-{
- GString *out = g_string_new("");
- char *ret;
-
- filter_rule_build_code(view->rule, out);
- ret = out->str;
- printf("Searching using %s\n", ret);
- g_string_free(out, FALSE);
- return ret;
-}
-
-static void
-button_press (GtkWidget *widget, int button, EAddressbookSearchDialog *dialog)
-{
- char *query;
-
- if (button == 0) {
- query = get_query(dialog);
- gtk_object_set(GTK_OBJECT(dialog->model),
- "query", query,
- NULL);
- g_free(query);
- }
- else
- gnome_dialog_close(GNOME_DIALOG (dialog));
-}
-
-static void
-e_addressbook_search_dialog_init (EAddressbookSearchDialog *view)
-{
- GnomeDialog *dialog = GNOME_DIALOG (view);
-
- gtk_window_set_policy(GTK_WINDOW(view), FALSE, TRUE, FALSE);
-
- view->search = get_widget(view);
- gtk_box_pack_start(GTK_BOX(dialog->vbox), view->search, FALSE, FALSE, 0);
- gtk_widget_show(view->search);
-
- gnome_dialog_append_buttons(dialog,
- _("Search"),
- GNOME_STOCK_BUTTON_CLOSE, NULL);
-
- gnome_dialog_set_default(dialog, 0);
-
- gtk_signal_connect(GTK_OBJECT(dialog), "clicked",
- GTK_SIGNAL_FUNC(button_press), view);
-
- view->model = e_addressbook_model_new ();
- view->adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(e_addressbook_reflow_adapter_new (view->model));
- view->view = e_minicard_view_widget_new(view->adapter);
- gtk_widget_show(view->view);
-
- view->scrolled_window = e_scroll_frame_new(NULL, NULL);
- e_scroll_frame_set_policy(E_SCROLL_FRAME(view->scrolled_window),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER);
- gtk_container_add(GTK_CONTAINER(view->scrolled_window), view->view);
-
- gtk_widget_show(view->scrolled_window);
-
- gtk_box_pack_start(GTK_BOX(dialog->vbox), view->scrolled_window, TRUE, TRUE, 0);
-}
-
-GtkWidget *
-e_addressbook_search_dialog_new (EBook *book)
-{
- EAddressbookSearchDialog *view = gtk_type_new (e_addressbook_search_dialog_get_type ());
- gtk_object_set(GTK_OBJECT(view->model),
- "book", book,
- NULL);
- return GTK_WIDGET(view);
-}
-
-static void
-e_addressbook_search_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- EAddressbookSearchDialog *emvw;
-
- emvw = E_ADDRESSBOOK_SEARCH_DIALOG (o);
-
- switch (arg_id){
- case ARG_BOOK:
- gtk_object_set(GTK_OBJECT(emvw->model),
- "book", GTK_VALUE_OBJECT (*arg),
- NULL);
- break;
- }
-}
-
-static void
-e_addressbook_search_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EAddressbookSearchDialog *emvw;
-
- emvw = E_ADDRESSBOOK_SEARCH_DIALOG (object);
-
- switch (arg_id) {
- case ARG_BOOK:
- gtk_object_get(GTK_OBJECT(emvw->model),
- "book", &(GTK_VALUE_OBJECT (*arg)),
- NULL);
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-e_addressbook_search_dialog_destroy (GtkObject *object)
-{
- EAddressbookSearchDialog *view;
-
- view = E_ADDRESSBOOK_SEARCH_DIALOG (object);
-
- gtk_object_unref((GtkObject *)view->model);
- gtk_object_unref((GtkObject *)view->adapter);
- gtk_object_unref((GtkObject *)view->context);
- gtk_object_unref((GtkObject *)view->rule);
-
- GTK_OBJECT_CLASS(parent_class)->destroy (object);
-}
diff --git a/addressbook/gui/search/e-addressbook-search-dialog.h b/addressbook/gui/search/e-addressbook-search-dialog.h
deleted file mode 100644
index 9bc4c6ac18..0000000000
--- a/addressbook/gui/search/e-addressbook-search-dialog.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-minicard-view-widget.h
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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_ADDRESSBOOK_SEARCH_DIALOG_H__
-#define __E_ADDRESSBOOK_SEARCH_DIALOG_H__
-
-#include <ebook/e-book.h>
-
-#include "addressbook/gui/widgets/e-addressbook-model.h"
-#include "addressbook/gui/widgets/e-addressbook-reflow-adapter.h"
-#include "filter/rule-context.h"
-#include "filter/filter-rule.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#include <libgnomeui/gnome-dialog.h>
-
-#define E_ADDRESSBOOK_SEARCH_DIALOG_TYPE (e_addressbook_search_dialog_get_type ())
-#define E_ADDRESSBOOK_SEARCH_DIALOG(obj) (GTK_CHECK_CAST ((obj), E_ADDRESSBOOK_SEARCH_DIALOG_TYPE, EAddressbookSearchDialog))
-#define E_ADDRESSBOOK_SEARCH_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_ADDRESSBOOK_SEARCH_DIALOG_TYPE, EAddressbookSearchDialogClass))
-#define E_IS_ADDRESSBOOK_SEARCH_DIALOG(obj) (GTK_CHECK_TYPE ((obj), E_ADDRESSBOOK_SEARCH_DIALOG_TYPE))
-#define E_IS_ADDRESSBOOK_SEARCH_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_ADDRESSBOOK_SEARCH_DIALOG_TYPE))
-
-
-typedef struct _EAddressbookSearchDialog EAddressbookSearchDialog;
-typedef struct _EAddressbookSearchDialogClass EAddressbookSearchDialogClass;
-
-struct _EAddressbookSearchDialog
-{
- GnomeDialog parent;
-
- GtkWidget *search;
- GtkWidget *view;
-
- EAddressbookModel *model;
- EAddressbookReflowAdapter *adapter;
-
- RuleContext *context;
- FilterRule *rule;
- GtkWidget *scrolled_window;
-};
-
-struct _EAddressbookSearchDialogClass
-{
- GnomeDialogClass parent_class;
-};
-
-GtkType e_addressbook_search_dialog_get_type (void);
-
-GtkWidget *e_addressbook_search_dialog_new (EBook *book);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __E_ADDRESSBOOK_SEARCH_DIALOG_H__ */
diff --git a/addressbook/gui/widgets/.cvsignore b/addressbook/gui/widgets/.cvsignore
deleted file mode 100644
index 472fd2593f..0000000000
--- a/addressbook/gui/widgets/.cvsignore
+++ /dev/null
@@ -1,12 +0,0 @@
-.deps
-.libs
-.pure
-Makefile
-Makefile.in
-*.lo
-*.la
-minicard-label-test
-minicard-test
-minicard-view-test
-minicard-widget-test
-reflow-test
diff --git a/addressbook/gui/widgets/Makefile.am b/addressbook/gui/widgets/Makefile.am
deleted file mode 100644
index f031b284e5..0000000000
--- a/addressbook/gui/widgets/Makefile.am
+++ /dev/null
@@ -1,140 +0,0 @@
-INCLUDES = \
- -DG_LOG_DOMAIN=\"e-minicard\" \
- -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
- -DEVOLUTION_DATADIR=\""$(datadir)"\" \
- -DEVOLUTION_IMAGESDIR=\""$(datadir)"/images/evolution\" \
- -I$(top_srcdir) \
- -I$(top_srcdir)/addressbook/backend/ebook \
- -I$(top_srcdir)/addressbook/gui/contact-editor \
- -I$(top_srcdir)/addressbook/gui/merging \
- -I$(top_srcdir)/widgets/misc \
- -I$(top_builddir)/shell \
- $(BONOBO_GNOME_CFLAGS) \
- $(EXTRA_GNOME_CFLAGS)
-
-noinst_LIBRARIES = \
- libeminicard.a
-
-libeminicard_a_SOURCES = \
- e-addressbook-reflow-adapter.c \
- e-addressbook-reflow-adapter.h \
- e-addressbook-table-adapter.c \
- e-addressbook-table-adapter.h \
- e-addressbook-model.c \
- e-addressbook-model.h \
- e-addressbook-util.c \
- e-addressbook-util.h \
- e-addressbook-view.c \
- e-addressbook-view.h \
- e-minicard-control.c \
- e-minicard-control.h \
- e-minicard-label.c \
- e-minicard-label.h \
- e-minicard-view-widget.c \
- e-minicard-view-widget.h \
- e-minicard-view.c \
- e-minicard-view.h \
- e-minicard-widget.c \
- e-minicard-widget.h \
- e-minicard.c \
- e-minicard.h \
- gal-view-factory-minicard.c \
- gal-view-factory-minicard.h \
- gal-view-minicard.c \
- gal-view-minicard.h
-
-#noinst_PROGRAMS = \
-# minicard-widget-test \
-# minicard-label-test \
-# minicard-test
-## reflow-test
-## minicard-view-test
-#
-#minicard_label_test_SOURCES = \
-# test-minicard-label.c
-#
-#minicard_label_test_LDADD = \
-# libeminicard.a \
-# $(EXTRA_GNOME_LIBS) \
-# $(BONOBO_GNOME_LIBS) \
-# $(top_builddir)/e-util/libeutil.la
-#
-#minicard_test_SOURCES = \
-# test-minicard.c
-#
-#minicard_test_LDADD = \
-# libeminicard.a \
-# $(top_builddir)/addressbook/backend/ebook/libebook.la \
-# $(top_builddir)/e-util/libeutil.la \
-# $(top_builddir)/libversit/libversit.la \
-# $(top_builddir)/e-util/ename/libename.la \
-# $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.a \
-# $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.a \
-# $(top_builddir)/addressbook/printing/libecontactprint.a \
-# $(top_builddir)/addressbook/gui/merging/libecardmerging.a \
-# $(top_builddir)/widgets/misc/libemiscwidgets.a \
-# $(top_builddir)/addressbook/gui/component/select-names/libeselectnames.la \
-# $(top_builddir)/e-util/libeutil.la \
-# $(EXTRA_GNOME_LIBS) \
-# $(BONOBO_GNOME_LIBS) \
-# $(GNOME_PRINT_LIBS) \
-# libeminicard.a
-#
-#reflow_test_SOURCES = \
-# test-reflow.c
-#
-#reflow_test_LDADD = \
-# libeminicard.a \
-# $(top_builddir)/addressbook/backend/ebook/libebook.la \
-# $(top_builddir)/e-util/libeutil.la \
-# $(top_builddir)/libversit/libversit.la \
-# $(top_builddir)/e-util/ename/libename.la \
-# $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \
-# $(top_builddir)/addressbook/printing/libecontactprint.a \
-# $(top_builddir)/widgets/misc/libemiscwidgets.a \
-# $(top_builddir)/e-util/libeutil.la \
-# $(EXTRA_GNOME_LIBS) \
-# $(BONOBO_GNOME_LIBS) \
-# $(GNOME_PRINT_LIBS)
-
-#minicard_view_test_SOURCES = \
-# test-minicard-view.c
-
-#minicard_view_test_LDADD = \
-# $(EXTRA_GNOME_LIBS) \
-# $(BONOBO_GNOME_LIBS) \
-# libeminicard.a \
-# $(top_builddir)/addressbook/backend/ebook/libebook.la \
-# $(top_builddir)/e-util/libeutil.la \
-# $(top_builddir)/libversit/libversit.la \
-# $(top_builddir)/addressbook/ename/libename.la \
-# $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \
-# $(top_builddir)/addressbook/printing/libecontactprint.a \
-# $(top_builddir)/widgets/misc/libemiscwidgets.a \
-# $(top_builddir)/e-util/libeutil.la
-#
-#minicard_widget_test_SOURCES = \
-# e-minicard-widget-test.c
-#
-#minicard_widget_test_LDADD = \
-# libeminicard.a \
-# $(top_builddir)/addressbook/backend/ebook/libebook.la \
-# $(top_builddir)/e-util/libeutil.la \
-# $(top_builddir)/libversit/libversit.la \
-# $(top_builddir)/e-util/ename/libename.la \
-# $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.a \
-# $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.a \
-# $(top_builddir)/addressbook/gui/component/select-names/libeselectnames.la \
-# $(top_builddir)/addressbook/printing/libecontactprint.a \
-# $(top_builddir)/widgets/misc/libemiscwidgets.a \
-# $(top_builddir)/e-util/libeutil.la \
-# $(top_builddir)/addressbook/gui/merging/libecardmerging.a \
-# $(EXTRA_GNOME_LIBS) \
-# $(BONOBO_GNOME_LIBS) \
-# $(GNOME_PRINT_LIBS)
-
-gladedir = $(datadir)/evolution/glade
-glade_DATA = alphabet.glade
-
-EXTRA_DIST = \
- $(glade_DATA)
diff --git a/addressbook/gui/widgets/alphabet.glade b/addressbook/gui/widgets/alphabet.glade
deleted file mode 100644
index dc6ee33966..0000000000
--- a/addressbook/gui/widgets/alphabet.glade
+++ /dev/null
@@ -1,355 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>alphabet</name>
- <program_name>alphabet</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <use_widget_names>True</use_widget_names>
- <output_main_file>False</output_main_file>
- <output_support_files>False</output_support_files>
- <output_build_files>False</output_build_files>
- <gnome_help_support>True</gnome_help_support>
-</project>
-
-<widget>
- <class>GtkWindow</class>
- <name>window2</name>
- <visible>False</visible>
- <title>window2</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
-
- <widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow-top</name>
- <hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
- <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
- <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
- <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
-
- <widget>
- <class>GtkViewport</class>
- <name>viewport1</name>
- <border_width>4</border_width>
- <shadow_type>GTK_SHADOW_NONE</shadow_type>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox2</name>
- <width>27</width>
- <homogeneous>False</homogeneous>
- <spacing>4</spacing>
-
- <widget>
- <class>GtkButton</class>
- <name>button-1</name>
- <label>123</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-a</name>
- <label>a</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-b</name>
- <label>b</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-c</name>
- <label>c</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-d</name>
- <label>d</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-e</name>
- <label>e</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-f</name>
- <label>f</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-g</name>
- <label>g</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-h</name>
- <label>h</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-i</name>
- <label>i</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-j</name>
- <label>j</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-k</name>
- <label>k</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-l</name>
- <label>l</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-m</name>
- <label>m</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-n</name>
- <label>n</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-o</name>
- <label>o</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-p</name>
- <label>p</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-q</name>
- <label>q</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-r</name>
- <label>r</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-s</name>
- <label>s</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-t</name>
- <label>t</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-u</name>
- <label>u</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-v</name>
- <label>v</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-w</name>
- <can_focus>True</can_focus>
- <label>w</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-x</name>
- <label>x</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-y</name>
- <label>y</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-z</name>
- <label>z</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
deleted file mode 100644
index a44c066d4f..0000000000
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ /dev/null
@@ -1,522 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- *
- * Author:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * (C) 1999 Ximian, Inc.
- */
-
-#include <config.h>
-#include "e-addressbook-model.h"
-#include <gnome-xml/tree.h>
-#include <gnome-xml/parser.h>
-#include <gnome-xml/xmlmemory.h>
-#include <gnome.h>
-
-#define PARENT_TYPE gtk_object_get_type()
-GtkObjectClass *parent_class;
-
-/*
- * EAddressbookModel callbacks
- * These are the callbacks that define the behavior of our custom model.
- */
-static void e_addressbook_model_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_addressbook_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-
-
-enum {
- ARG_0,
- ARG_BOOK,
- ARG_QUERY,
- ARG_EDITABLE,
-};
-
-enum {
- WRITABLE_STATUS,
- STATUS_MESSAGE,
- CARD_ADDED,
- CARD_REMOVED,
- CARD_CHANGED,
- MODEL_CHANGED,
- STOP_STATE_CHANGED,
- LAST_SIGNAL
-};
-
-#define COLS (E_CARD_SIMPLE_FIELD_LAST)
-
-static guint e_addressbook_model_signals [LAST_SIGNAL] = {0, };
-
-static void
-remove_book_view(EAddressbookModel *model)
-{
- if (model->book_view && model->create_card_id)
- gtk_signal_disconnect(GTK_OBJECT (model->book_view),
- model->create_card_id);
- if (model->book_view && model->remove_card_id)
- gtk_signal_disconnect(GTK_OBJECT (model->book_view),
- model->remove_card_id);
- if (model->book_view && model->modify_card_id)
- gtk_signal_disconnect(GTK_OBJECT (model->book_view),
- model->modify_card_id);
- if (model->book_view && model->status_message_id)
- gtk_signal_disconnect(GTK_OBJECT (model->book_view),
- model->status_message_id);
- if (model->book_view && model->sequence_complete_id)
- gtk_signal_disconnect(GTK_OBJECT (model->book_view),
- model->sequence_complete_id);
-
- model->create_card_id = 0;
- model->remove_card_id = 0;
- model->modify_card_id = 0;
- model->status_message_id = 0;
- model->sequence_complete_id = 0;
-
- model->search_in_progress = FALSE;
-
- if (model->book_view)
- gtk_object_unref(GTK_OBJECT(model->book_view));
-
- model->book_view = NULL;
-}
-
-static void
-addressbook_destroy(GtkObject *object)
-{
- EAddressbookModel *model = E_ADDRESSBOOK_MODEL(object);
- int i;
-
- if (model->get_view_idle)
- g_source_remove(model->get_view_idle);
-
- remove_book_view(model);
-
- if (model->book) {
- if (model->writable_status_id)
- gtk_signal_disconnect(GTK_OBJECT (model->book),
- model->writable_status_id);
-
- model->writable_status_id = 0;
-
- gtk_object_unref(GTK_OBJECT(model->book));
- }
-
- for ( i = 0; i < model->data_count; i++ ) {
- gtk_object_unref(GTK_OBJECT(model->data[i]));
- }
- g_free(model->data);
-}
-
-static void
-create_card(EBookView *book_view,
- const GList *cards,
- EAddressbookModel *model)
-{
- int old_count = model->data_count;
- int length = g_list_length ((GList *)cards);
-
- if (model->data_count + length > model->allocated_count) {
- while (model->data_count + length > model->allocated_count)
- model->allocated_count += 256;
- model->data = g_renew(ECard *, model->data, model->allocated_count);
- }
-
- for ( ; cards; cards = cards->next) {
- model->data[model->data_count++] = cards->data;
- gtk_object_ref (cards->data);
- }
-
- gtk_signal_emit (GTK_OBJECT (model),
- e_addressbook_model_signals [CARD_ADDED],
- old_count, model->data_count - old_count);
-}
-
-static void
-remove_card(EBookView *book_view,
- const char *id,
- EAddressbookModel *model)
-{
- int i;
-
- for ( i = 0; i < model->data_count; i++) {
- if ( !strcmp(e_card_get_id(model->data[i]), id) ) {
- gtk_object_unref(GTK_OBJECT(model->data[i]));
- memmove(model->data + i, model->data + i + 1, (model->data_count - i - 1) * sizeof (ECard *));
- model->data_count--;
-
- gtk_signal_emit (GTK_OBJECT (model),
- e_addressbook_model_signals [CARD_REMOVED],
- i);
- break;
- }
- }
-}
-
-static void
-modify_card(EBookView *book_view,
- const GList *cards,
- EAddressbookModel *model)
-{
- for ( ; cards; cards = cards->next) {
- int i;
- for ( i = 0; i < model->data_count; i++) {
- if ( !strcmp(e_card_get_id(model->data[i]), e_card_get_id(E_CARD(cards->data))) ) {
- gtk_object_unref(GTK_OBJECT(model->data[i]));
- model->data[i] = e_card_duplicate(E_CARD(cards->data));
- gtk_object_ref(GTK_OBJECT(model->data[i]));
- gtk_signal_emit (GTK_OBJECT (model),
- e_addressbook_model_signals [CARD_CHANGED],
- i);
- break;
- }
- }
- }
-}
-
-static void
-status_message (EBookView *book_view,
- char* status,
- EAddressbookModel *model)
-{
- gtk_signal_emit (GTK_OBJECT (model),
- e_addressbook_model_signals [STATUS_MESSAGE],
- status);
-}
-
-static void
-sequence_complete (EBookView *book_view,
- EAddressbookModel *model)
-{
- model->search_in_progress = FALSE;
- gtk_signal_emit (GTK_OBJECT (model),
- e_addressbook_model_signals [STOP_STATE_CHANGED]);
-}
-
-static void
-writable_status (EBook *book,
- gboolean writable,
- EAddressbookModel *model)
-{
- if (!model->editable_set) {
- model->editable = writable;
-
- gtk_signal_emit (GTK_OBJECT (model),
- e_addressbook_model_signals [WRITABLE_STATUS],
- writable);
- }
-}
-
-static void
-e_addressbook_model_class_init (GtkObjectClass *object_class)
-{
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->destroy = addressbook_destroy;
- object_class->set_arg = e_addressbook_model_set_arg;
- object_class->get_arg = e_addressbook_model_get_arg;
-
- gtk_object_add_arg_type ("EAddressbookModel::book", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_BOOK);
- gtk_object_add_arg_type ("EAddressbookModel::query", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_QUERY);
- gtk_object_add_arg_type ("EAddressbookModel::editable", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_EDITABLE);
-
- e_addressbook_model_signals [WRITABLE_STATUS] =
- gtk_signal_new ("writable_status",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EAddressbookModelClass, writable_status),
- gtk_marshal_NONE__BOOL,
- GTK_TYPE_NONE, 1, GTK_TYPE_BOOL);
-
- e_addressbook_model_signals [STATUS_MESSAGE] =
- gtk_signal_new ("status_message",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EAddressbookModelClass, status_message),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
-
- e_addressbook_model_signals [CARD_ADDED] =
- gtk_signal_new ("card_added",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EAddressbookModelClass, card_added),
- gtk_marshal_NONE__INT_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
-
- e_addressbook_model_signals [CARD_REMOVED] =
- gtk_signal_new ("card_removed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EAddressbookModelClass, card_removed),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- e_addressbook_model_signals [CARD_CHANGED] =
- gtk_signal_new ("card_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EAddressbookModelClass, card_changed),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- e_addressbook_model_signals [MODEL_CHANGED] =
- gtk_signal_new ("model_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EAddressbookModelClass, model_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_addressbook_model_signals [STOP_STATE_CHANGED] =
- gtk_signal_new ("stop_state_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EAddressbookModelClass, stop_state_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, e_addressbook_model_signals, LAST_SIGNAL);
-}
-
-static void
-e_addressbook_model_init (GtkObject *object)
-{
- EAddressbookModel *model = E_ADDRESSBOOK_MODEL(object);
- model->book = NULL;
- model->query = g_strdup("(contains \"x-evolution-any-field\" \"\")");
- model->book_view = NULL;
- model->get_view_idle = 0;
- model->create_card_id = 0;
- model->remove_card_id = 0;
- model->modify_card_id = 0;
- model->status_message_id = 0;
- model->writable_status_id = 0;
- model->sequence_complete_id = 0;
- model->data = NULL;
- model->data_count = 0;
- model->allocated_count = 0;
- model->search_in_progress = FALSE;
- model->editable = FALSE;
- model->editable_set = FALSE;
- model->first_get_view = TRUE;
-}
-
-static void
-book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointer closure)
-{
- EAddressbookModel *model = closure;
- int i;
- remove_book_view(model);
- model->book_view = book_view;
- if (model->book_view)
- gtk_object_ref(GTK_OBJECT(model->book_view));
- model->create_card_id = gtk_signal_connect(GTK_OBJECT(model->book_view),
- "card_added",
- GTK_SIGNAL_FUNC(create_card),
- model);
- model->remove_card_id = gtk_signal_connect(GTK_OBJECT(model->book_view),
- "card_removed",
- GTK_SIGNAL_FUNC(remove_card),
- model);
- model->modify_card_id = gtk_signal_connect(GTK_OBJECT(model->book_view),
- "card_changed",
- GTK_SIGNAL_FUNC(modify_card),
- model);
- model->status_message_id = gtk_signal_connect(GTK_OBJECT(model->book_view),
- "status_message",
- GTK_SIGNAL_FUNC(status_message),
- model);
- model->sequence_complete_id = gtk_signal_connect(GTK_OBJECT(model->book_view),
- "sequence_complete",
- GTK_SIGNAL_FUNC(sequence_complete),
- model);
-
- for ( i = 0; i < model->data_count; i++ ) {
- gtk_object_unref(GTK_OBJECT(model->data[i]));
- }
-
- g_free(model->data);
- model->data = NULL;
- model->data_count = 0;
- model->allocated_count = 0;
- model->search_in_progress = TRUE;
- gtk_signal_emit (GTK_OBJECT (model),
- e_addressbook_model_signals [MODEL_CHANGED]);
- gtk_signal_emit (GTK_OBJECT (model),
- e_addressbook_model_signals [STOP_STATE_CHANGED]);
-}
-
-static gboolean
-get_view (EAddressbookModel *model)
-{
- if (model->book && model->query) {
- if (model->first_get_view) {
- char *capabilities;
- capabilities = e_book_get_static_capabilities (model->book);
- if (capabilities && strstr (capabilities, "local")) {
- e_book_get_book_view (model->book, model->query, book_view_loaded, model);
- }
- model->first_get_view = FALSE;
- }
- else
- e_book_get_book_view (model->book, model->query, book_view_loaded, model);
- }
-
- model->get_view_idle = 0;
- return FALSE;
-}
-
-ECard *
-e_addressbook_model_get_card(EAddressbookModel *model,
- int row)
-{
- if (model->data && row < model->data_count) {
- ECard *card;
- card = e_card_duplicate (model->data[row]);
- gtk_object_ref (GTK_OBJECT (card));
- return card;
- }
- return NULL;
-}
-
-static void
-e_addressbook_model_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- EAddressbookModel *model;
-
- model = E_ADDRESSBOOK_MODEL (o);
-
- switch (arg_id){
- case ARG_BOOK:
- if (model->book) {
- if (model->writable_status_id)
- gtk_signal_disconnect(GTK_OBJECT (model->book),
- model->writable_status_id);
-
- model->writable_status_id = 0;
-
- gtk_object_unref(GTK_OBJECT(model->book));
- }
- model->book = E_BOOK(GTK_VALUE_OBJECT (*arg));
- if (model->book) {
- gtk_object_ref(GTK_OBJECT(model->book));
- if (model->get_view_idle == 0)
- model->get_view_idle = g_idle_add((GSourceFunc)get_view, model);
- gtk_signal_connect (GTK_OBJECT(model->book),
- "writable_status",
- writable_status, model);
- }
- break;
- case ARG_QUERY:
- if (model->query)
- g_free(model->query);
- model->query = g_strdup(GTK_VALUE_STRING (*arg));
- if (model->get_view_idle == 0)
- model->get_view_idle = g_idle_add((GSourceFunc)get_view, model);
- break;
- case ARG_EDITABLE:
- model->editable = GTK_VALUE_BOOL (*arg);
- model->editable_set = TRUE;
- break;
- }
-}
-
-static void
-e_addressbook_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EAddressbookModel *e_addressbook_model;
-
- e_addressbook_model = E_ADDRESSBOOK_MODEL (object);
-
- switch (arg_id) {
- case ARG_BOOK:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_addressbook_model->book);
- break;
- case ARG_QUERY:
- GTK_VALUE_STRING (*arg) = g_strdup(e_addressbook_model->query);
- break;
- case ARG_EDITABLE:
- GTK_VALUE_BOOL (*arg) = e_addressbook_model->editable;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-GtkType
-e_addressbook_model_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "EAddressbookModel",
- sizeof (EAddressbookModel),
- sizeof (EAddressbookModelClass),
- (GtkClassInitFunc) e_addressbook_model_class_init,
- (GtkObjectInitFunc) e_addressbook_model_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-EAddressbookModel*
-e_addressbook_model_new (void)
-{
- EAddressbookModel *et;
-
- et = gtk_type_new (e_addressbook_model_get_type ());
-
- return et;
-}
-
-void e_addressbook_model_stop (EAddressbookModel *model)
-{
- remove_book_view(model);
- model->search_in_progress = FALSE;
- gtk_signal_emit (GTK_OBJECT (model),
- e_addressbook_model_signals [STOP_STATE_CHANGED]);
- gtk_signal_emit (GTK_OBJECT (model),
- e_addressbook_model_signals [STATUS_MESSAGE],
- "Search Interrupted.");
-}
-
-gboolean
-e_addressbook_model_can_stop (EAddressbookModel *model)
-{
- return model->search_in_progress;
-}
-
-int
-e_addressbook_model_card_count (EAddressbookModel *model)
-{
- return model->data_count;
-}
-
-ECard *
-e_addressbook_model_card_at (EAddressbookModel *model, int index)
-{
- return model->data[index];
-}
-
-gboolean
-e_addressbook_model_editable (EAddressbookModel *model)
-{
- return model->editable;
-}
-
-EBook *
-e_addressbook_model_get_ebook (EAddressbookModel *model)
-{
- return model->book;
-}
diff --git a/addressbook/gui/widgets/e-addressbook-model.h b/addressbook/gui/widgets/e-addressbook-model.h
deleted file mode 100644
index a0956d7003..0000000000
--- a/addressbook/gui/widgets/e-addressbook-model.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#ifndef _E_ADDRESSBOOK_MODEL_H_
-#define _E_ADDRESSBOOK_MODEL_H_
-
-#include "addressbook/backend/ebook/e-book.h"
-#include "addressbook/backend/ebook/e-book-view.h"
-#include "addressbook/backend/ebook/e-card-simple.h"
-
-#define E_ADDRESSBOOK_MODEL_TYPE (e_addressbook_model_get_type ())
-#define E_ADDRESSBOOK_MODEL(o) (GTK_CHECK_CAST ((o), E_ADDRESSBOOK_MODEL_TYPE, EAddressbookModel))
-#define E_ADDRESSBOOK_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_ADDRESSBOOK_MODEL_TYPE, EAddressbookModelClass))
-#define E_IS_ADDRESSBOOK_MODEL(o) (GTK_CHECK_TYPE ((o), E_ADDRESSBOOK_MODEL_TYPE))
-#define E_IS_ADDRESSBOOK_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_ADDRESSBOOK_MODEL_TYPE))
-
-typedef struct _EAddressbookModel EAddressbookModel;
-typedef struct _EAddressbookModelClass EAddressbookModelClass;
-
-struct _EAddressbookModel {
- GtkObject parent;
-
- /* item specific fields */
- EBook *book;
- char *query;
- EBookView *book_view;
-
- int get_view_idle;
-
- ECard **data;
- int data_count;
- int allocated_count;
-
- int create_card_id, remove_card_id, modify_card_id, status_message_id, writable_status_id, sequence_complete_id;
-
- guint search_in_progress : 1;
- guint editable : 1;
- guint editable_set : 1;
- guint first_get_view : 1;
-};
-
-
-struct _EAddressbookModelClass {
- GtkObjectClass parent_class;
-
- /*
- * Signals
- */
- void (*writable_status) (EAddressbookModel *model, gboolean writable);
- void (*status_message) (EAddressbookModel *model, const gchar *message);
- void (*card_added) (EAddressbookModel *model, gint index, gint count);
- void (*card_removed) (EAddressbookModel *model, gint index);
- void (*card_changed) (EAddressbookModel *model, gint index);
- void (*model_changed) (EAddressbookModel *model);
- void (*stop_state_changed) (EAddressbookModel *model);
-};
-
-
-GtkType e_addressbook_model_get_type (void);
-EAddressbookModel *e_addressbook_model_new (void);
-
-/* Returns object with ref count of 1. */
-ECard *e_addressbook_model_get_card (EAddressbookModel *model,
- int row);
-EBook *e_addressbook_model_get_ebook (EAddressbookModel *model);
-
-void e_addressbook_model_stop (EAddressbookModel *model);
-gboolean e_addressbook_model_can_stop (EAddressbookModel *model);
-
-int e_addressbook_model_card_count (EAddressbookModel *model);
-ECard *e_addressbook_model_card_at (EAddressbookModel *model, int index);
-gboolean e_addressbook_model_editable (EAddressbookModel *model);
-
-#endif /* _E_ADDRESSBOOK_MODEL_H_ */
diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
deleted file mode 100644
index 04f17fd074..0000000000
--- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
+++ /dev/null
@@ -1,610 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-
-#include <config.h>
-
-#include "e-addressbook-reflow-adapter.h"
-#include "e-addressbook-model.h"
-
-#include <gal/util/e-i18n.h>
-
-#include "e-minicard.h"
-#include <gal/widgets/e-unicode.h>
-#include <gal/widgets/e-font.h>
-#include <gal/widgets/e-popup-menu.h>
-#include "e-contact-save-as.h"
-#include "addressbook/printing/e-contact-print.h"
-#include "addressbook/printing/e-contact-print-envelope.h"
-
-struct _EAddressbookReflowAdapterPrivate {
- EAddressbookModel *model;
-
- int create_card_id, remove_card_id, modify_card_id, model_changed_id;
-};
-
-#define PARENT_TYPE e_reflow_model_get_type()
-EReflowModel *parent_class;
-
-#define d(x)
-
-enum {
- ARG_0,
- ARG_BOOK,
- ARG_QUERY,
- ARG_EDITABLE,
-};
-
-enum {
- DRAG_BEGIN,
- LAST_SIGNAL
-};
-
-static guint e_addressbook_reflow_adapter_signals [LAST_SIGNAL] = {0, };
-
-static void
-unlink_model(EAddressbookReflowAdapter *adapter)
-{
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
-
- gtk_signal_disconnect(GTK_OBJECT (priv->model),
- priv->create_card_id);
- gtk_signal_disconnect(GTK_OBJECT (priv->model),
- priv->remove_card_id);
- gtk_signal_disconnect(GTK_OBJECT (priv->model),
- priv->modify_card_id);
-
- priv->create_card_id = 0;
- priv->remove_card_id = 0;
- priv->modify_card_id = 0;
-
- gtk_object_unref(GTK_OBJECT(priv->model));
-
- priv->model = NULL;
-}
-
-
-static int
-count_lines (const gchar *text)
-{
- int num_lines = 1;
- gunichar unival;
-
- for (text = e_unicode_get_utf8 (text, &unival); (unival && text); text = e_unicode_get_utf8 (text, &unival)) {
- if (unival == '\n') {
- num_lines ++;
- }
- }
-
- return num_lines;
-}
-
-static int
-text_height (GnomeCanvas *canvas, const gchar *text)
-{
- EFont *font = e_font_from_gdk_font (((GtkWidget *) canvas)->style->font);
- gint height = e_font_height (font) * count_lines (text) / canvas->pixels_per_unit;
-
- e_font_unref (font);
- return height;
-}
-
-typedef struct {
- EAddressbookReflowAdapter *adapter;
- ESelectionModel *selection;
-} ModelAndSelection;
-
-static void
-model_and_selection_free (ModelAndSelection *mns)
-{
- gtk_object_unref(GTK_OBJECT(mns->adapter));
- gtk_object_unref(GTK_OBJECT(mns->selection));
- g_free(mns);
-}
-
-static void
-add_to_list (int model_row, gpointer closure)
-{
- GList **list = closure;
- *list = g_list_prepend (*list, GINT_TO_POINTER (model_row));
-}
-
-static GList *
-get_card_list (ModelAndSelection *mns)
-{
- EAddressbookReflowAdapterPrivate *priv = mns->adapter->priv;
- GList *list;
- GList *iterator;
-
- list = NULL;
- e_selection_model_foreach (mns->selection, add_to_list, &list);
-
- for (iterator = list; iterator; iterator = iterator->next) {
- iterator->data = e_addressbook_model_card_at (priv->model, GPOINTER_TO_INT (iterator->data));
- }
- list = g_list_reverse (list);
- return list;
-}
-
-static void
-save_as (GtkWidget *widget, ModelAndSelection *mns)
-{
- GList *list;
-
- list = get_card_list (mns);
- if (list)
- e_contact_list_save_as (_("Save as VCard"), list);
- g_list_free (list);
- model_and_selection_free (mns);
-}
-
-static void
-send_as (GtkWidget *widget, ModelAndSelection *mns)
-{
- GList *list;
-
- list = get_card_list (mns);
- if (list)
- e_card_list_send (list, E_CARD_DISPOSITION_AS_ATTACHMENT);
- g_list_free (list);
- model_and_selection_free (mns);
-}
-
-static void
-send_to (GtkWidget *widget, ModelAndSelection *mns)
-{
- GList *list;
-
- list = get_card_list (mns);
- if (list)
- e_card_list_send (list, E_CARD_DISPOSITION_AS_TO);
- g_list_free (list);
- model_and_selection_free (mns);
-}
-
-static void
-print (GtkWidget *widget, ModelAndSelection *mns)
-{
- GList *list;
-
- list = get_card_list (mns);
- if (list)
- gtk_widget_show (e_contact_print_card_list_dialog_new (list));
- g_list_free (list);
- model_and_selection_free (mns);
-}
-
-static void
-print_envelope (GtkWidget *widget, ModelAndSelection *mns)
-{
- GList *list;
-
- list = get_card_list (mns);
- if (list)
- gtk_widget_show (e_contact_print_envelope_list_dialog_new (list));
- g_list_free (list);
- model_and_selection_free (mns);
-}
-
-static void
-card_changed_cb (EBook* book, EBookStatus status, gpointer user_data)
-{
- d(g_print ("%s: %s(): a card was changed with status %d\n", __FILE__, __FUNCTION__, status));
-}
-
-static void
-delete (GtkWidget *widget, ModelAndSelection *mns)
-{
- EAddressbookReflowAdapterPrivate *priv = mns->adapter->priv;
- GList *list;
-
- list = get_card_list (mns);
- if (list) {
-
- if (e_contact_editor_confirm_delete(NULL)) { /*FIXME: Give a GtkWindow here. */
- GList *iterator;
- EBook *book = e_addressbook_model_get_ebook(priv->model);
-
- for (iterator = list; iterator; iterator = iterator->next) {
- ECard *card = iterator->data;
-
- gtk_object_ref(GTK_OBJECT(card));
-
- e_book_remove_card (book,
- card,
- card_changed_cb,
- NULL);
-
- gtk_object_unref(GTK_OBJECT(card));
- }
- }
- }
-
- g_list_free (list);
- model_and_selection_free (mns);
-}
-
-gint
-e_addressbook_reflow_adapter_right_click (EAddressbookReflowAdapter *adapter, GdkEvent *event, ESelectionModel *selection)
-{
- ModelAndSelection *mns = g_new(ModelAndSelection, 1);
- EPopupMenu menu[] = { {N_("Save as VCard"), NULL, GTK_SIGNAL_FUNC(save_as), NULL, 0},
- {N_("Send contact to other"), NULL, GTK_SIGNAL_FUNC(send_as), NULL, 0},
- {N_("Send message to contact"), NULL, GTK_SIGNAL_FUNC(send_to), NULL, 0},
- {N_("Print"), NULL, GTK_SIGNAL_FUNC(print), NULL, 0},
- {N_("Print Envelope"), NULL, GTK_SIGNAL_FUNC(print_envelope), NULL, 0},
- {N_("Delete"), NULL, GTK_SIGNAL_FUNC(delete), NULL, 0},
- {NULL, NULL, NULL, 0}};
-
- mns->adapter = adapter;
- mns->selection = selection;
- gtk_object_ref(GTK_OBJECT(mns->adapter));
- gtk_object_ref(GTK_OBJECT(mns->selection));
- e_popup_menu_run (menu, event, 0, 0, mns);
- return TRUE;
-}
-
-static void
-addressbook_finalize(GtkObject *object)
-{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(object);
-
- unlink_model (adapter);
-}
-
-static void
-addressbook_set_width (EReflowModel *erm, int width)
-{
-}
-
-/* This function returns the number of items in our EReflowModel. */
-static int
-addressbook_count (EReflowModel *erm)
-{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(erm);
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
-
- return e_addressbook_model_card_count (priv->model);
-}
-
-/* This function returns the number of items in our EReflowModel. */
-static int
-addressbook_height (EReflowModel *erm, int i, GnomeCanvasGroup *parent)
-{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(erm);
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
- /* FIXME */
- ECardSimpleField field;
- int count = 0;
- int height;
- char *string;
- ECardSimple *simple = e_card_simple_new (e_addressbook_model_card_at (priv->model, i));
-
- string = e_card_simple_get(simple, E_CARD_SIMPLE_FIELD_FILE_AS);
- height = text_height (GNOME_CANVAS_ITEM (parent)->canvas, string ? string : "") + 10.0;
- g_free(string);
-
- for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST - 2 && count < 5; field++) {
-
- if (field == E_CARD_SIMPLE_FIELD_FAMILY_NAME)
- continue;
-
- string = e_card_simple_get(simple, field);
- if (string && *string) {
- int this_height;
- int field_text_height;
-
- this_height = text_height (GNOME_CANVAS_ITEM (parent)->canvas, e_card_simple_get_name(simple, field));
-
- field_text_height = text_height (GNOME_CANVAS_ITEM (parent)->canvas, string);
- if (this_height < field_text_height)
- this_height = field_text_height;
-
- this_height += 3;
-
- height += this_height;
- count ++;
- }
- g_free (string);
- }
- height += 2;
-
- gtk_object_unref (GTK_OBJECT (simple));
-
- return height;
-}
-
-static int
-addressbook_compare (EReflowModel *erm, int n1, int n2)
-{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(erm);
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
- ECard *card1, *card2;
-
- card1 = e_addressbook_model_card_at (priv->model, n1);
- card2 = e_addressbook_model_card_at (priv->model, n2);
-
- if (card1 && card2) {
- char *file_as1, *file_as2;
- file_as1 = card1->file_as;
- file_as2 = card2->file_as;
- if (file_as1 && file_as2)
- return strcasecmp(file_as1, file_as2);
- if (file_as1)
- return -1;
- if (file_as2)
- return 1;
- return strcmp(e_card_get_id(card1), e_card_get_id(card2));
- }
- if (card1)
- return -1;
- if (card2)
- return 1;
- return 0;
-}
-
-static int
-adapter_drag_begin (EMinicard *card, GdkEvent *event, EAddressbookReflowAdapter *adapter)
-{
- gint ret_val = 0;
-
- gtk_signal_emit (GTK_OBJECT(adapter),
- e_addressbook_reflow_adapter_signals[DRAG_BEGIN],
- event, &ret_val);
-
- return ret_val;
-}
-
-static GnomeCanvasItem *
-addressbook_incarnate (EReflowModel *erm, int i, GnomeCanvasGroup *parent)
-{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(erm);
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
- GnomeCanvasItem *item;
-
- item = gnome_canvas_item_new(parent,
- e_minicard_get_type(),
- "card", e_addressbook_model_card_at (priv->model, i),
- "editable", e_addressbook_model_editable (priv->model),
- NULL);
-
-#if 0
- gtk_signal_connect (GTK_OBJECT (item), "selected",
- GTK_SIGNAL_FUNC(card_selected), emvm);
-#endif
-
- gtk_signal_connect (GTK_OBJECT (item), "drag_begin",
- GTK_SIGNAL_FUNC(adapter_drag_begin), adapter);
-
- return item;
-}
-
-static void
-addressbook_reincarnate (EReflowModel *erm, int i, GnomeCanvasItem *item)
-{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(erm);
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
-
- gnome_canvas_item_set(item,
- "card", e_addressbook_model_card_at (priv->model, i),
- NULL);
-}
-
-
-
-static void
-create_card(EAddressbookModel *model,
- gint index, gint count,
- EAddressbookReflowAdapter *adapter)
-{
- e_reflow_model_items_inserted (E_REFLOW_MODEL (adapter),
- index,
- count);
-}
-
-static void
-remove_card(EAddressbookModel *model,
- gint index,
- EAddressbookReflowAdapter *adapter)
-{
- e_reflow_model_changed (E_REFLOW_MODEL (adapter));
-}
-
-static void
-modify_card(EAddressbookModel *model,
- gint index,
- EAddressbookReflowAdapter *adapter)
-{
- e_reflow_model_item_changed (E_REFLOW_MODEL (adapter), index);
-}
-
-static void
-model_changed(EAddressbookModel *model,
- EAddressbookReflowAdapter *adapter)
-{
- e_reflow_model_changed (E_REFLOW_MODEL (adapter));
-}
-
-static void
-addressbook_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(o);
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
-
- switch (arg_id){
- case ARG_BOOK:
- gtk_object_set (GTK_OBJECT (priv->model),
- "book", GTK_VALUE_OBJECT (*arg),
- NULL);
- break;
- case ARG_QUERY:
- gtk_object_set (GTK_OBJECT (priv->model),
- "query", GTK_VALUE_STRING (*arg),
- NULL);
- break;
- case ARG_EDITABLE:
- gtk_object_set (GTK_OBJECT (priv->model),
- "editable", GTK_VALUE_BOOL (*arg),
- NULL);
- break;
- }
-}
-
-static void
-addressbook_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(o);
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
-
- switch (arg_id) {
- case ARG_BOOK: {
- EBook *book;
- gtk_object_get (GTK_OBJECT (priv->model),
- "book", &book,
- NULL);
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(book);
- break;
- }
- case ARG_QUERY: {
- char *query;
- gtk_object_get (GTK_OBJECT (priv->model),
- "query", &query,
- NULL);
- GTK_VALUE_STRING (*arg) = query;
- break;
- }
- case ARG_EDITABLE: {
- gboolean editable;
- gtk_object_get (GTK_OBJECT (priv->model),
- "editable", &editable,
- NULL);
- GTK_VALUE_BOOL (*arg) = editable;
- break;
- }
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-e_addressbook_reflow_adapter_class_init (GtkObjectClass *object_class)
-{
- EReflowModelClass *model_class = (EReflowModelClass *) object_class;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->set_arg = addressbook_set_arg;
- object_class->get_arg = addressbook_get_arg;
- object_class->finalize = addressbook_finalize;
-
- gtk_object_add_arg_type ("EAddressbookReflowAdapter::book", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_BOOK);
- gtk_object_add_arg_type ("EAddressbookReflowAdapter::query", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_QUERY);
- gtk_object_add_arg_type ("EAddressbookReflowAdapter::editable", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_EDITABLE);
-
- e_addressbook_reflow_adapter_signals [DRAG_BEGIN] =
- gtk_signal_new ("drag_begin",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EAddressbookReflowAdapterClass, drag_begin),
- gtk_marshal_INT__POINTER,
- GTK_TYPE_INT, 2, GTK_TYPE_POINTER, GTK_TYPE_POINTER);
-
-
- gtk_object_class_add_signals (object_class, e_addressbook_reflow_adapter_signals, LAST_SIGNAL);
-
- model_class->set_width = addressbook_set_width;
- model_class->count = addressbook_count;
- model_class->height = addressbook_height;
- model_class->compare = addressbook_compare;
- model_class->incarnate = addressbook_incarnate;
- model_class->reincarnate = addressbook_reincarnate;
-}
-
-static void
-e_addressbook_reflow_adapter_init (GtkObject *object)
-{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(object);
- EAddressbookReflowAdapterPrivate *priv;
-
- priv = adapter->priv = g_new0 (EAddressbookReflowAdapterPrivate, 1);
-
- priv->create_card_id = 0;
- priv->remove_card_id = 0;
- priv->modify_card_id = 0;
- priv->model_changed_id = 0;
-}
-
-GtkType
-e_addressbook_reflow_adapter_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "EAddressbookReflowAdapter",
- sizeof (EAddressbookReflowAdapter),
- sizeof (EAddressbookReflowAdapterClass),
- (GtkClassInitFunc) e_addressbook_reflow_adapter_class_init,
- (GtkObjectInitFunc) e_addressbook_reflow_adapter_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-void
-e_addressbook_reflow_adapter_construct (EAddressbookReflowAdapter *adapter,
- EAddressbookModel *model)
-{
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
-
- priv->model = model;
- gtk_object_ref (GTK_OBJECT (priv->model));
-
- priv->create_card_id = gtk_signal_connect(GTK_OBJECT(priv->model),
- "card_added",
- GTK_SIGNAL_FUNC(create_card),
- adapter);
- priv->remove_card_id = gtk_signal_connect(GTK_OBJECT(priv->model),
- "card_removed",
- GTK_SIGNAL_FUNC(remove_card),
- adapter);
- priv->modify_card_id = gtk_signal_connect(GTK_OBJECT(priv->model),
- "card_changed",
- GTK_SIGNAL_FUNC(modify_card),
- adapter);
- priv->model_changed_id = gtk_signal_connect(GTK_OBJECT(priv->model),
- "model_changed",
- GTK_SIGNAL_FUNC(model_changed),
- adapter);
-}
-
-EReflowModel *
-e_addressbook_reflow_adapter_new (EAddressbookModel *model)
-{
- EAddressbookReflowAdapter *et;
-
- et = gtk_type_new (e_addressbook_reflow_adapter_get_type ());
-
- e_addressbook_reflow_adapter_construct (et, model);
-
- return E_REFLOW_MODEL(et);
-}
-
-
-ECard *
-e_addressbook_reflow_adapter_get_card (EAddressbookReflowAdapter *adapter,
- int index)
-{
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
-
- return e_addressbook_model_get_card (priv->model, index);
-}
diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.h b/addressbook/gui/widgets/e-addressbook-reflow-adapter.h
deleted file mode 100644
index 1614a65064..0000000000
--- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#ifndef _E_ADDRESSBOOK_REFLOW_ADAPTER_H_
-#define _E_ADDRESSBOOK_REFLOW_ADAPTER_H_
-
-#include <gal/widgets/e-reflow-model.h>
-#include <gal/widgets/e-selection-model.h>
-#include "e-addressbook-model.h"
-#include "addressbook/backend/ebook/e-book.h"
-#include "addressbook/backend/ebook/e-book-view.h"
-#include "addressbook/backend/ebook/e-card.h"
-
-#define E_ADDRESSBOOK_REFLOW_ADAPTER_TYPE (e_addressbook_reflow_adapter_get_type ())
-#define E_ADDRESSBOOK_REFLOW_ADAPTER(o) (GTK_CHECK_CAST ((o), E_ADDRESSBOOK_REFLOW_ADAPTER_TYPE, EAddressbookReflowAdapter))
-#define E_ADDRESSBOOK_REFLOW_ADAPTER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_ADDRESSBOOK_REFLOW_ADAPTER_TYPE, EAddressbookReflowAdapterClass))
-#define E_IS_ADDRESSBOOK_REFLOW_ADAPTER(o) (GTK_CHECK_TYPE ((o), E_ADDRESSBOOK_REFLOW_ADAPTER_TYPE))
-#define E_IS_ADDRESSBOOK_REFLOW_ADAPTER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_ADDRESSBOOK_REFLOW_ADAPTER_TYPE))
-
-typedef struct _EAddressbookReflowAdapter EAddressbookReflowAdapter;
-typedef struct _EAddressbookReflowAdapterPrivate EAddressbookReflowAdapterPrivate;
-typedef struct _EAddressbookReflowAdapterClass EAddressbookReflowAdapterClass;
-
-struct _EAddressbookReflowAdapter {
- EReflowModel parent;
-
- EAddressbookReflowAdapterPrivate *priv;
-};
-
-
-struct _EAddressbookReflowAdapterClass {
- EReflowModelClass parent_class;
-
- /*
- * Signals
- */
- gint (* drag_begin) (EAddressbookReflowAdapter *adapter, GdkEvent *event);
-};
-
-
-GtkType e_addressbook_reflow_adapter_get_type (void);
-void e_addressbook_reflow_adapter_construct (EAddressbookReflowAdapter *adapter,
- EAddressbookModel *model);
-EReflowModel *e_addressbook_reflow_adapter_new (EAddressbookModel *model);
-
-/* Returns object with ref count of 1. */
-ECard *e_addressbook_reflow_adapter_get_card (EAddressbookReflowAdapter *adapter,
- int index);
-gint e_addressbook_reflow_adapter_right_click (EAddressbookReflowAdapter *emvm,
- GdkEvent *event,
- ESelectionModel *selection);
-
-#endif /* _E_ADDRESSBOOK_REFLOW_ADAPTER_H_ */
diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.c b/addressbook/gui/widgets/e-addressbook-table-adapter.c
deleted file mode 100644
index 3fa92d2300..0000000000
--- a/addressbook/gui/widgets/e-addressbook-table-adapter.c
+++ /dev/null
@@ -1,391 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#include <config.h>
-#include "e-addressbook-model.h"
-#include "e-addressbook-table-adapter.h"
-#include "e-card-merging.h"
-#include "e-addressbook-util.h"
-#include <gnome-xml/tree.h>
-#include <gnome-xml/parser.h>
-#include <gnome-xml/xmlmemory.h>
-#include <gnome.h>
-
-struct _EAddressbookTableAdapterPrivate {
- EAddressbookModel *model;
-
- ECardSimple **simples;
- int count;
-
- int create_card_id, remove_card_id, modify_card_id, model_changed_id;
-};
-
-#define PARENT_TYPE e_table_model_get_type()
-ETableModelClass *parent_class;
-
-#define COLS (E_CARD_SIMPLE_FIELD_LAST)
-
-static void
-unlink_model(EAddressbookTableAdapter *adapter)
-{
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
- int i;
-
- gtk_signal_disconnect(GTK_OBJECT (priv->model),
- priv->create_card_id);
- gtk_signal_disconnect(GTK_OBJECT (priv->model),
- priv->remove_card_id);
- gtk_signal_disconnect(GTK_OBJECT (priv->model),
- priv->modify_card_id);
- gtk_signal_disconnect(GTK_OBJECT (priv->model),
- priv->model_changed_id);
-
- priv->create_card_id = 0;
- priv->remove_card_id = 0;
- priv->modify_card_id = 0;
- priv->model_changed_id = 0;
-
- /* free up the existing mapping if there is one */
- if (priv->simples) {
- for (i = 0; i < priv->count; i ++)
- gtk_object_unref (GTK_OBJECT (priv->simples[i]));
- g_free (priv->simples);
- priv->simples = NULL;
- }
-
- gtk_object_unref(GTK_OBJECT(priv->model));
-
- priv->model = NULL;
-}
-
-static void
-build_simple_mapping(EAddressbookTableAdapter *adapter)
-{
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
- int i;
-
- /* free up the existing mapping if there is one */
- if (priv->simples) {
- for (i = 0; i < priv->count; i ++)
- gtk_object_unref (GTK_OBJECT (priv->simples[i]));
- g_free (priv->simples);
- }
-
- /* build up our mapping to ECardSimple*'s */
- priv->count = e_addressbook_model_card_count (priv->model);
- priv->simples = g_new (ECardSimple*, priv->count);
- for (i = 0; i < priv->count; i ++) {
- priv->simples[i] = e_card_simple_new (e_addressbook_model_card_at (priv->model, i));
- gtk_object_ref (GTK_OBJECT (priv->simples[i]));
- }
-}
-
-static void
-addressbook_destroy(GtkObject *object)
-{
- EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(object);
-
- unlink_model(adapter);
-}
-
-/* This function returns the number of columns in our ETableModel. */
-static int
-addressbook_col_count (ETableModel *etc)
-{
- return COLS;
-}
-
-/* This function returns the number of rows in our ETableModel. */
-static int
-addressbook_row_count (ETableModel *etc)
-{
- EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(etc);
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
-
- return e_addressbook_model_card_count (priv->model);
-}
-
-/* This function returns the value at a particular point in our ETableModel. */
-static void *
-addressbook_value_at (ETableModel *etc, int col, int row)
-{
- EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(etc);
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
- const char *value;
- if ( col >= COLS || row >= e_addressbook_model_card_count (priv->model) )
- return NULL;
-
- value = e_card_simple_get_const(priv->simples[row], col);
- return (void *)(value ? value : "");
-}
-
-/* This function sets the value at a particular point in our ETableModel. */
-static void
-card_modified_cb (EBook* book, EBookStatus status,
- gpointer user_data)
-{
- g_print ("%s: %s(): a card was modified\n", __FILE__, __FUNCTION__);
- if (status != E_BOOK_STATUS_SUCCESS)
- e_addressbook_error_dialog (_("Error modifying card"), status);
-}
-static void
-addressbook_set_value_at (ETableModel *etc, int col, int row, const void *val)
-{
- EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(etc);
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
- if (e_addressbook_model_editable (priv->model)) {
- ECard *card;
-
- if ( col >= COLS|| row >= e_addressbook_model_card_count (priv->model) )
- return;
-
- e_card_simple_set(priv->simples[row],
- col,
- val);
- gtk_object_get(GTK_OBJECT(priv->simples[row]),
- "card", &card,
- NULL);
-
- e_card_merging_book_commit_card(e_addressbook_model_get_ebook(priv->model),
- card, card_modified_cb, NULL);
-
- /* XXX do we need this? shouldn't the commit_card generate a changed signal? */
- e_table_model_cell_changed(etc, col, row);
- }
-}
-
-/* This function returns whether a particular cell is editable. */
-static gboolean
-addressbook_is_cell_editable (ETableModel *etc, int col, int row)
-{
- EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(etc);
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
- ECard *card;
-
- if (row >= 0 && row < e_addressbook_model_card_count (priv->model))
- card = e_addressbook_model_card_at (priv->model, row);
- else
- card = NULL;
-
- if (!e_addressbook_model_editable(priv->model))
- return FALSE;
- else if (card && e_card_evolution_list (card))
- /* we only allow editing of the name and file as for
- lists */
- return col == E_CARD_SIMPLE_FIELD_FULL_NAME || col == E_CARD_SIMPLE_FIELD_FILE_AS;
- else
- return col < E_CARD_SIMPLE_FIELD_LAST_SIMPLE_STRING;
-}
-
-static void
-addressbook_append_row (ETableModel *etm, ETableModel *source, gint row)
-{
- EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(etm);
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
- ECard *card;
- ECardSimple *simple;
- int col;
-
- card = e_card_new("");
- simple = e_card_simple_new(card);
-
- for (col = 0; col < E_CARD_SIMPLE_FIELD_LAST_SIMPLE_STRING; col++) {
- const void *val = e_table_model_value_at(source, col, row);
- e_card_simple_set(simple, col, val);
- }
- e_card_simple_sync_card(simple);
- e_card_merging_book_add_card (e_addressbook_model_get_ebook (priv->model), card, NULL, NULL);
- gtk_object_unref(GTK_OBJECT(simple));
- gtk_object_unref(GTK_OBJECT(card));
-}
-
-/* This function duplicates the value passed to it. */
-static void *
-addressbook_duplicate_value (ETableModel *etc, int col, const void *value)
-{
- return g_strdup(value);
-}
-
-/* This function frees the value passed to it. */
-static void
-addressbook_free_value (ETableModel *etc, int col, void *value)
-{
- g_free(value);
-}
-
-static void *
-addressbook_initialize_value (ETableModel *etc, int col)
-{
- return g_strdup("");
-}
-
-static gboolean
-addressbook_value_is_empty (ETableModel *etc, int col, const void *value)
-{
- return !(value && *(char *)value);
-}
-
-static char *
-addressbook_value_to_string (ETableModel *etc, int col, const void *value)
-{
- return g_strdup(value);
-}
-
-static void
-e_addressbook_table_adapter_class_init (GtkObjectClass *object_class)
-{
- ETableModelClass *model_class = (ETableModelClass *) object_class;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->destroy = addressbook_destroy;
-
- model_class->column_count = addressbook_col_count;
- model_class->row_count = addressbook_row_count;
- model_class->value_at = addressbook_value_at;
- model_class->set_value_at = addressbook_set_value_at;
- model_class->is_cell_editable = addressbook_is_cell_editable;
- model_class->append_row = addressbook_append_row;
- model_class->duplicate_value = addressbook_duplicate_value;
- model_class->free_value = addressbook_free_value;
- model_class->initialize_value = addressbook_initialize_value;
- model_class->value_is_empty = addressbook_value_is_empty;
- model_class->value_to_string = addressbook_value_to_string;
-}
-
-static void
-e_addressbook_table_adapter_init (GtkObject *object)
-{
- EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(object);
- EAddressbookTableAdapterPrivate *priv;
-
- priv = adapter->priv = g_new0 (EAddressbookTableAdapterPrivate, 1);
-
- priv->create_card_id = 0;
- priv->remove_card_id = 0;
- priv->modify_card_id = 0;
- priv->model_changed_id = 0;
- priv->simples = NULL;
- priv->count = 0;
-}
-
-
-static void
-create_card (EAddressbookModel *model,
- gint index, gint count,
- EAddressbookTableAdapter *adapter)
-{
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
- int i;
-
- priv->count += count;
- priv->simples = g_renew(ECardSimple *, priv->simples, priv->count);
- memmove (priv->simples + index + count, priv->simples + index, (priv->count - index - count) * sizeof (ECardSimple *));
-
- e_table_model_pre_change (E_TABLE_MODEL (adapter));
- for (i = 0; i < count; i ++) {
- priv->simples[index + i] = e_card_simple_new (e_addressbook_model_card_at (priv->model, index + i));
- }
- e_table_model_rows_inserted (E_TABLE_MODEL (adapter), index, count);
-}
-
-static void
-remove_card (EAddressbookModel *model,
- gint index,
- EAddressbookTableAdapter *adapter)
-{
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
-
- e_table_model_pre_change (E_TABLE_MODEL (adapter));
-
- gtk_object_unref (GTK_OBJECT (priv->simples[index]));
- memmove (priv->simples + index, priv->simples + index + 1, (priv->count - index - 1) * sizeof (ECardSimple *));
- priv->count --;
- e_table_model_rows_deleted (E_TABLE_MODEL (adapter), index, 1);
-}
-
-static void
-modify_card (EAddressbookModel *model,
- gint index,
- EAddressbookTableAdapter *adapter)
-{
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
-
- e_table_model_pre_change (E_TABLE_MODEL (adapter));
-
- gtk_object_unref (GTK_OBJECT (priv->simples[index]));
- priv->simples[index] = e_card_simple_new (e_addressbook_model_card_at (priv->model, index));
- gtk_object_ref (GTK_OBJECT (priv->simples[index]));
- e_table_model_row_changed (E_TABLE_MODEL (adapter), index);
-}
-
-static void
-model_changed (EAddressbookModel *model,
- EAddressbookTableAdapter *adapter)
-{
- build_simple_mapping (adapter);
- e_table_model_changed (E_TABLE_MODEL (adapter));
-}
-
-GtkType
-e_addressbook_table_adapter_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "EAddressbookTableAdapter",
- sizeof (EAddressbookTableAdapter),
- sizeof (EAddressbookTableAdapterClass),
- (GtkClassInitFunc) e_addressbook_table_adapter_class_init,
- (GtkObjectInitFunc) e_addressbook_table_adapter_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-void
-e_addressbook_table_adapter_construct (EAddressbookTableAdapter *adapter,
- EAddressbookModel *model)
-{
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
-
- priv->model = model;
- gtk_object_ref (GTK_OBJECT (priv->model));
-
- priv->create_card_id = gtk_signal_connect(GTK_OBJECT(priv->model),
- "card_added",
- GTK_SIGNAL_FUNC(create_card),
- adapter);
- priv->remove_card_id = gtk_signal_connect(GTK_OBJECT(priv->model),
- "card_removed",
- GTK_SIGNAL_FUNC(remove_card),
- adapter);
- priv->modify_card_id = gtk_signal_connect(GTK_OBJECT(priv->model),
- "card_changed",
- GTK_SIGNAL_FUNC(modify_card),
- adapter);
- priv->model_changed_id = gtk_signal_connect(GTK_OBJECT(priv->model),
- "model_changed",
- GTK_SIGNAL_FUNC(model_changed),
- adapter);
-
- build_simple_mapping (adapter);
-}
-
-ETableModel *
-e_addressbook_table_adapter_new (EAddressbookModel *model)
-{
- EAddressbookTableAdapter *et;
-
- et = gtk_type_new (e_addressbook_table_adapter_get_type ());
-
- e_addressbook_table_adapter_construct (et, model);
-
- return E_TABLE_MODEL(et);
-}
diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.h b/addressbook/gui/widgets/e-addressbook-table-adapter.h
deleted file mode 100644
index d76434e80a..0000000000
--- a/addressbook/gui/widgets/e-addressbook-table-adapter.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#ifndef _E_ADDRESSBOOK_TABLE_ADAPTER_H_
-#define _E_ADDRESSBOOK_TABLE_ADAPTER_H_
-
-#include <gal/e-table/e-table-model.h>
-#include "addressbook/backend/ebook/e-book.h"
-#include "addressbook/backend/ebook/e-book-view.h"
-#include "addressbook/backend/ebook/e-card-simple.h"
-
-#define E_ADDRESSBOOK_TABLE_ADAPTER_TYPE (e_addressbook_table_adapter_get_type ())
-#define E_ADDRESSBOOK_TABLE_ADAPTER(o) (GTK_CHECK_CAST ((o), E_ADDRESSBOOK_TABLE_ADAPTER_TYPE, EAddressbookTableAdapter))
-#define E_ADDRESSBOOK_TABLE_ADAPTER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_ADDRESSBOOK_TABLE_ADAPTER_TYPE, EAddressbookTableAdapterClass))
-#define E_IS_ADDRESSBOOK_TABLE_ADAPTER(o) (GTK_CHECK_TYPE ((o), E_ADDRESSBOOK_TABLE_ADAPTER_TYPE))
-#define E_IS_ADDRESSBOOK_TABLE_ADAPTER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_ADDRESSBOOK_TABLE_ADAPTER_TYPE))
-
-/* Virtual Column list:
- 0 Email
- 1 Full Name
- 2 Street
- 3 Phone
-*/
-
-typedef struct _EAddressbookTableAdapter EAddressbookTableAdapter;
-typedef struct _EAddressbookTableAdapterPrivate EAddressbookTableAdapterPrivate;
-typedef struct _EAddressbookTableAdapterClass EAddressbookTableAdapterClass;
-
-struct _EAddressbookTableAdapter {
- ETableModel parent;
-
- EAddressbookTableAdapterPrivate *priv;
-};
-
-
-struct _EAddressbookTableAdapterClass {
- ETableModelClass parent_class;
-};
-
-
-GtkType e_addressbook_table_adapter_get_type (void);
-void e_addressbook_table_adapter_construct (EAddressbookTableAdapter *adapter,
- EAddressbookModel *model);
-ETableModel *e_addressbook_table_adapter_new (EAddressbookModel *model);
-
-#endif /* _E_ADDRESSBOOK_TABLE_ADAPTER_H_ */
diff --git a/addressbook/gui/widgets/e-addressbook-util.c b/addressbook/gui/widgets/e-addressbook-util.c
deleted file mode 100644
index 9aaa554547..0000000000
--- a/addressbook/gui/widgets/e-addressbook-util.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-field-chooser.c
- * Copyright (C) 2001 Ximian, Inc.
- * Author: Chris Toshok <toshok@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <gnome.h>
-
-#include "e-addressbook-util.h"
-#include "e-card-merging.h"
-
-void
-e_addressbook_error_dialog (const gchar *msg, EBookStatus status)
-{
- static char *status_to_string[] = {
- N_("Success"),
- N_("Unknown error"),
- N_("Repository offline"),
- N_("Permission denied"),
- N_("Card not found"),
- N_("Card ID already exists"),
- N_("Protocol not supported"),
- N_("Canceled"),
- N_("Other error")
- };
- char *error_msg;
-
- error_msg = g_strdup_printf ("%s: %s", msg, status_to_string [status]);
-
- gtk_widget_show (gnome_error_dialog (error_msg));
-
- g_free (error_msg);
-}
-
-
-static void
-added_cb (EBook* book, EBookStatus status, const char *id,
- gboolean is_list)
-{
- if (status != E_BOOK_STATUS_SUCCESS) {
- e_addressbook_error_dialog (is_list ? _("Error adding list") : _("Error adding card"), status);
- }
-}
-
-static void
-modified_cb (EBook* book, EBookStatus status,
- gboolean is_list)
-{
- if (status != E_BOOK_STATUS_SUCCESS) {
- e_addressbook_error_dialog (is_list ? _("Error modifying list") : _("Error modifying card"),
- status);
- }
-}
-
-static void
-deleted_cb (EBook* book, EBookStatus status,
- gboolean is_list)
-{
- if (status != E_BOOK_STATUS_SUCCESS) {
- e_addressbook_error_dialog (is_list ? _("Error removing list") : _("Error removing card"),
- status);
- }
-}
-
-static void
-editor_closed_cb (GtkObject *editor, gpointer data)
-{
- gtk_object_unref (editor);
-}
-
-EContactEditor *
-e_addressbook_show_contact_editor (EBook *book, ECard *card,
- gboolean is_new_card,
- gboolean editable)
-{
- EContactEditor *ce;
-
- ce = e_contact_editor_new (book, card, is_new_card, editable);
-
- gtk_signal_connect (GTK_OBJECT (ce), "card_added",
- GTK_SIGNAL_FUNC (added_cb), GINT_TO_POINTER (FALSE));
- gtk_signal_connect (GTK_OBJECT (ce), "card_modified",
- GTK_SIGNAL_FUNC (modified_cb), GINT_TO_POINTER (FALSE));
- gtk_signal_connect (GTK_OBJECT (ce), "card_deleted",
- GTK_SIGNAL_FUNC (deleted_cb), GINT_TO_POINTER (FALSE));
- gtk_signal_connect (GTK_OBJECT (ce), "editor_closed",
- GTK_SIGNAL_FUNC (editor_closed_cb), NULL);
-
- return ce;
-}
-
-EContactListEditor *
-e_addressbook_show_contact_list_editor (EBook *book, ECard *card,
- gboolean is_new_card,
- gboolean editable)
-{
- EContactListEditor *ce;
-
- ce = e_contact_list_editor_new (book, card, is_new_card, editable);
-
- gtk_signal_connect (GTK_OBJECT (ce), "list_added",
- GTK_SIGNAL_FUNC (added_cb), GINT_TO_POINTER (TRUE));
- gtk_signal_connect (GTK_OBJECT (ce), "list_modified",
- GTK_SIGNAL_FUNC (modified_cb), GINT_TO_POINTER (TRUE));
- gtk_signal_connect (GTK_OBJECT (ce), "list_deleted",
- GTK_SIGNAL_FUNC (deleted_cb), GINT_TO_POINTER (TRUE));
- gtk_signal_connect (GTK_OBJECT (ce), "editor_closed",
- GTK_SIGNAL_FUNC (editor_closed_cb), GINT_TO_POINTER (TRUE));
-
- e_contact_list_editor_show (ce);
-
- return ce;
-}
diff --git a/addressbook/gui/widgets/e-addressbook-util.h b/addressbook/gui/widgets/e-addressbook-util.h
deleted file mode 100644
index 1f3ffe074d..0000000000
--- a/addressbook/gui/widgets/e-addressbook-util.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-addressbook-util.h
- * Copyright (C) 2001 Ximian, Inc.
- * Author: Chris Toshok <toshok@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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_ADDRESSBOOK_UTIL_H__
-#define __E_ADDRESSBOOK_UTIL_H__
-
-#include "addressbook/backend/ebook/e-book.h"
-#include "addressbook/gui/contact-editor/e-contact-editor.h"
-#include "addressbook/gui/contact-list-editor/e-contact-list-editor.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-void e_addressbook_error_dialog (const gchar *msg,
- EBookStatus status);
-EContactEditor* e_addressbook_show_contact_editor (EBook *book, ECard *card,
- gboolean is_new_card,
- gboolean editable);
-EContactListEditor * e_addressbook_show_contact_list_editor (EBook *book, ECard *card,
- gboolean is_new_card,
- gboolean editable);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __E_ADDRESSBOOK_UTIL_H__ */
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
deleted file mode 100644
index 74935dc242..0000000000
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ /dev/null
@@ -1,1426 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-field-chooser.c
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <gtk/gtkinvisible.h>
-
-#include <libgnome/gnome-paper.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnome/gnome-util.h>
-#include <gal/e-table/e-table-scrolled.h>
-#include <gal/e-table/e-table-model.h>
-#include <gal/widgets/e-scroll-frame.h>
-#include <gal/widgets/e-popup-menu.h>
-#include <gal/menus/gal-view-factory-etable.h>
-#include <gal/menus/gal-view-etable.h>
-#include <libgnomeui/gnome-dialog-util.h>
-
-#include <libgnomeprint/gnome-print.h>
-#include <libgnomeprint/gnome-print-dialog.h>
-#include <libgnomeprint/gnome-print-master.h>
-#include <libgnomeprint/gnome-print-master-preview.h>
-
-#include "addressbook/printing/e-contact-print.h"
-#include "addressbook/printing/e-contact-print-envelope.h"
-
-#include "gal-view-factory-minicard.h"
-#include "gal-view-minicard.h"
-
-#include "e-addressbook-view.h"
-#include "e-addressbook-model.h"
-#include "e-addressbook-util.h"
-#include "e-addressbook-table-adapter.h"
-#include "e-addressbook-reflow-adapter.h"
-#include "e-minicard-view-widget.h"
-#include "e-contact-save-as.h"
-#include "e-card-merging.h"
-
-#include "e-contact-editor.h"
-#include <ctype.h>
-
-static void e_addressbook_view_init (EAddressbookView *card);
-static void e_addressbook_view_class_init (EAddressbookViewClass *klass);
-static void e_addressbook_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_addressbook_view_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_addressbook_view_destroy (GtkObject *object);
-static void change_view_type (EAddressbookView *view, EAddressbookViewType view_type);
-
-static void status_message (GtkObject *object, const gchar *status, EAddressbookView *eav);
-static void stop_state_changed (GtkObject *object, EAddressbookView *eav);
-static void writable_status (GtkObject *object, gboolean writable, EAddressbookView *eav);
-static void command_state_change (EAddressbookView *eav);
-
-static void selection_clear_event (GtkWidget *invisible, GdkEventSelection *event,
- EAddressbookView *view);
-static void selection_received (GtkWidget *invisible, GtkSelectionData *selection_data,
- guint time, EAddressbookView *view);
-static void selection_get (GtkWidget *invisible, GtkSelectionData *selection_data,
- guint info, guint time_stamp, EAddressbookView *view);
-static void invisible_destroyed (GtkWidget *invisible, EAddressbookView *view);
-
-static GtkTableClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_BOOK,
- ARG_QUERY,
- ARG_TYPE,
-};
-
-enum {
- STATUS_MESSAGE,
- COMMAND_STATE_CHANGE,
- LAST_SIGNAL
-};
-
-enum DndTargetType {
- DND_TARGET_TYPE_VCARD,
-};
-#define VCARD_TYPE "text/x-vcard"
-static GtkTargetEntry drag_types[] = {
- { VCARD_TYPE, 0, DND_TARGET_TYPE_VCARD },
-};
-static const int num_drag_types = sizeof (drag_types) / sizeof (drag_types[0]);
-
-static guint e_addressbook_view_signals [LAST_SIGNAL] = {0, };
-
-static GdkAtom clipboard_atom = GDK_NONE;
-
-GtkType
-e_addressbook_view_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type) {
- static const GtkTypeInfo info =
- {
- "EAddressbookView",
- sizeof (EAddressbookView),
- sizeof (EAddressbookViewClass),
- (GtkClassInitFunc) e_addressbook_view_class_init,
- (GtkObjectInitFunc) e_addressbook_view_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (gtk_table_get_type (), &info);
- }
-
- return type;
-}
-
-static void
-e_addressbook_view_class_init (EAddressbookViewClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS(klass);
-
- parent_class = gtk_type_class (gtk_table_get_type ());
-
- object_class->set_arg = e_addressbook_view_set_arg;
- object_class->get_arg = e_addressbook_view_get_arg;
- object_class->destroy = e_addressbook_view_destroy;
-
- gtk_object_add_arg_type ("EAddressbookView::book", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_BOOK);
- gtk_object_add_arg_type ("EAddressbookView::query", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_QUERY);
- gtk_object_add_arg_type ("EAddressbookView::type", GTK_TYPE_ENUM,
- GTK_ARG_READWRITE, ARG_TYPE);
-
- e_addressbook_view_signals [STATUS_MESSAGE] =
- gtk_signal_new ("status_message",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EAddressbookViewClass, status_message),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
-
- e_addressbook_view_signals [COMMAND_STATE_CHANGE] =
- gtk_signal_new ("command_state_change",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EAddressbookViewClass, command_state_change),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, e_addressbook_view_signals, LAST_SIGNAL);
-
- if (!clipboard_atom)
- clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
-}
-
-static void
-e_addressbook_view_init (EAddressbookView *eav)
-{
- eav->view_type = E_ADDRESSBOOK_VIEW_NONE;
-
- eav->model = e_addressbook_model_new ();
-
- gtk_signal_connect (GTK_OBJECT(eav->model),
- "status_message",
- GTK_SIGNAL_FUNC (status_message),
- eav);
-
- gtk_signal_connect (GTK_OBJECT(eav->model),
- "stop_state_changed",
- GTK_SIGNAL_FUNC (stop_state_changed),
- eav);
-
- gtk_signal_connect (GTK_OBJECT(eav->model),
- "writable_status",
- GTK_SIGNAL_FUNC (writable_status),
- eav);
-
- eav->editable = FALSE;
- eav->book = NULL;
- eav->query = g_strdup("(contains \"x-evolution-any-field\" \"\")");
-
- eav->object = NULL;
- eav->widget = NULL;
-
- eav->view_collection = NULL;
- eav->view_menus = NULL;
-
- eav->invisible = gtk_invisible_new ();
-
- gtk_selection_add_target (eav->invisible,
- clipboard_atom,
- GDK_SELECTION_TYPE_STRING,
- 0);
-
- gtk_signal_connect (GTK_OBJECT(eav->invisible), "selection_get",
- GTK_SIGNAL_FUNC (selection_get),
- eav);
- gtk_signal_connect (GTK_OBJECT(eav->invisible), "selection_clear_event",
- GTK_SIGNAL_FUNC (selection_clear_event),
- eav);
- gtk_signal_connect (GTK_OBJECT(eav->invisible), "selection_received",
- GTK_SIGNAL_FUNC (selection_received),
- eav);
- gtk_signal_connect (GTK_OBJECT(eav->invisible), "destroy",
- GTK_SIGNAL_FUNC (invisible_destroyed),
- eav);
-}
-
-static void
-e_addressbook_view_destroy (GtkObject *object)
-{
- EAddressbookView *eav = E_ADDRESSBOOK_VIEW(object);
-
- if (eav->model)
- gtk_object_unref(GTK_OBJECT(eav->model));
-
- if (eav->book)
- gtk_object_unref(GTK_OBJECT(eav->book));
- g_free(eav->query);
-
- if (eav->view_collection) {
- gtk_object_unref (GTK_OBJECT (eav->view_collection));
- eav->view_collection = NULL;
- }
-
- if (eav->view_menus) {
- gtk_object_unref (GTK_OBJECT (eav->view_menus));
- eav->view_menus = NULL;
- }
-
- if (eav->clipboard_cards) {
- g_list_foreach (eav->clipboard_cards, (GFunc)gtk_object_unref, NULL);
- g_list_free (eav->clipboard_cards);
- eav->clipboard_cards = NULL;
- }
-
- if (eav->invisible)
- gtk_widget_destroy (eav->invisible);
-
- if (GTK_OBJECT_CLASS(parent_class)->destroy)
- GTK_OBJECT_CLASS(parent_class)->destroy(object);
-}
-
-GtkWidget*
-e_addressbook_view_new (void)
-{
- GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_addressbook_view_get_type ()));
- return widget;
-}
-
-static void
-book_writable_cb (EBook *book, gboolean writable, EAddressbookView *eav)
-{
- eav->editable = writable;
- gtk_object_set (GTK_OBJECT (eav->model),
- "editable", eav->editable,
- NULL);
-}
-
-static void
-e_addressbook_view_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EAddressbookView *eav = E_ADDRESSBOOK_VIEW(object);
-
- switch (arg_id){
- case ARG_BOOK:
- if (eav->book) {
- gtk_object_unref(GTK_OBJECT(eav->book));
- }
- if (GTK_VALUE_OBJECT(*arg)) {
- eav->book = E_BOOK(GTK_VALUE_OBJECT(*arg));
- gtk_object_ref(GTK_OBJECT(eav->book));
- gtk_signal_connect (GTK_OBJECT (eav->book),
- "writable_status",
- book_writable_cb, eav);
- }
- else
- eav->book = NULL;
- gtk_object_set(GTK_OBJECT(eav->model),
- "book", eav->book,
- "editable", eav->editable,
- NULL);
-
- break;
- case ARG_QUERY:
- g_free(eav->query);
- eav->query = g_strdup(GTK_VALUE_STRING(*arg));
- if (!eav->query)
- eav->query = g_strdup("(contains \"x-evolution-any-field\" \"\")");
- gtk_object_set(GTK_OBJECT(eav->model),
- "query", eav->query,
- NULL);
- break;
- case ARG_TYPE:
- change_view_type(eav, GTK_VALUE_ENUM(*arg));
- break;
- default:
- break;
- }
-}
-
-static void
-e_addressbook_view_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EAddressbookView *eav = E_ADDRESSBOOK_VIEW(object);
-
- switch (arg_id) {
- case ARG_BOOK:
- if (eav->book)
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(eav->book);
- else
- GTK_VALUE_OBJECT (*arg) = NULL;
- break;
- case ARG_QUERY:
- GTK_VALUE_STRING (*arg) = eav->query;
- break;
- case ARG_TYPE:
- GTK_VALUE_ENUM (*arg) = eav->view_type;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-
-
-typedef struct {
- EAddressbookView *view;
- char letter;
-} LetterClosure;
-
-static void
-jump_to_letter(GtkWidget *button, LetterClosure *closure)
-{
- char *query;
- switch (closure->letter) {
- case '1':
- query = g_strdup ("(not (or "
- "(beginswith \"file_as\" \"a\") "
- "(beginswith \"file_as\" \"b\") "
- "(beginswith \"file_as\" \"c\") "
- "(beginswith \"file_as\" \"d\") "
- "(beginswith \"file_as\" \"e\") "
- "(beginswith \"file_as\" \"f\") "
- "(beginswith \"file_as\" \"g\") "
- "(beginswith \"file_as\" \"h\") "
- "(beginswith \"file_as\" \"i\") "
- "(beginswith \"file_as\" \"j\") "
- "(beginswith \"file_as\" \"k\") "
- "(beginswith \"file_as\" \"l\") "
- "(beginswith \"file_as\" \"m\") "
- "(beginswith \"file_as\" \"n\") "
- "(beginswith \"file_as\" \"o\") "
- "(beginswith \"file_as\" \"p\") "
- "(beginswith \"file_as\" \"q\") "
- "(beginswith \"file_as\" \"r\") "
- "(beginswith \"file_as\" \"s\") "
- "(beginswith \"file_as\" \"t\") "
- "(beginswith \"file_as\" \"u\") "
- "(beginswith \"file_as\" \"v\") "
- "(beginswith \"file_as\" \"w\") "
- "(beginswith \"file_as\" \"x\") "
- "(beginswith \"file_as\" \"y\") "
- "(beginswith \"file_as\" \"z\") "
-
- "(beginswith \"file_as\" \"A\") "
- "(beginswith \"file_as\" \"B\") "
- "(beginswith \"file_as\" \"C\") "
- "(beginswith \"file_as\" \"D\") "
- "(beginswith \"file_as\" \"E\") "
- "(beginswith \"file_as\" \"F\") "
- "(beginswith \"file_as\" \"G\") "
- "(beginswith \"file_as\" \"H\") "
- "(beginswith \"file_as\" \"I\") "
- "(beginswith \"file_as\" \"J\") "
- "(beginswith \"file_as\" \"K\") "
- "(beginswith \"file_as\" \"L\") "
- "(beginswith \"file_as\" \"M\") "
- "(beginswith \"file_as\" \"N\") "
- "(beginswith \"file_as\" \"O\") "
- "(beginswith \"file_as\" \"P\") "
- "(beginswith \"file_as\" \"Q\") "
- "(beginswith \"file_as\" \"R\") "
- "(beginswith \"file_as\" \"S\") "
- "(beginswith \"file_as\" \"T\") "
- "(beginswith \"file_as\" \"U\") "
- "(beginswith \"file_as\" \"V\") "
- "(beginswith \"file_as\" \"W\") "
- "(beginswith \"file_as\" \"X\") "
- "(beginswith \"file_as\" \"Y\") "
- "(beginswith \"file_as\" \"Z\") "
- "))");
- break;
- default:
- query = g_strdup_printf ("(or "
- "(beginswith \"file_as\" \"%c\")"
- "(beginswith \"file_as\" \"%c\")"
- ")", closure->letter, toupper (closure->letter));
- break;
- }
- gtk_object_set (GTK_OBJECT (closure->view),
- "query", query,
- NULL);
- g_free (query);
-}
-
-static void
-free_closure(GtkWidget *button, LetterClosure *closure)
-{
- g_free(closure);
-}
-
-static void
-connect_button (EAddressbookView *view, GladeXML *gui, char letter)
-{
- char *name;
- GtkWidget *button;
- LetterClosure *closure;
- name = g_strdup_printf("button-%c", letter);
- button = glade_xml_get_widget(gui, name);
- g_free(name);
- if (!button)
- return;
- closure = g_new(LetterClosure, 1);
- closure->view = view;
- closure->letter = letter;
- gtk_signal_connect(GTK_OBJECT(button), "clicked",
- GTK_SIGNAL_FUNC(jump_to_letter), closure);
- gtk_signal_connect(GTK_OBJECT(button), "destroy",
- GTK_SIGNAL_FUNC(free_closure), closure);
-}
-
-static GtkWidget *
-create_alphabet (EAddressbookView *view)
-{
- GtkWidget *widget;
- char letter;
- GladeXML *gui = glade_xml_new (EVOLUTION_GLADEDIR "/alphabet.glade", NULL);
-
- widget = glade_xml_get_widget(gui, "scrolledwindow-top");
- if (!widget) {
- return NULL;
- }
-
- connect_button(view, gui, '1');
- for (letter = 'a'; letter <= 'z'; letter ++) {
- connect_button(view, gui, letter);
- }
-
- gtk_object_unref(GTK_OBJECT(gui));
- return widget;
-}
-
-static void
-minicard_selection_change (EMinicardViewWidget *widget, EAddressbookView *view)
-{
- command_state_change (view);
-}
-
-static void
-create_minicard_view (EAddressbookView *view)
-{
- GtkWidget *scrollframe;
- GtkWidget *alphabet;
- GtkWidget *minicard_view;
- GtkWidget *minicard_hbox;
- EAddressbookReflowAdapter *adapter;
-
- gtk_widget_push_visual (gdk_rgb_get_visual ());
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
-
- minicard_hbox = gtk_hbox_new(FALSE, 0);
-
- adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(e_addressbook_reflow_adapter_new (view->model));
- minicard_view = e_minicard_view_widget_new(adapter);
-
- gtk_signal_connect(GTK_OBJECT(minicard_view), "selection_change",
- GTK_SIGNAL_FUNC(minicard_selection_change), view);
-
-
- view->object = GTK_OBJECT(minicard_view);
- view->widget = minicard_hbox;
-
- scrollframe = e_scroll_frame_new (NULL, NULL);
- e_scroll_frame_set_policy (E_SCROLL_FRAME (scrollframe),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
-
- gtk_container_add (GTK_CONTAINER (scrollframe), minicard_view);
-
-
- gtk_box_pack_start(GTK_BOX(minicard_hbox), scrollframe, TRUE, TRUE, 0);
-
- alphabet = create_alphabet(view);
- if (alphabet) {
- gtk_object_ref(GTK_OBJECT(alphabet));
- gtk_widget_unparent(alphabet);
- gtk_box_pack_start(GTK_BOX(minicard_hbox), alphabet, FALSE, FALSE, 0);
- gtk_object_unref(GTK_OBJECT(alphabet));
- }
-
- gtk_table_attach(GTK_TABLE(view), minicard_hbox,
- 0, 1,
- 0, 1,
- GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND,
- 0, 0);
-
- gtk_widget_show_all( GTK_WIDGET(minicard_hbox) );
-
- gtk_widget_pop_visual ();
- gtk_widget_pop_colormap ();
-
- e_reflow_model_changed (E_REFLOW_MODEL (adapter));
-
- gtk_object_unref (GTK_OBJECT (adapter));
-}
-
-static void
-table_double_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EAddressbookView *view)
-{
- if (E_IS_ADDRESSBOOK_TABLE_ADAPTER(view->object)) {
- EAddressbookModel *model = view->model;
- ECard *card = e_addressbook_model_get_card(model, row);
- EBook *book;
-
- gtk_object_get(GTK_OBJECT(model),
- "book", &book,
- NULL);
-
- g_assert (E_IS_BOOK (book));
-
- if (e_card_evolution_list (card))
- e_addressbook_show_contact_list_editor (book, card, FALSE, view->editable);
- else
- e_addressbook_show_contact_editor (book, card, FALSE, view->editable);
- }
-}
-
-typedef struct {
- EBook *book;
- ECard *card;
- EAddressbookView *view;
- GtkWidget *widget;
- gpointer closure;
-} CardAndBook;
-
-static void
-card_and_book_free (CardAndBook *card_and_book)
-{
- gtk_object_unref(GTK_OBJECT(card_and_book->card));
- gtk_object_unref(GTK_OBJECT(card_and_book->book));
- gtk_object_unref(GTK_OBJECT(card_and_book->view));
-}
-
-static void
-get_card_list_1(gint model_row,
- gpointer closure)
-{
- CardAndBook *card_and_book;
- GList **list;
- EAddressbookView *view;
- ECard *card;
-
- card_and_book = closure;
- list = card_and_book->closure;
- view = card_and_book->view;
-
- card = e_addressbook_model_get_card(view->model, model_row);
- *list = g_list_prepend(*list, card);
-}
-
-static GList *
-get_card_list (CardAndBook *card_and_book)
-{
- GList *list = NULL;
- ETable *table;
-
- table = E_TABLE(card_and_book->widget);
- card_and_book->closure = &list;
- e_table_selected_row_foreach(table,
- get_card_list_1,
- card_and_book);
- return list;
-}
-
-static void
-save_as (GtkWidget *widget, CardAndBook *card_and_book)
-{
- e_contact_save_as(_("Save as VCard"), card_and_book->card);
- card_and_book_free(card_and_book);
-}
-
-static void
-send_as (GtkWidget *widget, CardAndBook *card_and_book)
-{
- e_card_send(card_and_book->card, E_CARD_DISPOSITION_AS_ATTACHMENT);
- card_and_book_free(card_and_book);
-}
-
-static void
-send_to (GtkWidget *widget, CardAndBook *card_and_book)
-
-{
- e_card_send(card_and_book->card, E_CARD_DISPOSITION_AS_TO);
- card_and_book_free(card_and_book);
-}
-
-static void
-print (GtkWidget *widget, CardAndBook *card_and_book)
-{
- gtk_widget_show(e_contact_print_card_dialog_new(card_and_book->card));
- card_and_book_free(card_and_book);
-}
-
-static void
-print_envelope (GtkWidget *widget, CardAndBook *card_and_book)
-{
- gtk_widget_show(e_contact_print_envelope_dialog_new(card_and_book->card));
- card_and_book_free(card_and_book);
-}
-
-static void
-delete (GtkWidget *widget, CardAndBook *card_and_book)
-{
- if (e_contact_editor_confirm_delete(GTK_WINDOW(gtk_widget_get_toplevel(card_and_book->widget)))) {
- GList *list = get_card_list(card_and_book);
- GList *iterator;
- for (iterator = list; iterator; iterator = iterator->next) {
- ECard *card = iterator->data;
- /* Add the card in the contact editor to our ebook */
- e_book_remove_card (card_and_book->book,
- card,
- NULL,
- NULL);
- }
- e_free_object_list(list);
- }
- card_and_book_free(card_and_book);
-}
-
-static gint
-table_right_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EAddressbookView *view)
-{
- if (E_IS_ADDRESSBOOK_TABLE_ADAPTER(view->object)) {
- EAddressbookModel *model = view->model;
- CardAndBook *card_and_book;
-
- EPopupMenu menu[] = {
- {N_("Save as VCard"), NULL, GTK_SIGNAL_FUNC(save_as), NULL, 0},
- {N_("Send contact to other"), NULL, GTK_SIGNAL_FUNC(send_as), NULL, 0},
- {N_("Send message to contact"), NULL, GTK_SIGNAL_FUNC(send_to), NULL, 0},
- {N_("Print"), NULL, GTK_SIGNAL_FUNC(print), NULL, 0},
- {N_("Print Envelope"), NULL, GTK_SIGNAL_FUNC(print_envelope), NULL, 0},
- {N_("Delete"), NULL, GTK_SIGNAL_FUNC(delete), NULL, 0},
- {NULL, NULL, NULL, NULL, 0}
- };
-
- card_and_book = g_new(CardAndBook, 1);
- card_and_book->card = e_addressbook_model_get_card(model, row);
- card_and_book->widget = GTK_WIDGET(table);
- card_and_book->view = view;
- gtk_object_get(GTK_OBJECT(model),
- "book", &(card_and_book->book),
- NULL);
-
- gtk_object_ref(GTK_OBJECT(card_and_book->book));
- gtk_object_ref(GTK_OBJECT(card_and_book->view));
-
- e_popup_menu_run (menu, event, 0, 0, card_and_book);
- return TRUE;
- } else
- return FALSE;
-}
-
-static void
-table_selection_change(ETableScrolled *table, EAddressbookView *view)
-{
- command_state_change (view);
-}
-
-static void
-table_drag_data_get (ETable *table,
- int row,
- int col,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- gpointer user_data)
-{
- EAddressbookView *view = user_data;
-
- printf ("table_drag_data_get (row %d, col %d)\n", row, col);
-
- if (!E_IS_ADDRESSBOOK_TABLE_ADAPTER(view->object))
- return;
-
- switch (info) {
- case DND_TARGET_TYPE_VCARD: {
- char *value;
-
- row = e_table_view_to_model_row (table, row);
- value = e_card_get_vcard(view->model->data[row]);
-
- gtk_selection_data_set (selection_data,
- selection_data->target,
- 8,
- value, strlen (value));
- break;
- }
- }
-}
-
-static void
-emit_status_message (EAddressbookView *eav, const gchar *status)
-{
- gtk_signal_emit (GTK_OBJECT (eav),
- e_addressbook_view_signals [STATUS_MESSAGE],
- status);
-}
-
-static void
-status_message (GtkObject *object, const gchar *status, EAddressbookView *eav)
-{
- emit_status_message (eav, status);
-}
-
-static void
-stop_state_changed (GtkObject *object, EAddressbookView *eav)
-{
- command_state_change (eav);
-}
-
-static void
-writable_status (GtkObject *object, gboolean writable, EAddressbookView *eav)
-{
- command_state_change (eav);
-}
-
-static void
-command_state_change (EAddressbookView *eav)
-{
- gtk_signal_emit (GTK_OBJECT (eav),
- e_addressbook_view_signals [COMMAND_STATE_CHANGE]);
-}
-
-#ifdef JUST_FOR_TRANSLATORS
-static char *list [] = {
- N_("* Click here to add a contact *"),
- N_("File As"),
- N_("Full Name"),
- N_("Email"),
- N_("Primary Phone"),
- N_("Assistant Phone"),
- N_("Business Phone"),
- N_("Callback Phone"),
- N_("Company Phone"),
- N_("Home Phone"),
- N_("Organization"),
- N_("Business Address"),
- N_("Home Address"),
- N_("Mobile Phone"),
- N_("Car Phone"),
- N_("Business Fax"),
- N_("Home Fax"),
- N_("Business Phone 2"),
- N_("Home Phone 2"),
- N_("ISDN"),
- N_("Other Phone"),
- N_("Other Fax"),
- N_("Pager"),
- N_("Radio"),
- N_("Telex"),
- N_("TTY"),
- N_("Other Address"),
- N_("Email 2"),
- N_("Email 3"),
- N_("Web Site"),
- N_("Department"),
- N_("Office"),
- N_("Title"),
- N_("Profession"),
- N_("Manager"),
- N_("Assistant"),
- N_("Nickname"),
- N_("Spouse"),
- N_("Note"),
- N_("Free-busy URL"),
-};
-#endif
-
-#define SPEC "<?xml version=\"1.0\"?> \
-<ETableSpecification click-to-add=\"true\" draw-grid=\"true\" _click-to-add-message=\"* Click here to add a contact *\"> \
- <ETableColumn model_col= \"0\" _title=\"File As\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col= \"1\" _title=\"Full Name\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col= \"3\" _title=\"Email\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col= \"4\" _title=\"Primary Phone\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col= \"5\" _title=\"Assistant Phone\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col= \"6\" _title=\"Business Phone\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col= \"7\" _title=\"Callback Phone\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col= \"8\" _title=\"Company Phone\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col= \"9\" _title=\"Home Phone\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"10\" _title=\"Organization\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"11\" _title=\"Business Address\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"12\" _title=\"Home Address\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"13\" _title=\"Mobile Phone\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"14\" _title=\"Car Phone\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"15\" _title=\"Business Fax\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"16\" _title=\"Home Fax\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"17\" _title=\"Business Phone 2\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"18\" _title=\"Home Phone 2\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"19\" _title=\"ISDN\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"20\" _title=\"Other Phone\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"21\" _title=\"Other Fax\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"22\" _title=\"Pager\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"23\" _title=\"Radio\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"24\" _title=\"Telex\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"25\" _title=\"TTY\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"26\" _title=\"Other Address\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"27\" _title=\"Email 2\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"28\" _title=\"Email 3\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"29\" _title=\"Web Site\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"30\" _title=\"Department\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"31\" _title=\"Office\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"32\" _title=\"Title\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"33\" _title=\"Profession\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"34\" _title=\"Manager\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"35\" _title=\"Assistant\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"36\" _title=\"Nickname\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"37\" _title=\"Spouse\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"38\" _title=\"Note\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"39\" _title=\"Free-busy URL\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableState> \
- <column source=\"0\"/> \
- <column source=\"1\"/> \
- <column source=\"5\"/> \
- <column source=\"3\"/> \
- <column source=\"4\"/> \
- <grouping> \
- <leaf column=\"0\" ascending=\"true\"/> \
- </grouping> \
- </ETableState> \
-</ETableSpecification>"
-
-static void
-create_table_view (EAddressbookView *view)
-{
- ETableModel *adapter;
- ECardSimple *simple;
- GtkWidget *table;
-
- simple = e_card_simple_new(NULL);
-
- adapter = e_addressbook_table_adapter_new(view->model);
-
- /* Here we create the table. We give it the three pieces of
- the table we've created, the header, the model, and the
- initial layout. It does the rest. */
- table = e_table_scrolled_new (adapter, NULL, SPEC, NULL);
-
- view->object = GTK_OBJECT(adapter);
- view->widget = table;
-
- gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(table))), "double_click",
- GTK_SIGNAL_FUNC(table_double_click), view);
- gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(table))), "right_click",
- GTK_SIGNAL_FUNC(table_right_click), view);
- gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(table))), "selection_change",
- GTK_SIGNAL_FUNC(table_selection_change), view);
-
- /* drag & drop signals */
- e_table_drag_source_set (E_TABLE(E_TABLE_SCROLLED(table)->table), GDK_BUTTON1_MASK,
- drag_types, num_drag_types, GDK_ACTION_MOVE);
-
- gtk_signal_connect (GTK_OBJECT (E_TABLE_SCROLLED(table)->table),
- "table_drag_data_get",
- GTK_SIGNAL_FUNC (table_drag_data_get),
- view);
-
- gtk_table_attach(GTK_TABLE(view), table,
- 0, 1,
- 0, 1,
- GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND,
- 0, 0);
-
- gtk_widget_show( GTK_WIDGET(table) );
-
- gtk_object_unref(GTK_OBJECT(simple));
-}
-
-
-static void
-change_view_type (EAddressbookView *view, EAddressbookViewType view_type)
-{
- if (view_type == view->view_type)
- return;
-
- if (view->widget) {
- gtk_widget_destroy (view->widget);
- view->widget = NULL;
- }
- view->object = NULL;
-
- switch (view_type) {
- case E_ADDRESSBOOK_VIEW_MINICARD:
- create_minicard_view (view);
- break;
- case E_ADDRESSBOOK_VIEW_TABLE:
- create_table_view (view);
- break;
- default:
- g_warning ("view_type must be either TABLE or MINICARD\n");
- return;
- }
-
- view->view_type = view_type;
-
- command_state_change (view);
-}
-
-static void
-e_contact_print_destroy(GnomeDialog *dialog, gpointer data)
-{
- ETableScrolled *table = gtk_object_get_data(GTK_OBJECT(dialog), "table");
- EPrintable *printable = gtk_object_get_data(GTK_OBJECT(dialog), "printable");
- gtk_object_unref(GTK_OBJECT(printable));
- gtk_object_unref(GTK_OBJECT(table));
-}
-
-static void
-e_contact_print_button(GnomeDialog *dialog, gint button, gpointer data)
-{
- GnomePrintMaster *master;
- GnomePrintContext *pc;
- EPrintable *printable = gtk_object_get_data(GTK_OBJECT(dialog), "printable");
- GtkWidget *preview;
- switch( button ) {
- case GNOME_PRINT_PRINT:
- master = gnome_print_master_new_from_dialog( GNOME_PRINT_DIALOG(dialog) );
- pc = gnome_print_master_get_context( master );
- e_printable_reset(printable);
- while (e_printable_data_left(printable)) {
- if (gnome_print_gsave(pc) == -1)
- /* FIXME */;
- if (gnome_print_translate(pc, 72, 72) == -1)
- /* FIXME */;
- e_printable_print_page(printable,
- pc,
- 6.5 * 72,
- 5 * 72,
- TRUE);
- if (gnome_print_grestore(pc) == -1)
- /* FIXME */;
- if (gnome_print_showpage(pc) == -1)
- /* FIXME */;
- }
- gnome_print_master_close(master);
- gnome_print_master_print(master);
- gtk_object_unref(GTK_OBJECT(master));
- gnome_dialog_close(dialog);
- break;
- case GNOME_PRINT_PREVIEW:
- master = gnome_print_master_new_from_dialog( GNOME_PRINT_DIALOG(dialog) );
- pc = gnome_print_master_get_context( master );
- e_printable_reset(printable);
- while (e_printable_data_left(printable)) {
- if (gnome_print_gsave(pc) == -1)
- /* FIXME */;
- if (gnome_print_translate(pc, 72, 72) == -1)
- /* FIXME */;
- e_printable_print_page(printable,
- pc,
- 6.5 * 72,
- 9 * 72,
- TRUE);
- if (gnome_print_grestore(pc) == -1)
- /* FIXME */;
- if (gnome_print_showpage(pc) == -1)
- /* FIXME */;
- }
- gnome_print_master_close(master);
- preview = GTK_WIDGET(gnome_print_master_preview_new(master, "Print Preview"));
- gtk_widget_show_all(preview);
- gtk_object_unref(GTK_OBJECT(master));
- break;
- case GNOME_PRINT_CANCEL:
- gnome_dialog_close(dialog);
- break;
- }
-}
-
-static void
-display_view(GalViewCollection *collection,
- GalView *view,
- gpointer data)
-{
- EAddressbookView *address_view = data;
- if (GAL_IS_VIEW_ETABLE(view)) {
- change_view_type (address_view, E_ADDRESSBOOK_VIEW_TABLE);
- e_table_set_state_object(e_table_scrolled_get_table(E_TABLE_SCROLLED(address_view->widget)), GAL_VIEW_ETABLE(view)->state);
- } else if (GAL_IS_VIEW_MINICARD(view)) {
- change_view_type (address_view, E_ADDRESSBOOK_VIEW_MINICARD);
- }
-}
-
-void
-e_addressbook_view_setup_menus (EAddressbookView *view,
- BonoboUIComponent *uic)
-{
- GalViewFactory *factory;
- ETableSpecification *spec;
- char *galview;
-
- g_return_if_fail (view != NULL);
- g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
- g_return_if_fail (uic != NULL);
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (uic));
- g_return_if_fail (view->view_collection == NULL);
-
- g_assert (view->view_collection == NULL);
- g_assert (view->view_menus == NULL);
-
- view->view_collection = gal_view_collection_new();
-
- galview = gnome_util_prepend_user_home("/evolution/views/addressbook/");
- gal_view_collection_set_storage_directories(view->view_collection,
- EVOLUTION_DATADIR "/evolution/views/addressbook/",
- galview);
- g_free(galview);
-
- spec = e_table_specification_new();
- e_table_specification_load_from_string(spec, SPEC);
-
- factory = gal_view_factory_etable_new (spec);
- gtk_object_unref (GTK_OBJECT (spec));
- gal_view_collection_add_factory (view->view_collection, factory);
- gtk_object_unref (GTK_OBJECT (factory));
-
- factory = gal_view_factory_minicard_new ();
- gal_view_collection_add_factory (view->view_collection, factory);
- gtk_object_unref (GTK_OBJECT (factory));
-
- gal_view_collection_load(view->view_collection);
-
- view->view_menus = gal_view_menus_new(view->view_collection);
- gal_view_menus_apply(view->view_menus, uic, NULL);
- gtk_signal_connect(GTK_OBJECT(view->view_collection), "display_view",
- display_view, view);
-}
-
-/**
- * e_addressbook_view_discard_menus:
- * @view: An addressbook view.
- *
- * Makes an addressbook view discard its GAL view menus and its views collection
- * objects. This should be called when the corresponding Bonobo component is
- * deactivated.
- **/
-void
-e_addressbook_view_discard_menus (EAddressbookView *view)
-{
- g_return_if_fail (view != NULL);
- g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
- g_return_if_fail (view->view_collection);
-
- g_assert (view->view_collection != NULL);
- g_assert (view->view_menus != NULL);
-
- gtk_object_unref (GTK_OBJECT (view->view_collection));
- view->view_collection = NULL;
-
- gtk_object_unref (GTK_OBJECT (view->view_menus));
- view->view_menus = NULL;
-}
-
-static ESelectionModel*
-get_selection_model (EAddressbookView *view)
-{
- if (view->view_type == E_ADDRESSBOOK_VIEW_MINICARD)
- return e_minicard_view_widget_get_selection_model (E_MINICARD_VIEW_WIDGET(view->object));
- else
- return E_SELECTION_MODEL(E_TABLE_SCROLLED(view->widget)->table->selection);
-}
-
-
-void
-e_addressbook_view_print(EAddressbookView *view)
-{
- if (view->view_type == E_ADDRESSBOOK_VIEW_MINICARD) {
- char *query;
- EBook *book;
- GtkWidget *print;
-
- gtk_object_get (GTK_OBJECT(view->model),
- "query", &query,
- "book", &book,
- NULL);
- print = e_contact_print_dialog_new(book, query);
- g_free(query);
- gtk_widget_show_all(print);
- } else if (view->view_type == E_ADDRESSBOOK_VIEW_TABLE) {
- GtkWidget *dialog;
- EPrintable *printable;
- ETable *etable;
-
- dialog = gnome_print_dialog_new("Print cards", GNOME_PRINT_DIALOG_RANGE | GNOME_PRINT_DIALOG_COPIES);
- gnome_print_dialog_construct_range_any(GNOME_PRINT_DIALOG(dialog), GNOME_PRINT_RANGE_ALL | GNOME_PRINT_RANGE_SELECTION,
- NULL, NULL, NULL);
-
- gtk_object_get(GTK_OBJECT(view->widget), "table", &etable, NULL);
- printable = e_table_get_printable(etable);
-
- gtk_object_ref(GTK_OBJECT(view->widget));
-
- gtk_object_set_data(GTK_OBJECT(dialog), "table", view->widget);
- gtk_object_set_data(GTK_OBJECT(dialog), "printable", printable);
-
- gtk_signal_connect(GTK_OBJECT(dialog),
- "clicked", GTK_SIGNAL_FUNC(e_contact_print_button), NULL);
- gtk_signal_connect(GTK_OBJECT(dialog),
- "destroy", GTK_SIGNAL_FUNC(e_contact_print_destroy), NULL);
- gtk_widget_show(dialog);
- }
-}
-
-static void
-card_deleted_cb (EBook* book, EBookStatus status, gpointer user_data)
-{
- EAddressbookView *view = user_data;
-
- emit_status_message (view, _("Done."));
-
- if (status != E_BOOK_STATUS_SUCCESS) {
- e_addressbook_error_dialog (_("Error removing card"), status);
- }
-}
-
-static void
-do_remove (int i, gpointer user_data)
-{
- EBook *book;
- ECard *card;
- EAddressbookView *view = user_data;
-
- gtk_object_get (GTK_OBJECT(view->model),
- "book", &book,
- NULL);
-
- card = e_addressbook_model_get_card (view->model, i);
-
- e_book_remove_card(book, card, card_deleted_cb, view);
-
- gtk_object_unref (GTK_OBJECT (card));
-}
-
-void
-e_addressbook_view_delete_selection(EAddressbookView *view)
-{
- ESelectionModel *model = get_selection_model (view);
-
- g_return_if_fail (model);
-
- emit_status_message (view, _("Removing cards..."));
-
- e_selection_model_foreach (model,
- do_remove,
- view);
-}
-
-static void
-invisible_destroyed (GtkWidget *invisible, EAddressbookView *view)
-{
- view->invisible = NULL;
-}
-
-static void
-selection_get (GtkWidget *invisible,
- GtkSelectionData *selection_data,
- guint info,
- guint time_stamp,
- EAddressbookView *view)
-{
- char *value;
-
- value = e_card_list_get_vcard(view->clipboard_cards);
-
- gtk_selection_data_set (selection_data, GDK_SELECTION_TYPE_STRING,
- 8, value, strlen (value));
-
-}
-
-static void
-selection_clear_event (GtkWidget *invisible,
- GdkEventSelection *event,
- EAddressbookView *view)
-{
- if (view->clipboard_cards) {
- g_list_foreach (view->clipboard_cards, (GFunc)gtk_object_unref, NULL);
- g_list_free (view->clipboard_cards);
- view->clipboard_cards = NULL;
- }
-}
-
-static void
-selection_received (GtkWidget *invisible,
- GtkSelectionData *selection_data,
- guint time,
- EAddressbookView *view)
-{
- if (selection_data->length < 0 || selection_data->type != GDK_SELECTION_TYPE_STRING) {
- return;
- }
- else {
- /* XXX make sure selection_data->data = \0 terminated */
- GList *card_list = e_card_load_cards_from_string (selection_data->data);
- GList *l;
-
- if (!card_list /* it wasn't a vcard list */)
- return;
-
- for (l = card_list; l; l = l->next) {
- ECard *card = l->data;
-
- e_card_merging_book_add_card (view->book, card, NULL /* XXX */, NULL);
- }
-
- g_list_foreach (card_list, (GFunc)gtk_object_unref, NULL);
- g_list_free (card_list);
- }
-}
-
-static void
-add_to_list (int model_row, gpointer closure)
-{
- GList **list = closure;
- *list = g_list_prepend (*list, GINT_TO_POINTER (model_row));
-}
-
-static GList *
-get_selected_cards (EAddressbookView *view)
-{
- GList *list;
- GList *iterator;
- ESelectionModel *selection = get_selection_model (view);
-
- list = NULL;
- e_selection_model_foreach (selection, add_to_list, &list);
-
- for (iterator = list; iterator; iterator = iterator->next) {
- iterator->data = e_addressbook_model_card_at (view->model, GPOINTER_TO_INT (iterator->data));
- }
- list = g_list_reverse (list);
- return list;
-}
-
-void
-e_addressbook_view_save_as (EAddressbookView *view)
-{
- GList *list = get_selected_cards (view);
- if (list)
- e_contact_list_save_as (_("Save as VCard"), list);
- g_list_free (list);
-}
-
-void
-e_addressbook_view_send (EAddressbookView *view)
-{
- GList *list = get_selected_cards (view);
- if (list)
- e_card_list_send (list, E_CARD_DISPOSITION_AS_ATTACHMENT);
- g_list_free (list);
-}
-
-void
-e_addressbook_view_send_to (EAddressbookView *view)
-{
- GList *list = get_selected_cards (view);
- if (list)
- e_card_list_send (list, E_CARD_DISPOSITION_AS_TO);
- g_list_free (list);
-}
-
-void
-e_addressbook_view_cut (EAddressbookView *view)
-{
- e_addressbook_view_copy (view);
- e_addressbook_view_delete_selection (view);
-}
-
-void
-e_addressbook_view_copy (EAddressbookView *view)
-{
- view->clipboard_cards = get_selected_cards (view);
-
- gtk_selection_owner_set (view->invisible, clipboard_atom, GDK_CURRENT_TIME);
-}
-
-void
-e_addressbook_view_paste (EAddressbookView *view)
-{
- gtk_selection_convert (view->invisible, clipboard_atom,
- GDK_SELECTION_TYPE_STRING,
- GDK_CURRENT_TIME);
-}
-
-void
-e_addressbook_view_select_all (EAddressbookView *view)
-{
- ESelectionModel *model = get_selection_model (view);
-
- g_return_if_fail (model);
-
- e_selection_model_select_all (model);
-}
-
-void
-e_addressbook_view_show_all(EAddressbookView *view)
-{
- gtk_object_set(GTK_OBJECT(view),
- "query", NULL,
- NULL);
-}
-
-void
-e_addressbook_view_stop(EAddressbookView *view)
-{
- e_addressbook_model_stop (view->model);
-}
-
-static gboolean
-e_addressbook_view_selection_nonempty (EAddressbookView *view)
-{
- ESelectionModel *selection_model;
-
- selection_model = get_selection_model (view);
- if (selection_model == NULL)
- return FALSE;
-
- return e_selection_model_selected_count (selection_model) != 0;
-}
-
-gboolean
-e_addressbook_view_can_create (EAddressbookView *view)
-{
- return e_addressbook_model_editable (view->model);
-}
-
-gboolean
-e_addressbook_view_can_print (EAddressbookView *view)
-{
- return e_addressbook_view_selection_nonempty (view);
-}
-
-gboolean
-e_addressbook_view_can_save_as (EAddressbookView *view)
-{
- return e_addressbook_view_selection_nonempty (view);
-}
-
-gboolean e_addressbook_view_can_send (EAddressbookView *view)
-{
- return e_addressbook_view_selection_nonempty (view);
-}
-
-gboolean e_addressbook_view_can_send_to (EAddressbookView *view)
-{
- return e_addressbook_view_selection_nonempty (view);
-}
-
-gboolean
-e_addressbook_view_can_delete (EAddressbookView *view)
-{
- return e_addressbook_view_selection_nonempty (view) && e_addressbook_model_editable (view->model);
-}
-
-gboolean
-e_addressbook_view_can_cut (EAddressbookView *view)
-{
- return e_addressbook_view_selection_nonempty (view) && e_addressbook_model_editable (view->model);
-}
-
-gboolean
-e_addressbook_view_can_copy (EAddressbookView *view)
-{
- return e_addressbook_view_selection_nonempty (view);
-}
-
-gboolean
-e_addressbook_view_can_paste (EAddressbookView *view)
-{
- return e_addressbook_model_editable (view->model);
-}
-
-gboolean
-e_addressbook_view_can_select_all (EAddressbookView *view)
-{
- return e_addressbook_model_card_count (view->model) != 0;
-}
-
-gboolean
-e_addressbook_view_can_stop (EAddressbookView *view)
-{
- return e_addressbook_model_can_stop (view->model);
-}
-
diff --git a/addressbook/gui/widgets/e-addressbook-view.h b/addressbook/gui/widgets/e-addressbook-view.h
deleted file mode 100644
index 8fc807572a..0000000000
--- a/addressbook/gui/widgets/e-addressbook-view.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-addressbook-view.h
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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_ADDRESSBOOK_VIEW_H__
-#define __E_ADDRESSBOOK_VIEW_H__
-
-#include <gtk/gtktable.h>
-#include <bonobo/bonobo-ui-component.h>
-#include <gal/menus/gal-view-collection.h>
-#include "e-addressbook-model.h"
-#include "widgets/menus/gal-view-menus.h"
-#include "addressbook/backend/ebook/e-book.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* EAddressbookView - A card displaying information about a contact.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- */
-
-#define E_ADDRESSBOOK_VIEW_TYPE (e_addressbook_view_get_type ())
-#define E_ADDRESSBOOK_VIEW(obj) (GTK_CHECK_CAST ((obj), E_ADDRESSBOOK_VIEW_TYPE, EAddressbookView))
-#define E_ADDRESSBOOK_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_ADDRESSBOOK_VIEW_TYPE, EAddressbookViewClass))
-#define E_IS_ADDRESSBOOK_VIEW(obj) (GTK_CHECK_TYPE ((obj), E_ADDRESSBOOK_VIEW_TYPE))
-#define E_IS_ADDRESSBOOK_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_ADDRESSBOOK_VIEW_TYPE))
-
-typedef enum {
- E_ADDRESSBOOK_VIEW_NONE, /* initialized to this */
- E_ADDRESSBOOK_VIEW_TABLE,
- E_ADDRESSBOOK_VIEW_MINICARD
-} EAddressbookViewType;
-
-
-typedef struct _EAddressbookView EAddressbookView;
-typedef struct _EAddressbookViewClass EAddressbookViewClass;
-
-struct _EAddressbookView
-{
- GtkTable parent;
-
- /* item specific fields */
- EAddressbookViewType view_type;
-
- EAddressbookModel *model;
-
- GtkWidget *invisible;
- GList *clipboard_cards;
-
- EBook *book;
- char *query;
- guint editable : 1;
-
- GtkObject *object;
- GtkWidget *widget;
-
- GtkWidget *vbox;
-
- /* Menus handler and the view collection */
- GalViewCollection *view_collection;
- GalViewMenus *view_menus;
-};
-
-struct _EAddressbookViewClass
-{
- GtkTableClass parent_class;
-
- /*
- * Signals
- */
- void (*status_message) (EAddressbookView *view, const gchar *message);
- void (*command_state_change) (EAddressbookView *view);
-};
-
-GtkWidget *e_addressbook_view_new (void);
-GtkType e_addressbook_view_get_type (void);
-
-void e_addressbook_view_setup_menus (EAddressbookView *view,
- BonoboUIComponent *uic);
-void e_addressbook_view_discard_menus (EAddressbookView *view);
-
-void e_addressbook_view_save_as (EAddressbookView *view);
-void e_addressbook_view_send (EAddressbookView *view);
-void e_addressbook_view_send_to (EAddressbookView *view);
-void e_addressbook_view_print (EAddressbookView *view);
-void e_addressbook_view_delete_selection (EAddressbookView *view);
-void e_addressbook_view_cut (EAddressbookView *view);
-void e_addressbook_view_copy (EAddressbookView *view);
-void e_addressbook_view_paste (EAddressbookView *view);
-void e_addressbook_view_select_all (EAddressbookView *view);
-void e_addressbook_view_show_all (EAddressbookView *view);
-void e_addressbook_view_stop (EAddressbookView *view);
-
-gboolean e_addressbook_view_can_create (EAddressbookView *view);
-gboolean e_addressbook_view_can_print (EAddressbookView *view);
-gboolean e_addressbook_view_can_save_as (EAddressbookView *view);
-gboolean e_addressbook_view_can_send (EAddressbookView *view);
-gboolean e_addressbook_view_can_send_to (EAddressbookView *view);
-gboolean e_addressbook_view_can_delete (EAddressbookView *view);
-gboolean e_addressbook_view_can_cut (EAddressbookView *view);
-gboolean e_addressbook_view_can_copy (EAddressbookView *view);
-gboolean e_addressbook_view_can_paste (EAddressbookView *view);
-gboolean e_addressbook_view_can_select_all (EAddressbookView *view);
-gboolean e_addressbook_view_can_stop (EAddressbookView *view);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_ADDRESSBOOK_VIEW_H__ */
diff --git a/addressbook/gui/widgets/e-minicard-control.c b/addressbook/gui/widgets/e-minicard-control.c
deleted file mode 100644
index 94f762560f..0000000000
--- a/addressbook/gui/widgets/e-minicard-control.c
+++ /dev/null
@@ -1,336 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-minicard-control.c
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * Copyright 1999, 2000, Ximian, Inc.
- */
-
-#include <config.h>
-
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-persist.h>
-#include <bonobo/bonobo-persist-stream.h>
-#include <bonobo/bonobo-stream-client.h>
-#include <addressbook/backend/ebook/e-book.h>
-#include <addressbook/backend/ebook/e-card.h>
-
-#include "e-minicard-control.h"
-#include "e-minicard-widget.h"
-#include "e-card-merging.h"
-
-#if 0
-enum {
- PROP_RUNNING
-} MyArgs;
-
-#define RUNNING_KEY "Clock::Running"
-
-static void
-get_prop (BonoboPropertyBag *bag,
- BonoboArg *arg,
- guint arg_id,
- CORBA_Environment *ev,
- gpointer user_data)
-{
- GtkObject *clock = user_data;
-
- switch (arg_id) {
-
- case PROP_RUNNING:
- {
- gboolean b = GPOINTER_TO_UINT (gtk_object_get_data (clock, RUNNING_KEY));
- BONOBO_ARG_SET_BOOLEAN (arg, b);
- break;
- }
-
- default:
- g_warning ("Unhandled arg %d", arg_id);
- break;
- }
-}
-
-static void
-set_prop (BonoboPropertyBag *bag,
- const BonoboArg *arg,
- guint arg_id,
- CORBA_Environment *ev,
- gpointer user_data)
-{
- GtkClock *clock = user_data;
-
- switch (arg_id) {
-
- case PROP_RUNNING:
- {
- guint i;
-
- i = BONOBO_ARG_GET_BOOLEAN (arg);
-
- if (i)
- gtk_clock_start (clock);
- else
- gtk_clock_stop (clock);
-
- gtk_object_set_data (GTK_OBJECT (clock), RUNNING_KEY,
- GUINT_TO_POINTER (i));
- break;
- }
-
- default:
- g_warning ("Unhandled arg %d", arg_id);
- break;
- }
-}
-#endif
-
-/*
- * Bonobo::PersistStream
- *
- * These two functions implement the Bonobo::PersistStream load and
- * save methods which allow data to be loaded into and out of the
- * BonoboObject.
- */
-static char *
-stream_read (Bonobo_Stream stream)
-{
- Bonobo_Stream_iobuf *buffer;
- CORBA_Environment ev;
- char *data = NULL;
- gint length = 0;
-
- CORBA_exception_init (&ev);
- do {
-#define READ_CHUNK_SIZE 65536
- Bonobo_Stream_read (stream, READ_CHUNK_SIZE,
- &buffer, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- if (buffer->_length <= 0)
- break;
-
- data = g_realloc (data, length + buffer->_length + 1);
-
- memcpy (data + length, buffer->_buffer, buffer->_length);
-
- length += buffer->_length;
-
- CORBA_free (buffer);
- } while (1);
-
- CORBA_free (buffer);
- CORBA_exception_free (&ev);
-
- if (data)
- data[length] = '\0';
- else
- data = g_strdup("");
-
- return data;
-} /* stream_read */
-
-/*
- * This function implements the Bonobo::PersistStream:load method.
- */
-static void
-pstream_load (BonoboPersistStream *ps, const Bonobo_Stream stream,
- Bonobo_Persist_ContentType type, void *data,
- CORBA_Environment *ev)
-{
- ECard *card;
- char *vcard;
- GtkWidget *minicard = data;
-
- if (type && g_strcasecmp (type, "text/vCard") != 0 &&
- g_strcasecmp (type, "text/x-vCard") != 0) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_Bonobo_Persist_WrongDataType, NULL);
- return;
- }
-
- if ((vcard = stream_read (stream)) == NULL) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_Bonobo_Persist_FileNotFound, NULL);
- return;
- }
-
- card = e_card_new(vcard);
- g_free(vcard);
- gtk_object_set(GTK_OBJECT(minicard),
- "card", card,
- NULL);
- gtk_object_unref(GTK_OBJECT(card));
-} /* pstream_load */
-
-/*
- * This function implements the Bonobo::PersistStream:save method.
- */
-static void
-pstream_save (BonoboPersistStream *ps, const Bonobo_Stream stream,
- Bonobo_Persist_ContentType type, void *data,
- CORBA_Environment *ev)
-{
- char *vcard;
- ECard *card;
- EMinicardWidget *minicard = data;
- int length;
-
- if (type && g_strcasecmp (type, "text/vCard") != 0 &&
- g_strcasecmp (type, "text/x-vCard") != 0) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_Bonobo_Persist_WrongDataType, NULL);
- return;
- }
-
- gtk_object_get (GTK_OBJECT (minicard),
- "card", &card,
- NULL);
- vcard = e_card_get_vcard(card);
- length = strlen (vcard);
- bonobo_stream_client_write (stream, vcard, length, ev);
- g_free (vcard);
-} /* pstream_save */
-
-static CORBA_long
-pstream_get_max_size (BonoboPersistStream *ps, void *data,
- CORBA_Environment *ev)
-{
- GtkWidget *minicard = data;
- ECard *card;
- char *vcard;
- gint length;
-
- gtk_object_get (GTK_OBJECT (minicard),
- "card", &card, NULL);
- vcard = e_card_get_vcard(card);
- length = strlen (vcard);
- g_free (vcard);
-
- return length;
-}
-
-static Bonobo_Persist_ContentTypeList *
-pstream_get_content_types (BonoboPersistStream *ps, void *closure,
- CORBA_Environment *ev)
-{
- return bonobo_persist_generate_content_types (2, "text/vCard", "text/x-vCard");
-}
-
-static void
-book_open_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- ECard *card = closure;
- e_card_merging_book_add_card(book, card, NULL, NULL);
- gtk_object_unref(GTK_OBJECT(card));
-}
-
-static void
-save_in_addressbook(GtkWidget *button, EMinicardWidget *minicard)
-{
- EBook *book;
- gchar *path, *uri;
- ECard *card;
-
- book = e_book_new ();
-
- if (!book) {
- printf ("%s: %s(): Couldn't create EBook, bailing.\n",
- __FILE__,
- __FUNCTION__);
- return;
- }
-
-
- path = g_concat_dir_and_file (g_get_home_dir (),
- "evolution/local/Contacts/addressbook.db");
- uri = g_strdup_printf ("file://%s", path);
- g_free (path);
-
- gtk_object_get(GTK_OBJECT(minicard),
- "card", &card,
- NULL);
- gtk_object_ref(GTK_OBJECT(card));
-
- if (! e_book_load_uri (book, uri, book_open_cb, card)) {
- printf ("error calling load_uri!\n");
- }
- g_free(uri);
-}
-
-static BonoboObject *
-e_minicard_control_factory (BonoboGenericFactory *Factory, void *closure)
-{
-#if 0
- BonoboPropertyBag *pb;
-#endif
- BonoboControl *control;
- BonoboPersistStream *stream;
- GtkWidget *minicard;
- GtkWidget *button;
- GtkWidget *vbox;
-
- /* Create the control. */
-
- minicard = e_minicard_widget_new ();
- gtk_widget_show (minicard);
-
- button = gtk_button_new_with_label(_("Save in addressbook"));
- gtk_signal_connect(GTK_OBJECT(button), "clicked",
- GTK_SIGNAL_FUNC(save_in_addressbook), minicard);
- gtk_widget_show (button);
-
- vbox = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), minicard, TRUE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
- gtk_widget_show (vbox);
-
- control = bonobo_control_new (vbox);
-
- stream = bonobo_persist_stream_new (pstream_load, pstream_save,
- pstream_get_max_size,
- pstream_get_content_types,
- minicard);
-
-#if 0
- /* Create the properties. */
- pb = bonobo_property_bag_new (get_prop, set_prop, clock);
- bonobo_control_set_properties (control, pb);
-
- bonobo_property_bag_add (pb, "running", PROP_RUNNING,
- BONOBO_ARG_BOOLEAN, NULL,
- "Whether or not the clock is running", 0);
-#endif
-
- if (stream == NULL) {
- bonobo_object_unref (BONOBO_OBJECT (control));
- return NULL;
- }
-
- bonobo_object_add_interface (BONOBO_OBJECT (control),
- BONOBO_OBJECT (stream));
-
- return BONOBO_OBJECT (control);
-}
-
-void
-e_minicard_control_factory_init (void)
-{
- static BonoboGenericFactory *factory = NULL;
-
- if (factory != NULL)
- return;
-
- factory =
- bonobo_generic_factory_new (
- "OAFIID:GNOME_Evolution_Addressbook_MiniCard_ControlFactory",
- e_minicard_control_factory, NULL);
-
- if (factory == NULL)
- g_error ("I could not register a EMinicard control factory.");
-}
diff --git a/addressbook/gui/widgets/e-minicard-control.h b/addressbook/gui/widgets/e-minicard-control.h
deleted file mode 100644
index 4a0da88435..0000000000
--- a/addressbook/gui/widgets/e-minicard-control.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef __E_MINICARD_CONTROL_H__
-#define __E_MINICARD_CONTROL_H__
-
-#include <bonobo/bonobo-control.h>
-
-void e_minicard_control_factory_init (void);
-
-#endif /* __E_MINICARD_CONTROL_H__ */
diff --git a/addressbook/gui/widgets/e-minicard-label.c b/addressbook/gui/widgets/e-minicard-label.c
deleted file mode 100644
index cdb16ef68d..0000000000
--- a/addressbook/gui/widgets/e-minicard-label.c
+++ /dev/null
@@ -1,457 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-minicard-label.c
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <gtk/gtksignal.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include <gal/util/e-util.h>
-#include <gal/e-text/e-text.h>
-#include <gal/widgets/e-canvas.h>
-#include <gal/widgets/e-canvas-utils.h>
-#include "e-minicard-label.h"
-
-static void e_minicard_label_init (EMinicardLabel *card);
-static void e_minicard_label_class_init (EMinicardLabelClass *klass);
-static void e_minicard_label_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static gboolean e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event);
-static void e_minicard_label_realize (GnomeCanvasItem *item);
-static void e_minicard_label_unrealize (GnomeCanvasItem *item);
-static void e_minicard_label_reflow(GnomeCanvasItem *item, int flags);
-
-static void e_minicard_label_resize_children( EMinicardLabel *e_minicard_label );
-
-static GnomeCanvasGroupClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_WIDTH,
- ARG_HEIGHT,
- ARG_HAS_FOCUS,
- ARG_FIELD,
- ARG_FIELDNAME,
- ARG_TEXT_MODEL,
- ARG_MAX_FIELD_NAME_WIDTH,
- ARG_EDITABLE
-};
-
-GtkType
-e_minicard_label_get_type (void)
-{
- static GtkType minicard_label_type = 0;
-
- if (!minicard_label_type)
- {
- static const GtkTypeInfo minicard_label_info =
- {
- "EMinicardLabel",
- sizeof (EMinicardLabel),
- sizeof (EMinicardLabelClass),
- (GtkClassInitFunc) e_minicard_label_class_init,
- (GtkObjectInitFunc) e_minicard_label_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- minicard_label_type = gtk_type_unique (gnome_canvas_group_get_type (), &minicard_label_info);
- }
-
- return minicard_label_type;
-}
-
-static void
-e_minicard_label_class_init (EMinicardLabelClass *klass)
-{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- object_class = (GtkObjectClass*) klass;
- item_class = (GnomeCanvasItemClass *) klass;
-
- parent_class = gtk_type_class (gnome_canvas_group_get_type ());
-
- gtk_object_add_arg_type ("EMinicardLabel::width", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_WIDTH);
- gtk_object_add_arg_type ("EMinicardLabel::height", GTK_TYPE_DOUBLE,
- GTK_ARG_READABLE, ARG_HEIGHT);
- gtk_object_add_arg_type ("EMinicardLabel::has_focus", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_HAS_FOCUS);
- gtk_object_add_arg_type ("EMinicardLabel::field", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_FIELD);
- gtk_object_add_arg_type ("EMinicardLabel::fieldname", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_FIELDNAME);
- gtk_object_add_arg_type ("EMinicardLabel::text_model", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_TEXT_MODEL);
- gtk_object_add_arg_type ("EMinicardLabel::max_field_name_length", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_MAX_FIELD_NAME_WIDTH);
- gtk_object_add_arg_type ("EMinicardLabel::editable", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_EDITABLE);
-
- object_class->set_arg = e_minicard_label_set_arg;
- object_class->get_arg = e_minicard_label_get_arg;
- /* object_class->destroy = e_minicard_label_destroy; */
-
- /* GnomeCanvasItem method overrides */
- item_class->realize = e_minicard_label_realize;
- item_class->unrealize = e_minicard_label_unrealize;
- item_class->event = e_minicard_label_event;
-}
-
-static void
-e_minicard_label_init (EMinicardLabel *minicard_label)
-{
- minicard_label->width = 10;
- minicard_label->height = 10;
- minicard_label->rect = NULL;
- minicard_label->fieldname = NULL;
- minicard_label->field = NULL;
-
- minicard_label->max_field_name_length = -1;
-
- e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(minicard_label), e_minicard_label_reflow);
-}
-
-static void
-e_minicard_label_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- EMinicardLabel *e_minicard_label;
-
- item = GNOME_CANVAS_ITEM (o);
- e_minicard_label = E_MINICARD_LABEL (o);
-
- switch (arg_id){
- case ARG_WIDTH:
- e_minicard_label->width = GTK_VALUE_DOUBLE (*arg);
- e_minicard_label_resize_children(e_minicard_label);
- e_canvas_item_request_reflow (item);
- break;
- case ARG_HAS_FOCUS:
- if (e_minicard_label->field && (GTK_VALUE_ENUM(*arg) != E_FOCUS_NONE))
- e_canvas_item_grab_focus(e_minicard_label->field, FALSE);
- break;
- case ARG_FIELD:
- gnome_canvas_item_set( e_minicard_label->field, "text", GTK_VALUE_STRING (*arg), NULL );
- break;
- case ARG_FIELDNAME:
- gnome_canvas_item_set( e_minicard_label->fieldname, "text", GTK_VALUE_STRING (*arg), NULL );
- break;
- case ARG_TEXT_MODEL:
- gnome_canvas_item_set( e_minicard_label->field, "model", GTK_VALUE_OBJECT (*arg), NULL);
- break;
- case ARG_MAX_FIELD_NAME_WIDTH:
- e_minicard_label->max_field_name_length = GTK_VALUE_DOUBLE (*arg);
- break;
- case ARG_EDITABLE:
- e_minicard_label->editable = GTK_VALUE_BOOL (*arg);
- gtk_object_set (GTK_OBJECT (e_minicard_label->field), "editable", e_minicard_label->editable, NULL);
- break;
- }
-}
-
-static void
-e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EMinicardLabel *e_minicard_label;
- char *temp;
- ETextModel *tempmodel;
-
- e_minicard_label = E_MINICARD_LABEL (object);
-
- switch (arg_id) {
- case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = e_minicard_label->width;
- break;
- case ARG_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = e_minicard_label->height;
- break;
- case ARG_HAS_FOCUS:
- GTK_VALUE_ENUM (*arg) = e_minicard_label->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE;
- break;
- case ARG_FIELD:
- gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "text", &temp, NULL );
- GTK_VALUE_STRING (*arg) = temp;
- break;
- case ARG_FIELDNAME:
- gtk_object_get( GTK_OBJECT( e_minicard_label->fieldname ), "text", &temp, NULL );
- GTK_VALUE_STRING (*arg) = temp;
- break;
- case ARG_TEXT_MODEL:
- gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "model", &tempmodel, NULL );
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(tempmodel);
- break;
- case ARG_MAX_FIELD_NAME_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = e_minicard_label->max_field_name_length;
- break;
- case ARG_EDITABLE:
- GTK_VALUE_BOOL (*arg) = e_minicard_label->editable;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-e_minicard_label_realize (GnomeCanvasItem *item)
-{
- if (GNOME_CANVAS_ITEM_CLASS( parent_class )->realize)
- (* GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) (item);
-
- e_canvas_item_request_reflow(item);
-
- if (!item->canvas->aa)
- {
- }
-}
-
-void
-e_minicard_label_construct (GnomeCanvasItem *item)
-{
- EMinicardLabel *e_minicard_label;
- GnomeCanvasGroup *group;
- GdkFont *font;
-
- font = ((GtkWidget *) item->canvas)->style->font;
-
- e_minicard_label = E_MINICARD_LABEL (item);
- group = GNOME_CANVAS_GROUP( item );
-
- e_minicard_label->rect =
- gnome_canvas_item_new( group,
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) e_minicard_label->width - 1,
- "y2", (double) e_minicard_label->height - 1,
- "outline_color", NULL,
- NULL );
- e_minicard_label->fieldname =
- gnome_canvas_item_new( group,
- e_text_get_type(),
- "anchor", GTK_ANCHOR_NW,
- "clip_width", (double) ( e_minicard_label->width / 2 - 4 ),
- "clip", TRUE,
- "use_ellipsis", TRUE,
- "font_gdk", font,
- "fill_color", "black",
- "draw_background", FALSE,
- NULL );
- e_canvas_item_move_absolute(e_minicard_label->fieldname, 2, 1);
-
- e_minicard_label->field =
- gnome_canvas_item_new( group,
- e_text_get_type(),
- "anchor", GTK_ANCHOR_NW,
- "clip_width", (double) ( ( e_minicard_label->width + 1 ) / 2 - 4 ),
- "clip", TRUE,
- "use_ellipsis", TRUE,
- "font_gdk", font,
- "fill_color", "black",
- "editable", e_minicard_label->editable,
- "draw_background", FALSE,
- NULL );
- e_canvas_item_move_absolute(e_minicard_label->field, ( e_minicard_label->width / 2 + 2), 1);
-
- e_canvas_item_request_reflow(item);
-}
-
-static void
-e_minicard_label_unrealize (GnomeCanvasItem *item)
-{
- EMinicardLabel *e_minicard_label;
-
- e_minicard_label = E_MINICARD_LABEL (item);
-
- if (!item->canvas->aa)
- {
- }
-
- if (GNOME_CANVAS_ITEM_CLASS( parent_class )->unrealize)
- (* GNOME_CANVAS_ITEM_CLASS( parent_class )->unrealize) (item);
-}
-
-static gboolean
-e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- EMinicardLabel *e_minicard_label;
-
- e_minicard_label = E_MINICARD_LABEL (item);
-
- switch( event->type )
- {
- case GDK_FOCUS_CHANGE:
- {
- GdkEventFocus *focus_event = (GdkEventFocus *) event;
- if ( focus_event->in )
- {
- gnome_canvas_item_set( e_minicard_label->rect,
- "outline_color", "grey50",
- "fill_color", "grey90",
- NULL );
- e_minicard_label->has_focus = TRUE;
- }
- else
- {
- gnome_canvas_item_set( e_minicard_label->rect,
- "outline_color", NULL,
- "fill_color", NULL,
- NULL );
- e_minicard_label->has_focus = FALSE;
- }
- }
- break;
- case GDK_BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- case GDK_MOTION_NOTIFY:
- case GDK_ENTER_NOTIFY:
- case GDK_LEAVE_NOTIFY: {
- gboolean return_val;
-#if 0
- GnomeCanvasItem *field;
- ArtPoint p;
- double inv[6], affine[6];
-
- field = e_minicard_label->field;
- art_affine_identity (affine);
-
- if (field->xform != NULL) {
- if (field->object.flags & GNOME_CANVAS_ITEM_AFFINE_FULL) {
- art_affine_multiply (affine, affine, field->xform);
- } else {
- affine[4] += field->xform[0];
- affine[5] += field->xform[1];
- }
- }
-
- art_affine_invert (inv, affine);
- switch(event->type) {
- case GDK_MOTION_NOTIFY:
- p.x = event->motion.x;
- p.y = event->motion.y;
- art_affine_point (&p, &p, inv);
- event->motion.x = p.x;
- event->motion.y = p.y;
- break;
- case GDK_BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- p.x = event->button.x;
- p.y = event->button.y;
- art_affine_point (&p, &p, inv);
- event->button.x = p.x;
- event->button.y = p.y;
- break;
- case GDK_ENTER_NOTIFY:
- case GDK_LEAVE_NOTIFY:
- p.x = event->crossing.x;
- p.y = event->crossing.y;
- art_affine_point (&p, &p, inv);
- event->crossing.x = p.x;
- event->crossing.y = p.y;
- break;
- default:
- break;
- }
-#endif
- gtk_signal_emit_by_name(GTK_OBJECT(e_minicard_label->field), "event", event, &return_val);
- return return_val;
- break;
- }
- default:
- break;
- }
-
- if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event)
- return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event);
- else
- return 0;
-}
-
-static void
-e_minicard_label_resize_children(EMinicardLabel *e_minicard_label)
-{
- double left_width;
- if (e_minicard_label->max_field_name_length != -1 && ((e_minicard_label->width / 2) - 4 > e_minicard_label->max_field_name_length))
- left_width = e_minicard_label->max_field_name_length;
- else
- left_width = e_minicard_label->width / 2 - 4;
-
- gnome_canvas_item_set( e_minicard_label->fieldname,
- "clip_width", (double) ( left_width ),
- NULL );
- gnome_canvas_item_set( e_minicard_label->field,
- "clip_width", (double) ( e_minicard_label->width - 8 - left_width ),
- NULL );
-}
-
-static void
-e_minicard_label_reflow(GnomeCanvasItem *item, int flags)
-{
- EMinicardLabel *e_minicard_label = E_MINICARD_LABEL(item);
-
- gint old_height;
- gdouble text_height;
- gdouble left_width;
-
- old_height = e_minicard_label->height;
-
- gtk_object_get(GTK_OBJECT(e_minicard_label->fieldname),
- "text_height", &text_height,
- NULL);
-
- e_minicard_label->height = text_height;
-
-
- gtk_object_get(GTK_OBJECT(e_minicard_label->field),
- "text_height", &text_height,
- NULL);
-
- if (e_minicard_label->height < text_height)
- e_minicard_label->height = text_height;
- e_minicard_label->height += 3;
-
- gnome_canvas_item_set( e_minicard_label->rect,
- "x2", (double) e_minicard_label->width - 1,
- "y2", (double) e_minicard_label->height - 1,
- NULL );
-
- if (e_minicard_label->max_field_name_length != -1 && ((e_minicard_label->width / 2) - 4 > e_minicard_label->max_field_name_length))
- left_width = e_minicard_label->max_field_name_length;
- else
- left_width = e_minicard_label->width / 2 - 4;
-
- e_canvas_item_move_absolute(e_minicard_label->field, left_width + 6, 1);
-
- if (old_height != e_minicard_label->height)
- e_canvas_item_request_parent_reflow(item);
-}
-
-GnomeCanvasItem *
-e_minicard_label_new(GnomeCanvasGroup *parent)
-{
- GnomeCanvasItem *item = gnome_canvas_item_new(parent, e_minicard_label_get_type(), NULL);
- e_minicard_label_construct(item);
- return item;
-}
-
diff --git a/addressbook/gui/widgets/e-minicard-label.h b/addressbook/gui/widgets/e-minicard-label.h
deleted file mode 100644
index eed6e1da21..0000000000
--- a/addressbook/gui/widgets/e-minicard-label.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-minicard-label.h
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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_MINICARD_LABEL_H__
-#define __E_MINICARD_LABEL_H__
-
-#include <glib.h>
-#include <libgnomeui/gnome-canvas.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* EMinicardLabel - A label doing focus with non-marching ants.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- * width double RW width of the label
- * height double R height of the label
- * field string RW text in the field label
- * fieldname string RW text in the fieldname label
- */
-
-#define E_MINICARD_LABEL_TYPE (e_minicard_label_get_type ())
-#define E_MINICARD_LABEL(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_LABEL_TYPE, EMinicardLabel))
-#define E_MINICARD_LABEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_LABEL_TYPE, EMiniCardLabelClass))
-#define E_IS_MINICARD_LABEL(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_LABEL_TYPE))
-#define E_IS_MINICARD_LABEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_LABEL_TYPE))
-
-
-typedef struct _EMinicardLabel EMinicardLabel;
-typedef struct _EMinicardLabelClass EMinicardLabelClass;
-
-struct _EMinicardLabel
-{
- GnomeCanvasGroup parent;
-
- /* item specific fields */
- double width;
- double height;
- double max_field_name_length;
- guint editable : 1;
- GnomeCanvasItem *fieldname;
- GnomeCanvasItem *field;
- GnomeCanvasItem *rect;
-
- gboolean has_focus;
-};
-
-struct _EMinicardLabelClass
-{
- GnomeCanvasGroupClass parent_class;
-};
-
-
-GtkType e_minicard_label_get_type (void);
-GnomeCanvasItem *e_minicard_label_new(GnomeCanvasGroup *parent);
-void e_minicard_label_construct (GnomeCanvasItem *item);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_MINICARD_LABEL_H__ */
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.c b/addressbook/gui/widgets/e-minicard-view-widget.c
deleted file mode 100644
index e01ec2cbb0..0000000000
--- a/addressbook/gui/widgets/e-minicard-view-widget.c
+++ /dev/null
@@ -1,343 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-minicard-view-widget.c
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <gtk/gtksignal.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include <gal/widgets/e-canvas.h>
-
-#include "e-minicard-view-widget.h"
-
-static void e_minicard_view_widget_init (EMinicardViewWidget *widget);
-static void e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass);
-static void e_minicard_view_widget_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_minicard_view_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_minicard_view_widget_destroy (GtkObject *object);
-static void e_minicard_view_widget_reflow (ECanvas *canvas);
-static void e_minicard_view_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
-static void e_minicard_view_widget_realize (GtkWidget *widget);
-
-static void selection_change (ESelectionModel *esm, EMinicardViewWidget *widget);
-
-static ECanvasClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_BOOK,
- ARG_QUERY,
- ARG_EDITABLE
-};
-
-enum {
- SELECTION_CHANGE,
- LAST_SIGNAL
-};
-
-static guint e_minicard_view_widget_signals [LAST_SIGNAL] = {0, };
-
-GtkType
-e_minicard_view_widget_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type)
- {
- static const GtkTypeInfo info =
- {
- "EMinicardViewWidget",
- sizeof (EMinicardViewWidget),
- sizeof (EMinicardViewWidgetClass),
- (GtkClassInitFunc) e_minicard_view_widget_class_init,
- (GtkObjectInitFunc) e_minicard_view_widget_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (e_canvas_get_type (), &info);
- }
-
- return type;
-}
-
-static void
-e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- ECanvasClass *canvas_class;
-
- object_class = (GtkObjectClass*) klass;
- widget_class = GTK_WIDGET_CLASS (klass);
- canvas_class = E_CANVAS_CLASS (klass);
-
- parent_class = gtk_type_class (e_canvas_get_type ());
-
- gtk_object_add_arg_type ("EMinicardViewWidget::book", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_BOOK);
- gtk_object_add_arg_type ("EMinicardViewWidget::query", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_QUERY);
- gtk_object_add_arg_type ("EMinicardViewWidget::editable", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_EDITABLE);
-
- e_minicard_view_widget_signals [SELECTION_CHANGE] =
- gtk_signal_new ("selection_change",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EMinicardViewWidgetClass, selection_change),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, e_minicard_view_widget_signals, LAST_SIGNAL);
-
- object_class->set_arg = e_minicard_view_widget_set_arg;
- object_class->get_arg = e_minicard_view_widget_get_arg;
- object_class->destroy = e_minicard_view_widget_destroy;
-
- widget_class->realize = e_minicard_view_widget_realize;
- widget_class->size_allocate = e_minicard_view_widget_size_allocate;
-
- canvas_class->reflow = e_minicard_view_widget_reflow;
-}
-
-static void
-e_minicard_view_widget_init (EMinicardViewWidget *view)
-{
- view->emv = NULL;
- view->rect = NULL;
-
- view->book = NULL;
- view->query = NULL;
- view->editable = FALSE;
-}
-
-GtkWidget *
-e_minicard_view_widget_new (EAddressbookReflowAdapter *adapter)
-{
- EMinicardViewWidget *widget = E_MINICARD_VIEW_WIDGET (gtk_type_new (e_minicard_view_widget_get_type ()));
-
- widget->adapter = adapter;
- gtk_object_ref (GTK_OBJECT (widget->adapter));
-
- return GTK_WIDGET (widget);
-}
-
-static void
-e_minicard_view_widget_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- EMinicardViewWidget *emvw;
-
- emvw = E_MINICARD_VIEW_WIDGET (o);
-
- switch (arg_id){
- case ARG_BOOK:
- if (emvw->book)
- gtk_object_unref(GTK_OBJECT(emvw->book));
- if (GTK_VALUE_OBJECT (*arg)) {
- emvw->book = E_BOOK(GTK_VALUE_OBJECT (*arg));
- if (emvw->book)
- gtk_object_ref(GTK_OBJECT(emvw->book));
- } else
- emvw->book = NULL;
- if (emvw->emv)
- gtk_object_set(GTK_OBJECT(emvw->emv),
- "book", emvw->book,
- NULL);
- break;
- case ARG_QUERY:
- emvw->query = g_strdup(GTK_VALUE_STRING (*arg));
- if (emvw->emv)
- gtk_object_set(GTK_OBJECT(emvw->emv),
- "query", emvw->query,
- NULL);
- break;
- case ARG_EDITABLE:
- emvw->editable = GTK_VALUE_BOOL(*arg);
- if (emvw->emv)
- gtk_object_set (GTK_OBJECT(emvw->emv),
- "editable", emvw->editable,
- NULL);
- break;
- }
-}
-
-static void
-e_minicard_view_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EMinicardViewWidget *emvw;
-
- emvw = E_MINICARD_VIEW_WIDGET (object);
-
- switch (arg_id) {
- case ARG_BOOK:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(emvw->book);
- break;
- case ARG_QUERY:
- GTK_VALUE_STRING (*arg) = g_strdup(emvw->query);
- break;
- case ARG_EDITABLE:
- GTK_VALUE_BOOL (*arg) = emvw->editable;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-e_minicard_view_widget_destroy (GtkObject *object)
-{
- EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(object);
-
- if (view->book)
- gtk_object_unref(GTK_OBJECT(view->book));
- g_free(view->query);
-
- gtk_object_unref (GTK_OBJECT (view->adapter));
-
- GTK_OBJECT_CLASS(parent_class)->destroy (object);
-}
-
-static void
-e_minicard_view_widget_realize (GtkWidget *widget)
-{
- EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(widget);
-
- view->rect = gnome_canvas_item_new(
- gnome_canvas_root( GNOME_CANVAS(view) ),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) 100,
- "y2", (double) 100,
- "fill_color", "white",
- NULL );
-
- view->emv = gnome_canvas_item_new(
- gnome_canvas_root( GNOME_CANVAS(view) ),
- e_minicard_view_get_type(),
- "height", (double) 100,
- "minimum_width", (double) 100,
- NULL );
-
- gtk_object_set(GTK_OBJECT(view->emv),
- "adapter", view->adapter,
- NULL);
-
- gtk_signal_connect (GTK_OBJECT (E_REFLOW(view->emv)->selection),
- "selection_changed",
- selection_change, view);
-
- if (GTK_WIDGET_CLASS(parent_class)->realize)
- GTK_WIDGET_CLASS(parent_class)->realize (widget);
-}
-
-static void
-e_minicard_view_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
-{
- if (GTK_WIDGET_CLASS(parent_class)->size_allocate)
- GTK_WIDGET_CLASS(parent_class)->size_allocate (widget, allocation);
-
- if (GTK_WIDGET_REALIZED(widget)) {
- double width;
- EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(widget);
-
- gnome_canvas_item_set( view->emv,
- "height", (double) allocation->height,
- NULL );
- gnome_canvas_item_set( view->emv,
- "minimum_width", (double) allocation->width,
- NULL );
- gtk_object_get(GTK_OBJECT(view->emv),
- "width", &width,
- NULL);
- width = MAX(width, allocation->width);
- gnome_canvas_set_scroll_region (GNOME_CANVAS (view), 0, 0, width - 1, allocation->height - 1);
- gnome_canvas_item_set( view->rect,
- "x2", (double) width,
- "y2", (double) allocation->height,
- NULL );
- }
-}
-
-static void
-e_minicard_view_widget_reflow(ECanvas *canvas)
-{
- double width;
- EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(canvas);
-
- if (E_CANVAS_CLASS(parent_class)->reflow)
- E_CANVAS_CLASS(parent_class)->reflow (canvas);
-
- gtk_object_get(GTK_OBJECT(view->emv),
- "width", &width,
- NULL);
- width = MAX(width, GTK_WIDGET(canvas)->allocation.width);
- gnome_canvas_set_scroll_region(GNOME_CANVAS(canvas), 0, 0, width - 1, GTK_WIDGET(canvas)->allocation.height - 1);
- gnome_canvas_item_set( view->rect,
- "x2", (double) width,
- "y2", (double) GTK_WIDGET(canvas)->allocation.height,
- NULL );
-}
-
-static void
-selection_change (ESelectionModel *esm, EMinicardViewWidget *widget)
-{
- gtk_signal_emit (GTK_OBJECT(widget),
- e_minicard_view_widget_signals [SELECTION_CHANGE], widget);
-}
-
-gint
-e_minicard_view_widget_selected_count (EMinicardViewWidget *view)
-{
- if (!view->emv)
- return 0;
- else
- return e_selection_model_selected_count (E_REFLOW (view->emv)->selection);
-}
-
-void
-e_minicard_view_widget_remove_selection(EMinicardViewWidget *view,
- EBookCallback cb,
- gpointer closure)
-{
- if (view->emv)
- e_minicard_view_remove_selection(E_MINICARD_VIEW(view->emv), cb, closure);
-}
-
-void e_minicard_view_widget_jump_to_letter (EMinicardViewWidget *view,
- char letter)
-{
- if (view->emv)
- e_minicard_view_jump_to_letter(E_MINICARD_VIEW(view->emv), letter);
-}
-
-ESelectionModel *
-e_minicard_view_widget_get_selection_model (EMinicardViewWidget *view)
-{
- if (view->emv)
- return E_SELECTION_MODEL (E_REFLOW (view->emv)->selection);
- else
- return NULL;
-}
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.h b/addressbook/gui/widgets/e-minicard-view-widget.h
deleted file mode 100644
index 61d5912dd5..0000000000
--- a/addressbook/gui/widgets/e-minicard-view-widget.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-minicard-view-widget.h
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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_MINICARD_VIEW_WIDGET_H__
-#define __E_MINICARD_VIEW_WIDGET_H__
-
-#include <gal/widgets/e-canvas.h>
-#include "addressbook/backend/ebook/e-book.h"
-#include "e-minicard-view.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_MINICARD_VIEW_WIDGET_TYPE (e_minicard_view_widget_get_type ())
-#define E_MINICARD_VIEW_WIDGET(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_VIEW_WIDGET_TYPE, EMinicardViewWidget))
-#define E_MINICARD_VIEW_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_VIEW_WIDGET_TYPE, EMinicardViewWidgetClass))
-#define E_IS_MINICARD_VIEW_WIDGET(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_VIEW_WIDGET_TYPE))
-#define E_IS_MINICARD_VIEW_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_VIEW_WIDGET_TYPE))
-
-
-typedef struct _EMinicardViewWidget EMinicardViewWidget;
-typedef struct _EMinicardViewWidgetClass EMinicardViewWidgetClass;
-
-struct _EMinicardViewWidget
-{
- ECanvas parent;
-
- GnomeCanvasItem *rect;
- GnomeCanvasItem *emv;
-
- EAddressbookReflowAdapter *adapter;
-
- EBook *book;
- char *query;
- guint editable : 1;
-};
-
-struct _EMinicardViewWidgetClass
-{
- ECanvasClass parent_class;
- void (*selection_change) (EMinicardViewWidget*);
-};
-
-GtkType e_minicard_view_widget_get_type (void);
-gint e_minicard_view_widget_selected_count (EMinicardViewWidget *view);
-void e_minicard_view_widget_remove_selection (EMinicardViewWidget *view,
- EBookCallback cb,
- gpointer closure);
-void e_minicard_view_widget_jump_to_letter (EMinicardViewWidget *view,
- char letter);
-GtkWidget *e_minicard_view_widget_new (EAddressbookReflowAdapter *adapter);
-
-ESelectionModel *e_minicard_view_widget_get_selection_model (EMinicardViewWidget *view);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __E_MINICARD_VIEW_WIDGET_H__ */
diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c
deleted file mode 100644
index 4a3925d75b..0000000000
--- a/addressbook/gui/widgets/e-minicard-view.c
+++ /dev/null
@@ -1,441 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-minicard-view.c
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 "e-minicard-view.h"
-
-#include "e-addressbook-util.h"
-
-#include <gtk/gtkselection.h>
-#include <gtk/gtkdnd.h>
-#include <gal/widgets/e-canvas.h>
-#include <gal/widgets/e-unicode.h>
-#include <libgnome/gnome-i18n.h>
-
-static void e_minicard_view_drag_data_get(GtkWidget *widget,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- EMinicardView *view);
-
-static EReflowClass *parent_class = NULL;
-#define PARENT_TYPE (E_REFLOW_TYPE)
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_ADAPTER,
- ARG_BOOK,
- ARG_QUERY,
- ARG_EDITABLE
-};
-
-enum DndTargetType {
- DND_TARGET_TYPE_VCARD_LIST,
-};
-#define VCARD_LIST_TYPE "text/x-vcard"
-static GtkTargetEntry drag_types[] = {
- { VCARD_LIST_TYPE, 0, DND_TARGET_TYPE_VCARD_LIST }
-};
-static gint num_drag_types = sizeof(drag_types) / sizeof(drag_types[0]);
-
-static void
-e_minicard_view_drag_data_get(GtkWidget *widget,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- EMinicardView *view)
-{
- if (!E_IS_MINICARD_VIEW(view))
- return;
-
- switch (info) {
- case DND_TARGET_TYPE_VCARD_LIST: {
- char *value;
-
- value = e_card_list_get_vcard(view->drag_list);
-
- gtk_selection_data_set (selection_data,
- selection_data->target,
- 8,
- value, strlen (value));
- break;
- }
- }
-
- g_list_foreach (view->drag_list, (GFunc)gtk_object_unref, NULL);
- g_list_free (view->drag_list);
- view->drag_list = NULL;
-}
-
-typedef struct {
- GList *list;
- EAddressbookReflowAdapter *adapter;
-} ModelAndList;
-
-static void
-add_to_list (int index, gpointer closure)
-{
- ModelAndList *mal = closure;
- mal->list = g_list_prepend (mal->list, e_addressbook_reflow_adapter_get_card (mal->adapter, index));
-}
-
-static GList *
-get_card_list (EAddressbookReflowAdapter *adapter, ESelectionModel *selection)
-{
- ModelAndList mal;
-
- mal.adapter = adapter;
- mal.list = NULL;
-
- e_selection_model_foreach (selection, add_to_list, &mal);
-
- mal.list = g_list_reverse (mal.list);
- return mal.list;
-}
-
-static int
-e_minicard_view_drag_begin (EAddressbookReflowAdapter *adapter, GdkEvent *event, EMinicardView *view)
-{
- GdkDragContext *context;
- GtkTargetList *target_list;
- GdkDragAction actions = GDK_ACTION_MOVE;
-
- view->drag_list = get_card_list (adapter, E_REFLOW (view)->selection);
-
- g_print ("dragging %d card(s)\n", g_list_length (view->drag_list));
-
- target_list = gtk_target_list_new (drag_types, num_drag_types);
-
- context = gtk_drag_begin (GTK_WIDGET (GNOME_CANVAS_ITEM (view)->canvas),
- target_list, actions, 1/*XXX*/, event);
-
- if (!view->canvas_drag_data_get_id)
- view->canvas_drag_data_get_id = gtk_signal_connect (GTK_OBJECT (GNOME_CANVAS_ITEM (view)->canvas),
- "drag_data_get",
- GTK_SIGNAL_FUNC (e_minicard_view_drag_data_get),
- view);
-
- gtk_drag_set_icon_default (context);
-
- return TRUE;
-}
-
-static void
-adapter_changed (EMinicardView *view)
-{
- char *empty_message;
-
- empty_message = e_utf8_from_locale_string(_("\n\nThere are no items to show in this view\n\n"
- "Double-click here to create a new Contact."));
- gtk_object_set (GTK_OBJECT(view),
- "empty_message", empty_message,
- NULL);
-
- gtk_signal_connect (GTK_OBJECT (view->adapter), "drag_begin",
- GTK_SIGNAL_FUNC (e_minicard_view_drag_begin), view);
-
- g_free (empty_message);
-}
-
-static void
-e_minicard_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- EMinicardView *view;
-
- item = GNOME_CANVAS_ITEM (o);
- view = E_MINICARD_VIEW (o);
-
- switch (arg_id){
- case ARG_ADAPTER:
- if (view->adapter)
- gtk_object_unref (GTK_OBJECT(view->adapter));
- view->adapter = GTK_VALUE_POINTER (*arg);
- gtk_object_ref (GTK_OBJECT (view->adapter));
- adapter_changed (view);
- gtk_object_set (GTK_OBJECT (view),
- "model", view->adapter,
- NULL);
- break;
- case ARG_BOOK:
- gtk_object_set (GTK_OBJECT (view->adapter),
- "book", GTK_VALUE_OBJECT (*arg),
- NULL);
- break;
- case ARG_QUERY:
- gtk_object_set (GTK_OBJECT (view->adapter),
- "query", GTK_VALUE_STRING (*arg),
- NULL);
- break;
- case ARG_EDITABLE:
- gtk_object_set (GTK_OBJECT (view->adapter),
- "editable", GTK_VALUE_BOOL (*arg),
- NULL);
- break;
- }
-}
-
-static void
-e_minicard_view_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EMinicardView *view;
-
- view = E_MINICARD_VIEW (object);
-
- switch (arg_id) {
- case ARG_ADAPTER:
- GTK_VALUE_POINTER (*arg) = view->adapter;
- break;
- case ARG_BOOK:
- gtk_object_get (GTK_OBJECT (view->adapter),
- "book", &GTK_VALUE_OBJECT (*arg),
- NULL);
- break;
- case ARG_QUERY:
- gtk_object_get (GTK_OBJECT (view->adapter),
- "query", &GTK_VALUE_STRING (*arg),
- NULL);
- break;
- case ARG_EDITABLE:
- gtk_object_get (GTK_OBJECT (view->adapter),
- "editable", &GTK_VALUE_BOOL (*arg),
- NULL);
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-e_minicard_view_destroy (GtkObject *object)
-{
- EMinicardView *view = E_MINICARD_VIEW(object);
-
- if (view->canvas_drag_data_get_id) {
- gtk_signal_disconnect (GTK_OBJECT (GNOME_CANVAS_ITEM (view)->canvas),
- view->canvas_drag_data_get_id);
- }
- gtk_object_unref (GTK_OBJECT (view->adapter));
-
- GTK_OBJECT_CLASS(parent_class)->destroy (object);
-}
-
-static gboolean
-e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- EMinicardView *view;
-
- view = E_MINICARD_VIEW (item);
-
- switch( event->type ) {
- case GDK_2BUTTON_PRESS:
- if (((GdkEventButton *)event)->button == 1)
- {
- EBook *book;
- gboolean editable;
-
- gtk_object_get(GTK_OBJECT(view), "book", &book, NULL);
- gtk_object_get(GTK_OBJECT(view->adapter), "editable", &editable, NULL);
-
- g_assert (E_IS_BOOK (book));
-
- e_addressbook_show_contact_editor (book, e_card_new(""), TRUE, editable);
- }
- return TRUE;
- default:
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event)
- return GNOME_CANVAS_ITEM_CLASS(parent_class)->event(item, event);
- else
- return FALSE;
- break;
- }
-}
-
-static gint
-e_minicard_view_selection_event (EReflow *reflow, GnomeCanvasItem *item, GdkEvent *event)
-{
- EMinicardView *view;
- int return_val = FALSE;
-
- view = E_MINICARD_VIEW (reflow);
- if (parent_class->selection_event) {
- return_val = parent_class->selection_event (reflow, item, event);
- }
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- if (event->button.button == 3) {
- return_val = e_addressbook_reflow_adapter_right_click (view->adapter, event, reflow->selection);
- }
- break;
- default:
- break;
- }
- return return_val;
-}
-
-typedef struct {
- EMinicardView *view;
- EBookCallback cb;
- gpointer closure;
-} ViewCbClosure;
-
-static void
-do_remove (int i, gpointer user_data)
-{
- EBook *book;
- ECard *card;
- ViewCbClosure *viewcbclosure = user_data;
- EMinicardView *view = viewcbclosure->view;
- EBookCallback cb = viewcbclosure->cb;
- gpointer closure = viewcbclosure->closure;
-
- gtk_object_get (GTK_OBJECT(view->adapter),
- "book", &book,
- NULL);
-
- card = e_addressbook_reflow_adapter_get_card (view->adapter, i);
-
- e_book_remove_card(book, card, cb, closure);
-
- gtk_object_unref (GTK_OBJECT (card));
-}
-
-void
-e_minicard_view_remove_selection(EMinicardView *view,
- EBookCallback cb,
- gpointer closure)
-{
- ViewCbClosure viewcbclosure;
- viewcbclosure.view = view;
- viewcbclosure.cb = cb;
- viewcbclosure.closure = closure;
-
- e_selection_model_foreach (E_REFLOW (view)->selection,
- do_remove,
- &viewcbclosure);
-}
-
-#if 0
-static int
-compare_to_letter(EMinicard *card, char *letter)
-{
- g_return_val_if_fail(card != NULL, 0);
- g_return_val_if_fail(E_IS_MINICARD(card), 0);
-
- if (*letter == '1')
- return 1;
-
- if (card->card) {
- char *file_as;
- gtk_object_get(GTK_OBJECT(card->card),
- "file_as", &file_as,
- NULL);
- if (file_as)
- return strncasecmp(file_as, letter, 1);
- else
- return 0;
- } else {
- return 0;
- }
-}
-#endif
-
-
-
-void
-e_minicard_view_jump_to_letter (EMinicardView *view,
- char letter)
-{
-#if 0
- e_reflow_sorted_jump(E_REFLOW_SORTED(view),
- (GCompareFunc) compare_to_letter,
- &letter);
-#endif
-}
-
-static void
-e_minicard_view_class_init (EMinicardViewClass *klass)
-{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
- EReflowClass *reflow_class;
-
- object_class = (GtkObjectClass*) klass;
- item_class = (GnomeCanvasItemClass *) klass;
- reflow_class = (EReflowClass *) klass;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- gtk_object_add_arg_type ("EMinicardView::adapter", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_ADAPTER);
- gtk_object_add_arg_type ("EMinicardView::book", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_BOOK);
- gtk_object_add_arg_type ("EMinicardView::query", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_QUERY);
- gtk_object_add_arg_type ("EMinicardView::editable", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_EDITABLE);
-
- object_class->set_arg = e_minicard_view_set_arg;
- object_class->get_arg = e_minicard_view_get_arg;
- object_class->destroy = e_minicard_view_destroy;
-
- item_class->event = e_minicard_view_event;
-
- reflow_class->selection_event = e_minicard_view_selection_event;
- /* GnomeCanvasItem method overrides */
-}
-
-static void
-e_minicard_view_init (EMinicardView *view)
-{
- view->adapter = NULL;
- view->canvas_drag_data_get_id = 0;
-}
-
-GtkType
-e_minicard_view_get_type (void)
-{
- static GtkType reflow_type = 0;
-
- if (!reflow_type) {
- static const GtkTypeInfo reflow_info = {
- "EMinicardView",
- sizeof (EMinicardView),
- sizeof (EMinicardViewClass),
- (GtkClassInitFunc) e_minicard_view_class_init,
- (GtkObjectInitFunc) e_minicard_view_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- reflow_type = gtk_type_unique (PARENT_TYPE, &reflow_info);
- }
-
- return reflow_type;
-}
diff --git a/addressbook/gui/widgets/e-minicard-view.h b/addressbook/gui/widgets/e-minicard-view.h
deleted file mode 100644
index 5c7065fe1d..0000000000
--- a/addressbook/gui/widgets/e-minicard-view.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-minicard-view.h
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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_MINICARD_VIEW_H__
-#define __E_MINICARD_VIEW_H__
-
-#include "e-minicard.h"
-
-#include <gal/widgets/e-reflow.h>
-#include <gal/widgets/e-selection-model-simple.h>
-#include "addressbook/backend/ebook/e-book.h"
-#include "e-addressbook-reflow-adapter.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* EMinicardView - A canvas item container.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- * book EBook RW book to query
- * query string RW query string
- *
- * From EReflowSorted: (you should really know what you're doing if you set these.)
- * compare_func GCompareFunc RW compare function
- * string_func EReflowStringFunc RW string function
- *
- * From EReflow:
- * minimum_width double RW minimum width of the reflow. width >= minimum_width
- * width double R width of the reflow
- * height double RW height of the reflow
- */
-
-#define E_MINICARD_VIEW_TYPE (e_minicard_view_get_type ())
-#define E_MINICARD_VIEW(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_VIEW_TYPE, EMinicardView))
-#define E_MINICARD_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_VIEW_TYPE, EMinicardViewClass))
-#define E_IS_MINICARD_VIEW(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_VIEW_TYPE))
-#define E_IS_MINICARD_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_VIEW_TYPE))
-
-
-typedef struct _EMinicardView EMinicardView;
-typedef struct _EMinicardViewClass EMinicardViewClass;
-
-struct _EMinicardView
-{
- EReflow parent;
-
- EAddressbookReflowAdapter *adapter;
-
- /* item specific fields */
-
- ESelectionModelSimple *selection;
-
- GList *drag_list;
-
- int canvas_destroy_id;
- int canvas_drag_data_get_id;
-
- int status_message_id;
-};
-
-struct _EMinicardViewClass
-{
- EReflowClass parent_class;
-};
-
-GtkType e_minicard_view_get_type (void);
-void e_minicard_view_remove_selection (EMinicardView *view,
- EBookCallback cb,
- gpointer closure);
-void e_minicard_view_jump_to_letter (EMinicardView *view,
- char letter);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_MINICARD_VIEW_H__ */
diff --git a/addressbook/gui/widgets/e-minicard-widget-test.c b/addressbook/gui/widgets/e-minicard-widget-test.c
deleted file mode 100644
index 603f86b556..0000000000
--- a/addressbook/gui/widgets/e-minicard-widget-test.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* test-minicard.c
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- */
-
-#define TEST_VCARD \
-"BEGIN:VCARD
-" \
-"FN:Nat
-" \
-"N:Friedman;Nat;D;Mr.
-" \
-"ORG:Ximian, Inc.
-" \
-"TITLE:Head Geek
-" \
-"ROLE:Programmer/Executive
-" \
-"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
-" \
-"
-"
-
-#include "config.h"
-#include <gtk/gtkmain.h>
-#include <libgnomeui/gnome-app.h>
-#include <libgnomeui/gnome-init.h>
-#include "e-minicard-widget.h"
-
-/* This is a horrible thing to do, but it is just a test. */
-
-static void destroy_callback(GtkWidget *app, gpointer data)
-{
- exit(0);
-}
-
-#if 0
-static void about_callback( GtkWidget *widget, gpointer data )
-{
-
- const gchar *authors[] =
- {
- "Christopher James Lahey <clahey@umich.edu>",
- NULL
- };
-
- GtkWidget *about =
- gnome_about_new ( _( "Minicard Widget Test" ), VERSION,
- _( "Copyright (C) 2000, Ximian, Inc." ),
- authors,
- _( "This should test the minicard widget" ),
- NULL);
- gtk_widget_show (about);
-}
-#endif
-
-int main( int argc, char *argv[] )
-{
- GtkWidget *app;
- GtkWidget *minicard;
- ECard *card;
-
- /* bindtextdomain (PACKAGE, GNOMELOCALEDIR);
- textdomain (PACKAGE);*/
-
- gnome_init( "Minicard Widget Test", VERSION, argc, argv);
- app = gnome_app_new("Minicard Widget Test", NULL);
-
- minicard = e_minicard_widget_new();
- card = e_card_new(TEST_VCARD);
- gtk_object_set(GTK_OBJECT(minicard),
- "card", card,
- NULL);
-
- gnome_app_set_contents( GNOME_APP( app ), minicard );
-
- /* Connect the signals */
- gtk_signal_connect( GTK_OBJECT( app ), "destroy",
- GTK_SIGNAL_FUNC( destroy_callback ),
- ( gpointer ) app );
-
- gtk_widget_show_all( app );
-
- gtk_main();
-
- /* Not reached. */
- return 0;
-}
diff --git a/addressbook/gui/widgets/e-minicard-widget.c b/addressbook/gui/widgets/e-minicard-widget.c
deleted file mode 100644
index 1a8912e19d..0000000000
--- a/addressbook/gui/widgets/e-minicard-widget.c
+++ /dev/null
@@ -1,250 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-field-chooser.c
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include "e-minicard-widget.h"
-#include "e-minicard.h"
-
-static void e_minicard_widget_init (EMinicardWidget *card);
-static void e_minicard_widget_class_init (EMinicardWidgetClass *klass);
-static void e_minicard_widget_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_minicard_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_minicard_widget_destroy (GtkObject *object);
-static void e_minicard_widget_size_request (GtkWidget *widget, GtkRequisition *requisition);
-static void e_minicard_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
-static void e_minicard_widget_reflow (ECanvas *canvas);
-
-static ECanvasClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_CARD,
-};
-
-GtkType
-e_minicard_widget_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type)
- {
- static const GtkTypeInfo info =
- {
- "EMinicardWidget",
- sizeof (EMinicardWidget),
- sizeof (EMinicardWidgetClass),
- (GtkClassInitFunc) e_minicard_widget_class_init,
- (GtkObjectInitFunc) e_minicard_widget_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (e_canvas_get_type (), &info);
- }
-
- return type;
-}
-
-static void
-e_minicard_widget_class_init (EMinicardWidgetClass *klass)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- ECanvasClass *ecanvas_class;
-
- object_class = GTK_OBJECT_CLASS(klass);
- widget_class = GTK_WIDGET_CLASS(klass);
- ecanvas_class = E_CANVAS_CLASS(klass);
-
- parent_class = gtk_type_class (e_canvas_get_type ());
-
- object_class->set_arg = e_minicard_widget_set_arg;
- object_class->get_arg = e_minicard_widget_get_arg;
- object_class->destroy = e_minicard_widget_destroy;
-
- widget_class->size_request = e_minicard_widget_size_request;
- widget_class->size_allocate = e_minicard_widget_size_allocate;
-
- ecanvas_class->reflow = e_minicard_widget_reflow;
-
- gtk_object_add_arg_type ("EMinicardWidget::card", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_CARD);
-}
-
-static void
-e_minicard_widget_size_request(GtkWidget *widget, GtkRequisition *requisition)
-{
- double height;
- EMinicardWidget *emw = E_MINICARD_WIDGET(widget);
- gtk_object_get(GTK_OBJECT(emw->item),
- "height", &height,
- NULL);
- if (height <= 0)
- height = 1;
- widget->requisition.height = height;
- widget->requisition.width = 200;
- requisition->height = height;
- requisition->width = 200;
-}
-
-static void
-e_minicard_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
-{
- double height;
- EMinicardWidget *emw = E_MINICARD_WIDGET(widget);
- gnome_canvas_item_set( emw->item,
- "width", (double) allocation->width,
- NULL );
- gtk_object_get(GTK_OBJECT(emw->item),
- "height", &height,
- NULL);
- height = MAX(height, allocation->height);
- gnome_canvas_set_scroll_region(GNOME_CANVAS( emw ), 0, 0, allocation->width - 1, height - 1);
- gnome_canvas_item_set( emw->rect,
- "x2", (double) allocation->width,
- "y2", (double) height,
- NULL );
- if (GTK_WIDGET_CLASS(parent_class)->size_allocate)
- GTK_WIDGET_CLASS(parent_class)->size_allocate(widget, allocation);
-}
-
-static void e_minicard_widget_reflow(ECanvas *canvas)
-{
- double height;
- EMinicardWidget *emw = E_MINICARD_WIDGET(canvas);
- gtk_object_get(GTK_OBJECT(emw->item),
- "height", &height,
- NULL);
-
- height = MAX(height, GTK_WIDGET(emw)->allocation.height);
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS(emw), 0, 0, GTK_WIDGET(emw)->allocation.width - 1, height - 1);
- gnome_canvas_item_set( emw->rect,
- "x2", (double) GTK_WIDGET(emw)->allocation.width,
- "y2", (double) height,
- NULL );
-
- gtk_widget_queue_resize(GTK_WIDGET(canvas));
-}
-
-static void
-e_minicard_widget_init (EMinicardWidget *emw)
-{
- emw->rect = gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(emw)),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) 100,
- "y2", (double) 100,
- "fill_color", "white",
- NULL );
-
- emw->item = gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(emw)),
- e_minicard_get_type(),
- "width", (double) 100,
- NULL );
-
- gnome_canvas_set_scroll_region ( GNOME_CANVAS( emw ),
- 0, 0,
- 100, 100 );
-
- emw->card = NULL;
-}
-
-static void
-e_minicard_widget_destroy (GtkObject *object)
-{
- EMinicardWidget *emw = E_MINICARD_WIDGET(object);
-
- if (emw->card)
- gtk_object_unref(GTK_OBJECT(emw->card));
-
- if (GTK_OBJECT_CLASS(parent_class)->destroy)
- GTK_OBJECT_CLASS(parent_class)->destroy(object);
-}
-
-GtkWidget*
-e_minicard_widget_new (void)
-{
- GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_minicard_widget_get_type ()));
- return widget;
-}
-
-static void
-e_minicard_widget_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EMinicardWidget *emw = E_MINICARD_WIDGET(object);
- gpointer ptr;
-
- switch (arg_id){
- case ARG_CARD:
- ptr = GTK_VALUE_POINTER (*arg);
- e_minicard_widget_set_card (emw, ptr ? E_CARD (ptr) : NULL);
- break;
- default:
- break;
- }
-}
-
-static void
-e_minicard_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EMinicardWidget *emw = E_MINICARD_WIDGET(object);
-
- switch (arg_id) {
- case ARG_CARD:
- if (emw->card)
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(emw->card);
- else
- GTK_VALUE_OBJECT (*arg) = NULL;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-void
-e_minicard_widget_set_card (EMinicardWidget *emw, ECard *card)
-{
- g_return_if_fail (emw && E_IS_MINICARD_WIDGET (emw));
- g_return_if_fail (card == NULL || E_IS_CARD (card));
-
- if (card != emw->card) {
-
- if (emw->card)
- gtk_object_unref (GTK_OBJECT (emw->card));
-
- emw->card = card;
-
- if (emw->card)
- gtk_object_ref (GTK_OBJECT (emw->card));
-
- if (emw->item)
- gtk_object_set (GTK_OBJECT (emw->item),
- "card", emw->card,
- NULL);
- }
-}
diff --git a/addressbook/gui/widgets/e-minicard-widget.h b/addressbook/gui/widgets/e-minicard-widget.h
deleted file mode 100644
index 6daf7f6fa3..0000000000
--- a/addressbook/gui/widgets/e-minicard-widget.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-minicard-widget.h
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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_MINICARD_WIDGET_H__
-#define __E_MINICARD_WIDGET_H__
-
-#include <gal/widgets/e-canvas.h>
-#include "addressbook/backend/ebook/e-card.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* EMinicardWidget - A card displaying information about a contact.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- */
-
-#define E_MINICARD_WIDGET_TYPE (e_minicard_widget_get_type ())
-#define E_MINICARD_WIDGET(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_WIDGET_TYPE, EMinicardWidget))
-#define E_MINICARD_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_WIDGET_TYPE, EMinicardWidgetClass))
-#define E_IS_MINICARD_WIDGET(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_WIDGET_TYPE))
-#define E_IS_MINICARD_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_WIDGET_TYPE))
-
-
-typedef struct _EMinicardWidget EMinicardWidget;
-typedef struct _EMinicardWidgetClass EMinicardWidgetClass;
-
-struct _EMinicardWidget
-{
- ECanvas parent;
-
- /* item specific fields */
- GnomeCanvasItem *item;
-
- GnomeCanvasItem *rect;
- ECard *card;
-};
-
-struct _EMinicardWidgetClass
-{
- ECanvasClass parent_class;
-};
-
-
-GtkWidget *e_minicard_widget_new(void);
-GtkType e_minicard_widget_get_type (void);
-
-void e_minicard_widget_set_card (EMinicardWidget *, ECard *);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_MINICARD_WIDGET_H__ */
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c
deleted file mode 100644
index 6835017a5b..0000000000
--- a/addressbook/gui/widgets/e-minicard.c
+++ /dev/null
@@ -1,937 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-minicard.c
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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 <glib.h>
-#include <gtk/gtkdnd.h>
-#include <gdk/gdkkeysyms.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include <gdk-pixbuf/gnome-canvas-pixbuf.h>
-#include <gal/e-text/e-text.h>
-#include <gal/util/e-util.h>
-#include <gal/widgets/e-canvas-utils.h>
-#include <gal/widgets/e-canvas.h>
-#include "addressbook/backend/ebook/e-book.h"
-#include "e-addressbook-util.h"
-#include "e-minicard.h"
-#include "e-minicard-label.h"
-#include "e-minicard-view.h"
-#include "e-contact-editor.h"
-#include "e-card-merging.h"
-
-static void e_minicard_init (EMinicard *card);
-static void e_minicard_class_init (EMinicardClass *klass);
-static void e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_minicard_destroy (GtkObject *object);
-static void e_minicard_finalize (GtkObject *object);
-static gboolean e_minicard_event (GnomeCanvasItem *item, GdkEvent *event);
-static void e_minicard_realize (GnomeCanvasItem *item);
-static void e_minicard_unrealize (GnomeCanvasItem *item);
-static void e_minicard_reflow ( GnomeCanvasItem *item, int flags );
-
-static void e_minicard_resize_children( EMinicard *e_minicard );
-static void remodel( EMinicard *e_minicard );
-
-static gint e_minicard_drag_begin (EMinicard *minicard, GdkEvent *event);
-
-static GnomeCanvasGroupClass *parent_class = NULL;
-
-typedef struct _EMinicardField EMinicardField;
-
-struct _EMinicardField {
- ECardSimpleField field;
- GnomeCanvasItem *label;
-};
-
-#define LIST_ICON_FILENAME "contact-is-a-list.png"
-
-#define E_MINICARD_FIELD(field) ((EMinicardField *)(field))
-
-static void
-e_minicard_field_destroy(EMinicardField *field)
-{
- gtk_object_destroy(GTK_OBJECT(field->label));
- g_free(field);
-}
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_WIDTH,
- ARG_HEIGHT,
- ARG_HAS_FOCUS,
- ARG_SELECTED,
- ARG_EDITABLE,
- ARG_CARD
-};
-
-enum {
- SELECTED,
- DRAG_BEGIN,
- LAST_SIGNAL
-};
-
-static guint e_minicard_signals [LAST_SIGNAL] = {0, };
-
-GtkType
-e_minicard_get_type (void)
-{
- static GtkType minicard_type = 0;
-
- if (!minicard_type)
- {
- static const GtkTypeInfo minicard_info =
- {
- "EMinicard",
- sizeof (EMinicard),
- sizeof (EMinicardClass),
- (GtkClassInitFunc) e_minicard_class_init,
- (GtkObjectInitFunc) e_minicard_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- minicard_type = gtk_type_unique (gnome_canvas_group_get_type (), &minicard_info);
- }
-
- return minicard_type;
-}
-
-static void
-e_minicard_class_init (EMinicardClass *klass)
-{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- object_class = (GtkObjectClass*) klass;
- item_class = (GnomeCanvasItemClass *) klass;
-
- parent_class = gtk_type_class (gnome_canvas_group_get_type ());
-
- gtk_object_add_arg_type ("EMinicard::width", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_WIDTH);
- gtk_object_add_arg_type ("EMinicard::height", GTK_TYPE_DOUBLE,
- GTK_ARG_READABLE, ARG_HEIGHT);
- gtk_object_add_arg_type ("EMinicard::has_focus", GTK_TYPE_ENUM,
- GTK_ARG_READWRITE, ARG_HAS_FOCUS);
- gtk_object_add_arg_type ("EMinicard::selected", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_SELECTED);
- gtk_object_add_arg_type ("EMinicard::editable", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_EDITABLE);
- gtk_object_add_arg_type ("EMinicard::card", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_CARD);
-
- e_minicard_signals [SELECTED] =
- gtk_signal_new ("selected",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EMinicardClass, selected),
- gtk_marshal_INT__POINTER,
- GTK_TYPE_INT, 1, GTK_TYPE_POINTER);
-
- e_minicard_signals [DRAG_BEGIN] =
- gtk_signal_new ("drag_begin",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EMinicardClass, drag_begin),
- gtk_marshal_INT__POINTER,
- GTK_TYPE_INT, 1, GTK_TYPE_POINTER);
-
- gtk_object_class_add_signals (object_class, e_minicard_signals, LAST_SIGNAL);
-
- object_class->set_arg = e_minicard_set_arg;
- object_class->get_arg = e_minicard_get_arg;
- object_class->destroy = e_minicard_destroy;
- object_class->finalize = e_minicard_finalize;
-
- /* GnomeCanvasItem method overrides */
- item_class->realize = e_minicard_realize;
- item_class->unrealize = e_minicard_unrealize;
- item_class->event = e_minicard_event;
-
- klass->selected = NULL;
-}
-
-static void
-e_minicard_init (EMinicard *minicard)
-{
- /* minicard->card = NULL;*/
- minicard->rect = NULL;
- minicard->fields = NULL;
- minicard->width = 10;
- minicard->height = 10;
- minicard->has_focus = FALSE;
- minicard->selected = FALSE;
- minicard->editable = FALSE;
-
- minicard->card = NULL;
- minicard->simple = e_card_simple_new(NULL);
-
- minicard->list_icon_pixbuf = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" LIST_ICON_FILENAME);
- minicard->list_icon_size = gdk_pixbuf_get_height (minicard->list_icon_pixbuf);
-
- minicard->editor = NULL;
-
- minicard->changed = FALSE;
-
- e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(minicard), e_minicard_reflow);
-}
-
-static void
-set_selected (EMinicard *minicard, gboolean selected)
-{
- GtkWidget *canvas = GTK_WIDGET(GNOME_CANVAS_ITEM(minicard)->canvas);
- if (selected) {
- gnome_canvas_item_set (minicard->rect,
- "outline_color_gdk", &canvas->style->bg[GTK_STATE_NORMAL],
- NULL);
- gnome_canvas_item_set (minicard->header_rect,
- "fill_color_gdk", &canvas->style->bg[GTK_STATE_SELECTED],
- NULL);
- gnome_canvas_item_set (minicard->header_text,
- "fill_color_gdk", &canvas->style->text[GTK_STATE_SELECTED],
- NULL);
- } else {
- gnome_canvas_item_set (minicard->rect,
- "outline_color", NULL,
- NULL);
- gnome_canvas_item_set (minicard->header_rect,
- "fill_color_gdk", &canvas->style->bg[GTK_STATE_NORMAL],
- NULL);
- gnome_canvas_item_set (minicard->header_text,
- "fill_color_gdk", &canvas->style->fg[GTK_STATE_NORMAL],
- NULL);
- }
- minicard->selected = selected;
-}
-
-
-static void
-e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- EMinicard *e_minicard;
- GList *l;
-
- item = GNOME_CANVAS_ITEM (o);
- e_minicard = E_MINICARD (o);
-
- switch (arg_id){
- case ARG_WIDTH:
- if (e_minicard->width != GTK_VALUE_DOUBLE (*arg)) {
- e_minicard->width = GTK_VALUE_DOUBLE (*arg);
- e_minicard_resize_children(e_minicard);
- if ( GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED )
- e_canvas_item_request_reflow(item);
- }
- break;
- case ARG_HAS_FOCUS:
- if (e_minicard->fields) {
- if ( GTK_VALUE_ENUM(*arg) == E_FOCUS_START ||
- GTK_VALUE_ENUM(*arg) == E_FOCUS_CURRENT) {
- gnome_canvas_item_set(E_MINICARD_FIELD(e_minicard->fields->data)->label,
- "has_focus", GTK_VALUE_ENUM(*arg),
- NULL);
- } else if ( GTK_VALUE_ENUM(*arg) == E_FOCUS_END ) {
- gnome_canvas_item_set(E_MINICARD_FIELD(g_list_last(e_minicard->fields)->data)->label,
- "has_focus", GTK_VALUE_ENUM(*arg),
- NULL);
- }
- }
- else
- e_canvas_item_grab_focus(item, FALSE);
- break;
- case ARG_SELECTED:
- if (e_minicard->selected != GTK_VALUE_BOOL(*arg))
- set_selected (e_minicard, GTK_VALUE_BOOL(*arg));
- break;
- case ARG_EDITABLE:
- e_minicard->editable = GTK_VALUE_BOOL(*arg);
- for (l = e_minicard->fields; l; l = l->next)
- gtk_object_set (GTK_OBJECT (E_MINICARD_FIELD (l->data)->label),
- "editable", e_minicard->editable,
- NULL);
- break;
- case ARG_CARD:
- if (e_minicard->card)
- gtk_object_unref (GTK_OBJECT(e_minicard->card));
- e_minicard->card = E_CARD(GTK_VALUE_OBJECT (*arg));
- if (e_minicard->card)
- gtk_object_ref (GTK_OBJECT(e_minicard->card));
- gtk_object_set(GTK_OBJECT(e_minicard->simple),
- "card", e_minicard->card,
- NULL);
- remodel(e_minicard);
- e_canvas_item_request_reflow(item);
- e_minicard->changed = FALSE;
- break;
- }
-}
-
-static void
-e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EMinicard *e_minicard;
-
- e_minicard = E_MINICARD (object);
-
- switch (arg_id) {
- case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = e_minicard->width;
- break;
- case ARG_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = e_minicard->height;
- break;
- case ARG_HAS_FOCUS:
- GTK_VALUE_ENUM (*arg) = e_minicard->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE;
- break;
- case ARG_SELECTED:
- GTK_VALUE_BOOL (*arg) = e_minicard->selected;
- break;
- case ARG_EDITABLE:
- GTK_VALUE_BOOL (*arg) = e_minicard->editable;
- break;
- case ARG_CARD:
- e_card_simple_sync_card(e_minicard->simple);
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_minicard->card);
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-e_minicard_destroy (GtkObject *object)
-{
- EMinicard *e_minicard;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (E_IS_MINICARD (object));
-
- e_minicard = E_MINICARD (object);
-
- g_list_foreach(e_minicard->fields, (GFunc) e_minicard_field_destroy, NULL);
- g_list_free(e_minicard->fields);
-
- gdk_pixbuf_unref (e_minicard->list_icon_pixbuf);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-
-
-static void
-e_minicard_finalize (GtkObject *object)
-{
- EMinicard *e_minicard;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (E_IS_MINICARD (object));
-
- e_minicard = E_MINICARD (object);
-
- if (e_minicard->card)
- gtk_object_unref (GTK_OBJECT(e_minicard->card));
- if (e_minicard->simple)
- gtk_object_unref (GTK_OBJECT(e_minicard->simple));
-
- if (GTK_OBJECT_CLASS (parent_class)->finalize)
- (* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-static void
-e_minicard_realize (GnomeCanvasItem *item)
-{
- EMinicard *e_minicard;
- GnomeCanvasGroup *group;
- GtkWidget *canvas;
-
- e_minicard = E_MINICARD (item);
- group = GNOME_CANVAS_GROUP( item );
- canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (item)->canvas);
-
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize)
- (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item);
-
- e_minicard->rect =
- gnome_canvas_item_new( group,
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) e_minicard->width - 1,
- "y2", (double) e_minicard->height - 1,
- "outline_color", NULL,
- NULL );
-
- e_minicard->header_rect =
- gnome_canvas_item_new( group,
- gnome_canvas_rect_get_type(),
- "x1", (double) 2,
- "y1", (double) 2,
- "x2", (double) e_minicard->width - 3,
- "y2", (double) e_minicard->height - 3,
- "fill_color_gdk", &canvas->style->bg[GTK_STATE_NORMAL],
- NULL );
-
- e_minicard->header_text =
- gnome_canvas_item_new( group,
- e_text_get_type(),
- "anchor", GTK_ANCHOR_NW,
- "width", (double) ( e_minicard->width - 12 ),
- "clip", TRUE,
- "use_ellipsis", TRUE,
-#if 0
- "font", "fixed-bold-10",
-#endif
- "fill_color_gdk", &canvas->style->fg[GTK_STATE_NORMAL],
- "text", "",
- "draw_background", FALSE,
- NULL );
-
- e_canvas_item_move_absolute(e_minicard->header_text, 6, 6);
-
- e_minicard->list_icon =
- gnome_canvas_item_new ( group,
- gnome_canvas_pixbuf_get_type(),
- "pixbuf", e_minicard->list_icon_pixbuf,
- NULL);
-
- remodel(e_minicard);
- e_canvas_item_request_reflow(item);
-
- if (!item->canvas->aa) {
- }
-}
-
-static void
-e_minicard_unrealize (GnomeCanvasItem *item)
-{
- EMinicard *e_minicard;
-
- e_minicard = E_MINICARD (item);
-
- if (!item->canvas->aa)
- {
- }
-
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize)
- (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item);
-}
-
-static void
-card_modified_cb (EBook* book, EBookStatus status, gpointer user_data)
-{
- g_print ("%s: %s(): a card was modified\n", __FILE__, __FUNCTION__);
- if (status != E_BOOK_STATUS_SUCCESS)
- e_addressbook_error_dialog (_("Error modifying card"), status);
-}
-
-/* Callback used when the contact editor is closed */
-static void
-editor_closed_cb (GtkObject *editor, gpointer data)
-{
- EMinicard *minicard = data;
- gtk_object_unref (GTK_OBJECT (editor));
- minicard->editor = NULL;
-}
-
-static gboolean
-e_minicard_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- EMinicard *e_minicard;
- GtkWidget *canvas;
-
- e_minicard = E_MINICARD (item);
- canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (item)->canvas);
-
- switch( event->type ) {
- case GDK_FOCUS_CHANGE:
- {
- GdkEventFocus *focus_event = (GdkEventFocus *) event;
- if (focus_event->in) {
- if (!e_minicard->selected) {
- e_minicard_selected(e_minicard, event);
- }
- } else {
- EBook *book = NULL;
-
- if (e_minicard->changed) {
-
- e_card_simple_sync_card(e_minicard->simple);
-
- if (E_IS_MINICARD_VIEW(GNOME_CANVAS_ITEM(e_minicard)->parent)) {
-
- gtk_object_get(GTK_OBJECT(GNOME_CANVAS_ITEM(e_minicard)->parent),
- "book", &book,
- NULL);
-
- }
-
- if (book) {
-
- /* Add the card in the contact editor to our ebook */
- e_card_merging_book_commit_card (book,
- e_minicard->card,
- card_modified_cb,
- NULL);
- } else {
- remodel(e_minicard);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(e_minicard));
- }
- e_minicard->changed = FALSE;
- }
- e_minicard->has_focus = FALSE;
- }
- }
- break;
- case GDK_BUTTON_PRESS:
- if (event->button.button == 1) {
- int ret_val = e_minicard_selected(e_minicard, event);
- e_canvas_item_grab_focus(item, TRUE);
- e_minicard->button_x = event->button.x;
- e_minicard->button_y = event->button.y;
- e_minicard->drag_button_down = TRUE;
- return ret_val;
- } else if (event->button.button == 3) {
- return e_minicard_selected(e_minicard, event);
- }
- break;
- case GDK_BUTTON_RELEASE:
- e_minicard->drag_button_down = FALSE;
- break;
- case GDK_MOTION_NOTIFY:
- /* shamelessly ripped from e-table.c, complete with
- broken stuck-grab behavior */
- if (e_minicard->drag_button_down && event->motion.state & GDK_BUTTON1_MASK) {
- if (MAX (abs (e_minicard->button_x - event->motion.x),
- abs (e_minicard->button_y - event->motion.y)) > 3) {
- gint ret_val = e_minicard_drag_begin(e_minicard, event);
-
- printf ("signalled drag begin\n");
-
- e_minicard->drag_button_down = FALSE;
-
- return ret_val;
- }
- }
- break;
- case GDK_2BUTTON_PRESS:
- if (event->button.button == 1 && E_IS_MINICARD_VIEW(item->parent)) {
- if (e_minicard->editor) {
- if (e_card_evolution_list (e_minicard->card))
- e_contact_list_editor_raise (E_CONTACT_LIST_EDITOR(e_minicard->editor));
- else
- e_contact_editor_raise(E_CONTACT_EDITOR(e_minicard->editor));
- } else {
- EBook *book = NULL;
- if (E_IS_MINICARD_VIEW(item->parent)) {
- gtk_object_get(GTK_OBJECT(item->parent),
- "book", &book,
- NULL);
- }
-
- if (book != NULL) {
- if (e_card_evolution_list (e_minicard->card)) {
- EContactListEditor *editor = e_addressbook_show_contact_list_editor (book, e_minicard->card,
- FALSE, e_minicard->editable);
- e_minicard->editor = GTK_OBJECT (editor);
- }
- else {
- EContactEditor *editor = e_addressbook_show_contact_editor (book, e_minicard->card,
- FALSE, e_minicard->editable);
- e_minicard->editor = GTK_OBJECT (editor);
- }
- gtk_object_ref (e_minicard->editor);
-
- gtk_signal_connect (e_minicard->editor, "editor_closed",
- GTK_SIGNAL_FUNC (editor_closed_cb), e_minicard);
-
- }
- }
- return TRUE;
- }
- break;
- case GDK_KEY_PRESS:
- if (event->key.keyval == GDK_Tab ||
- event->key.keyval == GDK_KP_Tab ||
- event->key.keyval == GDK_ISO_Left_Tab) {
- GList *list;
- for (list = e_minicard->fields; list; list = list->next) {
- EMinicardField *field = E_MINICARD_FIELD(list->data);
- GnomeCanvasItem *item = field->label;
- EFocus has_focus;
- gtk_object_get(GTK_OBJECT(item),
- "has_focus", &has_focus,
- NULL);
- if (has_focus != E_FOCUS_NONE) {
- if (event->key.state & GDK_SHIFT_MASK)
- list = list->prev;
- else
- list = list->next;
- if (list) {
- EMinicardField *field = E_MINICARD_FIELD(list->data);
- GnomeCanvasItem *item = field->label;
- gnome_canvas_item_set(item,
- "has_focus", (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START,
- NULL);
- return 1;
- } else {
- return 0;
- }
- }
- }
- }
- default:
- break;
- }
-
- if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event)
- return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event);
- else
- return 0;
-}
-
-static void
-e_minicard_resize_children( EMinicard *e_minicard )
-{
- GList *list;
-
- if (e_minicard->header_text) {
- gnome_canvas_item_set( e_minicard->header_text,
- "width", ((double) e_minicard->width - 12
- - (e_card_evolution_list (e_minicard->card) ? e_minicard->list_icon_size : 0.0)),
- NULL );
- }
- if (e_minicard->list_icon) {
- e_canvas_item_move_absolute(e_minicard->list_icon,
- e_minicard->width - e_minicard->list_icon_size - 3,
- 3);
- }
- for ( list = e_minicard->fields; list; list = g_list_next( list ) ) {
- gnome_canvas_item_set( E_MINICARD_FIELD( list->data )->label,
- "width", (double) e_minicard->width - 4.0,
- NULL );
- }
-}
-
-static void
-field_changed (EText *text, EMinicard *e_minicard)
-{
- ECardSimpleType type;
- char *string;
-
- type = GPOINTER_TO_INT
- (gtk_object_get_data(GTK_OBJECT(text),
- "EMinicard:field"));
- gtk_object_get(GTK_OBJECT(text),
- "text", &string,
- NULL);
- e_card_simple_set(e_minicard->simple,
- type,
- string);
- g_free(string);
- e_minicard->changed = TRUE;
-}
-
-static void
-add_field (EMinicard *e_minicard, ECardSimpleField field, gdouble left_width)
-{
- GnomeCanvasItem *new_item;
- GnomeCanvasGroup *group;
- ECardSimpleType type;
- EMinicardField *minicard_field;
- char *name;
- char *string;
-
- group = GNOME_CANVAS_GROUP( e_minicard );
-
- type = e_card_simple_type(e_minicard->simple, field);
- name = g_strdup_printf("%s:", e_card_simple_get_name(e_minicard->simple, field));
- string = e_card_simple_get(e_minicard->simple, field);
-
- /* Magically convert embedded XML into an address. */
- if (!strncmp (string, "<?xml", 4)) {
- EDestination *dest = e_destination_import (string);
- if (dest != NULL) {
- gchar *new_string = g_strdup (e_destination_get_address (dest));
- g_free (string);
- string = new_string;
- gtk_object_unref (GTK_OBJECT (dest));
- }
- }
-
- new_item = e_minicard_label_new(group);
- gnome_canvas_item_set( new_item,
- "width", e_minicard->width - 4.0,
- "fieldname", name,
- "field", string,
- "max_field_name_length", left_width,
- "editable", e_minicard->editable,
- NULL );
- gtk_signal_connect(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field),
- "changed", GTK_SIGNAL_FUNC(field_changed), e_minicard);
- gtk_object_set_data(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field),
- "EMinicard:field",
- GINT_TO_POINTER(field));
-
- minicard_field = g_new(EMinicardField, 1);
- minicard_field->field = field;
- minicard_field->label = new_item;
-
- e_minicard->fields = g_list_append( e_minicard->fields, minicard_field);
- e_canvas_item_move_absolute(new_item, 2, e_minicard->height);
- g_free(name);
- g_free(string);
-}
-
-static gdouble
-get_left_width(EMinicard *e_minicard)
-{
- gchar *name;
- ECardSimpleField field;
- gdouble width = -1;
- GdkFont *font;
-
- font = ((GtkWidget *) ((GnomeCanvasItem *) e_minicard)->canvas)->style->font;
-
- for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST; field++) {
- gdouble this_width;
- name = g_strdup_printf("%s:", e_card_simple_get_name(e_minicard->simple, field));
- this_width = gdk_text_width(font, name, strlen(name));
- if (width < this_width)
- width = this_width;
- g_free(name);
- }
- return width;
-}
-
-static void
-remodel( EMinicard *e_minicard )
-{
- int count = 0;
- if ( !(GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED) )
- return;
- if (e_minicard->simple) {
- ECardSimpleField field;
- GList *list;
- char *file_as;
- gdouble left_width = -1;
-
- if (e_minicard->header_text) {
- file_as = e_card_simple_get(e_minicard->simple, E_CARD_SIMPLE_FIELD_FILE_AS);
- gnome_canvas_item_set( e_minicard->header_text,
- "text", file_as ? file_as : "",
- NULL );
- g_free(file_as);
- }
-
- if ( e_card_evolution_list (e_minicard->card) ) {
- gnome_canvas_item_show (e_minicard->list_icon);
- }
- else {
- gnome_canvas_item_hide (e_minicard->list_icon);
- }
-
- list = e_minicard->fields;
- e_minicard->fields = NULL;
-
- for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST - 2 && count < 5; field++) {
- EMinicardField *minicard_field = NULL;
-
- if (field == E_CARD_SIMPLE_FIELD_FAMILY_NAME)
- continue;
-
- if (list)
- minicard_field = list->data;
- if (minicard_field && minicard_field->field == field) {
- GList *this_list = list;
- char *string;
-
- string = e_card_simple_get(e_minicard->simple, field);
- if (string && *string) {
- /* Magically convert embedded XML into an address. */
- if (!strncmp (string, "<?xml", 4)) {
- EDestination *dest = e_destination_import (string);
- if (dest != NULL) {
- gchar *new_string = g_strdup (e_destination_get_address (dest));
- g_free (string);
- string = new_string;
- gtk_object_unref (GTK_OBJECT (dest));
- }
- }
-
- e_minicard->fields = g_list_append(e_minicard->fields, minicard_field);
- gtk_object_set(GTK_OBJECT(minicard_field->label),
- "field", string,
- NULL);
- count ++;
- } else {
- e_minicard_field_destroy(minicard_field);
- }
- list = g_list_remove_link(list, this_list);
- g_list_free_1(this_list);
- g_free(string);
- } else {
- char *string;
- if (left_width == -1) {
- left_width = get_left_width(e_minicard);
- }
-
- string = e_card_simple_get(e_minicard->simple, field);
- if (string && *string) {
- add_field(e_minicard, field, left_width);
- count++;
- }
- g_free(string);
- }
- }
-
- g_list_foreach(list, (GFunc) e_minicard_field_destroy, NULL);
- g_list_free(list);
- }
-}
-
-static void
-e_minicard_reflow( GnomeCanvasItem *item, int flags )
-{
- EMinicard *e_minicard = E_MINICARD(item);
- if ( GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED ) {
- GList *list;
- gdouble text_height;
- gint old_height;
-
- old_height = e_minicard->height;
-
- gtk_object_get( GTK_OBJECT( e_minicard->header_text ),
- "text_height", &text_height,
- NULL );
-
- e_minicard->height = text_height + 10.0;
-
- gnome_canvas_item_set( e_minicard->header_rect,
- "y2", text_height + 9.0,
- NULL );
-
- for(list = e_minicard->fields; list; list = g_list_next(list)) {
- EMinicardField *field = E_MINICARD_FIELD(list->data);
- GnomeCanvasItem *item = field->label;
- gtk_object_get (GTK_OBJECT(item),
- "height", &text_height,
- NULL);
- e_canvas_item_move_absolute(item, 2, e_minicard->height);
- e_minicard->height += text_height;
- }
- e_minicard->height += 2;
-
- gnome_canvas_item_set( e_minicard->rect,
- "y2", (double) e_minicard->height - 1,
- NULL );
-
- gnome_canvas_item_set( e_minicard->rect,
- "x2", (double) e_minicard->width - 1.0,
- "y2", (double) e_minicard->height - 1.0,
- NULL );
- gnome_canvas_item_set( e_minicard->header_rect,
- "x2", (double) e_minicard->width - 3.0,
- NULL );
-
- if (old_height != e_minicard->height)
- e_canvas_item_request_parent_reflow(item);
- }
-}
-
-const char *
-e_minicard_get_card_id (EMinicard *minicard)
-{
- g_return_val_if_fail(minicard != NULL, NULL);
- g_return_val_if_fail(E_IS_MINICARD(minicard), NULL);
-
- if (minicard->card) {
- return e_card_get_id(minicard->card);
- } else {
- return "";
- }
-}
-
-int
-e_minicard_compare (EMinicard *minicard1, EMinicard *minicard2)
-{
- g_return_val_if_fail(minicard1 != NULL, 0);
- g_return_val_if_fail(E_IS_MINICARD(minicard1), 0);
- g_return_val_if_fail(minicard2 != NULL, 0);
- g_return_val_if_fail(E_IS_MINICARD(minicard2), 0);
-
- if (minicard1->card && minicard2->card) {
- char *file_as1, *file_as2;
- gtk_object_get(GTK_OBJECT(minicard1->card),
- "file_as", &file_as1,
- NULL);
- gtk_object_get(GTK_OBJECT(minicard2->card),
- "file_as", &file_as2,
- NULL);
- if (file_as1 && file_as2)
- return strcasecmp(file_as1, file_as2);
- if (file_as1)
- return -1;
- if (file_as2)
- return 1;
- return strcmp(e_minicard_get_card_id(minicard1), e_minicard_get_card_id(minicard2));
- } else {
- return 0;
- }
-}
-
-int
-e_minicard_selected (EMinicard *minicard, GdkEvent *event)
-{
- gint ret_val = 0;
- GnomeCanvasItem *item = GNOME_CANVAS_ITEM (minicard);
- if (item->parent) {
- guint signal_id = gtk_signal_lookup ("selection_event", GTK_OBJECT_TYPE (item->parent));
- /* We should probably check the signature here, but I
- * don't think it's worth the time required to code
- * it.
- */
- if (signal_id != 0) {
- gtk_signal_emit(GTK_OBJECT(item->parent),
- signal_id,
- item, event, &ret_val);
- }
- }
- return ret_val;
-}
-
-static gint
-e_minicard_drag_begin (EMinicard *minicard, GdkEvent *event)
-{
- gint ret_val = 0;
- gtk_signal_emit (GTK_OBJECT(minicard),
- e_minicard_signals[DRAG_BEGIN],
- event, &ret_val);
- return ret_val;
-}
diff --git a/addressbook/gui/widgets/e-minicard.h b/addressbook/gui/widgets/e-minicard.h
deleted file mode 100644
index 5a0f590c23..0000000000
--- a/addressbook/gui/widgets/e-minicard.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-minicard.h
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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_MINICARD_H__
-#define __E_MINICARD_H__
-
-#include <libgnomeui/gnome-canvas.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include "addressbook/gui/contact-editor/e-contact-editor.h"
-#include "addressbook/backend/ebook/e-card.h"
-#include "addressbook/backend/ebook/e-card-simple.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* EMinicard - A small card displaying information about a contact.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- * width double RW width of the card
- * height double R height of the card
- * card ECard* RW Pointer to the ECard
- */
-
-#define E_MINICARD_TYPE (e_minicard_get_type ())
-#define E_MINICARD(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_TYPE, EMinicard))
-#define E_MINICARD_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_TYPE, EMinicardClass))
-#define E_IS_MINICARD(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_TYPE))
-#define E_IS_MINICARD_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_TYPE))
-
-
-typedef struct _EMinicard EMinicard;
-typedef struct _EMinicardClass EMinicardClass;
-typedef enum _EMinicardFocusType EMinicardFocusType;
-
-enum _EMinicardFocusType {
- E_MINICARD_FOCUS_TYPE_START,
- E_MINICARD_FOCUS_TYPE_END
-};
-
-struct _EMinicard
-{
- GnomeCanvasGroup parent;
-
- /* item specific fields */
- ECard *card;
- ECardSimple *simple;
-
- GnomeCanvasItem *rect;
- GnomeCanvasItem *header_rect;
- GnomeCanvasItem *header_text;
- GnomeCanvasItem *list_icon;
-
- GdkPixbuf *list_icon_pixbuf;
- double list_icon_size;
-
- GtkObject *editor;
-
- GList *fields; /* Of type EMinicardField */
- guint needs_remodeling : 1;
-
- guint changed : 1;
-
- guint selected : 1;
-
- guint has_focus : 1;
-
- guint editable : 1;
-
- guint drag_button_down : 1;
-
- gint button_x;
- gint button_y;
-
- double width;
- double height;
-};
-
-struct _EMinicardClass
-{
- GnomeCanvasGroupClass parent_class;
-
- gint (* selected) (EMinicard *minicard, GdkEvent *event);
- gint (* drag_begin) (EMinicard *minicard, GdkEvent *event);
-};
-
-
-GtkType e_minicard_get_type (void);
-const char *e_minicard_get_card_id (EMinicard *minicard);
-int e_minicard_compare (EMinicard *minicard1,
- EMinicard *minicard2);
-
-int e_minicard_selected (EMinicard *minicard,
- GdkEvent *event);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_MINICARD_H__ */
diff --git a/addressbook/gui/widgets/gal-view-factory-minicard.c b/addressbook/gui/widgets/gal-view-factory-minicard.c
deleted file mode 100644
index 10e13d9bdf..0000000000
--- a/addressbook/gui/widgets/gal-view-factory-minicard.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-factory-minicard.c: A View Factory
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * (C) 2000, 2001 Ximian, Inc.
- */
-#include <config.h>
-#include <glib.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include "gal-view-factory-minicard.h"
-#include "gal-view-minicard.h"
-
-#define GVFE_CLASS(e) ((GalViewFactoryMinicardClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE gal_view_factory_get_type ()
-
-static GalViewFactoryClass *gal_view_factory_minicard_parent_class;
-
-static const char *
-gal_view_factory_minicard_get_title (GalViewFactory *factory)
-{
- return _("Card View");
-}
-
-static GalView *
-gal_view_factory_minicard_new_view (GalViewFactory *factory,
- const char *name)
-{
- return gal_view_minicard_new(name);
-}
-
-static const char *
-gal_view_factory_minicard_get_type_code (GalViewFactory *factory)
-{
- return "minicard";
-}
-
-static void
-gal_view_factory_minicard_destroy (GtkObject *object)
-{
-#if 0
- GalViewFactoryMinicard *factory = GAL_VIEW_FACTORY_MINICARD(object);
-#endif
-}
-
-static void
-gal_view_factory_minicard_class_init (GtkObjectClass *object_class)
-{
- GalViewFactoryClass *view_factory_class = GAL_VIEW_FACTORY_CLASS(object_class);
- gal_view_factory_minicard_parent_class = gtk_type_class (PARENT_TYPE);
-
- view_factory_class->get_title = gal_view_factory_minicard_get_title;
- view_factory_class->new_view = gal_view_factory_minicard_new_view;
- view_factory_class->get_type_code = gal_view_factory_minicard_get_type_code;
-
- object_class->destroy = gal_view_factory_minicard_destroy;
-}
-
-static void
-gal_view_factory_minicard_init (GalViewFactoryMinicard *factory)
-{
-}
-
-/**
- * gal_view_minicard_new
- *
- * A new GalViewFactory for creating Minicard views. Create one of
- * these and pass it to GalViewCollection for use.
- *
- * Returns: The new GalViewFactoryMinicard.
- */
-GalViewFactory *
-gal_view_factory_minicard_new (void)
-{
- return gal_view_factory_minicard_construct (gtk_type_new (gal_view_factory_minicard_get_type ()));
-}
-
-/**
- * gal_view_minicard_construct
- * @factory: The factory to construct
- *
- * constructs the GalViewFactoryMinicard. To be used by subclasses and
- * language bindings.
- *
- * Returns: The GalViewFactoryMinicard.
- */
-GalViewFactory *
-gal_view_factory_minicard_construct (GalViewFactoryMinicard *factory)
-{
- return GAL_VIEW_FACTORY(factory);
-}
-
-GtkType
-gal_view_factory_minicard_get_type (void)
-{
- static guint type = 0;
-
- if (!type)
- {
- GtkTypeInfo info =
- {
- "GalViewFactoryMinicard",
- sizeof (GalViewFactoryMinicard),
- sizeof (GalViewFactoryMinicardClass),
- (GtkClassInitFunc) gal_view_factory_minicard_class_init,
- (GtkObjectInitFunc) gal_view_factory_minicard_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
diff --git a/addressbook/gui/widgets/gal-view-factory-minicard.h b/addressbook/gui/widgets/gal-view-factory-minicard.h
deleted file mode 100644
index 3816fdba46..0000000000
--- a/addressbook/gui/widgets/gal-view-factory-minicard.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-factory-minicard.c: A View Factory
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * (C) 2000, 2001 Ximian, Inc.
- */
-#ifndef _GAL_VIEW_FACTORY_MINICARD_H_
-#define _GAL_VIEW_FACTORY_MINICARD_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/menus/gal-view-factory.h>
-
-#define GAL_VIEW_FACTORY_MINICARD_TYPE (gal_view_factory_minicard_get_type ())
-#define GAL_VIEW_FACTORY_MINICARD(o) (GTK_CHECK_CAST ((o), GAL_VIEW_FACTORY_MINICARD_TYPE, GalViewFactoryMinicard))
-#define GAL_VIEW_FACTORY_MINICARD_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_FACTORY_MINICARD_TYPE, GalViewFactoryMinicardClass))
-#define GAL_IS_VIEW_FACTORY_MINICARD(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_FACTORY_MINICARD_TYPE))
-#define GAL_IS_VIEW_FACTORY_MINICARD_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_FACTORY_MINICARD_TYPE))
-
-typedef struct {
- GalViewFactory base;
-} GalViewFactoryMinicard;
-
-typedef struct {
- GalViewFactoryClass parent_class;
-} GalViewFactoryMinicardClass;
-
-/* Standard functions */
-GtkType gal_view_factory_minicard_get_type (void);
-GalViewFactory *gal_view_factory_minicard_new (void);
-GalViewFactory *gal_view_factory_minicard_construct (GalViewFactoryMinicard *factory);
-
-#endif /* _GAL_VIEW_FACTORY_MINICARD_H_ */
diff --git a/addressbook/gui/widgets/gal-view-minicard.c b/addressbook/gui/widgets/gal-view-minicard.c
deleted file mode 100644
index 4cfa71f470..0000000000
--- a/addressbook/gui/widgets/gal-view-minicard.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-minicard.c: An Minicard View
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * (C) 2000, 2001 Ximian, Inc.
- */
-#include <config.h>
-#include "gal-view-minicard.h"
-
-#define PARENT_TYPE gal_view_get_type ()
-
-static GalViewClass *gal_view_minicard_parent_class;
-
-static void
-gal_view_minicard_edit (GalView *view)
-{
- /* GalViewMinicard *minicard_view = GAL_VIEW_MINICARD(view); */
-}
-
-static void
-gal_view_minicard_load (GalView *view,
- const char *filename)
-{
-}
-
-static void
-gal_view_minicard_save (GalView *view,
- const char *filename)
-{
-}
-
-static const char *
-gal_view_minicard_get_title (GalView *view)
-{
- return GAL_VIEW_MINICARD(view)->title;
-}
-
-static void
-gal_view_minicard_set_title (GalView *view,
- const char *title)
-{
- g_free(GAL_VIEW_MINICARD(view)->title);
- GAL_VIEW_MINICARD(view)->title = g_strdup(title);
-}
-
-static const char *
-gal_view_minicard_get_type_code (GalView *view)
-{
- return "minicard";
-}
-
-static GalView *
-gal_view_minicard_clone (GalView *view)
-{
- GalViewMinicard *gve, *new;
-
- gve = GAL_VIEW_MINICARD(view);
-
- new = gtk_type_new (gal_view_minicard_get_type ());
- new->title = g_strdup (gve->title);
-
- return GAL_VIEW(new);
-}
-
-static void
-gal_view_minicard_destroy (GtkObject *object)
-{
- GalViewMinicard *view = GAL_VIEW_MINICARD(object);
- g_free(view->title);
-}
-
-static void
-gal_view_minicard_class_init (GtkObjectClass *object_class)
-{
- GalViewClass *gal_view_class = GAL_VIEW_CLASS(object_class);
- gal_view_minicard_parent_class = gtk_type_class (PARENT_TYPE);
-
- gal_view_class->edit = gal_view_minicard_edit ;
- gal_view_class->load = gal_view_minicard_load ;
- gal_view_class->save = gal_view_minicard_save ;
- gal_view_class->get_title = gal_view_minicard_get_title ;
- gal_view_class->set_title = gal_view_minicard_set_title ;
- gal_view_class->get_type_code = gal_view_minicard_get_type_code;
- gal_view_class->clone = gal_view_minicard_clone ;
-
- object_class->destroy = gal_view_minicard_destroy ;
-}
-
-static void
-gal_view_minicard_init (GalViewMinicard *gve)
-{
- gve->title = NULL;
-}
-
-/**
- * gal_view_minicard_new
- * @title: The name of the new view.
- *
- * Returns a new GalViewMinicard. This is primarily for use by
- * GalViewFactoryMinicard.
- *
- * Returns: The new GalViewMinicard.
- */
-GalView *
-gal_view_minicard_new (const gchar *title)
-{
- return gal_view_minicard_construct (gtk_type_new (gal_view_minicard_get_type ()), title);
-}
-
-/**
- * gal_view_minicard_construct
- * @view: The view to construct.
- * @title: The name of the new view.
- *
- * constructs the GalViewMinicard. To be used by subclasses and
- * language bindings.
- *
- * Returns: The GalViewMinicard.
- */
-GalView *
-gal_view_minicard_construct (GalViewMinicard *view,
- const gchar *title)
-{
- view->title = g_strdup(title);
- return GAL_VIEW(view);
-}
-
-GtkType
-gal_view_minicard_get_type (void)
-{
- static guint type = 0;
-
- if (!type)
- {
- GtkTypeInfo info =
- {
- "GalViewMinicard",
- sizeof (GalViewMinicard),
- sizeof (GalViewMinicardClass),
- (GtkClassInitFunc) gal_view_minicard_class_init,
- (GtkObjectInitFunc) gal_view_minicard_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
diff --git a/addressbook/gui/widgets/gal-view-minicard.h b/addressbook/gui/widgets/gal-view-minicard.h
deleted file mode 100644
index fef98141f3..0000000000
--- a/addressbook/gui/widgets/gal-view-minicard.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-minicard.h: An Minicard View
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * (C) 2000, 2001 Ximian, Inc.
- */
-#ifndef _GAL_VIEW_MINICARD_H_
-#define _GAL_VIEW_MINICARD_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/menus/gal-view.h>
-
-#define GAL_VIEW_MINICARD_TYPE (gal_view_minicard_get_type ())
-#define GAL_VIEW_MINICARD(o) (GTK_CHECK_CAST ((o), GAL_VIEW_MINICARD_TYPE, GalViewMinicard))
-#define GAL_VIEW_MINICARD_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_MINICARD_TYPE, GalViewMinicardClass))
-#define GAL_IS_VIEW_MINICARD(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_MINICARD_TYPE))
-#define GAL_IS_VIEW_MINICARD_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_MINICARD_TYPE))
-
-typedef struct {
- GalView base;
-
- char *title;
-} GalViewMinicard;
-
-typedef struct {
- GalViewClass parent_class;
-} GalViewMinicardClass;
-
-/* Standard functions */
-GtkType gal_view_minicard_get_type (void);
-GalView *gal_view_minicard_new (const gchar *title);
-GalView *gal_view_minicard_construct (GalViewMinicard *view,
- const gchar *title);
-
-#endif /* _GAL_VIEW_MINICARD_H_ */
diff --git a/addressbook/gui/widgets/test-minicard-label.c b/addressbook/gui/widgets/test-minicard-label.c
deleted file mode 100644
index 90a6ed5f34..0000000000
--- a/addressbook/gui/widgets/test-minicard-label.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* test-minicard-label.c
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- */
-
-
-
-#include "config.h"
-
-#include <gtk/gtkmain.h>
-#include <libgnomeui/gnome-app.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include <libgnomeui/gnome-init.h>
-#include <gal/widgets/e-canvas.h>
-#include "e-minicard-label.h"
-
-/* This is a horrible thing to do, but it is just a test. */
-GnomeCanvasItem *label;
-GnomeCanvasItem *rect;
-
-static void destroy_callback(GtkWidget *app, gpointer data)
-{
- exit(0);
-}
-
-static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data)
-{
- gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, allocation->height );
- gnome_canvas_item_set( label,
- "width", (double) allocation->width,
- "height", (double) allocation->height,
- NULL );
- gnome_canvas_item_set( rect,
- "x2", (double) allocation->width,
- "y2", (double) allocation->height,
- NULL );
-}
-
-#if 0
-static void about_callback( GtkWidget *widget, gpointer data )
-{
-
- const gchar *authors[] =
- {
- "Christopher James Lahey <clahey@umich.edu>",
- NULL
- };
-
- GtkWidget *about =
- gnome_about_new ( _( "Minicard Label Test" ), VERSION,
- _( "Copyright (C) 2000, Ximian, Inc." ),
- authors,
- _( "This should test the minicard label canvas item" ),
- NULL);
- gtk_widget_show (about);
-}
-#endif
-
-static void button_press_callback( GtkWidget *widget, gpointer data )
-{
- gnome_canvas_item_grab_focus( label );
-}
-
-int main( int argc, char *argv[] )
-{
- GtkWidget *app;
- GtkWidget *canvas;
-
- /* bindtextdomain (PACKAGE, GNOMELOCALEDIR);
- textdomain (PACKAGE);*/
-
- gnome_init( "Minicard Label Test", VERSION, argc, argv);
- app = gnome_app_new("Minicard Label Test", NULL);
-
- canvas = e_canvas_new();
- rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) 100,
- "y2", (double) 100,
- "fill_color", "white",
- NULL );
- label = e_minicard_label_new(gnome_canvas_root( GNOME_CANVAS( canvas ) ));
- gnome_canvas_item_set( label,
- "width", (double) 100,
- "height", (double) 100,
- "fieldname", "Full Name:",
- "field", "Christopher James Lahey",
- NULL );
- gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ),
- 0, 0,
- 100, 100 );
-
- gnome_app_set_contents( GNOME_APP( app ), canvas );
-
-
- /* Connect the signals */
- gtk_signal_connect( GTK_OBJECT( app ), "destroy",
- GTK_SIGNAL_FUNC( destroy_callback ),
- ( gpointer ) app );
-
- gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate",
- GTK_SIGNAL_FUNC( allocate_callback ),
- ( gpointer ) app );
-
- gtk_signal_connect( GTK_OBJECT( canvas ), "button_press_event",
- GTK_SIGNAL_FUNC( button_press_callback ),
- ( gpointer ) app );
-
- gtk_widget_show_all( app );
-
- gtk_main();
-
- /* Not reached. */
- return 0;
-}
diff --git a/addressbook/gui/widgets/test-minicard-view.c b/addressbook/gui/widgets/test-minicard-view.c
deleted file mode 100644
index e327190987..0000000000
--- a/addressbook/gui/widgets/test-minicard-view.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* test-reflow.c
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- */
-
-#include "config.h"
-
-#include <libgnorba/gnorba.h>
-#include <e-util/e-canvas.h>
-#include "e-minicard-view.h"
-
-/* This is a horrible thing to do, but it is just a test. */
-GnomeCanvasItem *reflow;
-GnomeCanvasItem *rect;
-GtkAllocation last_alloc;
-
-CORBA_Environment ev;
-CORBA_ORB orb;
-
-static void
-init_bonobo (int argc, char **argv)
-{
-
- gnome_CORBA_init_with_popt_table (
- "Reflow Test", VERSION,
- &argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev);
-
- orb = gnome_CORBA_ORB ();
-
- if (bonobo_init (orb, NULL, NULL) == FALSE)
- g_error (_("Could not initialize Bonobo"));
-
-}
-
-static void destroy_callback(GtkWidget *app, gpointer data)
-{
- exit(0);
-}
-
-static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data)
-{
- double width;
- last_alloc = *allocation;
- gnome_canvas_item_set( reflow,
- "height", (double) allocation->height,
- NULL );
- gnome_canvas_item_set( reflow,
- "minimum_width", (double) allocation->width,
- NULL );
- gtk_object_get(GTK_OBJECT(reflow),
- "width", &width,
- NULL);
- width = MAX(width, allocation->width);
- gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, width, allocation->height );
- gnome_canvas_item_set( rect,
- "x2", (double) width,
- "y2", (double) allocation->height,
- NULL );
-}
-
-static void resize(GnomeCanvas *canvas, gpointer data)
-{
- double width;
- gtk_object_get(GTK_OBJECT(reflow),
- "width", &width,
- NULL);
- width = MAX(width, last_alloc.width);
- gnome_canvas_set_scroll_region(canvas , 0, 0, width, last_alloc.height );
- gnome_canvas_item_set( rect,
- "x2", (double) width,
- "y2", (double) last_alloc.height,
- NULL );
-}
-
-#if 0
-static void about_callback( GtkWidget *widget, gpointer data )
-{
-
- const gchar *authors[] =
- {
- "Christopher James Lahey <clahey@umich.edu>",
- NULL
- };
-
- GtkWidget *about =
- gnome_about_new ( _( "Reflow Test" ), VERSION,
- _( "Copyright (C) 2000, Ximian, Inc." ),
- authors,
- _( "This should test the reflow canvas item" ),
- NULL);
- gtk_widget_show (about);
-}
-#endif
-
-static void
-book_open_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- if (status == E_BOOK_STATUS_SUCCESS)
- gnome_canvas_item_set(reflow,
- "book", book,
- NULL);
-}
-
-static guint
-ebook_create (void)
-{
- EBook *book;
-
- book = e_book_new ();
-
- if (!book) {
- printf ("%s: %s(): Couldn't create EBook, bailing.\n",
- __FILE__,
- __FUNCTION__);
- return FALSE;
- }
-
-
- if (! e_book_load_uri (book, "file:/tmp/test.db", book_open_cb, NULL)) {
- printf ("error calling load_uri!\n");
- }
-
-
- return FALSE;
-}
-
-int main( int argc, char *argv[] )
-{
- GtkWidget *app;
- GtkWidget *canvas;
- GtkWidget *vbox;
- GtkWidget *scrollbar;
-
- /* bindtextdomain (PACKAGE, GNOMELOCALEDIR);
- textdomain (PACKAGE);*/
-
- CORBA_exception_init (&ev);
- init_bonobo (argc, argv);
-
- app = gnome_app_new("Reflow Test", NULL);
-
- vbox = gtk_vbox_new(FALSE, 0);
-
- canvas = e_canvas_new();
- rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) 100,
- "y2", (double) 100,
- "fill_color", "white",
- NULL );
- reflow = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ),
- e_minicard_view_get_type(),
- "height", (double) 100,
- "minimum_width", (double) 100,
- NULL );
- gtk_signal_connect( GTK_OBJECT( canvas ), "reflow",
- GTK_SIGNAL_FUNC( resize ),
- ( gpointer ) app);
-
- gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ),
- 0, 0,
- 100, 100 );
-
- gtk_box_pack_start(GTK_BOX(vbox), canvas, TRUE, TRUE, 0);
-
- scrollbar = gtk_hscrollbar_new(gtk_layout_get_hadjustment(GTK_LAYOUT(canvas)));
-
- gtk_box_pack_start(GTK_BOX(vbox), scrollbar, FALSE, FALSE, 0);
-
- gnome_app_set_contents( GNOME_APP( app ), vbox );
-
- /* Connect the signals */
- gtk_signal_connect( GTK_OBJECT( app ), "destroy",
- GTK_SIGNAL_FUNC( destroy_callback ),
- ( gpointer ) app );
-
- gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate",
- GTK_SIGNAL_FUNC( allocate_callback ),
- ( gpointer ) app );
-
- gtk_widget_show_all( app );
- gdk_window_set_back_pixmap( GTK_LAYOUT(canvas)->bin_window, NULL, FALSE);
-
- gtk_idle_add ((GtkFunction) ebook_create, NULL);
-
- bonobo_main ();
-
- /* Not reached. */
- return 0;
-}
diff --git a/addressbook/gui/widgets/test-minicard.c b/addressbook/gui/widgets/test-minicard.c
deleted file mode 100644
index 362c3fddef..0000000000
--- a/addressbook/gui/widgets/test-minicard.c
+++ /dev/null
@@ -1,119 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* test-minicard.c
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- */
-
-
-
-#include "config.h"
-
-#include <gtk/gtkmain.h>
-#include <libgnomeui/gnome-app.h>
-#include <libgnomeui/gnome-init.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-
-#include "e-minicard.h"
-
-/* This is a horrible thing to do, but it is just a test. */
-GnomeCanvasItem *card;
-GnomeCanvasItem *rect;
-
-static void destroy_callback(GtkWidget *app, gpointer data)
-{
- exit(0);
-}
-
-static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data)
-{
- gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, allocation->height );
- gnome_canvas_item_set( card,
- "width", (double) allocation->width,
- NULL );
- gnome_canvas_item_set( rect,
- "x2", (double) allocation->width,
- "y2", (double) allocation->height,
- NULL );
-}
-
-#if 0
-static void about_callback( GtkWidget *widget, gpointer data )
-{
-
- const gchar *authors[] =
- {
- "Christopher James Lahey <clahey@umich.edu>",
- NULL
- };
-
- GtkWidget *about =
- gnome_about_new ( _( "Minicard Test" ), VERSION,
- _( "Copyright (C) 2000, Ximian, Inc." ),
- authors,
- _( "This should test the minicard canvas item" ),
- NULL);
- gtk_widget_show (about);
-}
-#endif
-
-int main( int argc, char *argv[] )
-{
- GtkWidget *app;
- GtkWidget *canvas;
- int i;
-
- /* bindtextdomain (PACKAGE, GNOMELOCALEDIR);
- textdomain (PACKAGE);*/
-
- gnome_init( "Minicard Test", VERSION, argc, argv);
- app = gnome_app_new("Minicard Test", NULL);
-
- canvas = gnome_canvas_new();
- rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) 100,
- "y2", (double) 100,
- "fill_color", "white",
- NULL );
- for ( i = 0; i < 1; i++ )
- {
- card = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ),
- e_minicard_get_type(),
- "width", (double) 100,
- NULL );
- }
- gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ),
- 0, 0,
- 100, 100 );
-
- gnome_app_set_contents( GNOME_APP( app ), canvas );
-
- /* Connect the signals */
- gtk_signal_connect( GTK_OBJECT( app ), "destroy",
- GTK_SIGNAL_FUNC( destroy_callback ),
- ( gpointer ) app );
-
- gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate",
- GTK_SIGNAL_FUNC( allocate_callback ),
- ( gpointer ) app );
-
- gtk_widget_show_all( app );
-
- gtk_main();
-
- /* Not reached. */
- return 0;
-}
diff --git a/addressbook/gui/widgets/test-reflow.c b/addressbook/gui/widgets/test-reflow.c
deleted file mode 100644
index 0a3f34235d..0000000000
--- a/addressbook/gui/widgets/test-reflow.c
+++ /dev/null
@@ -1,198 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* test-reflow.c
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * 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.
- */
-
-
-#define TEST_VCARD \
-"BEGIN:VCARD
-" \
-"FN:Nat
-" \
-"N:Friedman;Nat;D;Mr.
-" \
-"TITLE:Head Geek
-" \
-"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
-" \
-"
-"
-
-
-#include "config.h"
-
-#include <gtk/gtkmain.h>
-#include <gtk/gtkvbox.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include <libgnomeui/gnome-init.h>
-#include <gal/widgets/e-canvas.h>
-#include <gal/widgets/e-reflow.h>
-#include <gal/widgets/e-scroll-frame.h>
-
-#include "e-minicard.h"
-
-/* This is a horrible thing to do, but it is just a test. */
-GnomeCanvasItem *reflow;
-GnomeCanvasItem *rect;
-GtkAllocation last_alloc;
-
-static void destroy_callback(GtkWidget *app, gpointer data)
-{
- exit(0);
-}
-
-static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data)
-{
- double width;
- last_alloc = *allocation;
- gnome_canvas_item_set( reflow,
- "height", (double) allocation->height,
- NULL );
- gnome_canvas_item_set( reflow,
- "minimum_width", (double) allocation->width,
- NULL );
- gtk_object_get(GTK_OBJECT(reflow),
- "width", &width,
- NULL);
- width = MAX(width, allocation->width);
- gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, width - 1, allocation->height - 1);
- gnome_canvas_item_set( rect,
- "x2", (double) width,
- "y2", (double) allocation->height,
- NULL );
-}
-
-static void resize(GnomeCanvas *canvas, gpointer data)
-{
- double width;
- gtk_object_get(GTK_OBJECT(reflow),
- "width", &width,
- NULL);
- width = MAX(width, last_alloc.width);
- gnome_canvas_set_scroll_region(canvas , 0, 0, width - 1, last_alloc.height - 1);
- gnome_canvas_item_set( rect,
- "x2", (double) width,
- "y2", (double) last_alloc.height,
- NULL );
-}
-
-#if 0
-static void about_callback( GtkWidget *widget, gpointer data )
-{
-
- const gchar *authors[] =
- {
- "Christopher James Lahey <clahey@umich.edu>",
- NULL
- };
-
- GtkWidget *about =
- gnome_about_new ( _( "Reflow Test" ), VERSION,
- _( "Copyright (C) 2000, Ximian, Inc." ),
- authors,
- _( "This should test the reflow canvas item" ),
- NULL);
- gtk_widget_show (about);
-}
-#endif
-
-int main( int argc, char *argv[] )
-{
- GtkWidget *app;
- GtkWidget *canvas;
- GtkWidget *vbox;
- GtkWidget *scrollframe;
- int i;
-
- /* bindtextdomain (PACKAGE, GNOMELOCALEDIR);
- textdomain (PACKAGE);*/
-
- gnome_init( "Reflow Test", VERSION, argc, argv);
- app = gnome_app_new("Reflow Test", NULL);
-
- vbox = gtk_vbox_new(FALSE, 0);
-
- canvas = e_canvas_new();
- rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) 100,
- "y2", (double) 100,
- "fill_color", "white",
- NULL );
- reflow = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ),
- e_reflow_get_type(),
- "height", (double) 100,
- "minimum_width", (double) 100,
- NULL );
- gtk_signal_connect( GTK_OBJECT( canvas ), "reflow",
- GTK_SIGNAL_FUNC( resize ),
- ( gpointer ) app);
- for ( i = 0; i < 200; i++ )
- {
- GnomeCanvasItem *item;
- ECard *card = e_card_new (TEST_VCARD);
- item = gnome_canvas_item_new( GNOME_CANVAS_GROUP(reflow),
- e_minicard_get_type(),
- "card", card,
- NULL);
- e_reflow_add_item(E_REFLOW(reflow), item, NULL);
- }
- gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ),
- 0, 0,
- 100, 100 );
-
- scrollframe = e_scroll_frame_new (gtk_layout_get_hadjustment(GTK_LAYOUT(canvas)),
- gtk_layout_get_vadjustment(GTK_LAYOUT(canvas)));
- e_scroll_frame_set_policy (E_SCROLL_FRAME (scrollframe),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_NEVER);
-
- gtk_container_add (GTK_CONTAINER (scrollframe), canvas);
-
- gnome_app_set_contents( GNOME_APP( app ), scrollframe );
-
- /* Connect the signals */
- gtk_signal_connect( GTK_OBJECT( app ), "destroy",
- GTK_SIGNAL_FUNC( destroy_callback ),
- ( gpointer ) app );
-
- gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate",
- GTK_SIGNAL_FUNC( allocate_callback ),
- ( gpointer ) app );
-
- gtk_widget_show_all( app );
- gdk_window_set_back_pixmap( GTK_LAYOUT(canvas)->bin_window, NULL, FALSE);
-
- gtk_main();
-
- /* Not reached. */
- return 0;
-}