aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addressbook/ChangeLog34
-rw-r--r--addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl42
-rw-r--r--addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.server.in.in31
-rw-r--r--addressbook/gui/component/select-names/Makefile.am96
-rw-r--r--addressbook/gui/component/select-names/e-select-names-bonobo.c600
-rw-r--r--addressbook/gui/component/select-names/e-select-names-bonobo.h66
-rw-r--r--addressbook/gui/component/select-names/e-select-names-completion.c1236
-rw-r--r--addressbook/gui/component/select-names/e-select-names-completion.h68
-rw-r--r--addressbook/gui/component/select-names/e-select-names-config-keys.h39
-rw-r--r--addressbook/gui/component/select-names/e-select-names-config.c117
-rw-r--r--addressbook/gui/component/select-names/e-select-names-config.h43
-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.h30
-rw-r--r--addressbook/gui/component/select-names/e-select-names-manager.c696
-rw-r--r--addressbook/gui/component/select-names/e-select-names-manager.h68
-rw-r--r--addressbook/gui/component/select-names/e-select-names-marshal.list3
-rw-r--r--addressbook/gui/component/select-names/e-select-names-model.c792
-rw-r--r--addressbook/gui/component/select-names/e-select-names-model.h88
-rw-r--r--addressbook/gui/component/select-names/e-select-names-popup.c390
-rw-r--r--addressbook/gui/component/select-names/e-select-names-popup.h36
-rw-r--r--addressbook/gui/component/select-names/e-select-names-section.etspec7
-rw-r--r--addressbook/gui/component/select-names/e-select-names-table-model.c366
-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.c856
-rw-r--r--addressbook/gui/component/select-names/e-select-names-text-model.h53
-rw-r--r--addressbook/gui/component/select-names/e-select-names.c861
-rw-r--r--addressbook/gui/component/select-names/e-select-names.etspec7
-rw-r--r--addressbook/gui/component/select-names/e-select-names.h101
-rw-r--r--addressbook/gui/component/select-names/recipient.glade45
-rw-r--r--addressbook/gui/component/select-names/select-names.glade443
30 files changed, 34 insertions, 7290 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 033425bee6..c8736f7bd7 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,5 +1,39 @@
2004-12-23 Hans Petter Jansson <hpj@novell.com>
+ This is the last we see of ESelectNames.
+
+ * gui/component/select-names/Evolution-Addressbook-SelectNames.idl
+ * gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.server.in.in
+ * gui/component/select-names/Makefile.am
+ * gui/component/select-names/e-select-names-bonobo.c
+ * gui/component/select-names/e-select-names-bonobo.h
+ * gui/component/select-names/e-select-names-completion.c
+ * gui/component/select-names/e-select-names-completion.h
+ * gui/component/select-names/e-select-names-config-keys.h
+ * gui/component/select-names/e-select-names-config.c
+ * gui/component/select-names/e-select-names-config.h
+ * gui/component/select-names/e-select-names-factory.c
+ * gui/component/select-names/e-select-names-factory.h
+ * gui/component/select-names/e-select-names-manager.c
+ * gui/component/select-names/e-select-names-manager.h
+ * gui/component/select-names/e-select-names-marshal.list
+ * gui/component/select-names/e-select-names-model.c
+ * gui/component/select-names/e-select-names-model.h
+ * gui/component/select-names/e-select-names-popup.c
+ * gui/component/select-names/e-select-names-popup.h
+ * gui/component/select-names/e-select-names-section.etspec
+ * gui/component/select-names/e-select-names-table-model.c
+ * gui/component/select-names/e-select-names-table-model.h
+ * gui/component/select-names/e-select-names-text-model.c
+ * gui/component/select-names/e-select-names-text-model.h
+ * gui/component/select-names/e-select-names.c
+ * gui/component/select-names/e-select-names.etspec
+ * gui/component/select-names/e-select-names.h
+ * gui/component/select-names/recipient.glade
+ * gui/component/select-names/select-names.glade: Begone.
+
+2004-12-23 Hans Petter Jansson <hpj@novell.com>
+
* gui/component/Makefile.am (SUBDIRS): No more select-names.
(libevolution_addressbook_la_LIBADD): Remove libeselectnames.la.
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 6feb6b54bb..0000000000
--- a/addressbook/gui/component/select-names/Evolution-Addressbook-SelectNames.idl
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode: C; 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.server.in.in b/addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.server.in.in
deleted file mode 100644
index 0a9f975463..0000000000
--- a/addressbook/gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.server.in.in
+++ /dev/null
@@ -1,31 +0,0 @@
-<oaf_info>
-
-<!--
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_SelectNamesFactory:@VERSION@"
- type="shlib"
- location="@COMPONENTDIR@/libevolution-addressbook.so">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/ObjectFactory:1.0"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution Addressbook name selection interface"/>
-
-</oaf_server>
--->
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_SelectNames:@VERSION@"
- type="factory"
- location="OAFIID:GNOME_Evolution_Addressbook_Factory:@VERSION@">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution/Addressbook/SelectNames:@VERSION@"/>
- </oaf_attribute>
-
- <oaf_attribute name="name" type="string"
- _value="Evolution Addressbook name selection interface"/>
-
-</oaf_server>
-
-</oaf_info>
diff --git a/addressbook/gui/component/select-names/Makefile.am b/addressbook/gui/component/select-names/Makefile.am
deleted file mode 100644
index c8d0b83052..0000000000
--- a/addressbook/gui/component/select-names/Makefile.am
+++ /dev/null
@@ -1,96 +0,0 @@
-# CORBA stuff
-
-idl_DATA = \
- Evolution-Addressbook-SelectNames.idl
-
-IDL_GENERATED_H = \
- Evolution-Addressbook-SelectNames.h
-IDL_GENERATED_C = \
- Evolution-Addressbook-SelectNames-common.c \
- Evolution-Addressbook-SelectNames-skels.c \
- Evolution-Addressbook-SelectNames-stubs.c
-IDL_GENERATED = $(IDL_GENERATED_C) $(IDL_GENERATED_H)
-
-$(IDL_GENERATED_H): $(idl_DATA)
- $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) \
- $(srcdir)/Evolution-Addressbook-SelectNames.idl
-$(IDL_GENERATED_C): $(IDL_GENERATED_H)
-
-server_in_files = GNOME_Evolution_Addressbook_SelectNames.server.in.in
-server_DATA = $(server_in_files:.server.in.in=_$(BASE_VERSION).server)
-@EVO_SERVER_RULE@
-@INTLTOOL_SERVER_RULE@
-
-INCLUDES = \
- -DG_LOG_DOMAIN=\"evolution-addressbook\" \
- -I$(top_srcdir) \
- -I$(top_builddir) \
- -I$(top_srcdir)/shell \
- -I$(top_builddir)/shell \
- -I$(top_srcdir)/widgets/misc \
- -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 \
- -I$(top_srcdir)/addressbook/util \
- -DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \
- -DEVOLUTION_DATADIR=\""$(datadir)"\" \
- -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
- -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
- -DEVOLUTION_UIDIR=\""$(evolutionuidir)"\" \
- -DPREFIX=\""$(prefix)"\" \
- $(EVOLUTION_ADDRESSBOOK_CFLAGS)
-
-privlib_LTLIBRARIES = libeselectnames.la
-
-libeselectnames_la_SOURCES = \
- $(IDL_GENERATED) \
- $(MARSHAL_GENERATED) \
- e-select-names-bonobo.c \
- e-select-names-bonobo.h \
- e-select-names-completion.c \
- e-select-names-completion.h \
- e-select-names-config.c \
- e-select-names-config.h \
- e-select-names-config-keys.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
-
-libeselectnames_la_LIBADD = \
- $(EVOLUTION_ADDRESSBOOK_LIBS)
-
-# We'll need these again when we split out the select names control
-# into its own shlib factory, but for now they're redundant.
-#
-# e-select-names-factory.c
-# e-select-names-factory.h
-
-MARSHAL_GENERATED = e-select-names-marshal.c e-select-names-marshal.h
-@EVO_MARSHAL_RULE@
-
-glade_DATA = select-names.glade
-etspec_DATA = e-select-names.etspec e-select-names-section.etspec
-
-EXTRA_DIST = \
- $(glade_DATA) \
- $(server_in_files) \
- $(idl_DATA) \
- $(etspec_DATA) \
- e-select-names-marshal.list
-
-BUILT_SOURCES = $(IDL_GENERATED) $(MARSHAL_GENERATED) $(server_DATA)
-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 9c0245ff46..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-bonobo.c
+++ /dev/null
@@ -1,600 +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 version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-select-names-bonobo.h"
-
-#include <bonobo-activation/bonobo-activation-activate.h>
-
-#include <bonobo/bonobo-property-bag.h>
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-event-source.h>
-#include <bonobo/bonobo-ui-util.h>
-
-#include <gal/util/e-util.h>
-#include <gal/e-text/e-entry.h>
-#include <gal/util/e-text-event-processor.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"
-
-#include <string.h>
-
-
-#define PARENT_TYPE BONOBO_TYPE_OBJECT
-static BonoboObjectClass *parent_class = NULL;
-
-struct _ESelectNamesBonoboPrivate {
- ESelectNamesManager *manager;
- BonoboEventSource *event_source;
-};
-
-enum _EntryPropertyID {
- ENTRY_PROPERTY_ID_TEXT,
- ENTRY_PROPERTY_ID_ADDRESSES,
- 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:
- {
- ETextModel *text_model;
- text_model = E_TEXT_MODEL (g_object_get_data (G_OBJECT (w), "select_names_text_model"));
- g_assert (text_model != NULL);
-
- BONOBO_ARG_SET_STRING (arg, e_text_model_get_text (text_model));
- break;
- }
-
- case ENTRY_PROPERTY_ID_ADDRESSES:
- {
- ESelectNamesModel *model;
- char *text;
-
- model = E_SELECT_NAMES_MODEL (g_object_get_data (G_OBJECT (w), "select_names_model"));
- g_assert (model != NULL);
-
- text = e_select_names_model_get_address_text (model, ", ");
- BONOBO_ARG_SET_STRING (arg, text);
- g_free (text);
- }
- break;
-
- case ENTRY_PROPERTY_ID_DESTINATIONS:
- {
- ESelectNamesModel *model;
- char *text;
-
- model = E_SELECT_NAMES_MODEL (g_object_get_data (G_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 (g_object_get_data (G_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:
- case ENTRY_PROPERTY_ID_ADDRESSES:
- {
- ESelectNamesModel *model;
- model = E_SELECT_NAMES_MODEL (g_object_get_data (G_OBJECT (w), "select_names_model"));
- g_assert (model != NULL);
-
- e_entry_set_text (E_ENTRY (w), BONOBO_ARG_GET_STRING (arg));
- e_select_names_model_load_contacts (model);
- break;
- }
-
- case ENTRY_PROPERTY_ID_DESTINATIONS:
- {
- ESelectNamesModel *model;
- model = E_SELECT_NAMES_MODEL (g_object_get_data (G_OBJECT (w), "select_names_model"));
- g_assert (model != NULL);
-
- e_select_names_model_import_destinationv (model, BONOBO_ARG_GET_STRING (arg));
- e_select_names_model_load_contacts (model);
- break;
- }
-
- case ENTRY_PROPERTY_ID_ALLOW_CONTACT_LISTS:
- {
- ESelectNamesCompletion *comp;
- comp = E_SELECT_NAMES_COMPLETION (g_object_get_data (G_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:
- g_object_set_data (G_OBJECT (w), "entry_property_id_changed", GUINT_TO_POINTER (1));
- break;
-
- default:
- break;
- }
-}
-
-static void
-impl_SelectNames_add_section (PortableServer_Servant servant,
- const CORBA_char *id,
- const CORBA_char *title,
- CORBA_Environment *ev)
-{
- ESelectNamesBonobo *select_names;
- ESelectNamesBonoboPrivate *priv;
-
- select_names = E_SELECT_NAMES_BONOBO (bonobo_object (servant));
- 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)
-{
- ESelectNamesBonobo *select_names;
- ESelectNamesBonoboPrivate *priv;
-
- select_names = E_SELECT_NAMES_BONOBO (bonobo_object (servant));
- 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 (g_object_get_data (G_OBJECT (widget), "entry_property_id_changed"));
-
- if (!changed)
- bonobo_control_set_property (control, NULL, "entry_changed", TC_CORBA_boolean, TRUE, NULL);
-}
-
-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
-manager_ok_cb (ESelectNamesManager *manager, gpointer closure)
-{
- ESelectNamesBonobo *select_names = E_SELECT_NAMES_BONOBO (closure);
- BonoboArg *arg;
-
- arg = bonobo_arg_new (BONOBO_ARG_NULL);
-
- bonobo_event_source_notify_listeners_full (select_names->priv->event_source,
- "GNOME/Evolution",
- "ok",
- "dialog",
- arg,
- NULL);
-
- bonobo_arg_release (arg);
-}
-
-static void
-copy_cb (BonoboUIComponent *ui, gpointer user_data, const char *command)
-{
- EEntry *entry = E_ENTRY (user_data);
-
- e_text_copy_clipboard (entry->item);
-}
-
-static void
-cut_cb (BonoboUIComponent *ui, gpointer user_data, const char *command)
-{
- EEntry *entry = E_ENTRY (user_data);
-
- e_text_cut_clipboard (entry->item);
-}
-
-static void
-paste_cb (BonoboUIComponent *ui, gpointer user_data, const char *command)
-{
- EEntry *entry = E_ENTRY (user_data);
-
- e_text_paste_clipboard (entry->item);
-}
-
-static void
-select_all_cb (BonoboUIComponent *ui, gpointer user_data, const char *command)
-{
- EEntry *entry = E_ENTRY (user_data);
-
- e_text_select_all (entry->item);
-}
-
-static BonoboUIVerb verbs [] = {
- BONOBO_UI_VERB ("EditCut", cut_cb),
- BONOBO_UI_VERB ("EditCopy", copy_cb),
- BONOBO_UI_VERB ("EditPaste", paste_cb),
- BONOBO_UI_VERB ("EditSelectAll", select_all_cb),
- BONOBO_UI_VERB_END
-};
-
-typedef struct {
- GtkWidget *widget;
- BonoboControl *control;
- Bonobo_UIContainer remote_ui_container;
- char *ui_xml_path;
- char *app_name;
- BonoboUIVerb *verbs;
- gpointer user_data;
-} ControlUIClosure;
-
-static void
-free_closure (ControlUIClosure *closure,
- GtkObject *where_object_was)
-{
- bonobo_object_release_unref (closure->remote_ui_container, NULL);
- g_free (closure->ui_xml_path);
- g_free (closure->app_name);
- g_free (closure);
-}
-
-static void
-merge_menu_items (BonoboControl *control, BonoboUIComponent *uic, ControlUIClosure *closure)
-{
- if (closure->remote_ui_container) {
- bonobo_ui_component_set_container (uic, closure->remote_ui_container, NULL);
-
- bonobo_ui_component_add_verb_list_with_data (uic, closure->verbs, closure->user_data);
-
- bonobo_ui_component_freeze (uic, NULL);
-
- bonobo_ui_util_set_ui (uic, PREFIX,
- closure->ui_xml_path,
- closure->app_name, NULL);
-
- bonobo_ui_component_thaw (uic, NULL);
- }
-}
-
-static void
-unmerge_menu_items (BonoboControl *control, BonoboUIComponent *uic, ControlUIClosure *closure)
-{
- bonobo_ui_component_unset_container (uic, NULL);
-}
-
-static void
-control_set_frame_cb (BonoboControl *control,
- ControlUIClosure *closure)
-{
- Bonobo_ControlFrame frame = bonobo_control_get_control_frame (control,
- NULL);
- if (!frame)
- return;
- closure->remote_ui_container = bonobo_control_get_remote_ui_container (control, NULL);
-}
-
-static void
-control_activate_cb (BonoboControl *control,
- gboolean activate,
- ControlUIClosure *closure)
-{
- if (activate)
- gtk_widget_grab_focus (closure->widget); /* the ECanvas */
-}
-
-static gboolean
-widget_focus_cb (GtkWidget *w, GdkEventFocus *focus, ControlUIClosure *closure)
-{
- BonoboUIComponent *uic;
-
- uic = bonobo_control_get_ui_component (closure->control);
-
- if (GTK_WIDGET_HAS_FOCUS (w)) {
- merge_menu_items (closure->control, uic, closure);
- } else {
- unmerge_menu_items (closure->control, uic, closure);
- }
-
- return FALSE;
-}
-
-static void
-e_bonobo_control_automerge_ui (GtkWidget *w,
- BonoboControl *control,
- const char *ui_xml_path,
- const char *app_name,
- BonoboUIVerb *verbs,
- gpointer data)
-{
- ControlUIClosure *closure;
-
- g_return_if_fail (GTK_IS_WIDGET (w));
- g_return_if_fail (BONOBO_IS_CONTROL (control));
- g_return_if_fail (ui_xml_path != NULL);
- g_return_if_fail (app_name != NULL);
- g_return_if_fail (verbs != NULL);
-
- closure = g_new (ControlUIClosure, 1);
-
- closure->widget = w;
- closure->control = control;
- closure->ui_xml_path = g_strdup (ui_xml_path);
- closure->app_name = g_strdup (app_name);
- closure->verbs = verbs;
- closure->user_data = data;
-
- g_signal_connect (w, "focus_in_event",
- G_CALLBACK (widget_focus_cb), closure);
- g_signal_connect (w, "focus_out_event",
- G_CALLBACK (widget_focus_cb), closure);
- g_signal_connect (control, "activate",
- G_CALLBACK (control_activate_cb), closure);
- g_signal_connect (control, "set_frame",
- G_CALLBACK (control_set_frame_cb), closure);
-
- g_object_weak_ref (G_OBJECT (control), (GWeakNotify)free_closure, closure);
-}
-
-static Bonobo_Control
-impl_SelectNames_get_entry_for_section (PortableServer_Servant servant,
- const CORBA_char *section_id,
- CORBA_Environment *ev)
-{
- ESelectNamesBonobo *select_names;
- ESelectNamesBonoboPrivate *priv;
- GtkWidget *entry_widget;
- BonoboControl *control;
- BonoboPropertyBag *property_bag;
-
- select_names = E_SELECT_NAMES_BONOBO (bonobo_object (servant));
- 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, "addresses", ENTRY_PROPERTY_ID_ADDRESSES,
- 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, bonobo_object_corba_objref (BONOBO_OBJECT (property_bag)), NULL);
- bonobo_object_unref (BONOBO_OBJECT (property_bag));
-
- g_signal_connect (entry_widget, "changed", G_CALLBACK (entry_changed), control);
-
- e_bonobo_control_automerge_ui (GTK_WIDGET (E_ENTRY (entry_widget)->canvas),
- control,
- EVOLUTION_UIDIR "/evolution-composer-entries.xml",
- "evolution-addressbook",
- verbs, entry_widget);
-
- 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)
-{
- ESelectNamesBonobo *select_names;
- ESelectNamesBonoboPrivate *priv;
-
- select_names = E_SELECT_NAMES_BONOBO (bonobo_object (servant));
- priv = select_names->priv;
-
- e_select_names_manager_activate_dialog (priv->manager, section_id);
-}
-
-
-/* GtkObject methods. */
-
-static void
-impl_dispose (GObject *object)
-{
- ESelectNamesBonobo *select_names;
- ESelectNamesBonoboPrivate *priv;
-
- select_names = E_SELECT_NAMES_BONOBO (object);
- priv = select_names->priv;
-
- if (priv) {
- if (priv->manager->names) {
- gtk_widget_destroy (GTK_WIDGET (priv->manager->names));
- priv->manager->names = NULL;
- }
-
- g_object_unref (priv->manager);
-
- g_free (priv);
- select_names->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-
-static void
-e_select_names_bonobo_class_init (ESelectNamesBonoboClass *klass)
-{
- GObjectClass *object_class;
- POA_GNOME_Evolution_Addressbook_SelectNames__epv *epv;
-
- object_class = G_OBJECT_CLASS (klass);
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->dispose = impl_dispose;
-
- epv = &klass->epv;
- 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;
-}
-
-static void
-e_select_names_bonobo_init (ESelectNamesBonobo *select_names)
-{
- ESelectNamesBonoboPrivate *priv;
-
- priv = g_new (ESelectNamesBonoboPrivate, 1);
-
- priv->manager = e_select_names_manager_new ();
- priv->event_source = NULL;
-
- g_signal_connect (priv->manager,
- "changed",
- G_CALLBACK (manager_changed_cb),
- select_names);
-
- g_signal_connect (priv->manager,
- "ok",
- G_CALLBACK (manager_ok_cb),
- select_names);
-
- select_names->priv = priv;
-}
-
-
-static void
-e_select_names_bonobo_construct (ESelectNamesBonobo *select_names)
-{
- g_return_if_fail (select_names != NULL);
- g_return_if_fail (E_IS_SELECT_NAMES_BONOBO (select_names));
-
- 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)
-{
- ESelectNamesBonobo *select_names;
-
- select_names = g_object_new (E_TYPE_SELECT_NAMES_BONOBO, NULL);
-
- e_select_names_bonobo_construct (select_names);
-
- return select_names;
-}
-
-
-BONOBO_TYPE_FUNC_FULL (
- ESelectNamesBonobo,
- GNOME_Evolution_Addressbook_SelectNames,
- PARENT_TYPE,
- e_select_names_bonobo);
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 5b04ed5b2e..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-bonobo.h
+++ /dev/null
@@ -1,66 +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 version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Author: Ettore Perazzoli
- */
-
-#ifndef __E_SELECT_NAMES_BONOBO_H__
-#define __E_SELECT_NAMES_BONOBO_H__
-
-#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) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SELECT_NAMES_BONOBO, ESelectNamesBonobo))
-#define E_SELECT_NAMES_BONOBO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_BONOBO, ESelectNamesBonoboClass))
-#define E_IS_SELECT_NAMES_BONOBO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SELECT_NAMES_BONOBO))
-#define E_IS_SELECT_NAMES_BONOBO_CLASS(klass) (G_TYPE_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;
-
- POA_GNOME_Evolution_Addressbook_SelectNames__epv epv;
-};
-
-
-GType e_select_names_bonobo_get_type (void);
-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 ec0a6b456c..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-completion.c
+++ /dev/null
@@ -1,1236 +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 version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- */
-
-#include <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 <libebook/e-contact.h>
-#include <addressbook/util/eab-book-util.h>
-#include <libebook/e-destination.h>
-#include <addressbook/gui/merging/eab-contact-compare.h>
-
-#include <libedataserver/e-sexp.h>
-
-typedef struct {
- EBook *book;
- guint book_view_tag;
- EBookView *book_view;
- ESelectNamesCompletion *comp;
- guint contacts_added_tag;
- guint seq_complete_tag;
- gboolean sequence_complete_received;
-
- gchar *cached_query_text;
- GList *cached_cards;
- gboolean cache_complete;
-
-} ESelectNamesCompletionBookData;
-
-struct _ESelectNamesCompletionPrivate {
-
- ESelectNamesTextModel *text_model;
-
- GList *book_data;
- gint books_not_ready;
- gint pending_completion_seq;
-
- gchar *waiting_query;
- gint waiting_pos, waiting_limit;
- gchar *query_text;
-
- gboolean match_contact_lists;
-
- gint minimum_query_length;
-};
-
-static void e_select_names_completion_class_init (ESelectNamesCompletionClass *);
-static void e_select_names_completion_init (ESelectNamesCompletion *);
-static void e_select_names_completion_dispose (GObject *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_contacts_added_cb (EBookView *, const GList *cards, gpointer user_data);
-static void e_select_names_completion_seq_complete_cb (EBookView *, EBookViewStatus status, 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_handle_request (ECompletion *, const gchar *txt, gint pos, gint limit);
-static void e_select_names_completion_end (ECompletion *);
-
-static GObjectClass *parent_class;
-
-static FILE *out;
-
-/*
- *
- * Query builders
- *
- */
-
-typedef gchar *(*BookQuerySExp) (ESelectNamesCompletion *);
-typedef ECompletionMatch *(*BookQueryMatchTester) (ESelectNamesCompletion *, EDestination *);
-
-static int
-utf8_casefold_collate_len (const gchar *str1, const gchar *str2, int len)
-{
- gchar *s1 = g_utf8_casefold(str1, len);
- gchar *s2 = g_utf8_casefold(str2, len);
- int rv;
-
- rv = g_utf8_collate (s1, s2);
-
- g_free (s1);
- g_free (s2);
-
- return rv;
-}
-
-static int
-utf8_casefold_collate (const gchar *str1, const gchar *str2)
-{
- return utf8_casefold_collate_len (str1, str2, -1);
-}
-
-static void
-our_match_destroy (ECompletionMatch *match)
-{
- g_object_unref (match->user_data);
-}
-
-static ECompletionMatch *
-make_match (EDestination *dest, const gchar *menu_form, double score)
-{
- ECompletionMatch *match;
-#if notyet
- EContact *contact = e_destination_get_contact (dest);
-#endif
-
- match = e_completion_match_new (e_destination_get_name (dest), menu_form, score);
-
- e_completion_match_set_text (match, e_destination_get_name (dest), menu_form);
-
- /* Reject any match that has null text fields. */
- if (! (e_completion_match_get_match_text (match) && e_completion_match_get_menu_text (match))) {
- g_object_unref (match);
- return NULL;
- }
-
-#if notyet
- /* XXX toshok - EContact doesn't have the use_score stuff */
- /* Since we sort low to high, we negate so that larger use scores will come first */
- match->sort_major = contact ? -floor (e_contact_get_use_score (contact)) : 0;
-#else
- match->sort_major = 0;
-#endif
-
- match->sort_minor = e_destination_get_email_num (dest);
-
- match->user_data = g_object_ref (dest);
-
- match->destroy = our_match_destroy;
-
- return match;
-}
-
-/*
- * Nickname query
- */
-
-static gchar *
-sexp_nickname (ESelectNamesCompletion *comp)
-{
- gchar *query = g_strdup_printf ("(beginswith \"nickname\" \"%s\")", comp->priv->query_text);
-
- return query;
-}
-
-static ECompletionMatch *
-match_nickname (ESelectNamesCompletion *comp, EDestination *dest)
-{
- ECompletionMatch *match = NULL;
- gint len;
- EContact *contact = e_destination_get_contact (dest);
- double score;
- const char *nickname;
-
- nickname = e_contact_get_const (contact, E_CONTACT_NICKNAME);
- if (nickname == NULL)
- return NULL;
-
- len = g_utf8_strlen (comp->priv->query_text, -1);
- if (nickname && !utf8_casefold_collate_len (comp->priv->query_text, nickname, len)) {
- const gchar *name;
- gchar *str;
-
- score = len * 2; /* nickname gives 2 points per matching character */
-
- if (len == g_utf8_strlen (nickname, -1)) /* boost score on an exact match */
- score *= 10;
-
- name = e_destination_get_name (dest);
- if (name && *name)
- str = g_strdup_printf ("'%s' %s <%s>", nickname, name, e_destination_get_email (dest));
- else
- str = g_strdup_printf ("'%s' <%s>", nickname, e_destination_get_email (dest));
-
- match = make_match (dest, str, score);
- 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);
- const gchar *name = e_destination_get_name (dest);
- const gchar *email = e_destination_get_email (dest);
- double score;
-
- if (email
- && !utf8_casefold_collate_len (comp->priv->query_text, email, len)
- && !e_destination_is_evolution_list (dest)) {
-
- gchar *str;
-
- score = len * 2; /* 2 points for each matching character */
-
- if (name && *name)
- str = g_strdup_printf ("<%s> %s", email, name);
- else
- str = g_strdup (email);
-
- match = make_match (dest, str, score);
-
- g_free (str);
-
- return match;
- }
-
- return NULL;
-}
-
-/*
- * Name Query
- */
-
-static gchar *
-name_style_query (ESelectNamesCompletion *comp, const gchar *field)
-{
- if (comp && comp->priv->query_text && *comp->priv->query_text) {
- gchar *cpy = g_strdup (comp->priv->query_text), *c;
- gchar **strv;
- gchar *query;
- gint i;
- GString *out = g_string_new("");
-
- for (c = cpy; *c; ++c) {
- if (*c == ',')
- *c = ' ';
- }
-
- strv = g_strsplit (cpy, " ", 0);
- if (strv[0] && strv[1])
- g_string_append(out, "(and ");
- for (i=0; strv[i]; ++i) {
- if (i==0)
- g_string_append(out, "(beginswith ");
- else
- g_string_append(out, " (beginswith ");
- e_sexp_encode_string(out, field);
- g_strstrip(strv[i]);
- e_sexp_encode_string(out, strv[i]);
- g_string_append(out, ")");
- }
- if (strv[0] && strv[1])
- g_string_append(out, ")");
-
- query = out->str;
- g_string_free(out, FALSE);
-
- g_free (cpy);
- g_strfreev (strv);
-
- return query;
- }
-
- return NULL;
-}
-
-static gchar *
-sexp_name (ESelectNamesCompletion *comp)
-{
- return name_style_query (comp, "full_name");
-}
-
-static ECompletionMatch *
-match_name (ESelectNamesCompletion *comp, EDestination *dest)
-{
- ECompletionMatch *final_match = NULL;
- gchar *menu_text = NULL;
- EContact *contact;
- const gchar *email;
- gint match_len = 0;
- EABContactMatchType match;
- EABContactMatchPart first_match;
- double score = 0;
- gboolean have_given, have_additional, have_family;
- EContactName *contact_name;
-
- contact = e_destination_get_contact (dest);
-
- contact_name = e_contact_get (contact, E_CONTACT_NAME);
- if (!contact_name)
- return NULL;
-
- email = e_destination_get_email (dest);
-
- match = eab_contact_compare_name_to_string_full (contact, comp->priv->query_text, TRUE /* yes, allow partial matches */,
- NULL, &first_match, &match_len);
-
- if (match <= EAB_CONTACT_MATCH_NONE) {
- e_contact_name_free (contact_name);
- return NULL;
- }
-
- score = match_len * 3; /* three points per match character */
-
- have_given = contact_name->given && *contact_name->given;
- have_additional = contact_name->additional && *contact_name->additional;
- have_family = contact_name->family && *contact_name->family;
-
- if (e_contact_get (contact, E_CONTACT_IS_LIST)) {
-
- menu_text = e_contact_name_to_string (contact_name);
-
- } else if (first_match == EAB_CONTACT_MATCH_PART_GIVEN_NAME) {
-
- if (have_family)
- menu_text = g_strdup_printf ("%s %s <%s>", contact_name->given, contact_name->family, email);
- else
- menu_text = g_strdup_printf ("%s <%s>", contact_name->given, email);
-
- } else if (first_match == EAB_CONTACT_MATCH_PART_ADDITIONAL_NAME) {
-
- if (have_given) {
-
- menu_text = g_strdup_printf ("%s%s%s, %s <%s>",
- contact_name->additional,
- have_family ? " " : "",
- have_family ? contact_name->family : "",
- contact_name->given,
- email);
- } else {
-
- menu_text = g_strdup_printf ("%s%s%s <%s>",
- contact_name->additional,
- have_family ? " " : "",
- have_family ? contact_name->family : "",
- email);
- }
-
- } else if (first_match == EAB_CONTACT_MATCH_PART_FAMILY_NAME) {
-
- if (have_given)
- menu_text = g_strdup_printf ("%s, %s%s%s <%s>",
- contact_name->family,
- contact_name->given,
- have_additional ? " " : "",
- have_additional ? contact_name->additional : "",
- email);
- else
- menu_text = g_strdup_printf ("%s <%s>", contact_name->family, email);
-
- } else { /* something funny happened */
-
- menu_text = g_strdup_printf ("<%s> ???", email);
-
- }
-
- if (menu_text) {
- g_strstrip (menu_text);
- final_match = make_match (dest, menu_text, score);
- g_free (menu_text);
- }
-
- e_contact_name_free (contact_name);
-
- return final_match;
-}
-
-/*
- * File As Query
- */
-
-static gchar *
-sexp_file_as (ESelectNamesCompletion *comp)
-{
- return name_style_query (comp, "file_as");
-}
-
-static ECompletionMatch *
-match_file_as (ESelectNamesCompletion *comp, EDestination *dest)
-{
- const gchar *name;
- const gchar *email;
- gchar *cpy, **strv, *menu_text;
- gint i, len;
- double score = 0.00001;
- ECompletionMatch *match;
-
- name = e_destination_get_name (dest);
- email = e_destination_get_email (dest);
-
- if (!(name && *name))
- return NULL;
-
- cpy = g_strdup (comp->priv->query_text);
- strv = g_strsplit (cpy, " ", 0);
-
- for (i=0; strv[i] && score > 0; ++i) {
- len = g_utf8_strlen (strv[i], -1);
- if (!utf8_casefold_collate_len (name, strv[i], len))
- score += len; /* one point per character of the match */
- else
- score = 0;
- }
-
- g_free (cpy);
- g_strfreev (strv);
-
- if (score <= 0)
- return NULL;
-
- menu_text = g_strdup_printf ("%s <%s>", name, email);
- g_strstrip (menu_text);
- match = make_match (dest, menu_text, score);
- g_free (menu_text);
-
- return match;
-}
-
-typedef struct _BookQuery BookQuery;
-struct _BookQuery {
- BookQuerySExp builder;
- BookQueryMatchTester tester;
-};
-
-static BookQuery book_queries[] = {
- { sexp_nickname, match_nickname},
- { sexp_email, match_email },
- { sexp_name, match_name },
- { sexp_file_as, match_file_as },
-};
-static gint book_query_count = sizeof (book_queries) / sizeof (BookQuery);
-
-/*
- * Build up a big compound sexp corresponding to all of our queries.
- */
-static EBookQuery*
-book_query_sexp (ESelectNamesCompletion *comp)
-{
- gint i, j;
- gchar **queryv;
- EBookQuery *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;
-
- queryv = g_new0 (gchar *, book_query_count+1);
- for (i=0, j=0; i<book_query_count; ++i) {
- queryv[j] = book_queries[i].builder (comp);
- if (queryv[j])
- ++j;
- }
-
- if (j == 0) {
- query = NULL;
- } else if (j == 1) {
- query = e_book_query_from_string (queryv[0]);
- queryv[0] = NULL;
- } else {
- gchar *tmp, *tmp2;
- tmp = g_strjoinv (" ", queryv);
- tmp2 = g_strdup_printf ("(or %s)", tmp);
- query = e_book_query_from_string (tmp2);
- g_free (tmp);
- g_free (tmp2);
- }
-
- for (i=0; i<book_query_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 (E_IS_SELECT_NAMES_COMPLETION (comp), NULL);
- g_return_val_if_fail (E_IS_DESTINATION (dest), NULL);
-
- if (! (comp->priv->query_text && *comp->priv->query_text))
- return NULL;
-
- for (i=0; i<book_query_count; ++i) {
-
- ECompletionMatch *this_match = NULL;
-
- if (book_queries[i].tester && e_destination_get_contact (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);
- }
- }
- }
-
- return best_match;
-}
-
-static void
-book_query_process_card_list (ESelectNamesCompletion *comp, const GList *contacts)
-{
- while (contacts) {
- EContact *contact = E_CONTACT (contacts->data);
-
- if (e_contact_get (contact, E_CONTACT_IS_LIST)) {
-
- if (comp->priv->match_contact_lists) {
-
- EDestination *dest = e_destination_new ();
- ECompletionMatch *match;
- e_destination_set_contact (dest, contact, 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);
- }
- g_object_unref (dest);
-
- }
-
- }
- else {
- GList *email = e_contact_get (contact, E_CONTACT_EMAIL);
- if (email) {
- GList *iter;
- gint i;
- for (i=0, iter = email; iter; ++i, iter = iter->next) {
- EDestination *dest = e_destination_new ();
- gchar *e;
- ECompletionMatch *match;
-
- e_destination_set_contact (dest, contact, i);
- e = iter->data;
-
- if (e && *e) {
-
- 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);
- }
- }
-
- g_object_unref (dest);
- }
- }
- g_list_foreach (email, (GFunc)g_free, NULL);
- g_list_free (email);
- }
-
- contacts = contacts->next;
- }
-}
-
-/*
- *
- * ESelectNamesCompletion code
- *
- */
-
-
-GType
-e_select_names_completion_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (ESelectNamesCompletionClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_select_names_completion_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (ESelectNamesCompletion),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_select_names_completion_init,
- };
-
- type = g_type_register_static (e_completion_get_type (), "ESelectNamesCompletion", &info, 0);
- }
-
- return type;
-}
-
-static void
-e_select_names_completion_class_init (ESelectNamesCompletionClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- ECompletionClass *completion_class = E_COMPLETION_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->dispose = e_select_names_completion_dispose;
-
- completion_class->request_completion = e_select_names_completion_handle_request;
- completion_class->end_completion = e_select_names_completion_end;
-
- 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_clear_book_data (ESelectNamesCompletion *comp)
-{
- GList *l;
-
- for (l = comp->priv->book_data; l; l = l->next) {
- ESelectNamesCompletionBookData *book_data = l->data;
-
- if (book_data->contacts_added_tag) {
- g_signal_handler_disconnect (book_data->book_view, book_data->contacts_added_tag);
- book_data->contacts_added_tag = 0;
- }
-
- if (book_data->seq_complete_tag) {
- g_signal_handler_disconnect (book_data->book_view, book_data->seq_complete_tag);
- book_data->seq_complete_tag = 0;
- }
-
- g_object_unref (book_data->book);
-
- if (book_data->book_view) {
- e_book_view_stop (book_data->book_view);
- g_object_unref (book_data->book_view);
- }
-
- g_free (book_data->cached_query_text);
- g_list_foreach (book_data->cached_cards, (GFunc)g_object_unref, NULL);
- g_list_free (book_data->cached_cards);
-
- g_free (book_data);
- }
- g_list_free (comp->priv->book_data);
- comp->priv->book_data = NULL;
-}
-
-static void
-e_select_names_completion_dispose (GObject *object)
-{
- ESelectNamesCompletion *comp = E_SELECT_NAMES_COMPLETION (object);
-
- if (comp->priv) {
- if (comp->priv->text_model)
- g_object_unref (comp->priv->text_model);
-
- e_select_names_completion_clear_book_data (comp);
-
- g_free (comp->priv->waiting_query);
- g_free (comp->priv->query_text);
-
- g_free (comp->priv);
- comp->priv = NULL;
- }
-
- if (parent_class->dispose)
- parent_class->dispose (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';
-
- g_strstrip (q);
-
- return q;
-}
-
-static void
-e_select_names_completion_clear_cache (ESelectNamesCompletionBookData *book_data)
-{
- if (out)
- fprintf (out, "** clearing cache on book %s\n", e_book_get_uri (book_data->book));
-
- g_free (book_data->cached_query_text);
- g_list_foreach (book_data->cached_cards, (GFunc)g_object_unref, NULL);
- g_list_free (book_data->cached_cards);
-
- book_data->cached_query_text = NULL;
- book_data->cached_cards = NULL;
-}
-
-static void
-e_select_names_completion_done (ESelectNamesCompletion *comp)
-{
- g_free (comp->priv->query_text);
- comp->priv->query_text = NULL;
-
- 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_got_book_view_cb (EBook *book, EBookStatus status, EBookView *view, gpointer user_data)
-{
- ESelectNamesCompletion *comp;
- ESelectNamesCompletionBookData *book_data;
-
- book_data = (ESelectNamesCompletionBookData*)user_data;
- comp = book_data->comp;
-
- if (status != E_BOOK_ERROR_OK) {
- comp->priv->pending_completion_seq--;
- if (!comp->priv->pending_completion_seq)
- e_select_names_completion_done (comp);
- return;
- }
-
- book_data->book_view_tag = 0;
-
- if (book_data->contacts_added_tag) {
- g_signal_handler_disconnect (book_data->book_view, book_data->contacts_added_tag);
- book_data->contacts_added_tag = 0;
- }
- if (book_data->seq_complete_tag) {
- g_signal_handler_disconnect (book_data->book_view, book_data->seq_complete_tag);
- book_data->seq_complete_tag = 0;
- }
-
- g_object_ref (view);
- if (book_data->book_view) {
- e_book_view_stop (book_data->book_view);
- g_object_unref (book_data->book_view);
- }
- book_data->book_view = view;
-
- book_data->contacts_added_tag =
- g_signal_connect (view,
- "contacts_added",
- G_CALLBACK (e_select_names_completion_contacts_added_cb),
- book_data);
-
- book_data->seq_complete_tag =
- g_signal_connect (view,
- "sequence_complete",
- G_CALLBACK (e_select_names_completion_seq_complete_cb),
- book_data);
-
- book_data->sequence_complete_received = FALSE;
-
- e_book_view_start (view);
-}
-
-static void
-e_select_names_completion_contacts_added_cb (EBookView *book_view, const GList *cards, gpointer user_data)
-{
- ESelectNamesCompletionBookData *book_data = user_data;
- ESelectNamesCompletion *comp = book_data->comp;
-
- if (e_completion_searching (E_COMPLETION (comp))) {
- book_query_process_card_list (comp, cards);
-
- /* Save the list of matching cards. */
- while (cards) {
- book_data->cached_cards = g_list_prepend (book_data->cached_cards, g_object_ref (cards->data));
- cards = g_list_next (cards);
- }
- }
-}
-
-static void
-e_select_names_completion_seq_complete_cb (EBookView *book_view, EBookViewStatus status, gpointer user_data)
-{
- ESelectNamesCompletionBookData *book_data = user_data;
- ESelectNamesCompletion *comp = book_data->comp;
-
- if (out)
- fprintf (out, "** got sequence_complete (status = %d) on book %s\n", status, e_book_get_uri (book_data->book));
-
- /*
- * We aren't searching, but the addressbook has changed -- clear our card cache so that
- * future completion requests will take the changes into account.
- */
- if (! e_completion_searching (E_COMPLETION (comp))) {
- if (out)
- fprintf (out, "\t we weren't searching, clearing the cache\n");
- e_select_names_completion_clear_cache (book_data);
- return;
- }
-
- if (book_data->cached_query_text
- && status == E_BOOK_ERROR_OK
- && !book_data->cache_complete
- && !strcmp (book_data->cached_query_text, comp->priv->query_text))
- book_data->cache_complete = TRUE;
-
- if (out)
- fprintf (out, "\tending search, book_data->cache_complete == %d, cached_cards = %p\n",
- book_data->cache_complete,
- book_data->cached_cards);
-
- if (!book_data->sequence_complete_received) {
- book_data->sequence_complete_received = TRUE;
-
- if (book_data->contacts_added_tag) {
- g_signal_handler_disconnect (book_data->book_view, book_data->contacts_added_tag);
- book_data->contacts_added_tag = 0;
- }
- if (book_data->seq_complete_tag) {
- g_signal_handler_disconnect (book_data->book_view, book_data->seq_complete_tag);
- book_data->seq_complete_tag = 0;
- }
-
- if (out)
- fprintf (out, "\t %d remaining book view's\n", comp->priv->pending_completion_seq - 1);
-
- comp->priv->pending_completion_seq --;
- if (comp->priv->pending_completion_seq > 0)
- return;
- }
-
- e_select_names_completion_done (comp);
-}
-
-static void
-e_select_names_completion_stop_query (ESelectNamesCompletion *comp)
-{
- GList *l;
-
- 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;
-
- for (l = comp->priv->book_data; l; l = l->next) {
- ESelectNamesCompletionBookData *book_data = l->data;
- if (book_data->book_view_tag) {
- e_book_cancel (book_data->book, NULL);
- book_data->book_view_tag = 0;
- }
- if (book_data->book_view) {
- if (book_data->contacts_added_tag) {
- g_signal_handler_disconnect (book_data->book_view, book_data->contacts_added_tag);
- book_data->contacts_added_tag = 0;
- }
- if (book_data->seq_complete_tag) {
- g_signal_handler_disconnect (book_data->book_view, book_data->seq_complete_tag);
- book_data->seq_complete_tag = 0;
- }
-
- e_book_view_stop (book_data->book_view);
- g_object_unref (book_data->book_view);
- book_data->book_view = NULL;
- }
- }
-
- comp->priv->pending_completion_seq = 0;
-}
-
-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->books_not_ready == 0) {
- EBookQuery *query;
-
- if (strlen (query_text) < comp->priv->minimum_query_length) {
- e_completion_end_search (E_COMPLETION (comp));
- return;
- }
-
- g_free (comp->priv->query_text);
- comp->priv->query_text = g_strdup (query_text);
-
- query = book_query_sexp (comp);
- if (query) {
- GList *l;
-
- if (out)
- fprintf (out, "\n\n**** starting query: \"%s\"\n", comp->priv->query_text);
-
- for (l = comp->priv->book_data; l; l = l->next) {
- ESelectNamesCompletionBookData *book_data = l->data;
- gboolean can_reuse_cached_cards;
-
- if (out) {
- fprintf (out,
- "book == %s[\n"
- "\tbook_data->cached_query_text == `%s'\n"
- "\tbook_data->cache_complete == %d\n"
- "\tbook_data->cached_cards == %p\n",
- e_book_get_uri (book_data->book),
- book_data->cached_query_text,
- book_data->cache_complete,
- book_data->cached_cards);
- }
-
- /* for lack of a better place, we invalidate the cache here if we
- notice that the text is different. */
- if (book_data->cached_query_text
- && (strlen (book_data->cached_query_text) > strlen (query_text)
- || utf8_casefold_collate_len (book_data->cached_query_text, query_text,
- strlen (book_data->cached_query_text))))
- book_data->cache_complete = FALSE;
-
- can_reuse_cached_cards = (book_data->cached_query_text
- && book_data->cache_complete
- && book_data->cached_cards != NULL);
-
- if (can_reuse_cached_cards) {
-
- if (out)
- fprintf (out, "\t*** can reuse cached cards (%d cards cached)!\n", g_list_length (book_data->cached_cards));
-
- if (out)
- fprintf (out, "\tusing existing query info: %s (vs %s)\n", query_text, book_data->cached_query_text);
- book_query_process_card_list (comp, book_data->cached_cards);
- }
- else {
- e_select_names_completion_clear_cache (book_data);
- book_data->cached_query_text = g_strdup (query_text);
-
- book_data->book_view_tag = e_book_async_get_book_view (book_data->book,
- query,
- NULL, -1,
- e_select_names_completion_got_book_view_cb, book_data);
- comp->priv->pending_completion_seq++;
- }
-
- if (out)
- fprintf (out, "]\n");
- }
-
- /* if we looped through all the books
- and were able to complete based
- solely on our cached cards, signal
- that the search is over. */
- if (!comp->priv->pending_completion_seq)
- e_select_names_completion_done (E_SELECT_NAMES_COMPLETION (comp));
-
- e_book_query_unref (query);
- } else {
- g_free (comp->priv->query_text);
- comp->priv->query_text = NULL;
- }
- } else {
- g_free (comp->priv->waiting_query);
- 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;
-
- 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;
- }
-
- if (out)
- fprintf (out, "do_query: %s => %s\n", query_text, clean);
-
- 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 } },
- { "easter-egg?", { "What were you expecting, a flight simulator?", 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 !utf8_casefold_collate (over->trigger, text);
-}
-
-
-/*
- *
- * Completion Callbacks
- *
- */
-
-static void
-e_select_names_completion_handle_request (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->text_model->source,
- selcomp->priv->text_model->seplen,
- pos, &index, NULL, NULL);
- str = index >= 0 ? e_select_names_model_get_string (selcomp->priv->text_model->source, 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");
-}
-
-/*
- *
- * Our Pseudo-Constructor
- *
- */
-
-ECompletion *
-e_select_names_completion_new (ESelectNamesTextModel *text_model)
-{
- ESelectNamesCompletion *comp;
-
- g_return_val_if_fail (E_IS_SELECT_NAMES_TEXT_MODEL (text_model), NULL);
-
- comp = g_object_new (E_TYPE_SELECT_NAMES_COMPLETION, NULL);
-
- comp->priv->text_model = text_model;
- g_object_ref (text_model);
-
- return E_COMPLETION (comp);
-}
-
-void
-e_select_names_completion_add_book (ESelectNamesCompletion *comp, EBook *book)
-{
- ESelectNamesCompletionBookData *book_data;
-
- g_return_if_fail (book != NULL);
-
- book_data = g_new0 (ESelectNamesCompletionBookData, 1);
- book_data->book = book;
- book_data->comp = comp;
- g_object_ref (book_data->book);
- comp->priv->book_data = g_list_append (comp->priv->book_data, book_data);
-
- /* XXX toshok - this doesn't work properly. need to rethink this next bit. */
- /* if the user is typing as we're adding books, restart the
- query after the new book has been added */
- if (comp->priv->query_text && *comp->priv->query_text) {
- char *query_text = g_strdup (comp->priv->query_text);
- e_select_names_completion_stop_query (comp);
- e_select_names_completion_start_query (comp, query_text);
- g_free (query_text);
- }
-}
-
-void
-e_select_names_completion_clear_books (ESelectNamesCompletion *comp)
-{
- e_select_names_completion_stop_query (comp);
- e_select_names_completion_clear_book_data (comp);
-}
-
-void
-e_select_names_completion_set_minimum_query_length (ESelectNamesCompletion *comp, int query_length)
-{
- g_return_if_fail (E_IS_SELECT_NAMES_COMPLETION (comp));
- comp->priv->minimum_query_length = query_length;
-}
-
-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 97a3f3f5ca..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 version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- */
-
-#ifndef E_SELECT_NAMES_COMPLETION_H
-#define E_SELECT_NAMES_COMPLETION_H
-
-#include <gal/e-text/e-completion.h>
-#include <libebook/e-book.h>
-#include "e-select-names-text-model.h"
-
-G_BEGIN_DECLS
-
-#define E_TYPE_SELECT_NAMES_COMPLETION (e_select_names_completion_get_type ())
-#define E_SELECT_NAMES_COMPLETION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_SELECT_NAMES_COMPLETION, ESelectNamesCompletion))
-#define E_SELECT_NAMES_COMPLETION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), E_TYPE_SELECT_NAMES_COMPLETION, ESelectNamesCompletionClass))
-#define E_IS_SELECT_NAMES_COMPLETION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_SELECT_NAMES_COMPLETION))
-#define E_IS_SELECT_NAMES_COMPLETION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_SELECT_NAMES_COMPLETION))
-
-typedef struct _ESelectNamesCompletion ESelectNamesCompletion;
-typedef struct _ESelectNamesCompletionClass ESelectNamesCompletionClass;
-struct _ESelectNamesCompletionPrivate;
-
-struct _ESelectNamesCompletion {
- ECompletion parent;
-
- struct _ESelectNamesCompletionPrivate *priv;
-};
-
-struct _ESelectNamesCompletionClass {
- ECompletionClass parent_class;
-
-};
-
-GType e_select_names_completion_get_type (void);
-
-ECompletion *e_select_names_completion_new (ESelectNamesTextModel *);
-void e_select_names_completion_add_book (ESelectNamesCompletion *, EBook *);
-void e_select_names_completion_clear_books (ESelectNamesCompletion *);
-void e_select_names_completion_set_minimum_query_length (ESelectNamesCompletion *, int);
-gboolean e_select_names_completion_get_match_contact_lists (ESelectNamesCompletion *);
-void e_select_names_completion_set_match_contact_lists (ESelectNamesCompletion *, gboolean);
-
-G_END_DECLS
-
-#endif /* E_SELECT_NAMES_COMPLETION_H */
diff --git a/addressbook/gui/component/select-names/e-select-names-config-keys.h b/addressbook/gui/component/select-names/e-select-names-config-keys.h
deleted file mode 100644
index e0f08c3019..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-config-keys.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- * JP Rosevear <jpr@ximian.com>
- *
- * Copyright 2003, Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef _E_SELECT_NAMES_CONFIG_KEYS_H_
-#define _E_SELECT_NAMES_CONFIG_KEYS_H_
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-#define SELECT_NAMES_CONFIG_PREFIX "/apps/evolution/addressbook/completion"
-
-/* Display settings */
-#define SELECT_NAMES_CONFIG_COMPLETION_BOOKS SELECT_NAMES_CONFIG_PREFIX "/books"
-#define SELECT_NAMES_CONFIG_LAST_COMPLETION_BOOK SELECT_NAMES_CONFIG_PREFIX "/last_book"
-#define SELECT_NAMES_CONFIG_MIN_QUERY_LENGTH SELECT_NAMES_CONFIG_PREFIX "/minimum_query_length"
-
-G_END_DECLS
-
-#endif
diff --git a/addressbook/gui/component/select-names/e-select-names-config.c b/addressbook/gui/component/select-names/e-select-names-config.c
deleted file mode 100644
index 8335ed7c3b..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-config.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * Authors :
- * Damon Chaplin <damon@ximian.com>
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright 2000, Ximian, Inc.
- * Copyright 2000, Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include "e-select-names-config-keys.h"
-#include "e-select-names-config.h"
-
-static GConfClient *config = NULL;
-
-static void
-do_cleanup (void)
-{
- g_object_unref (config);
- config = NULL;
-}
-
-static void
-e_select_names_config_init (void)
-{
- if (config)
- return;
-
- config = gconf_client_get_default ();
- g_atexit ((GVoidFunc) do_cleanup);
-
- gconf_client_add_dir (config, SELECT_NAMES_CONFIG_PREFIX, GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);
-}
-
-void
-e_select_names_config_remove_notification (guint id)
-{
- gconf_client_notify_remove (config, id);
-}
-
-char *
-e_select_names_config_get_last_completion_book (void)
-{
- e_select_names_config_init ();
-
- return gconf_client_get_string (config, SELECT_NAMES_CONFIG_LAST_COMPLETION_BOOK, NULL);
-}
-
-void
-e_select_names_config_set_last_completion_book (const char *last_completion_book)
-{
- e_select_names_config_init ();
-
- gconf_client_set_string (config, SELECT_NAMES_CONFIG_LAST_COMPLETION_BOOK, last_completion_book, NULL);
-}
-
-guint
-e_select_names_config_add_notification_last_completion_book (GConfClientNotifyFunc func, gpointer data)
-{
- guint id;
-
- e_select_names_config_init ();
-
- id = gconf_client_notify_add (config, SELECT_NAMES_CONFIG_LAST_COMPLETION_BOOK, func, data, NULL, NULL);
-
- return id;
-}
-
-gint
-e_select_names_config_get_min_query_length (void)
-{
- e_select_names_config_init ();
-
- return gconf_client_get_int (config, SELECT_NAMES_CONFIG_MIN_QUERY_LENGTH, NULL);
-}
-
-
-void
-e_select_names_config_set_min_query_length (gint day_end_hour)
-{
- e_select_names_config_init ();
-
- gconf_client_set_int (config, SELECT_NAMES_CONFIG_MIN_QUERY_LENGTH, day_end_hour, NULL);
-}
-
-guint
-e_select_names_config_add_notification_min_query_length (GConfClientNotifyFunc func, gpointer data)
-{
- guint id;
-
- e_select_names_config_init ();
-
- id = gconf_client_notify_add (config, SELECT_NAMES_CONFIG_MIN_QUERY_LENGTH, func, data, NULL, NULL);
-
- return id;
-}
diff --git a/addressbook/gui/component/select-names/e-select-names-config.h b/addressbook/gui/component/select-names/e-select-names-config.h
deleted file mode 100644
index 12d2c1314d..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-config.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- * Damon Chaplin <damon@ximian.com>
- * Rodrigo Moya <rodrigo@ximian.com>
- *
- * Copyright 2000, Ximian, Inc.
- * Copyright 2000, Ximian, Inc.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#ifndef _E_SELECT_NAMES_CONFIG_H_
-#define _E_SELECT_NAMES_CONFIG_H_
-
-#include <gconf/gconf-client.h>
-
-void e_select_names_config_remove_notification (guint id);
-
-/* The last completion book */
-char *e_select_names_config_get_last_completion_book (void);
-void e_select_names_config_set_last_completion_book (const char *last_completion_book);
-guint e_select_names_config_add_notification_last_completion_book (GConfClientNotifyFunc func, gpointer data);
-
-
-/* The minimum query length */
-gint e_select_names_config_get_min_query_length (void);
-void e_select_names_config_set_min_query_length (gint day_end_hour);
-guint e_select_names_config_add_notification_min_query_length (GConfClientNotifyFunc func, gpointer data);
-
-#endif /* _E_SELECT_NAMES_CONFIG_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 9e427513e0..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 version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * 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:" BASE_VERSION
-
-static BonoboGenericFactory *factory = NULL;
-
-
-static BonoboObject *
-factory_fn (BonoboGenericFactory *factory,
- const char *component_id,
- 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 0fe85c8361..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-factory.h
+++ /dev/null
@@ -1,30 +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 version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * 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 0bd3b672e1..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-manager.c
+++ /dev/null
@@ -1,696 +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 <gal/e-text/e-entry.h>
-
-#include <libgnome/gnome-i18n.h>
-#include "e-select-names-config.h"
-#include "e-select-names-manager.h"
-#include "e-select-names-marshal.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/util/eab-book-util.h>
-#include <libebook/e-destination.h>
-#include "addressbook/gui/component/addressbook.h"
-#include <bonobo/bonobo-object.h>
-
-#define DEFAULT_MINIMUM_QUERY_LENGTH 3
-
-enum {
- CHANGED,
- OK,
- CANCEL,
- LAST_SIGNAL
-};
-
-static guint e_select_names_manager_signals[LAST_SIGNAL] = { 0 };
-
-static GObjectClass *parent_class = NULL;
-
-typedef struct {
- char *id;
- char *title;
- ESelectNamesModel *model;
- ESelectNamesModel *original_model;
- ESelectNamesManager *manager;
- guint changed_tag;
-} ESelectNamesManagerSection;
-
-typedef struct {
- char *id;
- EEntry *entry;
- ESelectNamesManager *manager;
- ESelectNamesModel *model;
- ECompletion *comp;
- guint cleaning_tag;
-} 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_dispose (GObject *object);
-
-/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */
-
-/* ESelectNamesManagerSection routines */
-
-static void
-section_model_changed_cb (ESelectNamesModel *model, gpointer closure)
-{
- ESelectNamesManagerSection *section = closure;
- g_signal_emit (section->manager,
- e_select_names_manager_signals[CHANGED], 0,
- section->id,
- FALSE);
-}
-
-static ESelectNamesManagerSection *
-e_select_names_manager_section_new (ESelectNamesManager *manager,
- const gchar *id,
- const gchar *title,
- ESelectNamesModel *model)
-{
- ESelectNamesManagerSection *section;
-
- g_return_val_if_fail (E_IS_SELECT_NAMES_MANAGER (manager), NULL);
- g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), NULL);
-
- section = g_new0 (ESelectNamesManagerSection, 1);
-
- section->id = g_strdup (id);
- section->title = g_strdup (title);
-
- section->manager = manager;
-
- section->model = model;
- g_object_ref (section->model);
- section->changed_tag =
- g_signal_connect (section->model,
- "changed",
- G_CALLBACK (section_model_changed_cb),
- section);
-
- return section;
-}
-
-static void
-e_select_names_manager_section_free (ESelectNamesManagerSection *section)
-{
- if (section == NULL)
- return;
-
- g_free (section->id);
- g_free (section->title);
-
- if (section->model) {
- g_signal_handler_disconnect (section->model, section->changed_tag);
- g_object_unref (section->model);
- }
-
- if (section->original_model) {
- g_object_unref (section->original_model);
- }
-
- g_free (section);
-}
-
-/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */
-
-/* ESelectNamesManagerEntry routines */
-
-static ESelectNamesManagerEntry *
-get_entry_info (EEntry *entry)
-{
- g_return_val_if_fail (E_IS_ENTRY (entry), NULL);
- return (ESelectNamesManagerEntry *) g_object_get_data (G_OBJECT (entry), "entry_info");
-}
-
-static void
-populate_popup_cb (EEntry *eentry, GdkEventButton *ev, gint pos, GtkWidget *menu, gpointer user_data)
-{
- ESelectNamesTextModel *text_model;
-
- g_object_get (eentry,
- "model", &text_model,
- NULL);
- g_assert (E_IS_SELECT_NAMES_TEXT_MODEL (text_model));
-
- e_select_names_populate_popup (menu, text_model, ev, pos, GTK_WIDGET (eentry));
-}
-
-static void
-completion_handler (EEntry *entry, ECompletionMatch *match)
-{
- ESelectNamesManagerEntry *mgr_entry;
- ESelectNamesTextModel *text_model;
- EDestination *dest;
- gint i, pos, start_pos, len;
-
- if (match == NULL || match->user_data == NULL)
- return;
-
- mgr_entry = get_entry_info (entry);
- 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. */
- g_object_ref (dest);
-
- g_object_get (entry,
- "model", &text_model,
- NULL);
- g_assert (E_IS_SELECT_NAMES_TEXT_MODEL (text_model));
-
- pos = e_entry_get_position (entry);
- e_select_names_model_text_pos (mgr_entry->model, text_model->seplen, pos, &i, NULL, NULL);
- e_select_names_model_replace (mgr_entry->model, i, dest);
- e_select_names_model_name_pos (mgr_entry->model, text_model->seplen, i, &start_pos, &len);
- e_entry_set_position (entry, start_pos+len);
-}
-
-static ESelectNamesManagerEntry *
-e_select_names_manager_entry_new (ESelectNamesManager *manager, ESelectNamesModel *model, const gchar *id)
-{
- ESelectNamesManagerEntry *entry;
- ETextModel *text_model;
- GList *l;
-
- g_return_val_if_fail (E_IS_SELECT_NAMES_MANAGER (manager), NULL);
- g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), NULL);
-
- entry = g_new0 (ESelectNamesManagerEntry, 1);
-
- entry->id = g_strdup (id);
-
- entry->entry = E_ENTRY (e_entry_new ());
-
- if (atk_get_root () != NULL) {
- AtkObject *a11y = atk_gobject_accessible_for_object (entry->entry->item);
- if (a11y != NULL) {
- gchar *text;
- if (pango_parse_markup (id, -1, '_', NULL,
- &text, NULL, NULL)) {
- atk_object_set_name (a11y, text);
- g_free (text);
- }
- }
- }
- text_model = e_select_names_text_model_new (model);
- g_object_set(entry->entry,
- "model", text_model, /* The entry takes ownership of the text model */
- "editable", TRUE,
- "use_ellipsis", TRUE,
- "allow_newlines", FALSE,
- NULL);
-
- g_object_ref (entry->entry);
-
- entry->comp = e_select_names_completion_new (E_SELECT_NAMES_TEXT_MODEL (text_model));
-
- for (l = manager->completion_books; l; l = l->next) {
- EBook *book = l->data;
- e_select_names_completion_add_book (E_SELECT_NAMES_COMPLETION(entry->comp), book);
- }
-
- e_select_names_completion_set_minimum_query_length (E_SELECT_NAMES_COMPLETION(entry->comp),
- manager->minimum_query_length);
-
- e_entry_enable_completion_full (entry->entry, entry->comp, 100, completion_handler);
-
- entry->manager = manager;
-
- entry->model = model;
- g_object_ref (model);
-
- g_signal_connect (entry->entry,
- "populate_popup",
- G_CALLBACK (populate_popup_cb),
- entry);
-
- g_object_set_data (G_OBJECT (entry->entry), "entry_info", entry);
- g_object_set_data (G_OBJECT (entry->entry), "select_names_model", model);
- g_object_set_data (G_OBJECT (entry->entry), "select_names_text_model", text_model);
- g_object_set_data (G_OBJECT (entry->entry), "completion_handler", entry->comp);
-
- return entry;
-}
-
-static void
-e_select_names_manager_entry_free (ESelectNamesManagerEntry *entry)
-{
- if (entry == NULL)
- return;
-
- g_free (entry->id);
- g_object_unref (entry->model);
- g_object_unref (entry->entry);
-
- if (entry->cleaning_tag)
- g_source_remove (entry->cleaning_tag);
-
- g_free (entry);
-}
-
-/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */
-
-static void
-e_select_names_manager_save_models (ESelectNamesManager *manager)
-{
- GList *iter;
-
- for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) {
- ESelectNamesManagerSection *section = iter->data;
-
- if (section->original_model == NULL && section->model != NULL)
- section->original_model = e_select_names_model_duplicate (section->model);
-
- }
-}
-
-static void
-e_select_names_manager_revert_to_saved_models (ESelectNamesManager *manager)
-{
- GList *iter;
-
- for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) {
- ESelectNamesManagerSection *section = iter->data;
- if (section->model && section->original_model) {
- e_select_names_model_overwrite_copy (section->model, section->original_model);
- g_object_unref (section->original_model);
- section->original_model = NULL;
- }
- }
-}
-
-static void
-e_select_names_manager_discard_saved_models (ESelectNamesManager *manager)
-{
- GList *iter;
-
- for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) {
- ESelectNamesManagerSection *section = iter->data;
- if (section->original_model) {
- g_object_unref (section->original_model);
- section->original_model = NULL;
- }
- }
-}
-
-/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */
-
-static void
-open_book_cb (EBook *book, EBookStatus status, gpointer user_data)
-{
- ESelectNamesManager *manager = E_SELECT_NAMES_MANAGER (user_data);
-
- if (status == E_BOOK_ERROR_OK) {
- GList *l;
- for (l = manager->entries; l; l = l->next) {
- ESelectNamesManagerEntry *entry = l->data;
- e_select_names_completion_add_book (E_SELECT_NAMES_COMPLETION(entry->comp), book);
- }
-
- manager->completion_books = g_list_append (manager->completion_books, book);
- g_object_ref (book);
- }
-
- g_object_unref (manager); /* unref ourself (matches ref before the load_source call below) */
-}
-
-static void
-update_completion_books (ESelectNamesManager *manager)
-{
- GSList *groups;
-
- /* Add all the completion books */
- for (groups = e_source_list_peek_groups (manager->source_list); groups; groups = groups->next) {
- ESourceGroup *group = E_SOURCE_GROUP (groups->data);
- GSList *sources;
-
- for (sources = e_source_group_peek_sources (group); sources; sources = sources->next) {
- ESource *source = E_SOURCE (sources->data);
- const char *completion = e_source_get_property (source, "completion");
- if (completion && !g_ascii_strcasecmp (completion, "true")) {
- EBook *book = e_book_new (source, NULL);
- g_object_ref (manager);
- addressbook_load (book, open_book_cb, manager);
- }
- }
- }
-}
-
-static void
-source_list_changed (ESourceList *source_list, ESelectNamesManager *manager)
-{
- GList *l;
-
- for (l = manager->entries; l; l = l->next) {
- ESelectNamesManagerEntry *entry = l->data;
- e_select_names_completion_clear_books (E_SELECT_NAMES_COMPLETION (entry->comp));
- }
-
- g_list_foreach (manager->completion_books, (GFunc)g_object_unref, NULL);
- g_list_free (manager->completion_books);
- manager->completion_books = NULL;
-
- update_completion_books (manager);
-}
-
-static void
-config_min_query_length_changed_cb (GConfClient *client, guint id, GConfEntry *entry, gpointer data)
-{
- ESelectNamesManager *manager = data;
- GList *l;
-
- manager->minimum_query_length = e_select_names_config_get_min_query_length ();
- if (manager->minimum_query_length <= 0)
- manager->minimum_query_length = DEFAULT_MINIMUM_QUERY_LENGTH;
-
- for (l = manager->entries; l; l = l->next) {
- ESelectNamesManagerEntry *entry = l->data;
- e_select_names_completion_set_minimum_query_length (E_SELECT_NAMES_COMPLETION(entry->comp),
- manager->minimum_query_length);
- }
-}
-
-/**
- * e_select_names_manager_new:
- *
- * Returns: a new #ESelectNamesManager
- */
-ESelectNamesManager *
-e_select_names_manager_new (void)
-{
- ESelectNamesManager *manager = g_object_new (E_TYPE_SELECT_NAMES_MANAGER, NULL);
-
- return manager;
-}
-
-
-/*
- * ESelectNamesManager lifecycle management and vcard loading/saving.
- */
-
-
-void
-e_select_names_manager_add_section (ESelectNamesManager *manager,
- const char *id,
- const char *title)
-{
- g_return_if_fail (E_IS_SELECT_NAMES_MANAGER (manager));
- g_return_if_fail (id != NULL);
- g_return_if_fail (title != NULL);
-
- 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;
- ESelectNamesModel *model;
-
- g_return_if_fail (E_IS_SELECT_NAMES_MANAGER (manager));
- g_return_if_fail (id != NULL);
- g_return_if_fail (title != NULL);
-
- model = e_select_names_model_new ();
- e_select_names_model_set_limit (model, limit);
-
- section = e_select_names_manager_section_new (manager, id, title, model);
-
- manager->sections = g_list_append (manager->sections, section);
-
- g_object_unref (model);
-}
-
-ESelectNamesModel *
-e_select_names_manager_get_source (ESelectNamesManager *manager,
- const char *id)
-{
- GList *iter;
-
- g_return_val_if_fail (E_IS_SELECT_NAMES_MANAGER (manager), NULL);
- g_return_val_if_fail (id != NULL, NULL);
-
- for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) {
- ESelectNamesManagerSection *section = iter->data;
- if (!strcmp (section->id, id))
- return section->model;
- }
- return NULL;
-}
-
-GtkWidget *
-e_select_names_manager_create_entry (ESelectNamesManager *manager, const char *id)
-{
- GList *iter;
-
- g_return_val_if_fail (E_IS_SELECT_NAMES_MANAGER (manager), NULL);
- g_return_val_if_fail (id != NULL, NULL);
-
- for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) {
- ESelectNamesManagerSection *section = iter->data;
- if (!strcmp(section->id, id)) {
- ESelectNamesManagerEntry *entry;
-
- entry = e_select_names_manager_entry_new (manager, section->model, section->id);
- manager->entries = g_list_append (manager->entries, entry);
-
- return GTK_WIDGET(entry->entry);
- }
- }
-
- return NULL;
-}
-
-static void
-e_select_names_response(ESelectNames *dialog, gint response_id, ESelectNamesManager *manager)
-{
- gtk_widget_destroy (GTK_WIDGET (dialog));
-
- switch(response_id) {
- case GTK_RESPONSE_OK:
- e_select_names_manager_discard_saved_models (manager);
- g_signal_emit (manager, e_select_names_manager_signals[OK], 0);
- break;
-
- case GTK_RESPONSE_CANCEL:
- e_select_names_manager_revert_to_saved_models (manager);
- g_signal_emit (manager, e_select_names_manager_signals[CANCEL], 0);
- break;
- }
-}
-
-static void
-clear_widget (gpointer data, GObject *where_object_was)
-{
- GtkWidget **widget_ref = data;
- *widget_ref = NULL;
-}
-
-void
-e_select_names_manager_activate_dialog (ESelectNamesManager *manager,
- const char *id)
-{
- g_return_if_fail (E_IS_SELECT_NAMES_MANAGER (manager));
- g_return_if_fail (id != NULL);
-
- 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 {
-
- GList *iter;
-
- manager->names = E_SELECT_NAMES (e_select_names_new ());
-
- for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) {
- ESelectNamesManagerSection *section = iter->data;
- e_select_names_add_section (manager->names, section->id, section->title, section->model);
- }
-
- e_select_names_set_default (manager->names, id);
-
- g_signal_connect(manager->names,
- "response",
- G_CALLBACK(e_select_names_response),
- manager);
-
- g_object_weak_ref (G_OBJECT (manager->names), clear_widget, &manager->names);
-
- gtk_widget_show(GTK_WIDGET(manager->names));
- }
-
- e_select_names_manager_save_models (manager);
-}
-
-/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */
-
-static void
-e_select_names_manager_init (ESelectNamesManager *manager)
-{
- guint not;
-
- manager->sections = NULL;
- manager->entries = NULL;
-
- manager->source_list = e_source_list_new_for_gconf_default ("/apps/evolution/addressbook/sources");
- g_signal_connect (manager->source_list, "changed", G_CALLBACK (source_list_changed), manager);
-
- manager->completion_books = NULL;
-
- manager->minimum_query_length = e_select_names_config_get_min_query_length ();
-
- update_completion_books (manager);
-
- not = e_select_names_config_add_notification_min_query_length (config_min_query_length_changed_cb, manager);
- manager->notifications = g_list_append (manager->notifications, GUINT_TO_POINTER (not));
-}
-
-static void
-e_select_names_manager_dispose (GObject *object)
-{
- ESelectNamesManager *manager;
-
- manager = E_SELECT_NAMES_MANAGER (object);
-
- if (manager->names) {
- gtk_widget_destroy (GTK_WIDGET (manager->names));
- manager->names = NULL;
- }
-
- if (manager->sections) {
- g_list_foreach (manager->sections, (GFunc) e_select_names_manager_section_free, NULL);
- g_list_free (manager->sections);
- manager->sections = NULL;
- }
-
- if (manager->entries) {
- g_list_foreach (manager->entries, (GFunc) e_select_names_manager_entry_free, NULL);
- g_list_free (manager->entries);
- manager->entries = NULL;
- }
-
- if (manager->source_list) {
- g_object_unref (manager->source_list);
- manager->source_list = NULL;
- }
-
- if (manager->completion_books) {
- g_list_foreach (manager->completion_books, (GFunc) g_object_unref, NULL);
- g_list_free (manager->completion_books);
- manager->completion_books = NULL;
- }
-
- if (manager->notifications) {
- GList *l;
-
- for (l = manager->notifications; l; l = l->next)
- e_select_names_config_remove_notification (GPOINTER_TO_UINT (l->data));
- g_list_free (manager->notifications);
- manager->notifications = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-e_select_names_manager_class_init (ESelectNamesManagerClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS(klass);
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->dispose = e_select_names_manager_dispose;
-
- e_select_names_manager_signals[CHANGED] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESelectNamesManagerClass, changed),
- NULL, NULL,
- e_select_names_marshal_NONE__POINTER_INT,
- G_TYPE_NONE, 2,
- G_TYPE_POINTER,
- G_TYPE_INT);
-
- e_select_names_manager_signals[OK] =
- g_signal_new ("ok",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESelectNamesManagerClass, ok),
- NULL, NULL,
- e_select_names_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_select_names_manager_signals[CANCEL] =
- g_signal_new ("cancel",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESelectNamesManagerClass, cancel),
- NULL, NULL,
- e_select_names_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-}
-
-/**
- * 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.
- **/
-GType
-e_select_names_manager_get_type (void)
-{
- static GType manager_type = 0;
-
- if (!manager_type) {
- static const GTypeInfo manager_info = {
- sizeof (ESelectNamesManagerClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_select_names_manager_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (ESelectNamesManager),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_select_names_manager_init,
- };
-
- manager_type = g_type_register_static (G_TYPE_OBJECT, "ESelectNamesManager", &manager_info, 0);
- }
-
- return manager_type;
-}
-
-
-
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 0830d299d5..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-manager.h
+++ /dev/null
@@ -1,68 +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) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SELECT_NAMES_MANAGER, ESelectNamesManager))
-#define E_SELECT_NAMES_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_MANAGER, ESelectNamesManagerClass))
-#define E_IS_SELECT_NAMES_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SELECT_NAMES_MANAGER))
-#define E_IS_SELECT_NAMES_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_MANAGER))
-
-typedef struct _ESelectNamesManager ESelectNamesManager;
-typedef struct _ESelectNamesManagerClass ESelectNamesManagerClass;
-
-struct _ESelectNamesManager {
- GObject object;
-
- GList *sections;
- GList *entries;
-
- ESelectNames *names;
-
- ESourceList *source_list;
- GList *completion_books;
-
- int minimum_query_length;
-
- GList *notifications;
-};
-
-struct _ESelectNamesManagerClass {
- GObjectClass parent_class;
-
- void (*changed) (ESelectNamesManager *, const gchar *section_id, gint changed_working_copy);
- void (*ok) (ESelectNamesManager *);
- void (*cancel) (ESelectNamesManager *);
-};
-
-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);
-/* Standard Gtk function */
-GType e_select_names_manager_get_type (void);
-
-#endif /* ! __E_SELECT_NAMES_MANAGER_H__ */
diff --git a/addressbook/gui/component/select-names/e-select-names-marshal.list b/addressbook/gui/component/select-names/e-select-names-marshal.list
deleted file mode 100644
index 8e751dc27d..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-marshal.list
+++ /dev/null
@@ -1,3 +0,0 @@
-NONE:POINTER,INT
-NONE:NONE
-NONE:INT,INT,INT
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 49b9e5039d..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-model.c
+++ /dev/null
@@ -1,792 +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 <libebook/e-book.h>
-#include <libebook/e-contact.h>
-#include "e-select-names-model.h"
-#include "e-select-names-marshal.h"
-#include "eab-book-util.h"
-
-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_CONTACT,
-};
-
-struct _ESelectNamesModelPrivate {
- gchar *id;
- gchar *title;
-
- GList *data; /* of EDestination */
-
- gint limit;
-
- gint freeze_count;
- gboolean pending_changed;
-};
-
-static GObjectClass *parent_class = NULL;
-
-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_dispose (GObject *object);
-
-GType
-e_select_names_model_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (ESelectNamesModelClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_select_names_model_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (ESelectNamesModel),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_select_names_model_init,
- };
-
- type = g_type_register_static (G_TYPE_OBJECT, "ESelectNamesModel", &info, 0);
- }
-
- return type;
-}
-
-static void
-e_select_names_model_class_init (ESelectNamesModelClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS(klass);
- parent_class = g_type_class_peek_parent (klass);
-
- e_select_names_model_signals[E_SELECT_NAMES_MODEL_CHANGED] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESelectNamesModelClass, changed),
- NULL, NULL,
- e_select_names_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_select_names_model_signals[E_SELECT_NAMES_MODEL_RESIZED] =
- g_signal_new ("resized",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESelectNamesModelClass, resized),
- NULL, NULL,
- e_select_names_marshal_NONE__INT_INT_INT,
- G_TYPE_NONE, 3,
- G_TYPE_INT,
- G_TYPE_INT,
- G_TYPE_INT);
-
- klass->changed = NULL;
-
- object_class->dispose = e_select_names_model_dispose;
-}
-
-/**
- * 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_dispose (GObject *object)
-{
- ESelectNamesModel *model = E_SELECT_NAMES_MODEL (object);
-
- if (model->priv) {
- g_free (model->priv->title);
- g_free (model->priv->id);
-
- g_list_foreach (model->priv->data, (GFunc) g_object_unref, NULL);
- g_list_free (model->priv->data);
-
- g_free (model->priv);
- model->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-
-static void
-e_select_names_model_changed (ESelectNamesModel *model)
-{
- if (model->priv->freeze_count > 0) {
- model->priv->pending_changed = TRUE;
- } else {
- g_signal_emit (model, e_select_names_model_signals[E_SELECT_NAMES_MODEL_CHANGED], 0);
- model->priv->pending_changed = FALSE;
- }
-}
-
-/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
-
-ESelectNamesModel *
-e_select_names_model_new (void)
-{
- ESelectNamesModel *model;
- model = g_object_new (E_TYPE_SELECT_NAMES_MODEL, NULL);
- return model;
-}
-
-ESelectNamesModel *
-e_select_names_model_duplicate (ESelectNamesModel *old)
-{
- ESelectNamesModel *model = e_select_names_model_new ();
- 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));
- e_select_names_model_append (model, dup);
- }
-
- model->priv->limit = old->priv->limit;
-
- return model;
-}
-
-gchar *
-e_select_names_model_get_textification (ESelectNamesModel *model, const char *separator)
-{
- gchar *text;
-
- g_return_val_if_fail (model != NULL, NULL);
- g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), NULL);
- g_return_val_if_fail (separator && *separator, NULL);
-
- if (model->priv->data == NULL) {
-
- 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, FALSE);
- ++i;
- iter = g_list_next (iter);
- }
-
- text = g_strjoinv (separator, strv);
-
- g_free (strv);
-
- }
-
- return text;
-}
-
-gchar *
-e_select_names_model_get_address_text (ESelectNamesModel *model, const char *separator)
-{
- gchar *addr_text;
-
- g_return_val_if_fail (model != NULL, NULL);
- g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), NULL);
- g_return_val_if_fail (separator && *separator, NULL);
-
- if (model->priv->data == NULL) {
-
- 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);
- }
-
- addr_text = g_strjoinv (separator, strv);
-
- g_free (strv);
-
- }
-
- return 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;
-}
-
-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_select_names_model_append (model, destv[i]);
- }
- g_free (destv);
-}
-
-EContact *
-e_select_names_model_get_contact (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_contact (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, FALSE) : "";
-}
-
-gboolean
-e_select_names_model_contains (ESelectNamesModel *model, const EDestination *dest)
-{
- GList *iter;
-
- g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), FALSE);
- g_return_val_if_fail (E_IS_DESTINATION (dest), FALSE);
-
- for (iter = model->priv->data; iter != NULL; iter = g_list_next (iter)) {
- if (iter->data != NULL && e_destination_equal (dest, E_DESTINATION (iter->data)))
- return TRUE;
- }
-
- return FALSE;
-}
-
-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. */
- g_object_unref (dest);
- return;
- }
-
- model->priv->data = g_list_insert (model->priv->data, dest, index);
-
- g_object_ref (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. */
- g_object_unref (dest);
- return;
- }
-
- model->priv->data = g_list_append (model->priv->data, dest);
-
- g_object_ref (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, FALSE);
- new_strlen = new_str ? strlen (new_str) : 0;
-
- if (model->priv->data == NULL) {
-
- model->priv->data = g_list_append (model->priv->data, dest);
- g_object_ref (dest);
-
- } else {
-
- node = g_list_nth (model->priv->data, index);
-
- if (node->data != dest) {
-
- old_str = e_destination_get_textrep (E_DESTINATION (node->data), FALSE);
- old_strlen = old_str ? strlen (old_str) : 0;
-
- g_object_unref (node->data);
-
- node->data = dest;
- g_object_ref (dest);
- }
- }
-
- e_select_names_model_changed (model);
-
- g_signal_emit (model, e_select_names_model_signals[E_SELECT_NAMES_MODEL_RESIZED], 0,
- index, old_strlen, new_strlen);
-}
-
-void
-e_select_names_model_delete (ESelectNamesModel *model, gint index)
-{
- GList *node;
- 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));
-
- node = g_list_nth (model->priv->data, index);
- dest = E_DESTINATION (node->data);
-
- g_object_unref (dest);
-
- 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, gboolean clean_last_entry)
-{
- 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);
-
- if (next == NULL && !clean_last_entry)
- break;
-
- dest = iter->data ? E_DESTINATION (iter->data) : NULL;
-
- if (dest == NULL || e_destination_empty (dest)) {
- if (dest)
- g_object_unref (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)g_object_unref, model);
- 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_merge (ESelectNamesModel *dest, ESelectNamesModel *src)
-{
- gint i, len;
-
- g_return_if_fail (E_IS_SELECT_NAMES_MODEL (dest));
- g_return_if_fail (E_IS_SELECT_NAMES_MODEL (src));
-
- if (src == dest)
- return;
-
- 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_contains (dest, d))
- e_select_names_model_append (dest, e_destination_copy (d));
- }
-}
-
-typedef struct {
- EDestination *dest;
- ESelectNamesModel *model;
-} ModelDestClosure;
-
-static void
-name_and_email_simple_query_cb (EBook *book, EBookStatus status, GList *contacts, gpointer closure)
-{
- ModelDestClosure *c = closure;
- EDestination *dest = c->dest;
- ESelectNamesModel *model = c->model;
- EContact *contact;
- int num_non_list_contacts = 0;
- GList *l;
-
- g_free (c);
-
- if (status == E_BOOK_ERROR_OK) {
- for (l = contacts; l; l = l->next) {
- EContact *c = E_CONTACT (l->data);
- if (!e_contact_get (c, E_CONTACT_IS_LIST)) {
- num_non_list_contacts++;
- contact = c;
- }
- }
-
- if (num_non_list_contacts == 1) {
- const char *email = e_destination_get_email (dest);
- int email_num = 0;
-
- if (email && *email) {
- GList *email_list = e_contact_get (contact, E_CONTACT_EMAIL);
- GList *l;
-
- for (l = email_list; l; l = l->next) {
- if (!g_ascii_strcasecmp (email, l->data))
- break;
- email_num++;
- }
- if (l == NULL)
- email_num = -1;
- }
-
- if (email_num >= 0) {
- e_destination_set_contact (dest, contact, email_num);
- e_select_names_model_changed (model);
- }
- }
- }
-
-
- g_object_unref (dest);
- g_object_unref (model);
- g_object_unref (book);
-}
-
-static void
-book_opened (EBook *book, EBookStatus status, gpointer closure)
-{
- ESelectNamesModel *model = closure;
- GList *iter;
-
- for (iter = model->priv->data; iter != NULL; iter = g_list_next (iter)) {
- ModelDestClosure *c = g_new (ModelDestClosure, 1);
-
- c->dest = g_object_ref (E_DESTINATION (iter->data));
- c->model = g_object_ref (model);
-
- if (e_destination_is_evolution_list (c->dest))
- continue;
-
- if (e_destination_get_contact (c->dest))
- continue;
-
- g_object_ref (book);
-
- eab_name_and_email_query (book,
- e_destination_get_name (c->dest),
- e_destination_get_email (c->dest),
- name_and_email_simple_query_cb,
- c);
- }
-
-
- g_object_unref (model);
- g_object_unref (book);
-}
-
-void
-e_select_names_model_load_contacts (ESelectNamesModel *model)
-{
- EBook *book;
-
- g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
-
- if (model->priv->data) {
- g_object_ref (model);
-
- book = e_book_new_default_addressbook (NULL);
-
- e_book_async_open (book, TRUE, book_opened, model);
- }
-}
-
-void
-e_select_names_cancel_contacts_load (ESelectNamesModel *model)
-{
-}
-
-
-void
-e_select_names_model_name_pos (ESelectNamesModel *model, gint seplen, gint index, gint *pos, gint *length)
-{
- gint rp = 0, i, len = 0;
- GList *iter;
- const gchar *str;
-
- g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
- g_return_if_fail (seplen > 0);
-
- 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), FALSE);
- len = str ? g_utf8_strlen (str, -1) : 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 seplen, 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 (E_IS_SELECT_NAMES_MODEL (model));
- g_return_if_fail (seplen > 0);
-
- iter = model->priv->data;
-
- while (iter != NULL) {
- str = e_destination_get_textrep (E_DESTINATION (iter->data), FALSE);
- len = str ? g_utf8_strlen (str, -1) : 0;
-
- if (sp <= pos && pos <= sp + len + adj) {
- break;
- }
-
- sp += len + adj + 1;
- adj = seplen-1;
- ++i;
-
- iter = g_list_next (iter);
- }
-
- if (i != 0)
- sp += seplen-1; /* 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;
-}
-
-void
-e_select_names_model_freeze (ESelectNamesModel *model)
-{
- g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
-
- ++model->priv->freeze_count;
-}
-
-void
-e_select_names_model_thaw (ESelectNamesModel *model)
-{
- g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
- g_return_if_fail (model->priv->freeze_count > 0);
-
- --model->priv->freeze_count;
- if (model->priv->pending_changed)
- e_select_names_model_changed (model);
-}
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 ad9ade5982..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-model.h
+++ /dev/null
@@ -1,88 +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 <libebook/e-contact.h>
-#include <libebook/e-destination.h>
-
-#define E_TYPE_SELECT_NAMES_MODEL (e_select_names_model_get_type ())
-#define E_SELECT_NAMES_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SELECT_NAMES_MODEL, ESelectNamesModel))
-#define E_SELECT_NAMES_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_MODEL, ESelectNamesModelClass))
-#define E_IS_SELECT_NAMES_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SELECT_NAMES_MODEL))
-#define E_IS_SELECT_NAMES_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_MODEL))
-
-typedef struct _ESelectNamesModel ESelectNamesModel;
-typedef struct _ESelectNamesModelClass ESelectNamesModelClass;
-struct _ESelectNamesModelPrivate;
-
-struct _ESelectNamesModel {
- GObject object;
-
- struct _ESelectNamesModelPrivate *priv;
-};
-
-struct _ESelectNamesModelClass {
- GObjectClass parent_class;
-
- void (*changed) (ESelectNamesModel *model);
- void (*resized) (ESelectNamesModel *model, gint index, gint old_len, gint new_len);
-};
-
-GType e_select_names_model_get_type (void);
-
-ESelectNamesModel *e_select_names_model_new (void);
-ESelectNamesModel *e_select_names_model_duplicate (ESelectNamesModel *old);
-
-gchar *e_select_names_model_get_textification (ESelectNamesModel *model, const char *separator);
-gchar *e_select_names_model_get_address_text (ESelectNamesModel *model, const char *separator);
-
-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);
-EContact *e_select_names_model_get_contact (ESelectNamesModel *model, gint index);
-const gchar *e_select_names_model_get_string (ESelectNamesModel *model, gint index);
-
-gboolean e_select_names_model_contains (ESelectNamesModel *model, const EDestination *dest);
-
-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_merge (ESelectNamesModel *dest, ESelectNamesModel *src);
-
-void e_select_names_model_clean (ESelectNamesModel *model, gboolean clean_last_entry);
-
-void e_select_names_model_name_pos (ESelectNamesModel *model, gint seplen, gint index, gint *pos, gint *length);
-void e_select_names_model_text_pos (ESelectNamesModel *model, gint seplen, gint pos, gint *index, gint *start_pos, gint *length);
-
-void e_select_names_model_load_contacts (ESelectNamesModel *model);
-void e_select_names_cancel_contacts_load (ESelectNamesModel *model);
-
-/* This is a mildly annoying freeze/thaw pair, in that it only applies to the 'changed'
- signal and not to 'resized'. This could cause unexpected results in some cases. */
-void e_select_names_model_freeze (ESelectNamesModel *model);
-void e_select_names_model_thaw (ESelectNamesModel *model);
-
-
-#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 9cb95e42e5..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-popup.c
+++ /dev/null
@@ -1,390 +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 version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <string.h>
-
-#include <glib.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkimagemenuitem.h>
-#include <gtk/gtkcheckmenuitem.h>
-#include <gtk/gtkradiomenuitem.h>
-#include <gtk/gtkseparatormenuitem.h>
-#include <libgnome/gnome-i18n.h>
-
-#include <addressbook/util/eab-book-util.h>
-#include <addressbook/gui/contact-editor/e-contact-editor.h>
-#include <addressbook/gui/contact-list-editor/e-contact-list-editor.h>
-#include <addressbook/gui/contact-editor/e-contact-quick-add.h>
-#include "eab-gui-util.h"
-#include "e-select-names-popup.h"
-#include <e-util/e-icon-factory.h>
-
-#define LIST_ICON_NAME "stock_contact-list"
-#define CONTACT_ICON_NAME "stock_contact"
-
-typedef struct _PopupInfo PopupInfo;
-struct _PopupInfo {
- ESelectNamesTextModel *text_model;
- EDestination *dest;
- gint pos;
- gint index;
-};
-
-static PopupInfo *
-popup_info_new (ESelectNamesTextModel *text_model, EDestination *dest, gint pos, gint index)
-{
- PopupInfo *info = g_new0 (PopupInfo, 1);
- info->text_model = text_model;
- info->dest = dest;
- info->pos = pos;
- info->index = index;
-
- if (text_model)
- g_object_ref (text_model);
-
- if (dest)
- g_object_ref (dest);
-
- return info;
-}
-
-static void
-popup_info_free (PopupInfo *info)
-{
- if (info) {
-
- if (info->text_model)
- g_object_unref (info->text_model);
-
- if (info->dest)
- g_object_unref (info->dest);
-
- g_free (info);
- }
-}
-
-static void
-popup_info_cleanup (GtkWidget *w, gpointer info)
-{
- g_signal_handlers_disconnect_matched (G_OBJECT (w), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, info);
-
- popup_info_free ((PopupInfo *) info);
-}
-
-/* You are in a maze of twisty little callbacks, all alike... */
-
-#if TOO_MANY_MENU_ITEMS
-static void
-make_contact_editor_cb (EBook *book, gpointer user_data)
-{
- if (book) {
- EDestination *dest = E_DESTINATION (user_data);
- EContact *contact;
-
- contact = (EContact *) e_destination_get_contact (dest);
- if (e_contact_get (contact, E_CONTACT_IS_LIST)) {
- EContactListEditor *ce;
- ce = e_addressbook_show_contact_list_editor (book, contact, FALSE, TRUE);
- e_contact_list_editor_raise (ce);
- }
- else {
- EContactEditor *ce;
- ce = e_addressbook_show_contact_editor (book, contact, FALSE, TRUE);
- e_contact_editor_raise (ce);
- }
- g_object_unref (dest);
- }
-}
-
-static void
-edit_contact_info_cb (GtkWidget *w, gpointer user_data)
-{
- PopupInfo *info = (PopupInfo *) user_data;
- if (info == NULL)
- return;
-
- g_object_ref (info->dest);
- e_book_use_default_book (make_contact_editor_cb, (gpointer) info->dest);
-}
-#endif
-
-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 (g_object_get_data (G_OBJECT (w), "number"));
-
- if (n != e_destination_get_email_num (info->dest)) {
- dest = e_destination_new ();
- e_destination_set_contact (dest, e_destination_get_contact (info->dest), n);
- e_select_names_model_replace (info->text_model->source, info->index, dest);
- }
-}
-
-#if TOO_MANY_MENU_ITEMS
-static void
-remove_recipient_cb (GtkWidget *w, gpointer user_data)
-{
- PopupInfo *info = (PopupInfo *) user_data;
- e_select_names_model_delete (info->text_model->source, info->index);
-}
-
-static void
-remove_all_recipients_cb (GtkWidget *w, gpointer user_data)
-{
- PopupInfo *info = (PopupInfo *) user_data;
- e_select_names_model_delete_all (info->text_model->source);
-}
-
-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);
-}
-#endif
-
-static void
-populate_popup_contact (GtkWidget *pop, gboolean list, PopupInfo *info)
-{
- GtkWidget *image;
- EContact *contact;
- GtkWidget *menuitem;
- GList *email_list;
-
- contact = e_destination_get_contact (info->dest);
-
-#if TOO_MANY_MENU_ITEMS
- menuitem = gtk_separator_menu_item_new();
- gtk_widget_show (menuitem);
- gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem);
-
- menuitem = gtk_menu_item_new_with_label (_("Remove All"));
- g_signal_connect (menuitem, "activate",
- G_CALLBACK (remove_all_recipients_cb),
- info);
- gtk_widget_show (menuitem);
- gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem);
-
- menuitem = gtk_menu_item_new_with_label (_("Remove"));
- g_signal_connect (menuitem, "activate",
- G_CALLBACK (remove_recipient_cb),
- info);
- gtk_widget_show (menuitem);
- gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem);
-
- menuitem = gtk_menu_item_new_with_label (list ? _("View Contact List") : _("View Contact Info"));
- g_signal_connect (menuitem, "activate",
- G_CALLBACK (edit_contact_info_cb),
- info);
- gtk_widget_show (menuitem);
- gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem);
-
- menuitem = gtk_check_menu_item_new_with_label (_("Send HTML Mail?"));
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem),
- e_destination_get_html_mail_pref (info->dest));
- g_signal_connect (menuitem, "toggled",
- G_CALLBACK (toggle_html_mail_cb),
- info);
- gtk_widget_show (menuitem);
- gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem);
-#endif
-
- email_list = e_contact_get (contact, E_CONTACT_EMAIL);
-
- if (email_list) {
- menuitem = gtk_separator_menu_item_new();
- gtk_widget_show (menuitem);
- gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem);
-
- if (g_list_length (email_list) > 1) {
- GList *l;
- GSList *radiogroup = NULL;
- gint n = e_destination_get_email_num (info->dest);
- gint j = g_list_length (email_list) - 1;
-
- for (l = g_list_last (email_list); l; l = l->prev) {
- char *email = l->data;
- char *label = NULL;
-
- label = g_strdup (email);
-
- if (list) {
- menuitem = gtk_menu_item_new_with_label (label);
- }
- else {
- menuitem = gtk_radio_menu_item_new_with_label (radiogroup, label);
- g_signal_connect (menuitem, "toggled",
- G_CALLBACK (change_email_num_cb),
- info);
- if (j == n)
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem), TRUE);
-
- g_object_set_data (G_OBJECT (menuitem), "number", GINT_TO_POINTER (j));
- radiogroup = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menuitem));
- }
-
- gtk_widget_show (menuitem);
- gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem);
-
- j--;
-
- g_free (label);
- }
- } else {
- menuitem = gtk_menu_item_new_with_label (e_destination_get_email (info->dest));
- gtk_widget_show (menuitem);
- gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem);
- }
-
- g_list_foreach (email_list, (GFunc)g_free, NULL);
- g_list_free (email_list);
- }
-
- menuitem = gtk_separator_menu_item_new ();
- gtk_widget_show (menuitem);
- gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem);
-
- image = e_icon_factory_get_image (list ? LIST_ICON_NAME : CONTACT_ICON_NAME, E_ICON_SIZE_MENU);
- gtk_widget_show (image);
- menuitem = gtk_image_menu_item_new_with_label (e_destination_get_name (info->dest));
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem),
- image);
- gtk_widget_show (menuitem);
- gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem);
-}
-
-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 void
-populate_popup_nocontact (GtkWidget *pop, PopupInfo *info)
-{
- const gchar *str;
- GtkWidget *menuitem;
-
- menuitem = gtk_separator_menu_item_new ();
- gtk_widget_show (menuitem);
- gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem);
-
- menuitem = gtk_menu_item_new_with_label (_("Add to Contacts"));
- gtk_widget_show (menuitem);
- gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem);
- g_signal_connect (menuitem, "activate",
- G_CALLBACK (quick_add_cb),
- info);
-
-#if TOO_MANY_MENU_ITEMS
- menuitem = gtk_check_menu_item_new_with_label (_("Send HTML Mail?"));
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem),
- e_destination_get_html_mail_pref (info->dest));
- g_signal_connect (menuitem, "toggled",
- G_CALLBACK (toggle_html_mail_cb),
- info);
- gtk_widget_show (menuitem);
- gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem);
-#endif
-
- menuitem = gtk_separator_menu_item_new ();
- gtk_widget_show (menuitem);
- gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem);
-
- str = e_destination_get_name (info->dest);
- if (! (str && *str))
- str = e_destination_get_email (info->dest);
- if (! (str && *str))
- str = _("Unnamed Contact");
-
- menuitem = gtk_menu_item_new_with_label (str);
- gtk_widget_show (menuitem);
- gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem);
-}
-
-void
-e_select_names_populate_popup (GtkWidget *menu, ESelectNamesTextModel *text_model,
- GdkEventButton *ev, gint pos, GtkWidget *for_widget)
-{
- ESelectNamesModel *model;
- PopupInfo *info;
- EDestination *dest;
- gint index;
-
- g_return_if_fail (GTK_IS_MENU_SHELL (menu));
- g_return_if_fail (E_IS_SELECT_NAMES_TEXT_MODEL (text_model));
- g_return_if_fail (ev);
- g_return_if_fail (0 <= pos);
-
- model = text_model->source;
-
- e_select_names_model_text_pos (model, text_model->seplen, pos, &index, NULL, NULL);
- if (index < 0 || index >= e_select_names_model_count (model))
- return;
-
- /* XXX yuck, why does this return a const? */
- dest = (EDestination *)e_select_names_model_get_destination (model, index);
- if (e_destination_empty (dest))
- return;
-
- info = popup_info_new (text_model, dest, pos, index);
-
- if (e_destination_get_contact (dest)) {
- populate_popup_contact (menu, e_destination_is_evolution_list (dest), info);
- } else {
- populate_popup_nocontact (menu, info);
- }
-
- /* Clean up our info item after we've made our selection. */
- g_signal_connect (menu,
- "selection-done",
- G_CALLBACK (popup_info_cleanup),
- 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 531275190b..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 version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA.
- */
-
-#ifndef __E_SELECT_NAMES_POPUP_H__
-#define __E_SELECT_NAMES_POPUP_H__
-
-#include "e-select-names-text-model.h"
-
-void e_select_names_populate_popup (GtkWidget *menu, ESelectNamesTextModel *text_model,
- GdkEventButton *ev, gint pos, GtkWidget *for_widget);
-
-#endif /* __E_SELECT_NAMES_POPUP_H__ */
-
diff --git a/addressbook/gui/component/select-names/e-select-names-section.etspec b/addressbook/gui/component/select-names/e-select-names-section.etspec
deleted file mode 100644
index 9d7b038892..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-section.etspec
+++ /dev/null
@@ -1,7 +0,0 @@
-<ETableSpecification no-headers="true" cursor-mode="line" alternating-row-colors="false">
- <ETableColumn model_col= "0" _title="Name" expansion="1.0" minimum_width="20" resizable="true" cell="string" compare="collate" search="string"/>
- <ETableState>
- <column source="0"/>
- <grouping> <leaf column="0" ascending="true"/> </grouping>
- </ETableState>
-</ETableSpecification>
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 dd824a6322..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-table-model.c
+++ /dev/null
@@ -1,366 +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 <libgnome/gnome-i18n.h>
-#include <libebook/e-contact.h>
-#include "e-select-names-table-model.h"
-
-/* Object argument IDs */
-enum {
- PROP_0,
- PROP_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_dispose (GObject *object);
-static void e_select_names_table_model_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void e_select_names_table_model_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-static void e_select_names_table_model_model_changed (ESelectNamesModel *source,
- ESelectNamesTableModel *model);
-
-static ETableModelClass *parent_class = NULL;
-
-static void
-e_select_names_table_model_add_source (ESelectNamesTableModel *model,
- ESelectNamesModel *source)
-{
- model->source = source;
- if (model->source)
- g_object_ref(model->source);
- model->source_changed_id = g_signal_connect(model->source, "changed",
- G_CALLBACK(e_select_names_table_model_model_changed),
- model);
-}
-
-static void
-e_select_names_table_model_drop_source (ESelectNamesTableModel *model)
-{
- if (model->source_changed_id)
- g_signal_handler_disconnect(model->source, model->source_changed_id);
- if (model->source)
- g_object_unref(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.
- **/
-GType
-e_select_names_table_model_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (ESelectNamesTableModelClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_select_names_table_model_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (ESelectNamesTableModel),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_select_names_table_model_init,
- };
-
- type = g_type_register_static (e_table_model_get_type (), "ESelectNamesTableModel", &info, 0);
- }
-
- return 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 = g_object_new (E_TYPE_SELECT_NAMES_TABLE_MODEL, NULL);
- g_object_set(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);
- EContact *contact = dest ? e_destination_get_contact (dest) : NULL;
-
- if (contact) {
- model->data[i].name = e_contact_get(contact, E_CONTACT_NAME_OR_ORG);
- if (model->data[i].name == 0)
- model->data[i].name = g_strdup("");
- model->data[i].email = e_contact_get(contact, E_CONTACT_EMAIL_1);
- if (model->data[i].email == 0)
- model->data[i].email = g_strdup("");
- } else {
- const gchar *name = e_destination_get_name (dest);
- const gchar *email = e_destination_get_email (dest);
-
- model->data[i].name = g_strdup (name && *name ? name : email);
- model->data[i].email = g_strdup (email);
- }
- }
- } else {
- model->count = 0;
- }
-}
-
-static void
-clear_info (ESelectNamesTableModel *model)
-{
- if (model->data) {
- 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_dispose (GObject *object)
-{
- ESelectNamesTableModel *model;
-
- model = E_SELECT_NAMES_TABLE_MODEL (object);
-
- e_select_names_table_model_drop_source (model);
- clear_info(model);
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-/* This function returns the number of columns in our ETableModel. */
-static int
-e_select_names_table_model_col_count (ETableModel *etc)
-{
- return 3;
-}
-
-/* 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;
- case 2:
- /* underline column*/
- return (void*)TRUE;
- 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)
-{
- e_table_model_pre_change(E_TABLE_MODEL(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_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec)
-{
- ESelectNamesTableModel *model;
-
- model = E_SELECT_NAMES_TABLE_MODEL (object);
-
- switch (prop_id) {
- case PROP_SOURCE:
- e_select_names_table_model_drop_source (model);
- e_select_names_table_model_add_source (model, E_SELECT_NAMES_MODEL(g_value_get_object (value)));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/* Get_arg handler for the model */
-static void
-e_select_names_table_model_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec)
-{
- ESelectNamesTableModel *model;
-
- model = E_SELECT_NAMES_TABLE_MODEL (object);
-
- switch (prop_id) {
- case PROP_SOURCE:
- g_value_set_object (value, model->source);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- 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)
-{
- GObjectClass *object_class;
- ETableModelClass *table_model_class;
-
- object_class = G_OBJECT_CLASS(klass);
- table_model_class = E_TABLE_MODEL_CLASS(klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->dispose = e_select_names_table_model_dispose;
- object_class->get_property = e_select_names_table_model_get_property;
- object_class->set_property = e_select_names_table_model_set_property;
-
- g_object_class_install_property (object_class, PROP_SOURCE,
- g_param_spec_object ("source",
- _("Source"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_SELECT_NAMES_MODEL,
- G_PARAM_READWRITE));
-
- 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 1fd1026f19..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) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SELECT_NAMES_TABLE_MODEL, ESelectNamesTableModel))
-#define E_SELECT_NAMES_TABLE_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_TABLE_MODEL, ESelectNamesTableModelClass))
-#define E_IS_SELECT_NAMES_TABLE_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SELECT_NAMES_TABLE_MODEL))
-#define E_IS_SELECT_NAMES_TABLE_MODEL_CLASS(klass) (G_TYPE_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 */
-GType 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 5d0a1edf36..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-text-model.c
+++ /dev/null
@@ -1,856 +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 <libgnome/gnome-i18n.h>
-
-#include <addressbook/gui/contact-editor/e-contact-editor.h>
-#include "e-select-names-text-model.h"
-#include "eab-gui-util.h"
-
-static FILE *out = NULL; /* stream for debugging spew */
-
-/* Object argument IDs */
-enum {
- PROP_0,
- PROP_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_dispose (GObject *object);
-static void e_select_names_text_model_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void e_select_names_text_model_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-
-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);
-
-
-static 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 GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (ESelectNamesTextModelClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_select_names_text_model_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (ESelectNamesTextModel),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_select_names_text_model_init,
- };
-
- type = g_type_register_static (PARENT_TYPE, "ESelectNamesTextModel", &info, 0);
- }
-
- return type;
-}
-
-static void
-e_select_names_text_model_class_init (ESelectNamesTextModelClass *klass)
-{
- GObjectClass *object_class;
- ETextModelClass *text_model_class;
-
- object_class = G_OBJECT_CLASS(klass);
- text_model_class = E_TEXT_MODEL_CLASS(klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->dispose = e_select_names_text_model_dispose;
- object_class->get_property = e_select_names_text_model_get_property;
- object_class->set_property = e_select_names_text_model_set_property;
-
- g_object_class_install_property (object_class, PROP_SOURCE,
- g_param_spec_object ("source",
- _("Source"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_SELECT_NAMES_MODEL,
- G_PARAM_READWRITE));
-
- 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_contact (model, i) ? "<contact>" : "");
- fprintf (out, "\n");
-}
-
-static void
-e_select_names_text_model_init (ESelectNamesTextModel *model)
-{
- const gchar *default_sep;
-
- model->last_magic_comma_pos = -1;
-
- if (getenv ("EVOLUTION_DISABLE_MAGIC_COMMA"))
- default_sep = ",";
- else
- default_sep = ", ";
-
- e_select_names_text_model_set_separator (model, default_sep);
-}
-
-static void
-e_select_names_text_model_dispose (GObject *object)
-{
- ESelectNamesTextModel *model;
-
- model = E_SELECT_NAMES_TEXT_MODEL (object);
-
- if (model->text) {
- g_free (model->text);
- model->text = NULL;
- }
- if (model->sep) {
- g_free (model->sep);
- model->sep = NULL;
- }
-
- e_select_names_text_model_set_source (model, NULL);
-
- if (G_OBJECT_CLASS(parent_class)->dispose)
- G_OBJECT_CLASS(parent_class)->dispose(object);
-}
-
-static void
-e_select_names_text_model_set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec)
-{
- ESelectNamesTextModel *model;
-
- model = E_SELECT_NAMES_TEXT_MODEL (object);
-
- switch (prop_id) {
- case PROP_SOURCE:
- e_select_names_text_model_set_source(model, E_SELECT_NAMES_MODEL (g_value_get_object(value)));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-e_select_names_text_model_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec)
-{
- ESelectNamesTextModel *model;
-
- model = E_SELECT_NAMES_TEXT_MODEL (object);
-
- switch (prop_id) {
- case PROP_SOURCE:
- g_value_set_object (value, model->source);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- 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;
- gint seplen = E_SELECT_NAMES_TEXT_MODEL (model)->seplen;
-
- e_select_names_model_name_pos (source, seplen, 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
-changed_cb (ESelectNamesModel *source, ETextModel *model)
-{
- ESelectNamesTextModel *text_model = E_SELECT_NAMES_TEXT_MODEL (model);
-
- g_free (text_model->text);
- text_model->text = NULL;
-
- e_text_model_changed (model);
-}
-
-
-static void
-e_select_names_text_model_set_source (ESelectNamesTextModel *model,
- ESelectNamesModel *source)
-{
- if (source == model->source)
- return;
-
- if (model->source) {
- g_signal_handler_disconnect (model->source, model->source_changed_id);
- g_signal_handler_disconnect (model->source, model->source_resize_id);
- g_object_unref (model->source);
- }
-
- model->source = source;
-
- if (model->source) {
- g_object_ref (model->source);
- model->source_changed_id = g_signal_connect (model->source,
- "changed",
- G_CALLBACK (changed_cb),
- model);
- model->source_resize_id = g_signal_connect (model->source,
- "resized",
- G_CALLBACK (resize_cb),
- model);
- }
-}
-
-ETextModel *
-e_select_names_text_model_new (ESelectNamesModel *source)
-{
- ETextModel *model = g_object_new (E_TYPE_SELECT_NAMES_TEXT_MODEL, NULL);
- e_select_names_text_model_set_source (E_SELECT_NAMES_TEXT_MODEL (model), source);
- return model;
-}
-
-void
-e_select_names_text_model_set_separator (ESelectNamesTextModel *model, const char *sep)
-{
- g_return_if_fail (E_IS_SELECT_NAMES_TEXT_MODEL (model));
- g_return_if_fail (sep && *sep);
-
- g_free (model->sep);
- model->sep = g_strdup (sep);
- model->seplen = g_utf8_strlen (sep, -1);
-}
-
-static const gchar *
-e_select_names_text_model_get_text (ETextModel *model)
-{
- ESelectNamesTextModel *snm = E_SELECT_NAMES_TEXT_MODEL(model);
-
- if (snm == NULL)
- return "";
- else if (snm->text == NULL)
- snm->text = e_select_names_model_get_textification (snm->source, snm->sep);
-
- return snm->text;
-}
-
-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, g_utf8_strlen (text, -1));
-}
-
-static void
-e_select_names_text_model_insert_length (ETextModel *model, gint pos, const gchar *text, gint length)
-{
- ESelectNamesTextModel *text_model = E_SELECT_NAMES_TEXT_MODEL (model);
- ESelectNamesModel *source = text_model->source;
- const char *t;
- gchar *tmp;
-
- if (out) {
- tmp = g_strndup (text, length);
- fprintf (out, ">> insert \"%s\" (len=%d) at %d\n", tmp, length, pos);
- g_free (tmp);
- }
-
- tmp = e_select_names_model_get_textification (source, text_model->sep);
- pos = CLAMP (pos, 0, g_utf8_strlen (tmp, -1));
- g_free (tmp);
-
- /* We want to control all cursor motions ourselves, rather than taking hints
- from the ESelectNamesModel. */
- g_signal_handler_block (source, text_model->source_resize_id);
-
- /* We handle this one character at a time. */
-
- for (t = text; length >= 0; t = g_utf8_next_char (t), length--) {
- gint index, start_pos, text_len;
- gboolean inside_quote = FALSE;
- gunichar ut = g_utf8_get_char (t);
-
- if (ut == 0)
- break;
-
- text_model->last_magic_comma_pos = -1;
-
- if (out)
- fprintf (out, "processing [%d]\n", ut);
-
- e_select_names_model_text_pos (source, text_model->seplen, pos, &index, &start_pos, &text_len);
-
- if (out)
- fprintf (out, "index=%d start_pos=%d text_len=%d\n", index, start_pos, text_len);
-
- /* Is this a quoted or an unquoted separator we are dealing with? */
- if (ut == g_utf8_get_char(text_model->sep) && index >= 0) {
- const EDestination *dest = e_select_names_model_get_destination (source, index);
- if (dest) {
- const gchar *str = e_destination_get_textrep (dest, FALSE);
- int j;
- const char *jp;
-
- if (out)
- fprintf (out, "str=%s pos=%d\n", str, pos);
-
- for (jp = str, j = 0; j<pos-start_pos && *jp; jp = g_utf8_next_char (jp), ++j) {
- if (*jp == '"') {
- 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 (ut == g_utf8_get_char (text_model->sep) && !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 = text_model->seplen;
- e_text_model_reposition (model, e_repos_insert_shift, &repos);
- pos += text_model->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 = text_model->seplen;
- e_text_model_reposition (model, e_repos_insert_shift, &repos);
- pos += text_model->seplen;
- }
-
- if (text_model->seplen > 1)
- text_model->last_magic_comma_pos = pos;
-
- } else {
- EReposInsertShift repos;
- gint offset = MAX (pos - start_pos, 0);
- const gchar *str;
- GString *new_str = g_string_new (NULL);
- gint this_length = 1;
- gboolean whitespace = g_unichar_isspace (ut);
-
- 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" */
- /* FIXME: This code does the wrong thing if seplen > 2 */
- g_string_append_unichar (new_str, ut);
- g_string_append (new_str, pos < start_pos ? " " : "");
- g_string_append (new_str, str);
- if (pos < start_pos)
- ++this_length;
- }
- } else {
- const char *u;
- int n;
- for (u = str, n = 0; n < offset; u = g_utf8_next_char (u), n++)
- g_string_append_unichar (new_str, g_utf8_get_char (u));
- g_string_append_unichar (new_str, ut);
- g_string_append (new_str, u);
- }
- } else {
- if (whitespace) {
- /* swallow leading whitespace */
- this_length = 0;
- } else {
- g_string_append_unichar (new_str, ut);
- }
- }
-
- if (new_str->len) {
-
- EDestination *dest;
- dest = e_destination_new ();
- e_destination_set_raw (dest, new_str->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_string_free (new_str, TRUE);
- }
- }
-
- dump_model (text_model);
-
- g_signal_handler_unblock (source, text_model->source_resize_id);
-}
-
-
-static void
-e_select_names_text_model_delete (ETextModel *model, gint pos, gint length)
-{
- ESelectNamesTextModel *text_model = E_SELECT_NAMES_TEXT_MODEL (model);
- ESelectNamesModel *source = text_model->source;
- gint index, start_pos, text_len, offset;
-
- if (out) {
- const gchar *str = e_select_names_model_get_textification (source, text_model->sep);
- 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;
-
- if (text_model->last_magic_comma_pos == pos+1 && length == 1) {
- pos -= text_model->seplen-1;
- if (pos >= 0)
- length = text_model->seplen;
- text_model->last_magic_comma_pos = -1;
- }
-
- e_select_names_model_text_pos (source, text_model->seplen, 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. */
- g_signal_handler_block (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%s", str1, text_model->sep+1, 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 = text_model->seplen;
-
- 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 + text_model->seplen;
-
- e_text_model_reposition (model, e_repos_delete_shift, &repos);
-
- length -= text_len + text_model->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);
-
- if (str) {
- const char *p;
- char *np;
- int i;
- EReposDeleteShift repos;
- EDestination *dest;
-
- new_str = g_new0 (char, strlen (str) * 6 + 1); /* worse case it can't be any longer than this */
-
- /* copy the region before the deletion */
- for (p = str, i = 0, np = new_str; i < offset; i++) {
- gunichar ch;
-
- ch = g_utf8_get_char (p);
- g_unichar_to_utf8 (ch, np);
-
- np = g_utf8_next_char (np);
- p = g_utf8_next_char (p);
- }
-
- /* skip the deleted segment */
- for (i = 0; i < length; i++)
- p = g_utf8_next_char (p);
-
- /* copy the region after the deletion */
- for (; *p; p = g_utf8_next_char (p)) {
- gunichar ch;
-
- ch = g_utf8_get_char (p);
- g_unichar_to_utf8 (ch, np);
-
- np = g_utf8_next_char (np);
- }
-
- 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 = text_model->seplen;
-
- e_text_model_reposition (model, e_repos_delete_shift, &repos);
- }
- }
-
- finished:
- E_SELECT_NAMES_TEXT_MODEL (model)->last_magic_comma_pos = -1;
- g_signal_handler_unblock (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_contact (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_contact (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)
-{
- ESelectNamesTextModel *text_model = E_SELECT_NAMES_TEXT_MODEL (model);
- ESelectNamesModel *source = text_model->source;
- gint i, pos;
-
- i = nth_obj_index (source, n);
- if (i < 0)
- return NULL;
-
- e_select_names_model_name_pos (source, text_model->seplen, i, &pos, len);
- if (pos < 0)
- return NULL;
-
- if (text_model->text == NULL)
- text_model->text = e_select_names_model_get_textification (source, text_model->sep);
- return g_utf8_offset_to_pointer (text_model->text, pos);
-}
-
-static void
-e_select_names_text_model_activate_obj (ETextModel *model, gint n)
-{
- ESelectNamesModel *source = E_SELECT_NAMES_TEXT_MODEL (model)->source;
- EContact *contact;
- EBook *book;
- gint i;
-
- i = nth_obj_index (source, n);
- g_return_if_fail (i >= 0);
-
- contact = e_select_names_model_get_contact (source, i);
- g_return_if_fail (contact != NULL);
-
- /* XXX unfortunately we don't have an e_contact_get_book call
- anymore, so we can't query for the addressbook that the
- contact came from. however, since we're bringing up a
- read-only contact editor, it really doesn't matter what we
- show in the source option menu, does it? */
- book = e_book_new_system_addressbook (NULL);
- g_return_if_fail (book != NULL);
-
- /* present read-only contact editor when someone double clicks from here */
- if (e_contact_get (contact, E_CONTACT_IS_LIST)) {
- EContactListEditor *ce;
- ce = eab_show_contact_list_editor (book, contact, FALSE, FALSE);
- eab_editor_raise (EAB_EDITOR (ce));
- }
- else {
- EContactEditor *ce;
- ce = eab_show_contact_editor (book, contact, FALSE, FALSE);
- eab_editor_raise (EAB_EDITOR (ce));
- }
-
- g_object_unref (book);
-}
-
-
-
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 eec062aee6..0000000000
--- a/addressbook/gui/component/select-names/e-select-names-text-model.h
+++ /dev/null
@@ -1,53 +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) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SELECT_NAMES_TEXT_MODEL, ESelectNamesTextModel))
-#define E_SELECT_NAMES_TEXT_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES_TEXT_MODEL, ESelectNamesTextModelClass))
-#define E_IS_SELECT_NAMES_TEXT_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SELECT_NAMES_TEXT_MODEL))
-#define E_IS_SELECT_NAMES_TEXT_MODEL_CLASS(klass) (G_TYPE_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;
-
- gchar *text;
-
- gchar *sep;
- gint seplen;
-
- gint last_magic_comma_pos;
-};
-
-struct _ESelectNamesTextModelClass {
- ETextModelClass parent_class;
-};
-
-ETextModel *e_select_names_text_model_new (ESelectNamesModel *source);
-void e_select_names_text_model_set_separator (ESelectNamesTextModel *model, const char *sep);
-
-/* Standard Gtk function */
-GType 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 deed0dc875..0000000000
--- a/addressbook/gui/component/select-names/e-select-names.c
+++ /dev/null
@@ -1,861 +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 version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <string.h>
-#include <glib.h>
-#include <gtk/gtkalignment.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkstock.h>
-#include <libgnome/gnome-i18n.h>
-
-#include <gal/e-table/e-table-simple.h>
-#include <gal/e-table/e-table-without.h>
-
-#include <libebook/e-book.h>
-#include <libebook/e-contact.h>
-#include <addressbook/gui/widgets/e-addressbook-model.h>
-#include <addressbook/gui/widgets/e-addressbook-table-adapter.h>
-#include <addressbook/util/eab-book-util.h>
-#include <addressbook/gui/component/addressbook-component.h>
-#include <addressbook/gui/component/addressbook.h>
-#include <addressbook/gui/widgets/eab-popup.h>
-
-#include "e-select-names-config.h"
-#include "e-select-names.h"
-#include "e-select-names-table-model.h"
-#include <gal/widgets/e-categories-master-list-option-menu.h>
-#include <gal/e-text/e-entry.h>
-#include <e-util/e-categories-master-list-wombat.h>
-#include <libedataserver/e-sexp.h>
-
-static void e_select_names_init (ESelectNames *names);
-static void e_select_names_class_init (ESelectNamesClass *klass);
-static void e_select_names_dispose (GObject *object);
-static void update_query (GtkWidget *widget, ESelectNames *e_select_names);
-static char *get_query_string (ESelectNames *e_select_names);
-
-static void sync_table_and_models (ESelectNamesModel *triggering_model, ESelectNames *esl);
-
-static GtkDialogClass *parent_class = NULL;
-#define PARENT_TYPE gtk_dialog_get_type()
-
-/* The arguments we take */
-enum {
- ARG_0,
-};
-
-typedef struct {
- char *title;
- ESelectNamesModel *source;
- ESelectNamesTableModel *table_model;
- ESelectNames *names;
- GtkWidget *label;
- GtkWidget *button;
- GtkWidget *recipient_table;
- gulong changed_id;
-} ESelectNamesChild;
-
-GType
-e_select_names_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (ESelectNamesClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_select_names_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (ESelectNames),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_select_names_init,
- };
-
- type = g_type_register_static (PARENT_TYPE, "ESelectNames", &info, 0);
- }
-
- return type;
-}
-
-static void
-e_select_names_class_init (ESelectNamesClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->dispose = e_select_names_dispose;
-}
-
-GtkWidget *e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int num1, int num2);
-
-static void
-search_result (EABModel *model, EBookViewStatus status, ESelectNames *esn)
-{
- sync_table_and_models (NULL, esn);
-}
-
-static void
-set_book(EBook *book, EBookStatus status, ESelectNames *esn)
-{
- char *query_str = get_query_string (esn);
- g_object_set(esn->model,
- "book", book,
- "query", query_str,
- NULL);
- g_free (query_str);
- g_object_unref(book);
- g_object_unref(esn->model);
- g_object_unref(esn);
-}
-
-static ESource *
-find_first_source (ESourceList *source_list)
-{
- GSList *groups, *sources, *l, *m;
-
- groups = e_source_list_peek_groups (source_list);
- for (l = groups; l; l = l->next) {
- ESourceGroup *group = l->data;
-
- sources = e_source_group_peek_sources (group);
- for (m = sources; m; m = m->next) {
- ESource *source = m->data;
-
- return source;
- }
- }
-
- return NULL;
-}
-
-static void
-addressbook_model_set_source (ESelectNames *e_select_names, EABModel *model, ESource *source)
-{
- EBook *book;
-
- book = e_book_new(source, NULL);
-
- g_object_ref(e_select_names);
- g_object_ref(model);
-
- addressbook_load (book, (EBookCallback) set_book, e_select_names);
-}
-
-static void *
-contact_key (const EContact *contact)
-{
- EBook *book = NULL;
- const gchar *book_uri;
-
- if (contact == NULL)
- return NULL;
-
- g_assert (E_IS_CONTACT (contact));
-
-#if notyet
- /* XXX we need a way to reproduce this here somehow.. or at
- least make sure we never collide between two contacts in
- different books. */
- book = e_contact_get_book (contact);
-#endif
- book_uri = book ? e_book_get_uri (book) : "NoBook";
- return g_strdup_printf ("%s|%s", book_uri ? book_uri : "NoURI", (char*)e_contact_get_const ((EContact*)contact, E_CONTACT_UID));
-}
-
-static void
-sync_one_model (gpointer k, gpointer val, gpointer closure)
-{
- ETableWithout *etw = E_TABLE_WITHOUT (closure);
- ESelectNamesChild *child = val;
- ESelectNamesModel *model = child->source;
- gint i, count;
- EContact *contact;
- void *key;
-
- count = e_select_names_model_count (model);
- for (i = 0; i < count; ++i) {
- contact = e_select_names_model_get_contact (model, i);
- if (contact) {
- key = contact_key (contact);
- e_table_without_hide (etw, key);
- g_free (key);
- }
- }
-}
-
-static void
-sync_table_and_models (ESelectNamesModel *triggering_model, ESelectNames *esl)
-{
- e_table_without_show_all (E_TABLE_WITHOUT (esl->without));
- g_hash_table_foreach (esl->children, sync_one_model, esl->without);
-}
-
-static void
-real_add_address_cb (int model_row, gpointer closure)
-{
- ESelectNamesChild *child = closure;
- ESelectNames *names = child->names;
- const EContact *contact;
- EDestination *dest = e_destination_new ();
- gint mapped_row;
-
- mapped_row = e_table_subset_view_to_model_row (E_TABLE_SUBSET (names->without), model_row);
-
- contact = eab_model_contact_at (EAB_MODEL(names->model), mapped_row);
-
- if (contact != NULL) {
- e_destination_set_contact (dest, (EContact*)contact, 0);
-
- e_select_names_model_append (child->source, dest);
- e_select_names_model_clean (child->source, FALSE);
- }
-}
-
-static void
-real_add_address(ESelectNames *names, ESelectNamesChild *child)
-{
- e_select_names_model_freeze (child->source);
- e_table_selected_row_foreach(e_table_scrolled_get_table(names->table),
- real_add_address_cb, child);
- e_select_names_model_thaw (child->source);
-}
-
-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);
- }
-}
-
-static void
-sensitize_button (gpointer key, gpointer data, gpointer user_data)
-{
- gboolean *sensitive = user_data;
- ESelectNamesChild *child = data;
-
- gtk_widget_set_sensitive (child->button, *sensitive);
-}
-
-static void
-selection_change (ETable *table, ESelectNames *names)
-{
- gboolean sensitive;
-
- sensitive = e_table_selected_count (table) > 0;
-
- g_hash_table_foreach (names->children, sensitize_button, &sensitive);
-}
-
-static void *
-esn_get_key_fn (ETableModel *source, int row, void *closure)
-{
- EABModel *model = EAB_MODEL (closure);
- const EContact *contact = eab_model_contact_at (model, row);
- void *key = contact_key (contact);
- return key;
-}
-
-static void *
-esn_dup_key_fn (const void *key, void *closure)
-{
- void *dup = (void *) g_strdup ((const gchar *) key);
- return dup;
-}
-
-static void
-esn_free_gotten_key_fn (void *key, void *closure)
-{
- g_free (key);
-}
-
-static void
-esn_free_duped_key_fn (void *key, void *closure)
-{
- g_free (key);
-}
-
-GtkWidget *
-e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int num1, int num2)
-{
- ETableModel *adapter;
- ETableModel *without;
- EABModel *model;
- GtkWidget *table;
-
- model = eab_model_new ();
- adapter = E_TABLE_MODEL (eab_table_adapter_new (model));
-
- g_object_set(model,
- "editable", FALSE,
- NULL);
-
- without = e_table_without_new (adapter,
- g_str_hash,
- g_str_equal,
- esn_get_key_fn,
- esn_dup_key_fn,
- esn_free_gotten_key_fn,
- esn_free_duped_key_fn,
- model);
-
- table = e_table_scrolled_new_from_spec_file (without,
- NULL,
- EVOLUTION_ETSPECDIR "/e-select-names.etspec",
- NULL);
-
- g_object_set_data(G_OBJECT(table), "adapter", adapter);
- g_object_set_data(G_OBJECT(table), "without", without);
- g_object_set_data(G_OBJECT(table), "model", model);
-
- return table;
-}
-
-static void
-source_selected (ESourceOptionMenu *menu, ESource *source, ESelectNames *e_select_names)
-{
- addressbook_model_set_source (e_select_names, e_select_names->model, source);
- e_select_names_config_set_last_completion_book (e_source_peek_uid (source));
-}
-
-static char *
-get_query_string (ESelectNames *e_select_names)
-{
- char *category = "";
- const char *search = "";
- EBookQuery *query;
- EBookQuery *q_array[4];
- char *query_str;
- int i;
-
- if (e_select_names->categories) {
- category = e_categories_master_list_option_menu_get_category (E_CATEGORIES_MASTER_LIST_OPTION_MENU (e_select_names->categories));
- }
- if (e_select_names->select_entry) {
- search = gtk_entry_get_text (GTK_ENTRY (e_select_names->select_entry));
- }
-
- i = 0;
- q_array[i++] = e_book_query_field_test (E_CONTACT_EMAIL, E_BOOK_QUERY_CONTAINS, "");
- if (category && *category)
- q_array[i++] = e_book_query_field_test (E_CONTACT_CATEGORY_LIST, E_BOOK_QUERY_IS, category);
- if (search && *search)
- q_array[i++] = e_book_query_orv (e_book_query_field_test (E_CONTACT_EMAIL, E_BOOK_QUERY_BEGINS_WITH, search),
- e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_BEGINS_WITH, search),
- e_book_query_field_test (E_CONTACT_NICKNAME, E_BOOK_QUERY_BEGINS_WITH, search),
- e_book_query_field_test (E_CONTACT_FILE_AS, E_BOOK_QUERY_BEGINS_WITH, search),
- NULL);
- if (i > 1) {
- query = e_book_query_and (i, q_array, TRUE);
- }
- else {
- query = q_array[0];
- }
- query_str = e_book_query_to_string (query);
- e_book_query_unref (query);
- return query_str;
-}
-
-
-static void
-update_query (GtkWidget *widget, ESelectNames *e_select_names)
-{
- char *query_str = get_query_string (e_select_names);
- printf ("query_str = %s\n", query_str);
- g_object_set (e_select_names->model,
- "query", query_str,
- NULL);
- g_free (query_str);
-}
-
-static void
-status_message (EABModel *model, const gchar *message, ESelectNames *e_select_names)
-{
- if (message == NULL)
- gtk_label_set_text (GTK_LABEL (e_select_names->status_message), "");
- else
- gtk_label_set_text (GTK_LABEL (e_select_names->status_message), message);
-}
-
-static void
-categories_changed (GtkWidget *widget, ESelectNames *e_select_names)
-{
- update_query (widget, e_select_names);
-}
-
-static void
-select_entry_changed (GtkWidget *widget, ESelectNames *e_select_names)
-{
- if (e_select_names->select_entry) {
- const char *select_string = gtk_entry_get_text (GTK_ENTRY (e_select_names->select_entry));
- char *select_strcoll_string = g_utf8_collate_key (select_string, -1);
- int count;
- ETable *table;
- int i;
-
- table = e_table_scrolled_get_table (e_select_names->table);
-
- count = e_table_model_row_count (e_select_names->without);
-
- for (i = 0; i < count; i++) {
- int model_row = e_table_view_to_model_row (table, i);
- char *row_strcoll_string =
- g_utf8_collate_key (e_table_model_value_at (e_select_names->without,
- E_CONTACT_FULL_NAME,
- model_row),
- -1);
- if (strcmp (select_strcoll_string, row_strcoll_string) <= 0) {
- g_free (row_strcoll_string);
- break;
- }
- g_free (row_strcoll_string);
- }
- g_free (select_strcoll_string);
- if (i == count)
- i --;
-
- if (count > 0) {
- i = e_table_view_to_model_row (table, i);
- e_table_set_cursor_row (table, i);
- }
- }
-}
-
-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 *option_menu;
-
- ecml = e_categories_master_list_wombat_new ();
- option_menu = e_categories_master_list_option_menu_new (ecml);
- g_object_unref (ecml);
-
- return option_menu;
-}
-
-static void
-clear_widget (gpointer data, GObject *where_object_was)
-{
- GtkWidget **widget_ref = data;
- *widget_ref = NULL;
-}
-
-static void
-e_select_names_init (ESelectNames *e_select_names)
-{
- GladeXML *gui;
- GtkWidget *widget, *button, *table, *esom;
- ESource *source = NULL;
- char *uid;
-
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/select-names.glade", NULL, NULL);
- widget = glade_xml_get_widget (gui, "select-names-box");
- if (!widget) {
- g_object_unref (gui);
- return;
- }
- gtk_widget_ref (widget);
- gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (e_select_names)->vbox), widget, TRUE, TRUE, 0);
- gtk_widget_unref (widget);
-
- gtk_dialog_add_buttons (GTK_DIALOG (e_select_names),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
-
- gtk_window_set_modal (GTK_WINDOW (e_select_names), FALSE);
- gtk_window_set_default_size (GTK_WINDOW (e_select_names), 472, 512);
- gtk_window_set_title (GTK_WINDOW (e_select_names), _("Select Contacts from Address Book"));
- gtk_window_set_resizable (GTK_WINDOW (e_select_names), TRUE);
- gtk_dialog_set_has_separator (GTK_DIALOG (e_select_names), FALSE);
- gtk_container_set_border_width (GTK_CONTAINER (e_select_names), 4);
-
- /* FIXME What to do on error/NULL ? */
- e_select_names->source_list = e_source_list_new_for_gconf_default ("/apps/evolution/addressbook/sources");
-
- e_select_names->gui = gui;
-
- /* Add the source menu */
- esom = e_source_option_menu_new (e_select_names->source_list);
- g_signal_connect (esom, "source_selected", G_CALLBACK (source_selected), e_select_names);
- gtk_widget_show (esom);
-
- table = glade_xml_get_widget (gui, "show_contacts_table");
- gtk_table_attach (GTK_TABLE (table), esom, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
-
- /* Set up the rest of the widgets */
- 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;
-
- gtk_dialog_set_default_response (GTK_DIALOG (e_select_names),
- GTK_RESPONSE_OK);
-
- e_select_names->table = E_TABLE_SCROLLED(glade_xml_get_widget(gui, "table-source"));
- e_select_names->model = g_object_get_data(G_OBJECT(e_select_names->table), "model");
- e_select_names->adapter = g_object_get_data(G_OBJECT(e_select_names->table), "adapter");
- e_select_names->without = g_object_get_data(G_OBJECT(e_select_names->table), "without");
- gtk_widget_show (GTK_WIDGET (e_select_names->table));
-
- e_select_names->status_message = glade_xml_get_widget (gui, "status-message");
- if (e_select_names->status_message && !GTK_IS_LABEL (e_select_names->status_message))
- e_select_names->status_message = NULL;
- if (e_select_names->status_message) {
- e_select_names->status_id = g_signal_connect (e_select_names->model, "status_message",
- G_CALLBACK (status_message), e_select_names);
- g_object_weak_ref (G_OBJECT (e_select_names->status_message), clear_widget, &e_select_names->status_message);
- }
-
- e_select_names->search_id = g_signal_connect (e_select_names->model,
- "search_result", G_CALLBACK (search_result),
- e_select_names);
-
- e_select_names->categories = glade_xml_get_widget (gui, "custom-categories");
- if (e_select_names->categories && !E_IS_CATEGORIES_MASTER_LIST_OPTION_MENU (e_select_names->categories))
- e_select_names->categories = NULL;
- if (e_select_names->categories) {
- g_signal_connect(e_select_names->categories, "changed",
- G_CALLBACK(categories_changed), e_select_names);
- g_object_weak_ref (G_OBJECT (e_select_names->categories), clear_widget, &e_select_names->categories);
- }
- gtk_widget_show (e_select_names->categories);
-
- e_select_names->select_entry = glade_xml_get_widget (gui, "entry-select");
- if (e_select_names->select_entry && !GTK_IS_ENTRY (e_select_names->select_entry))
- e_select_names->select_entry = NULL;
- if (e_select_names->select_entry) {
- g_signal_connect(e_select_names->select_entry, "changed",
- G_CALLBACK(select_entry_changed), e_select_names);
- g_signal_connect(e_select_names->select_entry, "activate",
- G_CALLBACK(update_query), e_select_names);
- g_object_weak_ref (G_OBJECT (e_select_names->select_entry), clear_widget, &e_select_names->select_entry);
- }
-
- button = glade_xml_get_widget (gui, "button-find");
- if (button && GTK_IS_BUTTON (button))
- g_signal_connect(button, "clicked",
- G_CALLBACK(update_query), e_select_names);
-
- g_signal_connect (e_table_scrolled_get_table (e_select_names->table), "double_click",
- G_CALLBACK (add_address), e_select_names);
- g_signal_connect (e_table_scrolled_get_table (e_select_names->table), "selection_change",
- G_CALLBACK (selection_change), e_select_names);
- selection_change (e_table_scrolled_get_table (e_select_names->table), e_select_names);
-
- /* Select a source for to display initially */
- uid = e_select_names_config_get_last_completion_book ();
- if (uid) {
- source = e_source_list_peek_source_by_uid (e_select_names->source_list, uid);
- g_free (uid);
- }
-
- if (!source)
- source = find_first_source (e_select_names->source_list);
-
- /* FIXME What if we still can't find a source? */
- e_source_option_menu_select (E_SOURCE_OPTION_MENU (esom), source);
-
-}
-
-static void e_select_names_child_free(char *key, ESelectNamesChild *child, ESelectNames *e_select_names)
-{
- g_signal_handler_disconnect(child->source, child->changed_id);
-
- g_free(child->title);
- g_object_unref(child->table_model);
- g_object_unref(child->source);
- g_free(key);
- g_free(child);
-}
-
-static void
-e_select_names_dispose (GObject *object)
-{
- ESelectNames *e_select_names = E_SELECT_NAMES(object);
-
- if (e_select_names->source_list) {
- g_object_unref (e_select_names->source_list);
- e_select_names->source_list = NULL;
- }
-
- if (e_select_names->status_id) {
- g_signal_handler_disconnect(e_select_names->model, e_select_names->status_id);
- e_select_names->status_id = 0;
- }
-
- if (e_select_names->search_id) {
- g_signal_handler_disconnect(e_select_names->model, e_select_names->search_id);
- e_select_names->search_id = 0;
- }
-
- if (e_select_names->gui) {
- g_object_unref(e_select_names->gui);
- e_select_names->gui = NULL;
- }
-
- if (e_select_names->children) {
- 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);
- e_select_names->children = NULL;
- }
-
- if (e_select_names->without) {
- g_object_unref(e_select_names->without);
- e_select_names->without = NULL;
- }
- if (e_select_names->adapter) {
- g_object_unref(e_select_names->adapter);
- e_select_names->adapter = NULL;
- }
- if (e_select_names->model) {
- g_object_unref(e_select_names->model);
- e_select_names->model = NULL;
- }
-
- if (e_select_names->def) {
- g_free(e_select_names->def);
- e_select_names->def = NULL;
- }
-
- if (G_OBJECT_CLASS(parent_class)->dispose)
- G_OBJECT_CLASS(parent_class)->dispose(object);
-}
-
-GtkWidget*
-e_select_names_new (void)
-{
- ESelectNames *e_select_names;
-
- e_select_names = g_object_new (E_TYPE_SELECT_NAMES, NULL);
-
- return GTK_WIDGET (e_select_names);
-}
-
-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);
-}
-
-static void
-remove_cb (EPopup *ep, EPopupItem *pitem, void *data)
-{
- EABPopupTargetSelectNames *t = (EABPopupTargetSelectNames *)ep->target;
-
- e_select_names_model_delete (t->model, t->row);
-}
-
-static EPopupItem esn_select_popups[] = {
- { E_POPUP_ITEM, "20.delete", N_("Remove"), remove_cb, NULL, NULL, 0, 0 },
-};
-
-static void
-esn_select_popup_free (EPopup *ep, GSList *list, void *data)
-{
- g_slist_free (list);
-}
-
-static void
-section_right_click_cb (ETable *et, int row, int col, GdkEvent *ev, ESelectNamesChild *child)
-{
- EABPopup *ep;
- EABPopupTargetSelectNames *t;
- GSList *menus = NULL;
- int i;
- GtkMenu *menu;
-
- ep = eab_popup_new("org.gnome.evolution.addressbook.selectNames.popup");
- t = eab_popup_target_new_select_names(ep, child->source, row);
- t->target.widget = (GtkWidget *)et;
-
- for (i=0;i<sizeof(esn_select_popups)/sizeof(esn_select_popups[0]);i++)
- menus = g_slist_prepend(menus, &esn_select_popups[i]);
-
- e_popup_add_items((EPopup *)ep, menus, NULL, esn_select_popup_free, NULL);
-
- menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0);
- gtk_menu_popup(menu, NULL, NULL, NULL, NULL, ev->button.button, ev->button.time);
-}
-
-void
-e_select_names_add_section (ESelectNames *e_select_names,
- const char *name, const char *id,
- ESelectNamesModel *source)
-{
- ESelectNamesChild *child;
- GtkWidget *button;
- GtkWidget *label;
- GtkWidget *alignment;
- GtkTable *table;
- char *label_text;
- ETable *etable;
- ETableExtras *extras;
- ECell *string_cell;
-
- GtkWidget *sw;
-
- 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));
-
- child->table_model = (ESelectNamesTableModel*)e_select_names_table_model_new (source);
-
- child->source = source;
- g_object_ref(child->source);
-
- alignment = gtk_alignment_new(0, 0, 1, 0);
-
- label_text = g_strconcat (child->title, " ->", NULL);
-
- label = gtk_label_new ("");
-
- gtk_label_set_markup (GTK_LABEL(label), label_text);
-
- g_free (label_text);
-
- button = gtk_button_new ();
- gtk_container_add (GTK_CONTAINER (button), label);
- child->label = label;
- child->button = button;
-
- gtk_container_add(GTK_CONTAINER(alignment), button);
- gtk_widget_show_all(alignment);
- g_signal_connect(button, "clicked",
- G_CALLBACK(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);
-
- etable = e_table_scrolled_get_table (e_select_names->table);
- gtk_widget_set_sensitive (button, e_table_selected_count (etable) > 0);
-
- extras = e_table_extras_new ();
- string_cell = e_table_extras_get_cell (extras, "string");
-
- g_object_set (string_cell,
- "underline_column", 2,
- NULL);
-
- sw = e_table_scrolled_new_from_spec_file (E_TABLE_MODEL (child->table_model),
- extras,
- EVOLUTION_ETSPECDIR "/e-select-names-section.etspec",
- NULL);
- g_object_unref (extras);
-
- child->recipient_table = GTK_WIDGET (e_table_scrolled_get_table (E_TABLE_SCROLLED (sw)));
-
- g_signal_connect (child->recipient_table,
- "right_click",
- G_CALLBACK (section_right_click_cb),
- child);
-
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
-
- g_signal_connect(child->recipient_table, "double_click",
- G_CALLBACK(remove_address), child);
-
- child->changed_id = g_signal_connect (child->source,
- "changed",
- G_CALLBACK (sync_table_and_models),
- e_select_names);
-
- gtk_widget_show_all (sw);
-
- gtk_table_attach(table, sw,
- 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);
-
- sync_table_and_models (child->source, e_select_names);
-
- e_select_names->child_count++;
-}
-
-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) {
- GtkWidget *label = child->label;
-
- /* set the previous default to non-bold */
- gtk_label_set_markup (GTK_LABEL (label), child->title);
- }
- }
-
- 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) {
- GtkWidget *label = child->label;
- char *markup = g_strconcat ("<b>", child->title, "</b>", NULL);
-
- /* set the new default to bold */
- gtk_label_set_markup (GTK_LABEL (label), markup);
- g_free (markup);
- }
- }
-}
diff --git a/addressbook/gui/component/select-names/e-select-names.etspec b/addressbook/gui/component/select-names/e-select-names.etspec
deleted file mode 100644
index 45899e1f23..0000000000
--- a/addressbook/gui/component/select-names/e-select-names.etspec
+++ /dev/null
@@ -1,7 +0,0 @@
-<ETableSpecification no-headers="true" cursor-mode="line">
- <ETableColumn model_col= "86" _title="Name" expansion="1.0" minimum_width="20" resizable="true" cell="string" compare="collate" search="string"/>
- <ETableState>
- <column source="0"/>
- <grouping> <leaf column="0" ascending="true"/> </grouping>
- </ETableState>
-</ETableSpecification>
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 664735f74a..0000000000
--- a/addressbook/gui/component/select-names/e-select-names.h
+++ /dev/null
@@ -1,101 +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 version 2 of the GNU General Public
- * License as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifndef __E_SELECT_NAMES_H__
-#define __E_SELECT_NAMES_H__
-
-#include <glib.h>
-#include <gtk/gtkwidget.h>
-#include <gtk/gtkdialog.h>
-#include <glade/glade.h>
-#include <gal/e-table/e-table.h>
-#include <gal/e-table/e-table-scrolled.h>
-#include <libedataserver/e-source-list.h>
-#include <libedataserverui/e-source-option-menu.h>
-
-#include "e-addressbook-model.h"
-
-#include "e-select-names-model.h"
-
-G_BEGIN_DECLS
-
-/* ESelectNames - A dialog displaying information about a contact.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- */
-
-#define E_TYPE_SELECT_NAMES (e_select_names_get_type ())
-#define E_SELECT_NAMES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SELECT_NAMES, ESelectNames))
-#define E_SELECT_NAMES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES, ESelectNamesClass))
-#define E_IS_SELECT_NAMES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SELECT_NAMES))
-#define E_IS_SELECT_NAMES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_SELECT_NAMES))
-
-typedef struct _ESelectNames ESelectNames;
-typedef struct _ESelectNamesClass ESelectNamesClass;
-typedef struct _ESelectNamesFolder ESelectNamesFolder;
-
-struct _ESelectNames
-{
- GtkDialog parent;
-
- ESourceList *source_list;
-
- /* item specific fields */
- GladeXML *gui;
-
- GHashTable *children; /* Of type char * to ESelectNamesChild */
- int child_count;
- ETableScrolled *table;
- ETableModel *adapter;
- ETableModel *without;
- EABModel *model;
- GtkWidget *categories;
- GtkWidget *select_entry;
- GtkWidget *status_message;
- char *def;
- ESelectNamesFolder *current_folder;
-
- /* signal handlers */
- gulong status_id;
- gulong search_id;
-};
-
-struct _ESelectNamesClass
-{
- GtkDialogClass parent_class;
-};
-
-
-GType e_select_names_get_type (void);
-
-GtkWidget *e_select_names_new (void);
-
-void e_select_names_add_section (ESelectNames *e_select_names,
- const char *name,
- const char *id,
- ESelectNamesModel *source);
-void e_select_names_set_default (ESelectNames *e_select_names,
- const char *id);
-
-G_END_DECLS
-
-#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 edcf6bbab0..0000000000
--- a/addressbook/gui/component/select-names/recipient.glade
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd" >
-
-<glade-interface>
- <widget class="GtkWindow" id="window1">
- <property name="visible">no</property>
- <property name="title" translatable="yes">window1</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="modal">no</property>
- <property name="allow_shrink">no</property>
- <property name="allow_grow">yes</property>
- <property name="window-position">GTK_WIN_POS_NONE</property>
-
- <child>
- <widget class="GtkHBox" id="hbox-top">
- <property name="homogeneous">no</property>
- <property name="spacing">4</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment1">
- <property name="xalign">1.08033e-07</property>
- <property name="yalign">0</property>
- <property name="xscale">1</property>
- <property name="yscale">0</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkButton" id="text-button">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">-&gt;</property>
- <property name="visible">yes</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">yes</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
-</glade-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 205400de08..0000000000
--- a/addressbook/gui/component/select-names/select-names.glade
+++ /dev/null
@@ -1,443 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-
-<glade-interface>
-<requires lib="gnome"/>
-
-<widget class="GtkDialog" id="dialog-top">
- <property name="border_width">3</property>
- <property name="title" translatable="yes">Select Contacts from Address Book</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">True</property>
- <property name="default_width">417</property>
- <property name="default_height">332</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="decorated">True</property>
- <property name="skip_taskbar_hint">False</property>
- <property name="skip_pager_hint">False</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
- <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
- <property name="has_separator">False</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox1">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area1">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
-
- <child>
- <widget class="GtkButton" id="button4">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="response_id">-6</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button5">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-ok</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <property name="response_id">-5</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="select-names-box">
- <property name="border_width">4</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label33">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Show Contacts&lt;/b&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label35">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="show_contacts_table">
- <property name="visible">True</property>
- <property name="n_rows">3</property>
- <property name="n_columns">2</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label30">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Address _Book:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label31">
- <property name="visible">True</property>
- <property name="label" translatable="yes">C_ategory:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="Custom" id="custom-categories">
- <property name="visible">True</property>
- <property name="creation_function">e_select_names_create_categories</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Tue, 19 Feb 2002 23:06:24 GMT</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">expand|shrink|fill</property>
- <property name="y_options">shrink|fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox1">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkEntry" id="entry-select">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="button-find">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Find</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label39">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Search:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">entry-select</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label37">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label36">
- <property name="visible">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Contacts&lt;/b&gt;</property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox3">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">12</property>
-
- <child>
- <widget class="GtkLabel" id="label38">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox8">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="Custom" id="table-source">
- <property name="visible">True</property>
- <property name="creation_function">e_addressbook_create_ebook_table</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Sat, 10 Jun 2000 22:02:57 GMT</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <placeholder/>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table-recipients">
- <property name="visible">True</property>
- <property name="n_rows">3</property>
- <property name="n_columns">2</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">18</property>
- <property name="column_spacing">12</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="status-message">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">True</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">3</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-</glade-interface>