aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui/widgets')
-rw-r--r--addressbook/gui/widgets/.cvsignore19
-rw-r--r--addressbook/gui/widgets/Makefile.am89
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c693
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.h80
-rw-r--r--addressbook/gui/widgets/e-addressbook-reflow-adapter.c517
-rw-r--r--addressbook/gui/widgets/e-addressbook-reflow-adapter.h44
-rw-r--r--addressbook/gui/widgets/e-addressbook-table-adapter.c356
-rw-r--r--addressbook/gui/widgets/e-addressbook-table-adapter.h36
-rw-r--r--addressbook/gui/widgets/e-addressbook-treeview-adapter.c630
-rw-r--r--addressbook/gui/widgets/e-addressbook-treeview-adapter.h44
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c1855
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.etspec58
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.h144
-rw-r--r--addressbook/gui/widgets/e-minicard-label.c508
-rw-r--r--addressbook/gui/widgets/e-minicard-label.h86
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.c440
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.h73
-rw-r--r--addressbook/gui/widgets/e-minicard-view.c581
-rw-r--r--addressbook/gui/widgets/e-minicard-view.h94
-rw-r--r--addressbook/gui/widgets/e-minicard.c968
-rw-r--r--addressbook/gui/widgets/e-minicard.h123
-rw-r--r--addressbook/gui/widgets/eab-contact-display.c486
-rw-r--r--addressbook/gui/widgets/eab-contact-display.h61
-rw-r--r--addressbook/gui/widgets/eab-gui-util.c819
-rw-r--r--addressbook/gui/widgets/eab-gui-util.h70
-rw-r--r--addressbook/gui/widgets/eab-marshal.list11
-rw-r--r--addressbook/gui/widgets/eab-popup-control.c1236
-rw-r--r--addressbook/gui/widgets/eab-popup-control.h85
-rw-r--r--addressbook/gui/widgets/eab-vcard-control.c310
-rw-r--r--addressbook/gui/widgets/eab-vcard-control.h8
-rw-r--r--addressbook/gui/widgets/gal-view-factory-minicard.c85
-rw-r--r--addressbook/gui/widgets/gal-view-factory-minicard.h35
-rw-r--r--addressbook/gui/widgets/gal-view-factory-treeview.c86
-rw-r--r--addressbook/gui/widgets/gal-view-factory-treeview.h35
-rw-r--r--addressbook/gui/widgets/gal-view-minicard.c227
-rw-r--r--addressbook/gui/widgets/gal-view-minicard.h45
-rw-r--r--addressbook/gui/widgets/gal-view-treeview.c234
-rw-r--r--addressbook/gui/widgets/gal-view-treeview.h43
-rw-r--r--addressbook/gui/widgets/test-reflow.c199
39 files changed, 0 insertions, 11513 deletions
diff --git a/addressbook/gui/widgets/.cvsignore b/addressbook/gui/widgets/.cvsignore
deleted file mode 100644
index b67f65e6c3..0000000000
--- a/addressbook/gui/widgets/.cvsignore
+++ /dev/null
@@ -1,19 +0,0 @@
-.deps
-.libs
-.pure
-Makefile
-Makefile.in
-*.lo
-*.la
-minicard-label-test
-minicard-test
-minicard-view-test
-minicard-widget-test
-reflow-test
-eab-marshal.c
-eab-marshal.h
-Evolution-Composer-stubs.c
-Evolution-Composer-skels.c
-Evolution-Composer-common.c
-Evolution-Composer.h
-
diff --git a/addressbook/gui/widgets/Makefile.am b/addressbook/gui/widgets/Makefile.am
deleted file mode 100644
index ce5cc32275..0000000000
--- a/addressbook/gui/widgets/Makefile.am
+++ /dev/null
@@ -1,89 +0,0 @@
-INCLUDES = \
- -DG_LOG_DOMAIN=\"eab-widgets\" \
- -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
- -DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \
- -DEVOLUTION_GALVIEWSDIR=\""$(viewsdir)"\" \
- -I$(top_srcdir) \
- -I$(top_srcdir)/addressbook \
- -I$(top_srcdir)/addressbook/backend \
- -I$(top_builddir)/addressbook/backend \
- -I$(top_srcdir)/addressbook/gui/contact-editor \
- -I$(top_srcdir)/addressbook/gui/merging \
- -I$(top_srcdir)/addressbook/gui/component \
- -I$(top_srcdir)/widgets/misc \
- -I$(top_builddir)/shell \
- $(EVOLUTION_ADDRESSBOOK_CFLAGS)
-
-CORBA_COMPOSER_SOURCE_H = \
- Evolution-Composer.h
-CORBA_COMPOSER_SOURCE_C = \
- Evolution-Composer-common.c \
- Evolution-Composer-skels.c \
- Evolution-Composer-stubs.c
-CORBA_COMPOSER_IDL = $(srcdir)/../../../composer/Evolution-Composer.idl
-
-$(CORBA_COMPOSER_SOURCE_H): $(CORBA_COMPOSER_IDL)
- $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) $(CORBA_COMPOSER_IDL)
-
-$(CORBA_COMPOSER_SOURCE_C): $(CORBA_COMPOSER_SOURCE_H)
-
-CORBA_SOURCE_H = $(CORBA_COMPOSER_SOURCE_H)
-CORBA_SOURCE_C = $(CORBA_COMPOSER_SOURCE_C)
-CORBA_SOURCE = $(CORBA_SOURCE_H) $(CORBA_SOURCE_C)
-
-noinst_LTLIBRARIES = \
- libeabwidgets.la
-
-libeabwidgets_la_SOURCES = \
- $(CORBA_SOURCE) \
- $(MARSHAL_GENERATED) \
- eab-contact-display.c \
- eab-contact-display.h \
- eab-gui-util.c \
- eab-gui-util.h \
- eab-popup-control.c \
- eab-popup-control.h \
- eab-vcard-control.c \
- eab-vcard-control.h \
- e-minicard.c \
- e-minicard.h \
- e-minicard-label.c \
- e-minicard-label.h \
- e-minicard-view.c \
- e-minicard-view.h \
- e-minicard-view-widget.c \
- e-minicard-view-widget.h \
- e-addressbook-reflow-adapter.c \
- e-addressbook-reflow-adapter.h \
- e-addressbook-table-adapter.c \
- e-addressbook-table-adapter.h \
- e-addressbook-model.c \
- e-addressbook-model.h \
- e-addressbook-view.c \
- e-addressbook-view.h \
- gal-view-minicard.c \
- gal-view-minicard.h \
- gal-view-factory-minicard.c \
- gal-view-factory-minicard.h
-
-#TREEVIEW_SOURCES= e-addressbook-treeview-adapter.c \
-# e-addressbook-treeview-adapter.h \
-# gal-view-factory-treeview.c \
-# gal-view-factory-treeview.h \
-# gal-view-treeview.c \
-# gal-view-treeview.h
-
-MARSHAL_GENERATED = eab-marshal.c eab-marshal.h
-@EVO_MARSHAL_RULE@
-
-BUILT_SOURCES = $(CORBA_SOURCE) $(MARSHAL_GENERATED)
-CLEANFILES = $(BUILT_SOURCES)
-
-dist-hook:
- cd $(distdir); rm -f $(BUILT_SOURCES)
-
-etspec_DATA= e-addressbook-view.etspec
-
-EXTRA_DIST = \
- $(etspec_DATA) \
- eab-marshal.list
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
deleted file mode 100644
index 992b42b852..0000000000
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ /dev/null
@@ -1,693 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- *
- * Author:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * (C) 1999 Ximian, Inc.
- */
-
-#include <config.h>
-#include "eab-marshal.h"
-#include "e-addressbook-model.h"
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-#include <gnome.h>
-#include <gal/widgets/e-gui-utils.h>
-#include "eab-gui-util.h"
-
-#define PARENT_TYPE G_TYPE_OBJECT
-static GObjectClass *parent_class;
-
-/*
- * EABModel callbacks
- * These are the callbacks that define the behavior of our custom model.
- */
-static void eab_model_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void eab_model_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-
-
-enum {
- PROP_0,
- PROP_BOOK,
- PROP_QUERY,
- PROP_EDITABLE,
-};
-
-enum {
- WRITABLE_STATUS,
- STATUS_MESSAGE,
- SEARCH_STARTED,
- SEARCH_RESULT,
- FOLDER_BAR_MESSAGE,
- CONTACT_ADDED,
- CONTACT_REMOVED,
- CONTACT_CHANGED,
- MODEL_CHANGED,
- STOP_STATE_CHANGED,
- BACKEND_DIED,
- LAST_SIGNAL
-};
-
-static guint eab_model_signals [LAST_SIGNAL] = {0, };
-
-static void
-free_data (EABModel *model)
-{
- if (model->data) {
- int i;
-
- for ( i = 0; i < model->data_count; i++ ) {
- g_object_unref (model->data[i]);
- }
-
- g_free(model->data);
- model->data = NULL;
- model->data_count = 0;
- model->allocated_count = 0;
- }
-}
-
-static void
-remove_book_view(EABModel *model)
-{
- if (model->book_view && model->create_contact_id)
- g_signal_handler_disconnect (model->book_view,
- model->create_contact_id);
- if (model->book_view && model->remove_contact_id)
- g_signal_handler_disconnect (model->book_view,
- model->remove_contact_id);
- if (model->book_view && model->modify_contact_id)
- g_signal_handler_disconnect (model->book_view,
- model->modify_contact_id);
- if (model->book_view && model->status_message_id)
- g_signal_handler_disconnect (model->book_view,
- model->status_message_id);
- if (model->book_view && model->sequence_complete_id)
- g_signal_handler_disconnect (model->book_view,
- model->sequence_complete_id);
-
- model->create_contact_id = 0;
- model->remove_contact_id = 0;
- model->modify_contact_id = 0;
- model->status_message_id = 0;
- model->sequence_complete_id = 0;
-
- model->search_in_progress = FALSE;
-
- if (model->book_view) {
- e_book_view_stop (model->book_view);
- g_object_unref (model->book_view);
- model->book_view = NULL;
- }
-}
-
-static void
-addressbook_dispose(GObject *object)
-{
- EABModel *model = EAB_MODEL(object);
-
- remove_book_view(model);
- free_data (model);
-
- if (model->book) {
- if (model->writable_status_id)
- g_signal_handler_disconnect (model->book,
- model->writable_status_id);
- model->writable_status_id = 0;
-
- if (model->backend_died_id)
- g_signal_handler_disconnect (model->book,
- model->backend_died_id);
- model->backend_died_id = 0;
-
- g_object_unref (model->book);
- model->book = NULL;
- }
-
- if (model->query) {
- e_book_query_unref (model->query);
- model->query = NULL;
- }
-
- if (G_OBJECT_CLASS(parent_class)->dispose)
- G_OBJECT_CLASS(parent_class)->dispose(object);
-}
-
-static void
-update_folder_bar_message (EABModel *model)
-{
- int count;
- char *message;
-
- count = model->data_count;
-
- switch (count) {
- case 0:
- message = g_strdup (_("No contacts"));
- break;
- case 1:
- message = g_strdup (_("1 contact"));
- break;
- default:
- message = g_strdup_printf (_("%d contacts"), count);
- break;
- }
-
- g_signal_emit (model,
- eab_model_signals [FOLDER_BAR_MESSAGE], 0,
- message);
-
- g_free (message);
-}
-
-static void
-create_contact(EBookView *book_view,
- const GList *contacts,
- EABModel *model)
-{
- int old_count = model->data_count;
- int length = g_list_length ((GList *)contacts);
-
- if (model->data_count + length > model->allocated_count) {
- while (model->data_count + length > model->allocated_count)
- model->allocated_count = model->allocated_count * 2 + 1;
- model->data = g_renew(EContact *, model->data, model->allocated_count);
- }
-
- for ( ; contacts; contacts = contacts->next) {
- model->data[model->data_count++] = contacts->data;
- g_object_ref (contacts->data);
- }
-
- g_signal_emit (model,
- eab_model_signals [CONTACT_ADDED], 0,
- old_count, model->data_count - old_count);
-
- update_folder_bar_message (model);
-}
-
-static void
-remove_contact(EBookView *book_view,
- GList *ids,
- EABModel *model)
-{
- /* XXX we should keep a hash around instead of this O(n*m) loop */
- int i = 0;
- GList *l;
-
- for (l = ids; l; l = l->next) {
- char *id = l->data;
- for ( i = 0; i < model->data_count; i++) {
- if ( !strcmp(e_contact_get_const (model->data[i], E_CONTACT_UID), id) ) {
- g_object_unref (model->data[i]);
- memmove(model->data + i, model->data + i + 1, (model->data_count - i - 1) * sizeof (EContact *));
- model->data_count--;
-
- g_signal_emit (model,
- eab_model_signals [CONTACT_REMOVED], 0,
- i);
-
- break;
- }
- }
- }
-
- update_folder_bar_message (model);
-}
-
-static void
-modify_contact(EBookView *book_view,
- const GList *contacts,
- EABModel *model)
-{
- for ( ; contacts; contacts = contacts->next) {
- int i;
- for ( i = 0; i < model->data_count; i++) {
- if ( !strcmp(e_contact_get_const(model->data[i], E_CONTACT_UID),
- e_contact_get_const(E_CONTACT(contacts->data), E_CONTACT_UID)) ) {
- g_object_unref (model->data[i]);
- model->data[i] = e_contact_duplicate(E_CONTACT(contacts->data));
- g_signal_emit (model,
- eab_model_signals [CONTACT_CHANGED], 0,
- i);
- break;
- }
- }
- }
-}
-
-static void
-status_message (EBookView *book_view,
- char* status,
- EABModel *model)
-{
- g_signal_emit (model,
- eab_model_signals [STATUS_MESSAGE], 0,
- status);
-}
-
-static void
-sequence_complete (EBookView *book_view,
- EBookViewStatus status,
- EABModel *model)
-{
- model->search_in_progress = FALSE;
- status_message (book_view, NULL, model);
- g_signal_emit (model,
- eab_model_signals [SEARCH_RESULT], 0,
- status);
- g_signal_emit (model,
- eab_model_signals [STOP_STATE_CHANGED], 0);
-}
-
-static void
-writable_status (EBook *book,
- gboolean writable,
- EABModel *model)
-{
- if (!model->editable_set) {
- model->editable = writable;
-
- g_signal_emit (model,
- eab_model_signals [WRITABLE_STATUS], 0,
- writable);
- }
-}
-
-static void
-backend_died (EBook *book,
- EABModel *model)
-{
- g_signal_emit (model,
- eab_model_signals [BACKEND_DIED], 0);
-}
-
-static void
-eab_model_class_init (GObjectClass *object_class)
-{
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->dispose = addressbook_dispose;
- object_class->set_property = eab_model_set_property;
- object_class->get_property = eab_model_get_property;
-
- g_object_class_install_property (object_class, PROP_BOOK,
- g_param_spec_object ("book",
- _("Book"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_BOOK,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_QUERY,
- g_param_spec_string ("query",
- _("Query"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_EDITABLE,
- g_param_spec_boolean ("editable",
- _("Editable"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- eab_model_signals [WRITABLE_STATUS] =
- g_signal_new ("writable_status",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, writable_status),
- NULL, NULL,
- eab_marshal_NONE__BOOL,
- G_TYPE_NONE,
- 1, G_TYPE_BOOLEAN);
-
- eab_model_signals [STATUS_MESSAGE] =
- g_signal_new ("status_message",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, status_message),
- NULL, NULL,
- eab_marshal_NONE__POINTER,
- G_TYPE_NONE,
- 1, G_TYPE_POINTER);
-
- eab_model_signals [SEARCH_STARTED] =
- g_signal_new ("search_started",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, search_started),
- NULL, NULL,
- eab_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- eab_model_signals [SEARCH_RESULT] =
- g_signal_new ("search_result",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, search_result),
- NULL, NULL,
- eab_marshal_NONE__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- eab_model_signals [FOLDER_BAR_MESSAGE] =
- g_signal_new ("folder_bar_message",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, folder_bar_message),
- NULL, NULL,
- eab_marshal_NONE__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
-
- eab_model_signals [CONTACT_ADDED] =
- g_signal_new ("contact_added",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, contact_added),
- NULL, NULL,
- eab_marshal_NONE__INT_INT,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
-
- eab_model_signals [CONTACT_REMOVED] =
- g_signal_new ("contact_removed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, contact_removed),
- NULL, NULL,
- eab_marshal_NONE__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- eab_model_signals [CONTACT_CHANGED] =
- g_signal_new ("contact_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, contact_changed),
- NULL, NULL,
- eab_marshal_NONE__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- eab_model_signals [MODEL_CHANGED] =
- g_signal_new ("model_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, model_changed),
- NULL, NULL,
- eab_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- eab_model_signals [STOP_STATE_CHANGED] =
- g_signal_new ("stop_state_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, stop_state_changed),
- NULL, NULL,
- eab_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- eab_model_signals [BACKEND_DIED] =
- g_signal_new ("backend_died",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABModelClass, backend_died),
- NULL, NULL,
- eab_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-}
-
-static void
-eab_model_init (GObject *object)
-{
- EABModel *model = EAB_MODEL(object);
- model->book = NULL;
- model->query = e_book_query_any_field_contains ("");
- model->book_view = NULL;
- model->create_contact_id = 0;
- model->remove_contact_id = 0;
- model->modify_contact_id = 0;
- model->status_message_id = 0;
- model->writable_status_id = 0;
- model->backend_died_id = 0;
- model->sequence_complete_id = 0;
- model->data = NULL;
- model->data_count = 0;
- model->allocated_count = 0;
- model->search_in_progress = FALSE;
- model->editable = FALSE;
- model->editable_set = FALSE;
- model->first_get_view = TRUE;
-}
-
-static void
-book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointer closure)
-{
- EABModel *model = closure;
-
- if (status != E_BOOK_ERROR_OK) {
- eab_error_dialog (_("Error getting book view"), status);
- return;
- }
-
- remove_book_view (model);
- free_data (model);
-
- model->book_view = book_view;
- if (model->book_view)
- g_object_ref (model->book_view);
- model->create_contact_id = g_signal_connect(model->book_view,
- "contacts_added",
- G_CALLBACK (create_contact),
- model);
- model->remove_contact_id = g_signal_connect(model->book_view,
- "contacts_removed",
- G_CALLBACK (remove_contact),
- model);
- model->modify_contact_id = g_signal_connect(model->book_view,
- "contacts_changed",
- G_CALLBACK(modify_contact),
- model);
- model->status_message_id = g_signal_connect(model->book_view,
- "status_message",
- G_CALLBACK(status_message),
- model);
- model->sequence_complete_id = g_signal_connect(model->book_view,
- "sequence_complete",
- G_CALLBACK(sequence_complete),
- model);
-
- model->search_in_progress = TRUE;
- g_signal_emit (model,
- eab_model_signals [MODEL_CHANGED], 0);
- g_signal_emit (model,
- eab_model_signals [SEARCH_STARTED], 0);
- g_signal_emit (model,
- eab_model_signals [STOP_STATE_CHANGED], 0);
-
- e_book_view_start (model->book_view);
-}
-
-static void
-get_view (EABModel *model)
-{
- gboolean success;
-
- if (model->book && model->query) {
- char *query_string = e_book_query_to_string (model->query);
-
- remove_book_view(model);
- free_data (model);
-
- if (model->first_get_view) {
- model->first_get_view = FALSE;
-
- if (e_book_check_static_capability (model->book, "do-initial-query")) {
- success = e_book_async_get_book_view (model->book, query_string, book_view_loaded, model);
- } else {
- g_signal_emit (model,
- eab_model_signals [MODEL_CHANGED], 0);
- g_signal_emit (model,
- eab_model_signals [STOP_STATE_CHANGED], 0);
- g_free (query_string);
- return;
- }
- }
- else
- success = e_book_async_get_book_view (model->book, query_string, book_view_loaded, model);
-
- g_free (query_string);
- }
-}
-
-EContact *
-eab_model_get_contact(EABModel *model,
- int row)
-{
- if (model->data && 0 <= row && row < model->data_count) {
- return e_contact_duplicate (model->data[row]);
- }
- return NULL;
-}
-
-static void
-eab_model_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- EABModel *model;
-
- model = EAB_MODEL (object);
-
- switch (prop_id){
- case PROP_BOOK:
- if (model->book) {
- if (model->writable_status_id)
- g_signal_handler_disconnect (model->book,
- model->writable_status_id);
- model->writable_status_id = 0;
-
- if (model->backend_died_id)
- g_signal_handler_disconnect (model->book,
- model->backend_died_id);
- model->backend_died_id = 0;
-
- g_object_unref (model->book);
- }
- model->book = E_BOOK(g_value_get_object (value));
- if (model->book) {
- if (!model->editable_set) {
- model->editable = e_book_is_writable (model->book);
-
- g_signal_emit (model,
- eab_model_signals [WRITABLE_STATUS], 0,
- model->editable);
- }
- model->first_get_view = TRUE;
- g_object_ref (model->book);
- get_view (model);
- g_signal_connect (model->book,
- "writable_status",
- G_CALLBACK (writable_status), model);
- g_signal_connect (model->book,
- "backend_died",
- G_CALLBACK (backend_died), model);
- }
- break;
- case PROP_QUERY:
- if (model->query)
- e_book_query_unref (model->query);
- model->query = e_book_query_from_string (g_value_get_string (value));
- get_view (model);
- break;
- case PROP_EDITABLE:
- model->editable = g_value_get_boolean (value);
- model->editable_set = TRUE;
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-eab_model_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- EABModel *eab_model;
-
- eab_model = EAB_MODEL (object);
-
- switch (prop_id) {
- case PROP_BOOK:
- g_value_set_object (value, eab_model->book);
- break;
- case PROP_QUERY: {
- char *query_string = e_book_query_to_string (eab_model->query);
- g_value_set_string (value, query_string);
- break;
- }
- case PROP_EDITABLE:
- g_value_set_boolean (value, eab_model->editable);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-GType
-eab_model_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EABModelClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) eab_model_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EABModel),
- 0, /* n_preallocs */
- (GInstanceInitFunc) eab_model_init,
- };
-
- type = g_type_register_static (PARENT_TYPE, "EABModel", &info, 0);
- }
-
- return type;
-}
-
-EABModel*
-eab_model_new (void)
-{
- EABModel *et;
-
- et = g_object_new (EAB_TYPE_MODEL, NULL);
-
- return et;
-}
-
-void eab_model_stop (EABModel *model)
-{
- remove_book_view(model);
- g_signal_emit (model,
- eab_model_signals [STOP_STATE_CHANGED], 0);
- g_signal_emit (model,
- eab_model_signals [STATUS_MESSAGE], 0,
- "Search Interrupted.");
-}
-
-gboolean
-eab_model_can_stop (EABModel *model)
-{
- return model->search_in_progress;
-}
-
-void
-eab_model_force_folder_bar_message (EABModel *model)
-{
- update_folder_bar_message (model);
-}
-
-int
-eab_model_contact_count (EABModel *model)
-{
- return model->data_count;
-}
-
-const EContact *
-eab_model_contact_at (EABModel *model, int index)
-{
- return model->data[index];
-}
-
-gboolean
-eab_model_editable (EABModel *model)
-{
- return model->editable;
-}
-
-EBook *
-eab_model_get_ebook (EABModel *model)
-{
- return model->book;
-}
diff --git a/addressbook/gui/widgets/e-addressbook-model.h b/addressbook/gui/widgets/e-addressbook-model.h
deleted file mode 100644
index 64ce6c3845..0000000000
--- a/addressbook/gui/widgets/e-addressbook-model.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#ifndef _EAB_MODEL_H_
-#define _EAB_MODEL_H_
-
-#include <glib.h>
-#include <glib-object.h>
-#include <libebook/e-book-async.h>
-#include <libebook/e-book-view.h>
-
-#define EAB_TYPE_MODEL (eab_model_get_type ())
-#define EAB_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EAB_TYPE_MODEL, EABModel))
-#define EAB_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), EAB_TYPE_MODEL, EABModelClass))
-#define E_IS_ADDRESSBOOK_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EAB_TYPE_MODEL))
-#define E_IS_ADDRESSBOOK_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EAB_TYPE_MODEL))
-
-typedef struct _EABModel EABModel;
-typedef struct _EABModelClass EABModelClass;
-
-struct _EABModel {
- GObject parent;
-
- /* item specific fields */
- EBook *book;
- EBookQuery *query;
- EBookView *book_view;
-
- EContact **data;
- int data_count;
- int allocated_count;
-
- int create_contact_id, remove_contact_id, modify_contact_id;
- int status_message_id, writable_status_id, sequence_complete_id;
- int backend_died_id;
-
- guint search_in_progress : 1;
- guint editable : 1;
- guint editable_set : 1;
- guint first_get_view : 1;
-};
-
-
-struct _EABModelClass {
- GObjectClass parent_class;
-
- /*
- * Signals
- */
- void (*writable_status) (EABModel *model, gboolean writable);
- void (*search_started) (EABModel *model);
- void (*search_result) (EABModel *model, EBookViewStatus status);
- void (*status_message) (EABModel *model, const gchar *message);
- void (*folder_bar_message) (EABModel *model, const gchar *message);
- void (*contact_added) (EABModel *model, gint index, gint count);
- void (*contact_removed) (EABModel *model, gint index);
- void (*contact_changed) (EABModel *model, gint index);
- void (*model_changed) (EABModel *model);
- void (*stop_state_changed) (EABModel *model);
- void (*backend_died) (EABModel *model);
-};
-
-
-GType eab_model_get_type (void);
-EABModel *eab_model_new (void);
-
-/* Returns object with ref count of 1. */
-EContact *eab_model_get_contact (EABModel *model,
- int row);
-EBook *eab_model_get_ebook (EABModel *model);
-
-void eab_model_stop (EABModel *model);
-gboolean eab_model_can_stop (EABModel *model);
-
-void eab_model_force_folder_bar_message (EABModel *model);
-
-int eab_model_contact_count (EABModel *model);
-const EContact *eab_model_contact_at (EABModel *model,
- int index);
-gboolean eab_model_editable (EABModel *model);
-
-#endif /* _EAB_MODEL_H_ */
diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
deleted file mode 100644
index cf1667fec5..0000000000
--- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
+++ /dev/null
@@ -1,517 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-
-#include <config.h>
-#include <string.h>
-
-#include <libgnome/gnome-i18n.h>
-#include "eab-marshal.h"
-#include "e-addressbook-reflow-adapter.h"
-#include "e-addressbook-model.h"
-#include "e-addressbook-view.h"
-#include "eab-gui-util.h"
-
-#include "e-minicard.h"
-#include <gal/widgets/e-popup-menu.h>
-#include <gal/widgets/e-gui-utils.h>
-#include "addressbook/printing/e-contact-print.h"
-#include "addressbook/printing/e-contact-print-envelope.h"
-
-
-struct _EAddressbookReflowAdapterPrivate {
- EABModel *model;
-
- gboolean loading;
-
- int create_contact_id, remove_contact_id, modify_contact_id, model_changed_id;
- int search_started_id, search_result_id;
-};
-
-#define PARENT_TYPE e_reflow_model_get_type()
-static EReflowModel *parent_class;
-
-#define d(x)
-
-enum {
- PROP_0,
- PROP_BOOK,
- PROP_QUERY,
- PROP_EDITABLE,
- PROP_MODEL,
-};
-
-enum {
- DRAG_BEGIN,
- LAST_SIGNAL
-};
-
-static guint e_addressbook_reflow_adapter_signals [LAST_SIGNAL] = {0, };
-
-static void
-unlink_model(EAddressbookReflowAdapter *adapter)
-{
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
-
- if (priv->model && priv->create_contact_id)
- g_signal_handler_disconnect (priv->model,
- priv->create_contact_id);
- if (priv->model && priv->remove_contact_id)
- g_signal_handler_disconnect (priv->model,
- priv->remove_contact_id);
- if (priv->model && priv->modify_contact_id)
- g_signal_handler_disconnect (priv->model,
- priv->modify_contact_id);
- if (priv->model && priv->model_changed_id)
- g_signal_handler_disconnect (priv->model,
- priv->model_changed_id);
- if (priv->model && priv->search_started_id)
- g_signal_handler_disconnect (priv->model,
- priv->search_started_id);
- if (priv->model && priv->search_result_id)
- g_signal_handler_disconnect (priv->model,
- priv->search_result_id);
-
- priv->create_contact_id = 0;
- priv->remove_contact_id = 0;
- priv->modify_contact_id = 0;
- priv->model_changed_id = 0;
- priv->search_started_id = 0;
- priv->search_result_id = 0;
-
- if (priv->model)
- g_object_unref (priv->model);
-
- priv->model = NULL;
-}
-
-
-static int
-text_height (PangoLayout *layout, const gchar *text)
-{
- int height;
-
- pango_layout_set_text (layout, text, -1);
-
- pango_layout_get_pixel_size (layout, NULL, &height);
-
- return height;
-}
-
-static void
-addressbook_dispose(GObject *object)
-{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(object);
-
- unlink_model (adapter);
-}
-
-static void
-addressbook_set_width (EReflowModel *erm, int width)
-{
-}
-
-/* This function returns the number of items in our EReflowModel. */
-static int
-addressbook_count (EReflowModel *erm)
-{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(erm);
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
-
- return eab_model_contact_count (priv->model);
-}
-
-/* This function returns the height of the minicontact in question */
-static int
-addressbook_height (EReflowModel *erm, int i, GnomeCanvasGroup *parent)
-{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(erm);
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
- EContactField field;
- int count = 0;
- char *string;
- EContact *contact = (EContact*)eab_model_contact_at (priv->model, i);
- PangoLayout *layout = gtk_widget_create_pango_layout (GTK_WIDGET (GNOME_CANVAS_ITEM (parent)->canvas), "");
- int height;
-
- string = e_contact_get(contact, E_CONTACT_FILE_AS);
- height = text_height (layout, string ? string : "") + 10.0;
- g_free(string);
-
- for(field = E_CONTACT_FULL_NAME; field != E_CONTACT_LAST_SIMPLE_STRING && count < 5; field++) {
-
- if (field == E_CONTACT_FAMILY_NAME || field == E_CONTACT_GIVEN_NAME)
- continue;
-
- string = e_contact_get(contact, field);
- if (string && *string) {
- int this_height;
- int field_text_height;
-
- this_height = text_height (layout, e_contact_pretty_name(field));
-
- field_text_height = text_height (layout, string);
- if (this_height < field_text_height)
- this_height = field_text_height;
-
- this_height += 3;
-
- height += this_height;
- count ++;
- }
- g_free (string);
- }
- height += 2;
-
- g_object_unref (layout);
-
- return height;
-}
-
-static int
-addressbook_compare (EReflowModel *erm, int n1, int n2)
-{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(erm);
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
- EContact *contact1, *contact2;
-
- if (priv->loading) {
- return n1-n2;
- }
- else {
- contact1 = (EContact*)eab_model_contact_at (priv->model, n1);
- contact2 = (EContact*)eab_model_contact_at (priv->model, n2);
-
- if (contact1 && contact2) {
- const char *file_as1, *file_as2;
- file_as1 = e_contact_get_const (contact1, E_CONTACT_FILE_AS);
- file_as2 = e_contact_get_const (contact2, E_CONTACT_FILE_AS);
- if (file_as1 && file_as2)
- return g_utf8_collate(file_as1, file_as2);
- if (file_as1)
- return -1;
- if (file_as2)
- return 1;
- return strcmp(e_contact_get_const (contact1, E_CONTACT_UID),
- e_contact_get_const (contact2, E_CONTACT_UID));
- }
- if (contact1)
- return -1;
- if (contact2)
- return 1;
- return 0;
- }
-}
-
-static int
-adapter_drag_begin (EMinicard *card, GdkEvent *event, EAddressbookReflowAdapter *adapter)
-{
- gint ret_val = 0;
-
- g_signal_emit (adapter,
- e_addressbook_reflow_adapter_signals[DRAG_BEGIN], 0,
- event, &ret_val);
-
- return ret_val;
-}
-
-static GnomeCanvasItem *
-addressbook_incarnate (EReflowModel *erm, int i, GnomeCanvasGroup *parent)
-{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(erm);
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
- GnomeCanvasItem *item;
-
- item = gnome_canvas_item_new(parent,
- e_minicard_get_type(),
- "contact", eab_model_contact_at (priv->model, i),
- "editable", eab_model_editable (priv->model),
- NULL);
-
-#if 0
- g_signal_connect (item, "selected",
- G_CALLBACK(card_selected), 0, emvm);
-#endif
-
- g_signal_connect (item, "drag_begin",
- G_CALLBACK(adapter_drag_begin), adapter);
-
- return item;
-}
-
-static void
-addressbook_reincarnate (EReflowModel *erm, int i, GnomeCanvasItem *item)
-{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(erm);
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
-
- gnome_canvas_item_set(item,
- "contact", eab_model_contact_at (priv->model, i),
- NULL);
-}
-
-static void
-create_contact (EABModel *model,
- gint index, gint count,
- EAddressbookReflowAdapter *adapter)
-{
- e_reflow_model_items_inserted (E_REFLOW_MODEL (adapter),
- index,
- count);
-}
-
-static void
-remove_contact (EABModel *model,
- gint index,
- EAddressbookReflowAdapter *adapter)
-{
- e_reflow_model_item_removed (E_REFLOW_MODEL (adapter), index);
-}
-
-static void
-modify_contact (EABModel *model,
- gint index,
- EAddressbookReflowAdapter *adapter)
-{
- e_reflow_model_item_changed (E_REFLOW_MODEL (adapter), index);
-}
-
-static void
-model_changed (EABModel *model,
- EAddressbookReflowAdapter *adapter)
-{
- e_reflow_model_changed (E_REFLOW_MODEL (adapter));
-}
-
-static void
-search_started (EABModel *model,
- EAddressbookReflowAdapter *adapter)
-{
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
-
- priv->loading = TRUE;
-}
-
-static void
-search_result (EABModel *model,
- EBookViewStatus status,
- EAddressbookReflowAdapter *adapter)
-{
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
-
- priv->loading = FALSE;
-
- e_reflow_model_comparison_changed (E_REFLOW_MODEL (adapter));
-}
-
-static void
-addressbook_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(object);
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
-
- switch (prop_id) {
- case PROP_BOOK:
- g_object_set (priv->model,
- "book", g_value_get_object (value),
- NULL);
- break;
- case PROP_QUERY:
- g_object_set (priv->model,
- "query", g_value_get_string (value),
- NULL);
- break;
- case PROP_EDITABLE:
- g_object_set (priv->model,
- "editable", g_value_get_boolean (value),
- NULL);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-addressbook_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(object);
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
-
- switch (prop_id) {
- case PROP_BOOK: {
- g_object_get_property (G_OBJECT (priv->model),
- "book", value);
- break;
- }
- case PROP_QUERY: {
- g_object_get_property (G_OBJECT (priv->model),
- "query", value);
- break;
- }
- case PROP_EDITABLE: {
- g_object_get_property (G_OBJECT (priv->model),
- "editable", value);
- break;
- }
- case PROP_MODEL:
- g_value_set_object (value, priv->model);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-e_addressbook_reflow_adapter_class_init (GObjectClass *object_class)
-{
- EReflowModelClass *model_class = (EReflowModelClass *) object_class;
-
- parent_class = g_type_class_peek_parent (object_class);
-
- object_class->set_property = addressbook_set_property;
- object_class->get_property = addressbook_get_property;
- object_class->dispose = addressbook_dispose;
-
- g_object_class_install_property (object_class, PROP_BOOK,
- g_param_spec_object ("book",
- _("Book"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_BOOK,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_QUERY,
- g_param_spec_string ("query",
- _("Query"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_EDITABLE,
- g_param_spec_boolean ("editable",
- _("Editable"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_MODEL,
- g_param_spec_object ("model",
- _("Model"),
- /*_( */"XXX blurb" /*)*/,
- EAB_TYPE_MODEL,
- G_PARAM_READABLE));
-
- e_addressbook_reflow_adapter_signals [DRAG_BEGIN] =
- g_signal_new ("drag_begin",
- G_OBJECT_CLASS_TYPE(object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EAddressbookReflowAdapterClass, drag_begin),
- NULL, NULL,
- eab_marshal_INT__POINTER,
- G_TYPE_INT, 1, G_TYPE_POINTER);
-
- model_class->set_width = addressbook_set_width;
- model_class->count = addressbook_count;
- model_class->height = addressbook_height;
- model_class->compare = addressbook_compare;
- model_class->incarnate = addressbook_incarnate;
- model_class->reincarnate = addressbook_reincarnate;
-}
-
-static void
-e_addressbook_reflow_adapter_init (GtkObject *object)
-{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(object);
- EAddressbookReflowAdapterPrivate *priv;
-
- priv = adapter->priv = g_new0 (EAddressbookReflowAdapterPrivate, 1);
-
- priv->loading = FALSE;
- priv->create_contact_id = 0;
- priv->remove_contact_id = 0;
- priv->modify_contact_id = 0;
- priv->model_changed_id = 0;
- priv->search_started_id = 0;
- priv->search_result_id = 0;
-}
-
-GType
-e_addressbook_reflow_adapter_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EAddressbookReflowAdapterClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_addressbook_reflow_adapter_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EAddressbookReflowAdapter),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_addressbook_reflow_adapter_init,
- };
-
- type = g_type_register_static (PARENT_TYPE, "EAddressbookReflowAdapter", &info, 0);
- }
-
- return type;
-}
-
-void
-e_addressbook_reflow_adapter_construct (EAddressbookReflowAdapter *adapter,
- EABModel *model)
-{
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
-
- priv->model = model;
- g_object_ref (priv->model);
-
- priv->create_contact_id = g_signal_connect(priv->model,
- "contact_added",
- G_CALLBACK(create_contact),
- adapter);
- priv->remove_contact_id = g_signal_connect(priv->model,
- "contact_removed",
- G_CALLBACK(remove_contact),
- adapter);
- priv->modify_contact_id = g_signal_connect(priv->model,
- "contact_changed",
- G_CALLBACK(modify_contact),
- adapter);
- priv->model_changed_id = g_signal_connect(priv->model,
- "model_changed",
- G_CALLBACK(model_changed),
- adapter);
- priv->search_started_id = g_signal_connect(priv->model,
- "search_started",
- G_CALLBACK(search_started),
- adapter);
- priv->search_result_id = g_signal_connect(priv->model,
- "search_result",
- G_CALLBACK(search_result),
- adapter);
-}
-
-EReflowModel *
-e_addressbook_reflow_adapter_new (EABModel *model)
-{
- EAddressbookReflowAdapter *et;
-
- et = g_object_new (E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER, NULL);
-
- e_addressbook_reflow_adapter_construct (et, model);
-
- return E_REFLOW_MODEL(et);
-}
-
-
-EContact *
-e_addressbook_reflow_adapter_get_contact (EAddressbookReflowAdapter *adapter,
- int index)
-{
- EAddressbookReflowAdapterPrivate *priv = adapter->priv;
-
- return eab_model_get_contact (priv->model, index);
-}
diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.h b/addressbook/gui/widgets/e-addressbook-reflow-adapter.h
deleted file mode 100644
index 1321b27bb4..0000000000
--- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#ifndef _E_ADDRESSBOOK_REFLOW_ADAPTER_H_
-#define _E_ADDRESSBOOK_REFLOW_ADAPTER_H_
-
-#include <gal/widgets/e-reflow-model.h>
-#include <libebook/e-contact.h>
-#include "e-addressbook-model.h"
-
-#define E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER (e_addressbook_reflow_adapter_get_type ())
-#define E_ADDRESSBOOK_REFLOW_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER, EAddressbookReflowAdapter))
-#define E_ADDRESSBOOK_REFLOW_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER, EAddressbookReflowAdapterClass))
-#define E_IS_ADDRESSBOOK_REFLOW_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER))
-#define E_IS_ADDRESSBOOK_REFLOW_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER))
-
-typedef struct _EAddressbookReflowAdapter EAddressbookReflowAdapter;
-typedef struct _EAddressbookReflowAdapterPrivate EAddressbookReflowAdapterPrivate;
-typedef struct _EAddressbookReflowAdapterClass EAddressbookReflowAdapterClass;
-
-struct _EAddressbookReflowAdapter {
- EReflowModel parent;
-
- EAddressbookReflowAdapterPrivate *priv;
-};
-
-
-struct _EAddressbookReflowAdapterClass {
- EReflowModelClass parent_class;
-
- /*
- * Signals
- */
- gint (* drag_begin) (EAddressbookReflowAdapter *adapter, GdkEvent *event);
-};
-
-
-GType e_addressbook_reflow_adapter_get_type (void);
-void e_addressbook_reflow_adapter_construct (EAddressbookReflowAdapter *adapter,
- EABModel *model);
-EReflowModel *e_addressbook_reflow_adapter_new (EABModel *model);
-
-/* Returns object with ref count of 1. */
-EContact *e_addressbook_reflow_adapter_get_contact (EAddressbookReflowAdapter *adapter,
- int index);
-#endif /* _E_ADDRESSBOOK_REFLOW_ADAPTER_H_ */
diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.c b/addressbook/gui/widgets/e-addressbook-table-adapter.c
deleted file mode 100644
index 9fa48084ed..0000000000
--- a/addressbook/gui/widgets/e-addressbook-table-adapter.c
+++ /dev/null
@@ -1,356 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#include <config.h>
-#include "e-addressbook-model.h"
-#include "e-addressbook-table-adapter.h"
-#include "eab-contact-merging.h"
-#include "eab-gui-util.h"
-#include "util/eab-destination.h"
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-#include <gnome.h>
-
-struct _EAddressbookTableAdapterPrivate {
- EABModel *model;
-
- int create_contact_id, remove_contact_id, modify_contact_id, model_changed_id;
-};
-
-#define PARENT_TYPE e_table_model_get_type()
-static ETableModelClass *parent_class;
-
-#define COLS (E_CONTACT_FIELD_LAST)
-
-static void
-unlink_model(EAddressbookTableAdapter *adapter)
-{
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
-
- g_signal_handler_disconnect (priv->model,
- priv->create_contact_id);
- g_signal_handler_disconnect (priv->model,
- priv->remove_contact_id);
- g_signal_handler_disconnect (priv->model,
- priv->modify_contact_id);
- g_signal_handler_disconnect (priv->model,
- priv->model_changed_id);
-
- priv->create_contact_id = 0;
- priv->remove_contact_id = 0;
- priv->modify_contact_id = 0;
- priv->model_changed_id = 0;
-
- g_object_unref (priv->model);
-
- priv->model = NULL;
-}
-
-static void
-addressbook_dispose(GObject *object)
-{
- EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER(object);
-
- if (adapter->priv) {
- unlink_model(adapter);
-
- g_free (adapter->priv);
- adapter->priv = NULL;
- }
-
- 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
-addressbook_col_count (ETableModel *etc)
-{
- return COLS;
-}
-
-/* This function returns the number of rows in our ETableModel. */
-static int
-addressbook_row_count (ETableModel *etc)
-{
- EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER(etc);
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
-
- return eab_model_contact_count (priv->model);
-}
-
-/* This function returns the value at a particular point in our ETableModel. */
-static void *
-addressbook_value_at (ETableModel *etc, int col, int row)
-{
- EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER(etc);
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
- const char *value;
-
- if ( col >= COLS || row >= eab_model_contact_count (priv->model) )
- return NULL;
-
- value = e_contact_get_const((EContact*)eab_model_contact_at (priv->model, row), col);
-
- if (value && !strncmp (value, "<?xml", 5)) {
- EABDestination *dest = eab_destination_import (value);
- if (dest) {
- /* XXX blech, we leak this */
- value = g_strdup (eab_destination_get_textrep (dest, TRUE));
- g_object_unref (dest);
- }
- }
-
-
- return (void *)(value ? value : "");
-}
-
-/* This function sets the value at a particular point in our ETableModel. */
-static void
-contact_modified_cb (EBook* book, EBookStatus status,
- gpointer user_data)
-{
- if (status != E_BOOK_ERROR_OK)
- eab_error_dialog (_("Error modifying card"), status);
-}
-
-static void
-addressbook_set_value_at (ETableModel *etc, int col, int row, const void *val)
-{
- EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER(etc);
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
-
- if (eab_model_editable (priv->model)) {
- EContact *contact;
-
- if (col >= COLS || row >= eab_model_contact_count (priv->model))
- return;
-
- contact = eab_model_get_contact (priv->model, row);
- if (!contact)
- return;
-
- e_table_model_pre_change(etc);
-
- e_contact_set(contact, col, (void *) val);
- eab_merging_book_commit_contact (eab_model_get_ebook (priv->model),
- contact, contact_modified_cb, NULL);
-
- g_object_unref (contact);
-
- /* XXX do we need this? shouldn't the commit_contact generate a changed signal? */
- e_table_model_cell_changed(etc, col, row);
- }
-}
-
-/* This function returns whether a particular cell is editable. */
-static gboolean
-addressbook_is_cell_editable (ETableModel *etc, int col, int row)
-{
- EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER(etc);
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
- const EContact *contact;
-
- if (row >= 0 && row < eab_model_contact_count (priv->model))
- contact = eab_model_contact_at (priv->model, row);
- else
- contact = NULL;
-
- if (!eab_model_editable(priv->model))
- return FALSE;
- else if (contact && e_contact_get ((EContact *) contact, E_CONTACT_IS_LIST))
- /* we only allow editing of the name and file as for
- lists */
- return col == E_CONTACT_FULL_NAME || col == E_CONTACT_FILE_AS;
- else
- return col < E_CONTACT_LAST_SIMPLE_STRING;
-
- return FALSE;
-}
-
-static void
-addressbook_append_row (ETableModel *etm, ETableModel *source, gint row)
-{
- EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER(etm);
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
- EContact *contact;
- int col;
-
- contact = e_contact_new ();
-
- for (col = 1; col < E_CONTACT_LAST_SIMPLE_STRING; col++) {
- const void *val = e_table_model_value_at (source, col, row);
- e_contact_set (contact, col, (void *) val);
- }
-
- eab_merging_book_add_contact (eab_model_get_ebook (priv->model), contact, NULL, NULL);
-
- g_object_unref (contact);
-}
-
-/* This function duplicates the value passed to it. */
-static void *
-addressbook_duplicate_value (ETableModel *etc, int col, const void *value)
-{
- return g_strdup(value);
-}
-
-/* This function frees the value passed to it. */
-static void
-addressbook_free_value (ETableModel *etc, int col, void *value)
-{
- g_free(value);
-}
-
-static void *
-addressbook_initialize_value (ETableModel *etc, int col)
-{
- return g_strdup("");
-}
-
-static gboolean
-addressbook_value_is_empty (ETableModel *etc, int col, const void *value)
-{
- return !(value && *(char *)value);
-}
-
-static char *
-addressbook_value_to_string (ETableModel *etc, int col, const void *value)
-{
- return g_strdup(value);
-}
-
-static void
-eab_table_adapter_class_init (GObjectClass *object_class)
-{
- ETableModelClass *model_class = (ETableModelClass *) object_class;
-
- parent_class = g_type_class_peek_parent (object_class);
-
- object_class->dispose = addressbook_dispose;
-
- model_class->column_count = addressbook_col_count;
- model_class->row_count = addressbook_row_count;
- model_class->value_at = addressbook_value_at;
- model_class->set_value_at = addressbook_set_value_at;
- model_class->is_cell_editable = addressbook_is_cell_editable;
- model_class->append_row = addressbook_append_row;
- model_class->duplicate_value = addressbook_duplicate_value;
- model_class->free_value = addressbook_free_value;
- model_class->initialize_value = addressbook_initialize_value;
- model_class->value_is_empty = addressbook_value_is_empty;
- model_class->value_to_string = addressbook_value_to_string;
-}
-
-static void
-eab_table_adapter_init (GObject *object)
-{
- EAddressbookTableAdapter *adapter = EAB_TABLE_ADAPTER(object);
- EAddressbookTableAdapterPrivate *priv;
-
- priv = adapter->priv = g_new0 (EAddressbookTableAdapterPrivate, 1);
-
- priv->create_contact_id = 0;
- priv->remove_contact_id = 0;
- priv->modify_contact_id = 0;
- priv->model_changed_id = 0;
-}
-
-
-static void
-create_contact (EABModel *model,
- gint index, gint count,
- EAddressbookTableAdapter *adapter)
-{
- e_table_model_pre_change (E_TABLE_MODEL (adapter));
- e_table_model_rows_inserted (E_TABLE_MODEL (adapter), index, count);
-}
-
-static void
-remove_contact (EABModel *model,
- gint index,
- EAddressbookTableAdapter *adapter)
-{
- e_table_model_pre_change (E_TABLE_MODEL (adapter));
- e_table_model_rows_deleted (E_TABLE_MODEL (adapter), index, 1);
-}
-
-static void
-modify_contact (EABModel *model,
- gint index,
- EAddressbookTableAdapter *adapter)
-{
- e_table_model_pre_change (E_TABLE_MODEL (adapter));
- e_table_model_row_changed (E_TABLE_MODEL (adapter), index);
-}
-
-static void
-model_changed (EABModel *model,
- EAddressbookTableAdapter *adapter)
-{
- e_table_model_pre_change (E_TABLE_MODEL (adapter));
- e_table_model_changed (E_TABLE_MODEL (adapter));
-}
-
-GType
-eab_table_adapter_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EAddressbookTableAdapterClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) eab_table_adapter_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EAddressbookTableAdapter),
- 0, /* n_preallocs */
- (GInstanceInitFunc) eab_table_adapter_init,
- };
-
- type = g_type_register_static (PARENT_TYPE, "EAddressbookTableAdapter", &info, 0);
- }
-
- return type;
-}
-
-void
-eab_table_adapter_construct (EAddressbookTableAdapter *adapter,
- EABModel *model)
-{
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
-
- priv->model = model;
- g_object_ref (priv->model);
-
- priv->create_contact_id = g_signal_connect(priv->model,
- "contact_added",
- G_CALLBACK(create_contact),
- adapter);
- priv->remove_contact_id = g_signal_connect(priv->model,
- "contact_removed",
- G_CALLBACK(remove_contact),
- adapter);
- priv->modify_contact_id = g_signal_connect(priv->model,
- "contact_changed",
- G_CALLBACK(modify_contact),
- adapter);
- priv->model_changed_id = g_signal_connect(priv->model,
- "model_changed",
- G_CALLBACK(model_changed),
- adapter);
-}
-
-ETableModel *
-eab_table_adapter_new (EABModel *model)
-{
- EAddressbookTableAdapter *et;
-
- et = g_object_new(E_TYPE_AB_TABLE_ADAPTER, NULL);
-
- eab_table_adapter_construct (et, model);
-
- return E_TABLE_MODEL(et);
-}
diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.h b/addressbook/gui/widgets/e-addressbook-table-adapter.h
deleted file mode 100644
index cf139e2bee..0000000000
--- a/addressbook/gui/widgets/e-addressbook-table-adapter.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#ifndef _EAB_TABLE_ADAPTER_H_
-#define _EAB_TABLE_ADAPTER_H_
-
-#include <gal/e-table/e-table-model.h>
-#include <libebook/e-book.h>
-#include <libebook/e-book-view.h>
-
-#define E_TYPE_AB_TABLE_ADAPTER (eab_table_adapter_get_type ())
-#define EAB_TABLE_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_AB_TABLE_ADAPTER, EAddressbookTableAdapter))
-#define EAB_TABLE_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_AB_TABLE_ADAPTER, EAddressbookTableAdapterClass))
-#define E_IS_ADDRESSBOOK_TABLE_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_AB_TABLE_ADAPTER))
-#define E_IS_ADDRESSBOOK_TABLE_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_AB_TABLE_ADAPTER))
-
-typedef struct _EAddressbookTableAdapter EAddressbookTableAdapter;
-typedef struct _EAddressbookTableAdapterPrivate EAddressbookTableAdapterPrivate;
-typedef struct _EAddressbookTableAdapterClass EAddressbookTableAdapterClass;
-
-struct _EAddressbookTableAdapter {
- ETableModel parent;
-
- EAddressbookTableAdapterPrivate *priv;
-};
-
-
-struct _EAddressbookTableAdapterClass {
- ETableModelClass parent_class;
-};
-
-
-GType eab_table_adapter_get_type (void);
-void eab_table_adapter_construct (EAddressbookTableAdapter *adapter,
- EABModel *model);
-ETableModel *eab_table_adapter_new (EABModel *model);
-
-#endif /* _EAB_TABLE_ADAPTER_H_ */
diff --git a/addressbook/gui/widgets/e-addressbook-treeview-adapter.c b/addressbook/gui/widgets/e-addressbook-treeview-adapter.c
deleted file mode 100644
index 592f9d2b03..0000000000
--- a/addressbook/gui/widgets/e-addressbook-treeview-adapter.c
+++ /dev/null
@@ -1,630 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#include <config.h>
-#include "e-addressbook-model.h"
-#include "e-addressbook-treeview-adapter.h"
-#include "e-card-merging.h"
-#include "eab-gui-util.h"
-#include <gtk/gtktreednd.h>
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-
-struct _EAddressbookTreeViewAdapterPrivate {
- EAddressbookModel *model;
-
- gint stamp;
-
- ECardSimple **simples;
- int count;
-
- int create_card_id, remove_card_id, modify_card_id, model_changed_id;
-};
-
-#define PARENT_TYPE G_TYPE_OBJECT
-GObjectClass *parent_class;
-
-#define COLS (E_CARD_SIMPLE_FIELD_LAST)
-
-static void
-unlink_model(EAddressbookTreeViewAdapter *adapter)
-{
- EAddressbookTreeViewAdapterPrivate *priv = adapter->priv;
- int i;
-
- g_signal_handler_disconnect (priv->model,
- priv->create_card_id);
- g_signal_handler_disconnect (priv->model,
- priv->remove_card_id);
- g_signal_handler_disconnect (priv->model,
- priv->modify_card_id);
- g_signal_handler_disconnect (priv->model,
- priv->model_changed_id);
-
- priv->create_card_id = 0;
- priv->remove_card_id = 0;
- priv->modify_card_id = 0;
- priv->model_changed_id = 0;
-
- /* free up the existing mapping if there is one */
- if (priv->simples) {
- for (i = 0; i < priv->count; i ++)
- g_object_unref (priv->simples[i]);
- g_free (priv->simples);
- priv->simples = NULL;
- }
-
- g_object_unref (priv->model);
-
- priv->model = NULL;
-}
-
-static void
-build_simple_mapping(EAddressbookTreeViewAdapter *adapter)
-{
- EAddressbookTreeViewAdapterPrivate *priv = adapter->priv;
- int i;
-
- /* free up the existing mapping if there is one */
- if (priv->simples) {
- for (i = 0; i < priv->count; i ++)
- g_object_unref (priv->simples[i]);
- g_free (priv->simples);
- }
-
- /* build up our mapping to ECardSimple*'s */
- priv->count = e_addressbook_model_card_count (priv->model);
- priv->simples = g_new (ECardSimple*, priv->count);
- for (i = 0; i < priv->count; i ++) {
- priv->simples[i] = e_card_simple_new (e_addressbook_model_card_at (priv->model, i));
- g_object_ref (priv->simples[i]);
- }
-}
-
-static void
-addressbook_destroy(GtkObject *object)
-{
- EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER(object);
-
- unlink_model(adapter);
-
- g_free (adapter->priv);
- adapter->priv = NULL;
-
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-#if 0
-static void
-addressbook_set_value_at (ETableModel *etc, int col, int row, const void *val)
-{
- EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(etc);
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
- if (e_addressbook_model_editable (priv->model)) {
- ECard *card;
-
- if ( col >= COLS|| row >= e_addressbook_model_card_count (priv->model) )
- return;
-
- e_table_model_pre_change(etc);
-
- e_card_simple_set(priv->simples[row],
- col,
- val);
- g_object_get(priv->simples[row],
- "card", &card,
- NULL);
-
- e_card_merging_book_commit_card(e_addressbook_model_get_ebook(priv->model),
- card, card_modified_cb, NULL);
-
- /* XXX do we need this? shouldn't the commit_card generate a changed signal? */
- e_table_model_cell_changed(etc, col, row);
- }
-}
-
-/* This function returns whether a particular cell is editable. */
-static gboolean
-addressbook_is_cell_editable (ETableModel *etc, int col, int row)
-{
- EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(etc);
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
- ECard *card;
-
- if (row >= 0 && row < e_addressbook_model_card_count (priv->model))
- card = e_addressbook_model_card_at (priv->model, row);
- else
- card = NULL;
-
- if (!e_addressbook_model_editable(priv->model))
- return FALSE;
- else if (card && e_card_evolution_list (card))
- /* we only allow editing of the name and file as for
- lists */
- return col == E_CARD_SIMPLE_FIELD_FULL_NAME || col == E_CARD_SIMPLE_FIELD_FILE_AS;
- else
- return col < E_CARD_SIMPLE_FIELD_LAST_SIMPLE_STRING;
-}
-
-static void
-addressbook_append_row (ETableModel *etm, ETableModel *source, gint row)
-{
- EAddressbookTableAdapter *adapter = E_ADDRESSBOOK_TABLE_ADAPTER(etm);
- EAddressbookTableAdapterPrivate *priv = adapter->priv;
- ECard *card;
- ECardSimple *simple;
- int col;
-
- card = e_card_new("");
- simple = e_card_simple_new(card);
-
- for (col = 0; col < E_CARD_SIMPLE_FIELD_LAST_SIMPLE_STRING; col++) {
- const void *val = e_table_model_value_at(source, col, row);
- e_card_simple_set(simple, col, val);
- }
- e_card_simple_sync_card(simple);
- e_card_merging_book_add_card (e_addressbook_model_get_ebook (priv->model), card, NULL, NULL);
- g_object_unref (simple);
- g_object_unref (card);
-}
-#endif
-
-static void
-e_addressbook_treeview_adapter_class_init (GtkObjectClass *object_class)
-{
- parent_class = g_type_class_peek_parent (object_class);
-
- object_class->destroy = addressbook_destroy;
-}
-
-static void
-e_addressbook_treeview_adapter_init (GtkObject *object)
-{
- EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER(object);
- EAddressbookTreeViewAdapterPrivate *priv;
-
- priv = adapter->priv = g_new0 (EAddressbookTreeViewAdapterPrivate, 1);
-
- priv->create_card_id = 0;
- priv->remove_card_id = 0;
- priv->modify_card_id = 0;
- priv->model_changed_id = 0;
- priv->simples = NULL;
- priv->count = 0;
-}
-
-static void
-get_iter (EAddressbookTreeViewAdapter *adapter, gint index, GtkTreeIter *iter)
-{
- EAddressbookTreeViewAdapterPrivate *priv = adapter->priv;
-
- iter->stamp = priv->stamp;
- iter->user_data = GINT_TO_POINTER (index);
-}
-
-static void
-create_card (EAddressbookModel *model,
- gint index, gint count,
- EAddressbookTreeViewAdapter *adapter)
-{
- EAddressbookTreeViewAdapterPrivate *priv = adapter->priv;
- int i;
-
- priv->count += count;
- priv->simples = g_renew(ECardSimple *, priv->simples, priv->count);
- memmove (priv->simples + index + count, priv->simples + index, (priv->count - index - count) * sizeof (ECardSimple *));
-
- for (i = 0; i < count; i ++) {
- GtkTreeIter iter;
- GtkTreePath *path;
-
- priv->simples[index + i] = e_card_simple_new (e_addressbook_model_card_at (priv->model, index + i));
-
- get_iter (adapter, index + i, &iter);
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (adapter), &iter);
-
- gtk_tree_model_row_inserted (GTK_TREE_MODEL (adapter), path, &iter);
- gtk_tree_model_row_changed (GTK_TREE_MODEL (adapter), path, &iter);
-
- gtk_tree_path_free (path);
- }
-}
-
-static void
-remove_card (EAddressbookModel *model,
- gint index,
- EAddressbookTreeViewAdapter *adapter)
-{
- EAddressbookTreeViewAdapterPrivate *priv = adapter->priv;
- GtkTreeIter iter;
- GtkTreePath *path;
-
- g_object_unref (priv->simples[index]);
- memmove (priv->simples + index, priv->simples + index + 1, (priv->count - index - 1) * sizeof (ECardSimple *));
- priv->count --;
- get_iter (adapter, index, &iter);
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (adapter), &iter);
-
- gtk_tree_model_row_deleted (GTK_TREE_MODEL (adapter), path);
-
- gtk_tree_path_free (path);
-}
-
-static void
-modify_card (EAddressbookModel *model,
- gint index,
- EAddressbookTreeViewAdapter *adapter)
-{
- EAddressbookTreeViewAdapterPrivate *priv = adapter->priv;
- GtkTreeIter iter;
- GtkTreePath *path;
-
- g_object_unref (priv->simples[index]);
- priv->simples[index] = e_card_simple_new (e_addressbook_model_card_at (priv->model, index));
-
- get_iter (adapter, index, &iter);
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (adapter), &iter);
-
- gtk_tree_model_row_changed (GTK_TREE_MODEL (adapter), path, &iter);
-
- gtk_tree_path_free (path);
-}
-
-static void
-model_changed (EAddressbookModel *model,
- EAddressbookTreeViewAdapter *adapter)
-{
- int i;
-
- /* there has *got* to be an easier/faster way to do this... */
- for (i = 0; i < adapter->priv->count; i++) {
- remove_card (model, i, adapter);
- }
-
- build_simple_mapping (adapter);
-
- if (adapter->priv->count) {
- printf ("AIIEEEEEE\n");
- }
-
- /* XXX this isn't right either, we need to add the new cards */
-}
-
-static GtkTreeModelFlags
-adapter_get_flags (GtkTreeModel *tree_model)
-{
- g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), 0);
-
- return GTK_TREE_MODEL_LIST_ONLY;
-}
-
-static gint
-adapter_get_n_columns (GtkTreeModel *tree_model)
-{
- g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), 0);
-
- return COLS;
-}
-
-static GType
-adapter_get_column_type (GtkTreeModel *tree_model,
- gint index)
-{
- g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), G_TYPE_INVALID);
- g_return_val_if_fail (index < COLS && index >= 0, G_TYPE_INVALID);
-
- return G_TYPE_STRING;
-}
-
-static gboolean
-adapter_get_iter (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreePath *path)
-{
- EAddressbookTreeViewAdapter *adapter;
- GSList *list;
- gint i;
-
- g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), FALSE);
- g_return_val_if_fail (gtk_tree_path_get_depth (path) > 0, FALSE);
-
- adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model);
-
- i = gtk_tree_path_get_indices (path)[0];
-
- if (i >= adapter->priv->count)
- return FALSE;
-
- iter->stamp = adapter->priv->stamp;
- iter->user_data = GINT_TO_POINTER (i);
-
- return TRUE;
-}
-
-static GtkTreePath *
-adapter_get_path (GtkTreeModel *tree_model,
- GtkTreeIter *iter)
-{
- EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model);
- GtkTreePath *retval;
-
- g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), NULL);
- g_return_val_if_fail (iter->stamp == adapter->priv->stamp, NULL);
-
-
- if (GPOINTER_TO_INT (iter->user_data) >= adapter->priv->count)
- return NULL;
-
- retval = gtk_tree_path_new ();
- gtk_tree_path_append_index (retval, GPOINTER_TO_INT (iter->user_data));
- return retval;
-}
-
-static void
-adapter_get_value (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- gint column,
- GValue *value)
-{
- EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model);
- ECardSimple *simple;
- gint tmp_column = column;
- const char *v;
-
- g_return_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model));
- g_return_if_fail (column < COLS);
- g_return_if_fail (adapter->priv->stamp == iter->stamp);
-
- simple = adapter->priv->simples [ GPOINTER_TO_INT (iter->user_data) ];
-
- v = e_card_simple_get_const(simple, column);
-
- if (v && !strncmp (v, "<?xml", 5)) {
- EABDestination *dest = eab_destination_import (v);
- if (dest) {
- /* XXX blech, we leak this */
- v = g_strdup (eab_destination_get_textrep (dest, TRUE));
- g_object_unref (dest);
- }
- }
-
- g_value_init (value, G_TYPE_STRING);
- g_value_set_string (value, (v ? v : ""));
-}
-
-static gboolean
-adapter_iter_next (GtkTreeModel *tree_model,
- GtkTreeIter *iter)
-{
- EAddressbookTreeViewAdapter *adapter;
-
- g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), FALSE);
- g_return_val_if_fail (E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model)->priv->stamp == iter->stamp, FALSE);
-
- adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model);
-
- iter->user_data = GINT_TO_POINTER (GPOINTER_TO_INT (iter->user_data) + 1);
-
- return (GPOINTER_TO_INT (iter->user_data) < adapter->priv->count);
-}
-
-static gboolean
-adapter_iter_children (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreeIter *parent)
-{
- EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model);
-
- /* this is a list, nodes have no children */
- if (parent)
- return FALSE;
-
- /* but if parent == NULL we return the list itself as children of the
- * "root"
- */
- if (adapter->priv->count) {
- iter->stamp = adapter->priv->stamp;
- iter->user_data = GINT_TO_POINTER (0);
- return TRUE;
- }
- else
- return FALSE;
-}
-
-static gboolean
-adapter_iter_has_child (GtkTreeModel *tree_model,
- GtkTreeIter *iter)
-{
- return FALSE;
-}
-
-static gint
-adapter_iter_n_children (GtkTreeModel *tree_model,
- GtkTreeIter *iter)
-{
- EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model);
-
- g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), -1);
- if (iter == NULL)
- return adapter->priv->count;
-
- g_return_val_if_fail (adapter->priv->stamp == iter->stamp, -1);
- return 0;
-}
-
-static gboolean
-adapter_iter_nth_child (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreeIter *parent,
- gint n)
-{
- EAddressbookTreeViewAdapter *adapter = E_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model);
-
- g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (tree_model), FALSE);
-
- if (parent)
- return FALSE;
-
- if (n < adapter->priv->count) {
- iter->stamp = adapter->priv->stamp;
- iter->user_data = GINT_TO_POINTER (n);
- return TRUE;
- }
- else
- return FALSE;
-}
-
-static gboolean
-adapter_iter_parent (GtkTreeModel *tree_model,
- GtkTreeIter *iter,
- GtkTreeIter *child)
-{
- return FALSE;
-}
-
-static void
-adapter_tree_model_init (GtkTreeModelIface *iface)
-{
- iface->get_flags = adapter_get_flags;
- iface->get_n_columns = adapter_get_n_columns;
- iface->get_column_type = adapter_get_column_type;
- iface->get_iter = adapter_get_iter;
- iface->get_path = adapter_get_path;
- iface->get_value = adapter_get_value;
- iface->iter_next = adapter_iter_next;
- iface->iter_children = adapter_iter_children;
- iface->iter_has_child = adapter_iter_has_child;
- iface->iter_n_children = adapter_iter_n_children;
- iface->iter_nth_child = adapter_iter_nth_child;
- iface->iter_parent = adapter_iter_parent;
-}
-
-static gboolean
-adapter_drag_data_delete (GtkTreeDragSource *drag_source,
- GtkTreePath *path)
-{
- g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (drag_source), FALSE);
-
- return FALSE;
-}
-
-static gboolean
-adapter_drag_data_get (GtkTreeDragSource *drag_source,
- GtkTreePath *path,
- GtkSelectionData *selection_data)
-{
- g_return_val_if_fail (E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER (drag_source), FALSE);
-
- /* Note that we don't need to handle the GTK_TREE_MODEL_ROW
- * target, because the default handler does it for us, but
- * we do anyway for the convenience of someone maybe overriding the
- * default handler.
- */
-
- if (gtk_tree_set_row_drag_data (selection_data,
- GTK_TREE_MODEL (drag_source),
- path)) {
- return TRUE;
- }
- else {
- if (selection_data->target == gdk_atom_intern ("text/x-vcard", FALSE)) {
- printf ("HI THERE\n");
- }
- }
-
- return FALSE;
-}
-
-static void
-adapter_drag_source_init (GtkTreeDragSourceIface *iface)
-{
- iface->drag_data_delete = adapter_drag_data_delete;
- iface->drag_data_get = adapter_drag_data_get;
-}
-
-GType
-e_addressbook_treeview_adapter_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo adapter_info = {
- sizeof (EAddressbookTreeViewAdapterClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_addressbook_treeview_adapter_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EAddressbookTreeViewAdapter),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_addressbook_treeview_adapter_init,
- };
-
- static const GInterfaceInfo tree_model_info = {
- (GInterfaceInitFunc) adapter_tree_model_init,
- NULL,
- NULL
- };
-
- static const GInterfaceInfo drag_source_info = {
- (GInterfaceInitFunc) adapter_drag_source_init,
- NULL,
- NULL
- };
-
- type = g_type_register_static (PARENT_TYPE, "EAddressbookTreeViewAdapter", &adapter_info, 0);
-
- g_type_add_interface_static (type,
- GTK_TYPE_TREE_MODEL,
- &tree_model_info);
-
- g_type_add_interface_static (type,
- GTK_TYPE_TREE_DRAG_SOURCE,
- &drag_source_info);
- }
-
- return type;
-}
-
-void
-e_addressbook_treeview_adapter_construct (EAddressbookTreeViewAdapter *adapter,
- EAddressbookModel *model)
-{
- EAddressbookTreeViewAdapterPrivate *priv = adapter->priv;
-
- priv->model = model;
- g_object_ref (priv->model);
-
- priv->stamp = g_random_int ();
-
- priv->create_card_id = g_signal_connect(priv->model,
- "card_added",
- G_CALLBACK(create_card),
- adapter);
- priv->remove_card_id = g_signal_connect(priv->model,
- "card_removed",
- G_CALLBACK(remove_card),
- adapter);
- priv->modify_card_id = g_signal_connect(priv->model,
- "card_changed",
- G_CALLBACK(modify_card),
- adapter);
- priv->model_changed_id = g_signal_connect(priv->model,
- "model_changed",
- G_CALLBACK(model_changed),
- adapter);
-
- build_simple_mapping (adapter);
-}
-
-GtkTreeModel *
-e_addressbook_treeview_adapter_new (EAddressbookModel *model)
-{
- EAddressbookTreeViewAdapter *et;
-
- et = g_object_new(E_TYPE_ADDRESSBOOK_TREEVIEW_ADAPTER, NULL);
-
- e_addressbook_treeview_adapter_construct (et, model);
-
- return (GtkTreeModel*)et;
-}
diff --git a/addressbook/gui/widgets/e-addressbook-treeview-adapter.h b/addressbook/gui/widgets/e-addressbook-treeview-adapter.h
deleted file mode 100644
index 2c4370dee3..0000000000
--- a/addressbook/gui/widgets/e-addressbook-treeview-adapter.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-#ifndef _E_ADDRESSBOOK_TREEVIEW_ADAPTER_H_
-#define _E_ADDRESSBOOK_TREEVIEW_ADAPTER_H_
-
-#include <gtk/gtktreemodel.h>
-#include "addressbook/backend/ebook/e-book.h"
-#include "addressbook/backend/ebook/e-book-view.h"
-#include "addressbook/backend/ebook/e-card-simple.h"
-
-#define E_TYPE_ADDRESSBOOK_TREEVIEW_ADAPTER (e_addressbook_treeview_adapter_get_type ())
-#define E_ADDRESSBOOK_TREEVIEW_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_ADDRESSBOOK_TREEVIEW_ADAPTER, EAddressbookTreeViewAdapter))
-#define E_ADDRESSBOOK_TREEVIEW_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_ADDRESSBOOK_TREEVIEW_ADAPTER, EAddressbookTreeViewAdapterClass))
-#define E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_ADDRESSBOOK_TREEVIEW_ADAPTER))
-#define E_IS_ADDRESSBOOK_TREEVIEW_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_ADDRESSBOOK_TREEVIEW_ADAPTER))
-
-/* Virtual Column list:
- 0 Email
- 1 Full Name
- 2 Street
- 3 Phone
-*/
-
-typedef struct _EAddressbookTreeViewAdapter EAddressbookTreeViewAdapter;
-typedef struct _EAddressbookTreeViewAdapterPrivate EAddressbookTreeViewAdapterPrivate;
-typedef struct _EAddressbookTreeViewAdapterClass EAddressbookTreeViewAdapterClass;
-
-struct _EAddressbookTreeViewAdapter {
- GObject parent;
-
- EAddressbookTreeViewAdapterPrivate *priv;
-};
-
-
-struct _EAddressbookTreeViewAdapterClass {
- GObjectClass parent_class;
-};
-
-
-GType e_addressbook_treeview_adapter_get_type (void);
-void e_addressbook_treeview_adapter_construct (EAddressbookTreeViewAdapter *adapter,
- EAddressbookModel *model);
-GtkTreeModel *e_addressbook_treeview_adapter_new (EAddressbookModel *model);
-
-#endif /* _E_ADDRESSBOOK_TABLE_ADAPTER_H_ */
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
deleted file mode 100644
index 5303b279be..0000000000
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ /dev/null
@@ -1,1855 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-field-chooser.c
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of 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 <gtk/gtk.h>
-
-#include <libgnome/gnome-i18n.h>
-#include <libgnome/gnome-util.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gal/e-table/e-table-scrolled.h>
-#include <gal/e-table/e-table-model.h>
-#include <gal/widgets/e-popup-menu.h>
-#include <gal/widgets/e-gui-utils.h>
-#include <gal/menus/gal-view-factory-etable.h>
-#include <gal/menus/gal-view-etable.h>
-#include <gal/util/e-xml-utils.h>
-#include <libgnomeui/gnome-dialog-util.h>
-
-#include <libgnomeprint/gnome-print.h>
-#include <libgnomeprint/gnome-print-job.h>
-#include <libgnomeprintui/gnome-print-dialog.h>
-#include <libgnomeprintui/gnome-print-job-preview.h>
-
-#include "addressbook/printing/e-contact-print.h"
-#include "addressbook/printing/e-contact-print-envelope.h"
-
-#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW
-#include <gal/widgets/e-treeview-selection-model.h>
-#include "gal-view-factory-treeview.h"
-#include "gal-view-treeview.h"
-#endif
-#include "gal-view-minicard.h"
-#include "gal-view-factory-minicard.h"
-
-#include "eab-marshal.h"
-#include "e-addressbook-view.h"
-#include "e-addressbook-model.h"
-#include "eab-gui-util.h"
-#include "util/eab-book-util.h"
-#include "e-addressbook-table-adapter.h"
-#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW
-#include "e-addressbook-treeview-adapter.h"
-#endif
-#include "eab-contact-merging.h"
-
-#include "e-contact-editor.h"
-#include <gdk/gdkkeysyms.h>
-#include <ctype.h>
-#include <string.h>
-
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-
-#define SHOW_ALL_SEARCH "(contains \"x-evolution-any-field\" \"\")"
-
-#define d(x)
-
-static void eab_view_init (EABView *card);
-static void eab_view_class_init (EABViewClass *klass);
-
-static void eab_view_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void eab_view_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-
-static void eab_view_dispose (GObject *object);
-static void change_view_type (EABView *view, EABViewType view_type);
-
-static void status_message (GtkObject *object, const gchar *status, EABView *eav);
-static void search_result (GtkObject *object, EBookViewStatus status, EABView *eav);
-static void folder_bar_message (GtkObject *object, const gchar *status, EABView *eav);
-static void stop_state_changed (GtkObject *object, EABView *eav);
-static void writable_status (GtkObject *object, gboolean writable, EABView *eav);
-static void backend_died (GtkObject *object, EABView *eav);
-static void command_state_change (EABView *eav);
-
-static void selection_clear_event (GtkWidget *invisible, GdkEventSelection *event,
- EABView *view);
-static void selection_received (GtkWidget *invisible, GtkSelectionData *selection_data,
- guint time, EABView *view);
-static void selection_get (GtkWidget *invisible, GtkSelectionData *selection_data,
- guint info, guint time_stamp, EABView *view);
-static void invisible_destroyed (gpointer data, GObject *where_object_was);
-
-#define PARENT_TYPE GTK_TYPE_EVENT_BOX
-static GtkEventBoxClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- PROP_0,
- PROP_BOOK,
- PROP_QUERY,
- PROP_TYPE,
-};
-
-enum {
- STATUS_MESSAGE,
- SEARCH_RESULT,
- FOLDER_BAR_MESSAGE,
- COMMAND_STATE_CHANGE,
- LAST_SIGNAL
-};
-
-enum DndTargetType {
- DND_TARGET_TYPE_VCARD,
-};
-#define VCARD_TYPE "text/x-vcard"
-static GtkTargetEntry drag_types[] = {
- { VCARD_TYPE, 0, DND_TARGET_TYPE_VCARD },
-};
-static const int num_drag_types = sizeof (drag_types) / sizeof (drag_types[0]);
-
-static guint eab_view_signals [LAST_SIGNAL] = {0, };
-
-static GdkAtom clipboard_atom = GDK_NONE;
-
-static GalViewCollection *collection = NULL;
-
-GType
-eab_view_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EABViewClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) eab_view_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EABView),
- 0, /* n_preallocs */
- (GInstanceInitFunc) eab_view_init,
- };
-
- type = g_type_register_static (PARENT_TYPE, "EABView", &info, 0);
- }
-
- return type;
-}
-
-static void
-eab_view_class_init (EABViewClass *klass)
-{
- GObjectClass *object_class;
- GtkWidgetClass *widget_class;
-
- object_class = G_OBJECT_CLASS(klass);
- widget_class = GTK_WIDGET_CLASS(klass);
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->set_property = eab_view_set_property;
- object_class->get_property = eab_view_get_property;
- object_class->dispose = eab_view_dispose;
-
- g_object_class_install_property (object_class, PROP_BOOK,
- g_param_spec_object ("book",
- _("Book"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_BOOK,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_QUERY,
- g_param_spec_string ("query",
- _("Query"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_TYPE,
- g_param_spec_int ("type",
- _("Type"),
- /*_( */"XXX blurb" /*)*/,
- EAB_VIEW_NONE,
- EAB_VIEW_TABLE,
- EAB_VIEW_NONE,
- G_PARAM_READWRITE));
-
- eab_view_signals [STATUS_MESSAGE] =
- g_signal_new ("status_message",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABViewClass, status_message),
- NULL, NULL,
- eab_marshal_NONE__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
-
- eab_view_signals [SEARCH_RESULT] =
- g_signal_new ("search_result",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABViewClass, search_result),
- NULL, NULL,
- eab_marshal_NONE__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- eab_view_signals [FOLDER_BAR_MESSAGE] =
- g_signal_new ("folder_bar_message",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABViewClass, folder_bar_message),
- NULL, NULL,
- eab_marshal_NONE__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
-
- eab_view_signals [COMMAND_STATE_CHANGE] =
- g_signal_new ("command_state_change",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EABViewClass, command_state_change),
- NULL, NULL,
- eab_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- if (!clipboard_atom)
- clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
-}
-
-static void
-eab_view_init (EABView *eav)
-{
- eav->view_type = EAB_VIEW_NONE;
-
- eav->model = NULL;
- eav->object = NULL;
- eav->widget = NULL;
- eav->scrolled = NULL;
- eav->contact_display = NULL;
-
- eav->view_instance = NULL;
- eav->view_menus = NULL;
- eav->current_view = NULL;
- eav->uic = NULL;
-
- eav->book = NULL;
- eav->query = NULL;
-
- eav->invisible = NULL;
- eav->clipboard_contacts = NULL;
-}
-
-static void
-eab_view_dispose (GObject *object)
-{
- EABView *eav = EAB_VIEW(object);
-
- if (eav->model) {
- g_signal_handlers_disconnect_matched (eav->model,
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL,
- object);
- g_object_unref (eav->model);
- eav->model = NULL;
- }
-
- if (eav->book) {
- g_object_unref (eav->book);
- eav->book = NULL;
- }
-
- if (eav->query) {
- g_free(eav->query);
- eav->query = NULL;
- }
-
- eav->uic = NULL;
-
- if (eav->view_instance) {
- g_object_unref (eav->view_instance);
- eav->view_instance = NULL;
- }
-
- if (eav->view_menus) {
- g_object_unref (eav->view_menus);
- eav->view_menus = NULL;
- }
-
- if (eav->clipboard_contacts) {
- g_list_foreach (eav->clipboard_contacts, (GFunc)g_object_unref, NULL);
- g_list_free (eav->clipboard_contacts);
- eav->clipboard_contacts = NULL;
- }
-
- if (eav->invisible) {
- gtk_widget_destroy (eav->invisible);
- eav->invisible = NULL;
- }
-
- if (G_OBJECT_CLASS(parent_class)->dispose)
- G_OBJECT_CLASS(parent_class)->dispose(object);
-}
-
-GtkWidget*
-eab_view_new (void)
-{
- GtkWidget *widget = GTK_WIDGET (g_object_new (E_TYPE_AB_VIEW, NULL));
- EABView *eav = EAB_VIEW (widget);
-
- /* create our model */
- eav->model = eab_model_new ();
-
- g_signal_connect (eav->model, "status_message",
- G_CALLBACK (status_message), eav);
- g_signal_connect (eav->model, "search_result",
- G_CALLBACK (search_result), eav);
- g_signal_connect (eav->model, "folder_bar_message",
- G_CALLBACK (folder_bar_message), eav);
- g_signal_connect (eav->model, "stop_state_changed",
- G_CALLBACK (stop_state_changed), eav);
- g_signal_connect (eav->model, "writable_status",
- G_CALLBACK (writable_status), eav);
- g_signal_connect (eav->model, "backend_died",
- G_CALLBACK (backend_died), eav);
-
- eav->editable = FALSE;
- eav->query = g_strdup (SHOW_ALL_SEARCH);
-
- /* create the paned window and contact display */
- eav->paned = gtk_vpaned_new ();
- gtk_container_add (GTK_CONTAINER (eav), eav->paned);
-
- eav->widget = gtk_label_new ("empty label here");
- gtk_container_add (GTK_CONTAINER (eav->paned), eav->widget);
- gtk_widget_show (eav->widget);
-
- eav->scrolled = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (eav->scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (eav->scrolled), GTK_SHADOW_IN);
- eav->contact_display = eab_contact_display_new ();
-
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (eav->scrolled), eav->contact_display);
- gtk_widget_show (eav->contact_display);
-
- gtk_container_add (GTK_CONTAINER (eav->paned), eav->scrolled);
- gtk_widget_show (eav->scrolled);
- gtk_widget_show (eav->paned);
-
- /* XXX hack */
- gtk_paned_set_position (GTK_PANED (eav->paned), 144);
-
- /* gtk selection crap */
- eav->invisible = gtk_invisible_new ();
-
- gtk_selection_add_target (eav->invisible,
- clipboard_atom,
- GDK_SELECTION_TYPE_STRING,
- 0);
-
- g_signal_connect (eav->invisible, "selection_get",
- G_CALLBACK (selection_get),
- eav);
- g_signal_connect (eav->invisible, "selection_clear_event",
- G_CALLBACK (selection_clear_event),
- eav);
- g_signal_connect (eav->invisible, "selection_received",
- G_CALLBACK (selection_received),
- eav);
- g_object_weak_ref (G_OBJECT (eav->invisible), invisible_destroyed, eav);
-
- return widget;
-}
-
-static void
-writable_status (GtkObject *object, gboolean writable, EABView *eav)
-{
- eav->editable = writable;
- command_state_change (eav);
-}
-
-static void
-init_collection (void)
-{
- GalViewFactory *factory;
- ETableSpecification *spec;
- char *galview;
-
- if (collection == NULL) {
- collection = gal_view_collection_new();
-
- gal_view_collection_set_title (collection, _("Addressbook"));
-
- galview = gnome_util_prepend_user_home("/evolution/views/addressbook/");
- gal_view_collection_set_storage_directories
- (collection,
- EVOLUTION_GALVIEWSDIR "/addressbook/",
- galview);
- g_free(galview);
-
- spec = e_table_specification_new();
- e_table_specification_load_from_file (spec, EVOLUTION_ETSPECDIR "/e-addressbook-view.etspec");
-
- factory = gal_view_factory_etable_new (spec);
- g_object_unref (spec);
- gal_view_collection_add_factory (collection, factory);
- g_object_unref (factory);
-
- factory = gal_view_factory_minicard_new();
- gal_view_collection_add_factory (collection, factory);
- g_object_unref (factory);
-
-#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW
- factory = gal_view_factory_treeview_new ();
- gal_view_collection_add_factory (collection, factory);
- g_object_unref (factory);
-#endif
-
- gal_view_collection_load(collection);
- }
-}
-
-static void
-display_view(GalViewInstance *instance,
- GalView *view,
- gpointer data)
-{
- EABView *address_view = data;
- if (GAL_IS_VIEW_ETABLE(view)) {
- change_view_type (address_view, EAB_VIEW_TABLE);
- gal_view_etable_attach_table (GAL_VIEW_ETABLE(view), e_table_scrolled_get_table(E_TABLE_SCROLLED(address_view->widget)));
- }
- else if (GAL_IS_VIEW_MINICARD(view)) {
- change_view_type (address_view, EAB_VIEW_MINICARD);
- gal_view_minicard_attach (GAL_VIEW_MINICARD (view), E_MINICARD_VIEW_WIDGET (address_view->object));
- }
-#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW
- else if (GAL_IS_VIEW_TREEVIEW (view)) {
- change_view_type (address_view, EAB_VIEW_TREEVIEW);
- gal_view_treeview_attach (GAL_VIEW_TREEVIEW(view), GTK_TREE_VIEW (address_view->object));
- }
-#endif
- address_view->current_view = view;
-}
-
-static void
-setup_menus (EABView *view)
-{
- if (view->book && view->view_instance == NULL) {
- init_collection ();
- view->view_instance = gal_view_instance_new (collection, e_book_get_uri (view->book));
- }
-
- if (view->view_instance && view->uic) {
- view->view_menus = gal_view_menus_new(view->view_instance);
- gal_view_menus_apply(view->view_menus, view->uic, NULL);
-
- display_view (view->view_instance, gal_view_instance_get_current_view (view->view_instance), view);
-
- g_signal_connect(view->view_instance, "display_view",
- G_CALLBACK (display_view), view);
- }
-}
-
-static void
-eab_view_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- EABView *eav = EAB_VIEW(object);
-
- switch (prop_id){
- case PROP_BOOK:
- if (eav->book) {
- g_object_unref (eav->book);
- }
- if (g_value_get_object (value)) {
- eav->book = E_BOOK(g_value_get_object (value));
- g_object_ref (eav->book);
- }
- else
- eav->book = NULL;
-
- if (eav->view_instance) {
- g_object_unref (eav->view_instance);
- eav->view_instance = NULL;
- }
-
- g_object_set(eav->model,
- "book", eav->book,
- NULL);
-
- setup_menus (eav);
-
- break;
- case PROP_QUERY:
-#if 0 /* This code will mess up ldap a bit. We need to think about the ramifications of this more. */
- if ((g_value_get_string (value) == NULL && !strcmp (eav->query, SHOW_ALL_SEARCH)) ||
- (g_value_get_string (value) != NULL && !strcmp (eav->query, g_value_get_string (value))))
- break;
-#endif
- g_free(eav->query);
- eav->query = g_strdup(g_value_get_string (value));
- if (!eav->query)
- eav->query = g_strdup (SHOW_ALL_SEARCH);
- g_object_set(eav->model,
- "query", eav->query,
- NULL);
- break;
- case PROP_TYPE:
- change_view_type(eav, g_value_get_int (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-eab_view_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- EABView *eav = EAB_VIEW(object);
-
- switch (prop_id) {
- case PROP_BOOK:
- if (eav->book)
- g_value_set_object (value, eav->book);
- else
- g_value_set_object (value, NULL);
- break;
- case PROP_QUERY:
- g_value_set_string (value, eav->query);
- break;
- case PROP_TYPE:
- g_value_set_int (value, eav->view_type);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static ESelectionModel*
-get_selection_model (EABView *view)
-{
- if (view->view_type == EAB_VIEW_TABLE)
- return e_table_get_selection_model (e_table_scrolled_get_table (E_TABLE_SCROLLED(view->widget)));
- else if (view->view_type == EAB_VIEW_MINICARD)
- return e_minicard_view_widget_get_selection_model (E_MINICARD_VIEW_WIDGET(view->object));
-#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW
- else if (view->view_type == EAB_VIEW_TREEVIEW)
- return e_treeview_get_selection_model (GTK_TREE_VIEW (view->object));
-#endif
- g_return_val_if_reached (NULL);
-}
-
-/* Popup menu stuff */
-typedef struct {
- EABView *view;
- EPopupMenu *submenu;
- gpointer closure;
-} ContactAndBook;
-
-static ESelectionModel*
-contact_and_book_get_selection_model (ContactAndBook *contact_and_book)
-{
- return get_selection_model (contact_and_book->view);
-}
-
-static void
-contact_and_book_free (ContactAndBook *contact_and_book)
-{
- EABView *view = contact_and_book->view;
- ESelectionModel *selection;
-
- if (contact_and_book->submenu)
- gal_view_instance_free_popup_menu (view->view_instance,
- contact_and_book->submenu);
-
- selection = contact_and_book_get_selection_model (contact_and_book);
- if (selection)
- e_selection_model_right_click_up(selection);
-
- g_object_unref (view);
-}
-
-static void
-get_contact_list_1(gint model_row,
- gpointer closure)
-{
- ContactAndBook *contact_and_book;
- GList **list;
- EABView *view;
- EContact *contact;
-
- contact_and_book = closure;
- list = contact_and_book->closure;
- view = contact_and_book->view;
-
- contact = eab_model_get_contact(view->model, model_row);
- *list = g_list_prepend(*list, contact);
-}
-
-static GList *
-get_contact_list (ContactAndBook *contact_and_book)
-{
- GList *list = NULL;
- ESelectionModel *selection;
-
- selection = contact_and_book_get_selection_model (contact_and_book);
-
- if (selection) {
- contact_and_book->closure = &list;
- e_selection_model_foreach (selection, get_contact_list_1, contact_and_book);
- }
-
- return list;
-}
-
-static void
-has_email_address_1(gint model_row,
- gpointer closure)
-{
- ContactAndBook *contact_and_book;
- gboolean *has_email;
- EABView *view;
- const EContact *contact;
- GList *email;
-
- contact_and_book = closure;
- has_email = contact_and_book->closure;
- view = contact_and_book->view;
-
- if (*has_email)
- return;
-
- contact = eab_model_contact_at(view->model, model_row);
-
- email = e_contact_get (E_CONTACT (contact), E_CONTACT_EMAIL);
-
- if (g_list_length (email) > 0)
- *has_email = TRUE;
-
- g_list_foreach (email, (GFunc)g_free, NULL);
- g_list_free (email);
-}
-
-static gboolean
-get_has_email_address (ContactAndBook *contact_and_book)
-{
- ESelectionModel *selection;
- gboolean has_email = FALSE;
-
- selection = contact_and_book_get_selection_model (contact_and_book);
-
- if (selection) {
- contact_and_book->closure = &has_email;
- e_selection_model_foreach (selection, has_email_address_1, contact_and_book);
- }
-
- return has_email;
-}
-
-static void
-save_as (GtkWidget *widget, ContactAndBook *contact_and_book)
-{
- GList *contacts = get_contact_list (contact_and_book);
- if (contacts) {
- eab_contact_list_save(_("Save as VCard"), contacts, NULL);
- e_free_object_list(contacts);
- }
-}
-
-static void
-send_as (GtkWidget *widget, ContactAndBook *contact_and_book)
-{
- GList *contacts = get_contact_list (contact_and_book);
- if (contacts) {
- eab_send_contact_list(contacts, EAB_DISPOSITION_AS_ATTACHMENT);
- e_free_object_list(contacts);
- }
-}
-
-static void
-send_to (GtkWidget *widget, ContactAndBook *contact_and_book)
-
-{
- GList *contacts = get_contact_list (contact_and_book);
-
- if (contacts) {
- eab_send_contact_list(contacts, EAB_DISPOSITION_AS_TO);
- e_free_object_list(contacts);
- }
-}
-
-static void
-print (GtkWidget *widget, ContactAndBook *contact_and_book)
-{
- GList *contacts = get_contact_list (contact_and_book);
- if (contacts) {
- if (contacts->next)
- gtk_widget_show(e_contact_print_contact_list_dialog_new(contacts));
- else
- gtk_widget_show(e_contact_print_contact_dialog_new(contacts->data));
- e_free_object_list(contacts);
- }
-}
-
-#if 0 /* Envelope printing is disabled for Evolution 1.0. */
-static void
-print_envelope (GtkWidget *widget, ContactAndBook *contact_and_book)
-{
- GList *cards = get_card_list (contact_and_book);
- if (cards) {
- gtk_widget_show(e_contact_list_print_envelope_dialog_new(contact_and_book->card));
- e_free_object_list(cards);
- }
-}
-#endif
-
-static void
-copy (GtkWidget *widget, ContactAndBook *contact_and_book)
-{
- eab_view_copy (contact_and_book->view);
-}
-
-static void
-paste (GtkWidget *widget, ContactAndBook *contact_and_book)
-{
- eab_view_paste (contact_and_book->view);
-}
-
-static void
-cut (GtkWidget *widget, ContactAndBook *contact_and_book)
-{
- eab_view_cut (contact_and_book->view);
-}
-
-static void
-delete (GtkWidget *widget, ContactAndBook *contact_and_book)
-{
- if (e_contact_editor_confirm_delete(GTK_WINDOW(gtk_widget_get_toplevel(contact_and_book->view->widget)))) {
- EBook *book;
- GList *list = get_contact_list(contact_and_book);
- GList *iterator;
- gboolean bulk_remove = FALSE;
-
- bulk_remove = e_book_check_static_capability (contact_and_book->view->model->book,
- "bulk-remove");
-
- g_object_get(contact_and_book->view->model,
- "book", &book,
- NULL);
-
- if (bulk_remove) {
- GList *ids = NULL;
-
- for (iterator = list; iterator; iterator = iterator->next) {
- EContact *contact = iterator->data;
- ids = g_list_prepend (ids, (char*)e_contact_get_const (contact, E_CONTACT_UID));
- }
-
- /* Remove the cards all at once. */
- /* XXX no callback specified... ugh */
- e_book_async_remove_contacts (book,
- ids,
- NULL,
- NULL);
-
- g_list_free (ids);
- }
- else {
- for (iterator = list; iterator; iterator = iterator->next) {
- EContact *contact = iterator->data;
- /* Remove the card. */
- /* XXX no callback specified... ugh */
- e_book_async_remove_contact (book,
- e_contact_get_const (contact, E_CONTACT_UID),
- NULL,
- NULL);
- }
- }
- e_free_object_list(list);
- g_object_unref(book);
- }
-}
-
-static void
-copy_to_folder (GtkWidget *widget, ContactAndBook *contact_and_book)
-{
- eab_view_copy_to_folder (contact_and_book->view);
-}
-
-static void
-move_to_folder (GtkWidget *widget, ContactAndBook *contact_and_book)
-{
- eab_view_move_to_folder (contact_and_book->view);
-}
-
-static void
-free_popup_info (GtkWidget *w, ContactAndBook *contact_and_book)
-{
- contact_and_book_free (contact_and_book);
-}
-
-static void
-new_card (GtkWidget *widget, ContactAndBook *contact_and_book)
-{
- EBook *book;
- EContact *contact = e_contact_new();
-
- g_object_get(contact_and_book->view->model,
- "book", &book,
- NULL);
-
- eab_show_contact_editor (book, contact, TRUE, TRUE);
- g_object_unref (book);
- g_object_unref (contact);
-}
-
-static void
-new_list (GtkWidget *widget, ContactAndBook *contact_and_book)
-{
- EBook *book;
- EContact *contact = e_contact_new ();
-
- g_object_get(contact_and_book->view->model,
- "book", &book,
- NULL);
- eab_show_contact_list_editor (book, contact, TRUE, TRUE);
- g_object_unref(book);
- g_object_unref(contact);
-}
-
-#if 0
-static void
-sources (GtkWidget *widget, ContactAndBook *contact_and_book)
-{
- BonoboControl *control;
- GNOME_Evolution_ShellView shell_view;
- CORBA_Environment ev;
-
- control = g_object_get_data (G_OBJECT (gcal), "control");
- if (control == NULL)
- return;
-
- shell_view = get_shell_view_interface (control);
- if (shell_view == CORBA_OBJECT_NIL)
- return;
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_ShellView_showSettings (shell_view, &ev);
-
- if (BONOBO_EX (&ev))
- g_message ("control_util_show_settings(): Could not show settings");
-
- CORBA_exception_free (&ev);
-}
-#endif
-
-#define POPUP_READONLY_MASK 0x1
-#define POPUP_NOSELECTION_MASK 0x2
-#define POPUP_NOEMAIL_MASK 0x4
-
-static void
-do_popup_menu(EABView *view, GdkEvent *event)
-{
- ContactAndBook *contact_and_book;
- GtkMenu *popup;
- EPopupMenu *submenu = NULL;
- ESelectionModel *selection_model;
- gboolean selection = FALSE;
-
- EPopupMenu menu[] = {
- E_POPUP_ITEM (N_("New Contact..."), G_CALLBACK(new_card), POPUP_READONLY_MASK),
- E_POPUP_ITEM (N_("New Contact List..."), G_CALLBACK(new_list), POPUP_READONLY_MASK),
- E_POPUP_SEPARATOR,
-#if 0
- E_POPUP_ITEM (N_("Go to Folder..."), G_CALLBACK (goto_folder), 0),
- E_POPUP_ITEM (N_("Import..."), G_CALLBACK (import), POPUP_READONLY_MASK),
- E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("Search for Contacts..."), G_CALLBACK (search), 0),
- E_POPUP_ITEM (N_("Addressbook Sources..."), G_CALLBACK (sources), 0),
- E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("Pilot Settings..."), G_CALLBACK (pilot_settings), 0),
-#endif
- E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("Save as VCard"), G_CALLBACK(save_as), POPUP_NOSELECTION_MASK),
- E_POPUP_ITEM (N_("Forward Contact"), G_CALLBACK(send_as), POPUP_NOSELECTION_MASK),
- E_POPUP_ITEM (N_("Send Message to Contact"), G_CALLBACK(send_to), POPUP_NOSELECTION_MASK | POPUP_NOEMAIL_MASK),
- E_POPUP_ITEM (N_("Print"), G_CALLBACK(print), POPUP_NOSELECTION_MASK),
-#if 0 /* Envelope printing is disabled for Evolution 1.0. */
- E_POPUP_ITEM (N_("Print Envelope"), G_CALLBACK(print_envelope), POPUP_NOSELECTION_MASK),
-#endif
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("Copy to folder..."), G_CALLBACK(copy_to_folder), POPUP_NOSELECTION_MASK),
- E_POPUP_ITEM (N_("Move to folder..."), G_CALLBACK(move_to_folder), POPUP_READONLY_MASK | POPUP_NOSELECTION_MASK),
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("Cut"), G_CALLBACK (cut), POPUP_READONLY_MASK | POPUP_NOSELECTION_MASK),
- E_POPUP_ITEM (N_("Copy"), G_CALLBACK (copy), POPUP_NOSELECTION_MASK),
- E_POPUP_ITEM (N_("Paste"), G_CALLBACK (paste), POPUP_READONLY_MASK),
- E_POPUP_ITEM (N_("Delete"), G_CALLBACK(delete), POPUP_READONLY_MASK | POPUP_NOSELECTION_MASK),
- E_POPUP_SEPARATOR,
-
-#if 0
- E_POPUP_SUBMENU (N_("Current View"), submenu = gal_view_instance_get_popup_menu (view->view_instance), 0),
-#endif
- E_POPUP_TERMINATOR
- };
-
- contact_and_book = g_new(ContactAndBook, 1);
- contact_and_book->view = view;
- contact_and_book->submenu = submenu;
-
- g_object_ref (contact_and_book->view);
-
- selection_model = contact_and_book_get_selection_model (contact_and_book);
- if (selection_model)
- selection = e_selection_model_selected_count (selection_model) > 0;
-
- popup = e_popup_menu_create (menu,
- 0,
- (eab_model_editable (view->model) ? 0 : POPUP_READONLY_MASK) +
- (selection ? 0 : POPUP_NOSELECTION_MASK) +
- (get_has_email_address (contact_and_book) ? 0 : POPUP_NOEMAIL_MASK),
- contact_and_book);
-
- g_signal_connect (popup, "selection-done",
- G_CALLBACK (free_popup_info), contact_and_book);
- e_popup_menu (popup, event);
-
-}
-
-static void
-render_contact (int row, EABView *view)
-{
- EContact *contact = eab_model_get_contact (view->model, row);
-
- eab_contact_display_render (EAB_CONTACT_DISPLAY (view->contact_display), contact,
- EAB_CONTACT_DISPLAY_RENDER_NORMAL);
-}
-
-static void
-selection_changed (GObject *o, EABView *view)
-{
- ESelectionModel *selection_model;
-
- command_state_change (view);
-
- selection_model = get_selection_model (view);
-
- if (e_selection_model_selected_count (selection_model) == 1)
- e_selection_model_foreach (selection_model,
- (EForeachFunc)render_contact, view);
- else
- eab_contact_display_render (EAB_CONTACT_DISPLAY (view->contact_display), NULL,
- EAB_CONTACT_DISPLAY_RENDER_NORMAL);
-
-}
-
-static void
-table_double_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EABView *view)
-{
- if (E_IS_ADDRESSBOOK_TABLE_ADAPTER(view->object)) {
- EABModel *model = view->model;
- EContact *contact = eab_model_get_contact (model, row);
- EBook *book;
-
- g_object_get(model,
- "book", &book,
- NULL);
-
- g_assert (E_IS_BOOK (book));
-
- if (e_contact_get (contact, E_CONTACT_IS_LIST))
- eab_show_contact_list_editor (book, contact, FALSE, view->editable);
- else
- eab_show_contact_editor (book, contact, FALSE, view->editable);
-
- g_object_unref (book);
- g_object_unref (contact);
- }
-}
-
-static gint
-table_right_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EABView *view)
-{
- do_popup_menu(view, event);
- return TRUE;
-}
-
-static gint
-table_white_space_event(ETableScrolled *table, GdkEvent *event, EABView *view)
-{
- if (event->type == GDK_BUTTON_PRESS && ((GdkEventButton *)event)->button == 3) {
- do_popup_menu(view, event);
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-static void
-table_drag_data_get (ETable *table,
- int row,
- int col,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- gpointer user_data)
-{
- EABView *view = user_data;
-
- if (!E_IS_ADDRESSBOOK_TABLE_ADAPTER(view->object))
- return;
-
- switch (info) {
- case DND_TARGET_TYPE_VCARD: {
- char *value;
-
- value = e_vcard_to_string (E_VCARD (view->model->data[row]), EVC_FORMAT_VCARD_30);
-
- gtk_selection_data_set (selection_data,
- selection_data->target,
- 8,
- value, strlen (value));
- break;
- }
- }
-}
-
-static void
-emit_status_message (EABView *eav, const gchar *status)
-{
- g_signal_emit (eav,
- eab_view_signals [STATUS_MESSAGE], 0,
- status);
-}
-
-static void
-emit_search_result (EABView *eav, EBookViewStatus status)
-{
- g_signal_emit (eav,
- eab_view_signals [SEARCH_RESULT], 0,
- status);
-}
-
-static void
-emit_folder_bar_message (EABView *eav, const gchar *message)
-{
- g_signal_emit (eav,
- eab_view_signals [FOLDER_BAR_MESSAGE], 0,
- message);
-}
-
-static void
-status_message (GtkObject *object, const gchar *status, EABView *eav)
-{
- emit_status_message (eav, status);
-}
-
-static void
-search_result (GtkObject *object, EBookViewStatus status, EABView *eav)
-{
- emit_search_result (eav, status);
-}
-
-static void
-folder_bar_message (GtkObject *object, const gchar *status, EABView *eav)
-{
- emit_folder_bar_message (eav, status);
-}
-
-static void
-stop_state_changed (GtkObject *object, EABView *eav)
-{
- command_state_change (eav);
-}
-
-static void
-command_state_change (EABView *eav)
-{
- /* Reffing during emission is unnecessary. Gtk automatically refs during an emission. */
- g_signal_emit (eav, eab_view_signals [COMMAND_STATE_CHANGE], 0);
-}
-
-static void
-backend_died (GtkObject *object, EABView *eav)
-{
- char *message = g_strdup_printf (_("The addressbook backend for\n%s\nhas crashed. "
- "You will have to restart Evolution in order "
- "to use it again"),
- e_book_get_uri (eav->book));
- gnome_error_dialog_parented (message, GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (eav))));
- g_free (message);
-}
-
-static void
-minicard_right_click (EMinicardView *minicard_view_item, GdkEvent *event, EABView *view)
-{
- do_popup_menu(view, event);
-}
-
-static void
-create_minicard_view (EABView *view)
-{
- GtkWidget *scrolled_window;
- GtkWidget *minicard_view;
- EAddressbookReflowAdapter *adapter;
-
- adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(e_addressbook_reflow_adapter_new (view->model));
- minicard_view = e_minicard_view_widget_new(adapter);
-
- g_signal_connect(minicard_view, "selection_change",
- G_CALLBACK(selection_changed), view);
-
- g_signal_connect(minicard_view, "right_click",
- G_CALLBACK(minicard_right_click), view);
-
- scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window), GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
-
- view->object = G_OBJECT(minicard_view);
- view->widget = scrolled_window;
-
- gtk_container_add (GTK_CONTAINER (scrolled_window), minicard_view);
- gtk_widget_show (minicard_view);
-
- gtk_widget_show_all( GTK_WIDGET(scrolled_window) );
-
- gtk_paned_add1 (GTK_PANED (view->paned), scrolled_window);
-
- e_reflow_model_changed (E_REFLOW_MODEL (adapter));
-}
-
-static void
-create_table_view (EABView *view)
-{
- ETableModel *adapter;
- GtkWidget *table;
-
- adapter = eab_table_adapter_new(view->model);
-
- /* Here we create the table. We give it the three pieces of
- the table we've created, the header, the model, and the
- initial layout. It does the rest. */
- table = e_table_scrolled_new_from_spec_file (adapter, NULL, EVOLUTION_ETSPECDIR "/e-addressbook-view.etspec", NULL);
-
- view->object = G_OBJECT(adapter);
- view->widget = table;
-
- g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "double_click",
- G_CALLBACK(table_double_click), view);
- g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "right_click",
- G_CALLBACK(table_right_click), view);
- g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "white_space_event",
- G_CALLBACK(table_white_space_event), view);
- g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "selection_change",
- G_CALLBACK(selection_changed), view);
-
- /* drag & drop signals */
- e_table_drag_source_set (E_TABLE(E_TABLE_SCROLLED(table)->table), GDK_BUTTON1_MASK,
- drag_types, num_drag_types, GDK_ACTION_MOVE);
-
- g_signal_connect (E_TABLE_SCROLLED(table)->table,
- "table_drag_data_get",
- G_CALLBACK (table_drag_data_get),
- view);
-
- gtk_paned_add1 (GTK_PANED (view->paned), table);
-
- gtk_widget_show( GTK_WIDGET(table) );
-}
-
-#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW
-static void
-treeview_row_activated(GtkTreeView *treeview,
- GtkTreePath *path, GtkTreeViewColumn *column,
- EABView *view)
-{
- EABModel *model = view->model;
- int row = gtk_tree_path_get_indices (path)[0];
- ECard *card = eab_model_get_card(model, row);
- EBook *book;
-
- g_object_get(model,
- "book", &book,
- NULL);
-
- g_assert (E_IS_BOOK (book));
-
- if (e_card_evolution_list (card))
- eab_show_contact_list_editor (book, card, FALSE, view->editable);
- else
- eab_show_contact_editor (book, card, FALSE, view->editable);
-
- g_object_unref (book);
- g_object_unref (card);
-}
-
-static void
-create_treeview_view (EABView *view)
-{
- GtkTreeModel *adapter;
- ECardSimple *simple;
- GtkWidget *treeview;
- GtkWidget *scrolled;
- int i;
-
- simple = e_card_simple_new(NULL);
-
- adapter = eab_treeview_adapter_new(view->model);
-
- scrolled = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_shadow (GTK_SCROLLED_WINDOW (scrolled), GTK_SHADOW_IN);
- treeview = gtk_tree_view_new_with_model (adapter);
-
- gtk_widget_show (treeview);
-
- gtk_container_add (GTK_CONTAINER (scrolled), treeview);
-
- for (i = 0; i < 15; i ++) {
- GtkTreeViewColumn *column =
- gtk_tree_view_column_new_with_attributes (e_card_simple_get_name (simple, i),
- gtk_cell_renderer_text_new (),
- "text", i,
- NULL);
-
- gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
- }
-
- view->object = G_OBJECT(treeview);
- view->widget = scrolled;
-
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)), GTK_SELECTION_MULTIPLE);
- gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (treeview),
- GDK_BUTTON1_MASK,
- drag_types,
- num_drag_types,
- GDK_ACTION_MOVE);
-
- g_signal_connect(treeview, "row_activated",
- G_CALLBACK (treeview_row_activated), view);
-#if 0
- g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(table)), "right_click",
- G_CALLBACK(table_right_click), view);
-
- /* drag & drop signals */
- e_table_drag_source_set (E_TABLE(E_TABLE_SCROLLED(table)->table), GDK_BUTTON1_MASK,
- drag_types, num_drag_types, GDK_ACTION_MOVE);
-
- g_signal_connect (E_TABLE_SCROLLED(table)->table,
- "table_drag_data_get",
- G_CALLBACK (table_drag_data_get),
- view);
-#endif
-
-
- g_signal_connect(e_treeview_get_selection_model (GTK_TREE_VIEW (treeview)), "selection_changed",
- G_CALLBACK(selection_changed), view);
-
- gtk_paned_add1 (GTK_PANED (view->paned), scrolled);
-
- gtk_widget_show( GTK_WIDGET(scrolled) );
-
- g_object_unref (simple);
-}
-#endif
-
-static void
-change_view_type (EABView *view, EABViewType view_type)
-{
- if (view_type == view->view_type)
- return;
-
- if (view->widget) {
- gtk_container_remove (GTK_CONTAINER (view->paned), view->widget);
- view->widget = NULL;
- }
- view->object = NULL;
-
- switch (view_type) {
- case EAB_VIEW_TABLE:
- create_table_view (view);
- break;
- case EAB_VIEW_MINICARD:
- create_minicard_view (view);
- break;
-#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW
- case EAB_VIEW_TREEVIEW:
- create_treeview_view (view);
- break;
-#endif
- default:
- g_warning ("view_type not recognized.");
- return;
- }
-
- view->view_type = view_type;
-
- command_state_change (view);
-}
-
-typedef struct {
- GtkWidget *table;
- GObject *printable;
-} EContactPrintDialogWeakData;
-
-static void
-e_contact_print_destroy(gpointer data, GObject *where_object_was)
-{
- EContactPrintDialogWeakData *weak_data = data;
- g_object_unref (weak_data->printable);
- g_object_unref (weak_data->table);
- g_free (weak_data);
-}
-
-static void
-e_contact_print_button(GtkDialog *dialog, gint response, gpointer data)
-{
- GnomePrintJob *master;
- GnomePrintContext *pc;
- EPrintable *printable = g_object_get_data(G_OBJECT(dialog), "printable");
- GtkWidget *preview;
- switch( response ) {
- case GNOME_PRINT_DIALOG_RESPONSE_PRINT:
- master = gnome_print_job_new(gnome_print_dialog_get_config ( GNOME_PRINT_DIALOG(dialog) ));
- pc = gnome_print_job_get_context( master );
- e_printable_reset(printable);
- while (e_printable_data_left(printable)) {
- if (gnome_print_gsave(pc) == -1)
- /* FIXME */;
- if (gnome_print_translate(pc, 72, 72) == -1)
- /* FIXME */;
- e_printable_print_page(printable,
- pc,
- 6.5 * 72,
- 5 * 72,
- TRUE);
- if (gnome_print_grestore(pc) == -1)
- /* FIXME */;
- if (gnome_print_showpage(pc) == -1)
- /* FIXME */;
- }
- gnome_print_job_close(master);
- gnome_print_job_print(master);
- g_object_unref (master);
- gtk_widget_destroy((GtkWidget *)dialog);
- break;
- case GNOME_PRINT_DIALOG_RESPONSE_PREVIEW:
- master = gnome_print_job_new (gnome_print_dialog_get_config ( GNOME_PRINT_DIALOG(dialog) ));
- pc = gnome_print_job_get_context( master );
- e_printable_reset(printable);
- while (e_printable_data_left(printable)) {
- if (gnome_print_gsave(pc) == -1)
- /* FIXME */;
- if (gnome_print_translate(pc, 72, 72) == -1)
- /* FIXME */;
- e_printable_print_page(printable,
- pc,
- 6.5 * 72,
- 9 * 72,
- TRUE);
- if (gnome_print_grestore(pc) == -1)
- /* FIXME */;
- if (gnome_print_showpage(pc) == -1)
- /* FIXME */;
- }
- gnome_print_job_close(master);
- preview = GTK_WIDGET(gnome_print_job_preview_new(master, "Print Preview"));
- gtk_widget_show_all(preview);
- g_object_unref (master);
- break;
- case GNOME_PRINT_DIALOG_RESPONSE_CANCEL:
- default:
- gtk_widget_destroy((GtkWidget *)dialog);
- break;
- }
-}
-
-void
-eab_view_setup_menus (EABView *view,
- BonoboUIComponent *uic)
-{
-
- g_return_if_fail (view != NULL);
- g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
- g_return_if_fail (uic != NULL);
- g_return_if_fail (BONOBO_IS_UI_COMPONENT (uic));
-
- init_collection ();
-
- view->uic = uic;
-
- setup_menus (view);
-}
-
-/**
- * eab_view_discard_menus:
- * @view: An addressbook view.
- *
- * Makes an addressbook view discard its GAL view menus and its views instance
- * objects. This should be called when the corresponding Bonobo component is
- * deactivated.
- **/
-void
-eab_view_discard_menus (EABView *view)
-{
- g_return_if_fail (view != NULL);
- g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
- g_return_if_fail (view->view_instance);
-
- if (view->view_menus) {
- gal_view_menus_unmerge (view->view_menus, NULL);
-
- g_object_unref (view->view_menus);
- view->view_menus = NULL;
- }
-
- if (view->view_instance) {
- g_object_unref (view->view_instance);
- view->view_instance = NULL;
- }
-
- view->uic = NULL;
-}
-
-void
-eab_view_print(EABView *view)
-{
- if (view->view_type == EAB_VIEW_MINICARD) {
- char *query;
- EBook *book;
- GtkWidget *print;
-
- g_object_get (view->model,
- "query", &query,
- "book", &book,
- NULL);
- print = e_contact_print_dialog_new(book, query);
- g_free(query);
- gtk_widget_show_all(print);
- }
- else if (view->view_type == EAB_VIEW_TABLE) {
- GtkWidget *dialog;
- EPrintable *printable;
- ETable *etable;
- EContactPrintDialogWeakData *weak_data;
-
- dialog = gnome_print_dialog_new(NULL, "Print cards", GNOME_PRINT_DIALOG_RANGE | GNOME_PRINT_DIALOG_COPIES);
- gnome_print_dialog_construct_range_any(GNOME_PRINT_DIALOG(dialog), GNOME_PRINT_RANGE_ALL | GNOME_PRINT_RANGE_SELECTION,
- NULL, NULL, NULL);
-
- g_object_get(view->widget, "table", &etable, NULL);
- printable = e_table_get_printable(etable);
- g_object_unref(etable);
- g_object_ref (view->widget);
-
- g_object_set_data (G_OBJECT (dialog), "table", view->widget);
- g_object_set_data (G_OBJECT (dialog), "printable", printable);
-
- g_signal_connect(dialog,
- "response", G_CALLBACK(e_contact_print_button), NULL);
-
- weak_data = g_new (EContactPrintDialogWeakData, 1);
-
- weak_data->table = view->widget;
- weak_data->printable = G_OBJECT (printable);
-
- g_object_weak_ref (G_OBJECT (dialog), e_contact_print_destroy, weak_data);
-
- gtk_widget_show(dialog);
- }
-#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW
- else if (view->view_type == EAB_VIEW_TREEVIEW) {
- /* XXX */
- }
-#endif
-}
-
-void
-eab_view_print_preview(EABView *view)
-{
- if (view->view_type == EAB_VIEW_MINICARD) {
- char *query;
- EBook *book;
-
- g_object_get (view->model,
- "query", &query,
- "book", &book,
- NULL);
- e_contact_print_preview(book, query);
- g_free(query);
- }
- else if (view->view_type == EAB_VIEW_TABLE) {
- EPrintable *printable;
- ETable *etable;
- GnomePrintJob *master;
- GnomePrintContext *pc;
- GnomePrintConfig *config;
- GtkWidget *preview;
-
- g_object_get(view->widget, "table", &etable, NULL);
- printable = e_table_get_printable(etable);
- g_object_unref(etable);
-
- master = gnome_print_job_new(NULL);
- config = gnome_print_job_get_config (master);
- gnome_print_config_set_int (config, GNOME_PRINT_KEY_NUM_COPIES, 1);
- pc = gnome_print_job_get_context( master );
- e_printable_reset(printable);
- while (e_printable_data_left(printable)) {
- if (gnome_print_gsave(pc) == -1)
- /* FIXME */;
- if (gnome_print_translate(pc, 72, 72) == -1)
- /* FIXME */;
- e_printable_print_page(printable,
- pc,
- 6.5 * 72,
- 9 * 72,
- TRUE);
- if (gnome_print_grestore(pc) == -1)
- /* FIXME */;
- if (gnome_print_showpage(pc) == -1)
- /* FIXME */;
- }
- gnome_print_job_close(master);
- preview = GTK_WIDGET(gnome_print_job_preview_new(master, "Print Preview"));
- gtk_widget_show_all(preview);
- g_object_unref (master);
- g_object_unref (printable);
- }
-#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW
- else if (view->view_type == EAB_VIEW_TREEVIEW) {
- /* XXX */
- }
-#endif
-}
-
-void
-eab_view_delete_selection(EABView *view)
-{
- ContactAndBook contact_and_book;
-
- memset (&contact_and_book, 0, sizeof (contact_and_book));
- contact_and_book.view = view;
-
- delete (GTK_WIDGET (view), &contact_and_book);
-}
-
-static void
-invisible_destroyed (gpointer data, GObject *where_object_was)
-{
- EABView *view = data;
- view->invisible = NULL;
-}
-
-static void
-selection_get (GtkWidget *invisible,
- GtkSelectionData *selection_data,
- guint info,
- guint time_stamp,
- EABView *view)
-{
- char *value;
-
- value = eab_contact_list_to_string (view->clipboard_contacts);
-
- gtk_selection_data_set (selection_data, GDK_SELECTION_TYPE_STRING,
- 8, value, strlen (value));
-
-}
-
-static void
-selection_clear_event (GtkWidget *invisible,
- GdkEventSelection *event,
- EABView *view)
-{
- if (view->clipboard_contacts) {
- g_list_foreach (view->clipboard_contacts, (GFunc)g_object_unref, NULL);
- g_list_free (view->clipboard_contacts);
- view->clipboard_contacts = NULL;
- }
-}
-
-static void
-selection_received (GtkWidget *invisible,
- GtkSelectionData *selection_data,
- guint time,
- EABView *view)
-{
- if (selection_data->length < 0 || selection_data->type != GDK_SELECTION_TYPE_STRING) {
- return;
- }
- else {
- /* XXX make sure selection_data->data = \0 terminated */
- GList *contact_list = eab_contact_list_from_string (selection_data->data);
- GList *l;
-
- for (l = contact_list; l; l = l->next) {
- EContact *contact = l->data;
-
- /* XXX NULL for a callback /sigh */
- eab_merging_book_add_contact (view->book, contact, NULL /* XXX */, NULL);
- }
-
- g_list_foreach (contact_list, (GFunc)g_object_unref, NULL);
- g_list_free (contact_list);
- }
-}
-
-static void
-add_to_list (int model_row, gpointer closure)
-{
- GList **list = closure;
- *list = g_list_prepend (*list, GINT_TO_POINTER (model_row));
-}
-
-static GList *
-get_selected_contacts (EABView *view)
-{
- GList *list;
- GList *iterator;
- ESelectionModel *selection = get_selection_model (view);
-
- list = NULL;
- e_selection_model_foreach (selection, add_to_list, &list);
-
- for (iterator = list; iterator; iterator = iterator->next) {
- iterator->data = eab_model_get_contact (view->model, GPOINTER_TO_INT (iterator->data));
- }
- list = g_list_reverse (list);
- return list;
-}
-
-void
-eab_view_save_as (EABView *view)
-{
- GList *list = get_selected_contacts (view);
- if (list)
- eab_contact_list_save (_("Save as VCard"), list, NULL);
- e_free_object_list(list);
-}
-
-void
-eab_view_view (EABView *view)
-{
- GList *list = get_selected_contacts (view);
- eab_show_multiple_contacts (view->book, list, view->editable);
- e_free_object_list(list);
-}
-
-void
-eab_view_send (EABView *view)
-{
- GList *list = get_selected_contacts (view);
- if (list)
- eab_send_contact_list (list, EAB_DISPOSITION_AS_ATTACHMENT);
- e_free_object_list(list);
-}
-
-void
-eab_view_send_to (EABView *view)
-{
- GList *list = get_selected_contacts (view);
- if (list)
- eab_send_contact_list (list, EAB_DISPOSITION_AS_TO);
- e_free_object_list(list);
-}
-
-void
-eab_view_cut (EABView *view)
-{
- eab_view_copy (view);
- eab_view_delete_selection (view);
-}
-
-void
-eab_view_copy (EABView *view)
-{
- view->clipboard_contacts = get_selected_contacts (view);
-
- gtk_selection_owner_set (view->invisible, clipboard_atom, GDK_CURRENT_TIME);
-}
-
-void
-eab_view_paste (EABView *view)
-{
- gtk_selection_convert (view->invisible, clipboard_atom,
- GDK_SELECTION_TYPE_STRING,
- GDK_CURRENT_TIME);
-}
-
-void
-eab_view_select_all (EABView *view)
-{
- ESelectionModel *model = get_selection_model (view);
-
- g_return_if_fail (model);
-
- e_selection_model_select_all (model);
-}
-
-void
-eab_view_show_all(EABView *view)
-{
- g_object_set(view,
- "query", NULL,
- NULL);
-}
-
-void
-eab_view_stop(EABView *view)
-{
- if (view)
- eab_model_stop (view->model);
-}
-
-static void
-view_transfer_contacts (EABView *view, gboolean delete_from_source)
-{
- EBook *book;
- GList *contacts;
- GtkWindow *parent_window;
-
- g_object_get(view->model,
- "book", &book,
- NULL);
- contacts = get_selected_contacts (view);
- parent_window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view)));
-
- eab_transfer_contacts (book, contacts, delete_from_source, parent_window);
- g_object_unref(book);
-}
-
-void
-eab_view_copy_to_folder (EABView *view)
-{
- view_transfer_contacts (view, FALSE);
-}
-
-void
-eab_view_move_to_folder (EABView *view)
-{
- view_transfer_contacts (view, TRUE);
-}
-
-
-static gboolean
-eab_view_selection_nonempty (EABView *view)
-{
- ESelectionModel *selection_model;
-
- selection_model = get_selection_model (view);
- if (selection_model == NULL)
- return FALSE;
-
- return e_selection_model_selected_count (selection_model) != 0;
-}
-
-gboolean
-eab_view_can_create (EABView *view)
-{
- return view ? eab_model_editable (view->model) : FALSE;
-}
-
-gboolean
-eab_view_can_print (EABView *view)
-{
- return view && view->model ? eab_model_contact_count (view->model) : FALSE;
-}
-
-gboolean
-eab_view_can_save_as (EABView *view)
-{
- return view ? eab_view_selection_nonempty (view) : FALSE;
-}
-
-gboolean
-eab_view_can_view (EABView *view)
-{
- return view ? eab_view_selection_nonempty (view) : FALSE;
-}
-
-gboolean
-eab_view_can_send (EABView *view)
-{
- return view ? eab_view_selection_nonempty (view) : FALSE;
-}
-
-gboolean
-eab_view_can_send_to (EABView *view)
-{
- return view ? eab_view_selection_nonempty (view) : FALSE;
-}
-
-gboolean
-eab_view_can_delete (EABView *view)
-{
- return view ? eab_view_selection_nonempty (view) && eab_model_editable (view->model) : FALSE;
-}
-
-gboolean
-eab_view_can_cut (EABView *view)
-{
- return view ? eab_view_selection_nonempty (view) && eab_model_editable (view->model) : FALSE;
-}
-
-gboolean
-eab_view_can_copy (EABView *view)
-{
- return view ? eab_view_selection_nonempty (view) : FALSE;
-}
-
-gboolean
-eab_view_can_paste (EABView *view)
-{
- return view ? eab_model_editable (view->model) : FALSE;
-}
-
-gboolean
-eab_view_can_select_all (EABView *view)
-{
- return view ? eab_model_contact_count (view->model) != 0 : FALSE;
-}
-
-gboolean
-eab_view_can_stop (EABView *view)
-{
- return view ? eab_model_can_stop (view->model) : FALSE;
-}
-
-gboolean
-eab_view_can_copy_to_folder (EABView *view)
-{
- return view ? eab_view_selection_nonempty (view) : FALSE;
-}
-
-gboolean
-eab_view_can_move_to_folder (EABView *view)
-{
- return view ? eab_view_selection_nonempty (view) && eab_model_editable (view->model) : FALSE;
-}
diff --git a/addressbook/gui/widgets/e-addressbook-view.etspec b/addressbook/gui/widgets/e-addressbook-view.etspec
deleted file mode 100644
index 84f9ad44b8..0000000000
--- a/addressbook/gui/widgets/e-addressbook-view.etspec
+++ /dev/null
@@ -1,58 +0,0 @@
-<ETableSpecification draw-grid="true">
- <ETableColumn model_col= "2" _title="File As" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col= "3" _title="Full Name" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col= "4" _title="Given Name" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col= "5" _title="Family Name" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col= "6" _title="Nickname" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
-
- <ETableColumn model_col= "7" _title="Email" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col= "8" _title="Email 2" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col= "9" _title="Email 3" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
-
- <ETableColumn model_col= "14" _title="Assistant Phone" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col= "15" _title="Business Phone" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col= "16" _title="Business Phone 2" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="17" _title="Business Fax" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="18" _title="Callback Phone" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="19" _title="Car Phone" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="20" _title="Company Phone" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="21" _title="Home Phone" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="22" _title="Home Phone 2" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="23" _title="Home Fax" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="24" _title="ISDN Phone" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="25" _title="Mobile Phone" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="26" _title="Other Phone" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="27" _title="Other Fax" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="28" _title="Pager" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="29" _title="Primary Phone" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="30" _title="Radio" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="31" _title="Telex" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="32" _title="TTYTDD" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
-
- <ETableColumn model_col="33" _title="Organization" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="34" _title="Unit" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="35" _title="Office" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="36" _title="Title" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="37" _title="Role" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="38" _title="Manager" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="39" _title="Assistant" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
-
- <ETableColumn model_col="40" _title="Web Site" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="41" _title="Journal" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
-
- <ETableColumn model_col="42" _title="Categories" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
-
- <ETableColumn model_col="46" _title="Spouse" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
- <ETableColumn model_col="47" _title="Note" expansion="1.0" minimum_width="75" resizable="true" cell="string" compare="string"/>
-
- <ETableState>
- <column source="0"/>
- <column source="1"/>
- <column source="5"/>
- <column source="23"/>
- <column source="36"/>
- <grouping>
- <leaf column="0" ascending="true"/>
- </grouping>
- </ETableState>
-</ETableSpecification>
diff --git a/addressbook/gui/widgets/e-addressbook-view.h b/addressbook/gui/widgets/e-addressbook-view.h
deleted file mode 100644
index f819704550..0000000000
--- a/addressbook/gui/widgets/e-addressbook-view.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-addressbook-view.h
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of 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 __EAB_VIEW_H__
-#define __EAB_VIEW_H__
-
-#include <gtk/gtkeventbox.h>
-#include <bonobo/bonobo-ui-component.h>
-#include <gal/menus/gal-view-instance.h>
-#include <libebook/e-book.h>
-#include "e-addressbook-model.h"
-#include "eab-contact-display.h"
-#include "widgets/menus/gal-view-menus.h"
-
-G_BEGIN_DECLS
-
-/* EABView - A card displaying information about a contact.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- */
-
-#define E_TYPE_AB_VIEW (eab_view_get_type ())
-#define EAB_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_AB_VIEW, EABView))
-#define EAB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_AB_VIEW, EABViewClass))
-#define E_IS_ADDRESSBOOK_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_AB_VIEW))
-#define E_IS_ADDRESSBOOK_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_AB_VIEW))
-
-typedef enum {
- EAB_VIEW_NONE, /* initialized to this */
- EAB_VIEW_MINICARD,
- EAB_VIEW_TABLE,
-#ifdef WITH_ADDRESSBOOK_VIEW_TREEVIEW
- ,EAB_VIEW_TREEVIEW
-#endif
-} EABViewType;
-
-
-typedef struct _EABView EABView;
-typedef struct _EABViewClass EABViewClass;
-
-struct _EABView
-{
- GtkEventBox parent;
-
- /* item specific fields */
- EABViewType view_type;
-
- EABModel *model;
-
- GtkWidget *invisible;
- GList *clipboard_contacts;
-
- EBook *book;
- char *query;
- guint editable : 1;
-
- GObject *object;
- GtkWidget *widget;
-
- GtkWidget *scrolled;
- GtkWidget *contact_display;
- GtkWidget *paned;
-
- /* Menus handler and the view instance */
- GalViewInstance *view_instance;
- GalViewMenus *view_menus;
- GalView *current_view;
- BonoboUIComponent *uic;
-};
-
-struct _EABViewClass
-{
- GtkEventBoxClass parent_class;
-
- /*
- * Signals
- */
- void (*status_message) (EABView *view, const gchar *message);
- void (*search_result) (EABView *view, EBookViewStatus status);
- void (*folder_bar_message) (EABView *view, const gchar *message);
- void (*command_state_change) (EABView *view);
-};
-
-GtkWidget *eab_view_new (void);
-GType eab_view_get_type (void);
-
-void eab_view_setup_menus (EABView *view,
- BonoboUIComponent *uic);
-
-void eab_view_discard_menus (EABView *view);
-
-void eab_view_save_as (EABView *view);
-void eab_view_view (EABView *view);
-void eab_view_send (EABView *view);
-void eab_view_send_to (EABView *view);
-void eab_view_print (EABView *view);
-void eab_view_print_preview (EABView *view);
-void eab_view_delete_selection (EABView *view);
-void eab_view_cut (EABView *view);
-void eab_view_copy (EABView *view);
-void eab_view_paste (EABView *view);
-void eab_view_select_all (EABView *view);
-void eab_view_show_all (EABView *view);
-void eab_view_stop (EABView *view);
-void eab_view_copy_to_folder (EABView *view);
-void eab_view_move_to_folder (EABView *view);
-
-gboolean eab_view_can_create (EABView *view);
-gboolean eab_view_can_print (EABView *view);
-gboolean eab_view_can_save_as (EABView *view);
-gboolean eab_view_can_view (EABView *view);
-gboolean eab_view_can_send (EABView *view);
-gboolean eab_view_can_send_to (EABView *view);
-gboolean eab_view_can_delete (EABView *view);
-gboolean eab_view_can_cut (EABView *view);
-gboolean eab_view_can_copy (EABView *view);
-gboolean eab_view_can_paste (EABView *view);
-gboolean eab_view_can_select_all (EABView *view);
-gboolean eab_view_can_stop (EABView *view);
-gboolean eab_view_can_copy_to_folder (EABView *view);
-gboolean eab_view_can_move_to_folder (EABView *view);
-
-G_END_DECLS;
-
-#endif /* __EAB_VIEW_H__ */
diff --git a/addressbook/gui/widgets/e-minicard-label.c b/addressbook/gui/widgets/e-minicard-label.c
deleted file mode 100644
index df1465349e..0000000000
--- a/addressbook/gui/widgets/e-minicard-label.c
+++ /dev/null
@@ -1,508 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-minicard-label.c
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of 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 "e-minicard-label.h"
-#include "eab-marshal.h"
-
-#include <gtk/gtksignal.h>
-#include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
-#include <libgnome/gnome-i18n.h>
-#include <gal/util/e-util.h>
-#include <gal/e-text/e-text.h>
-#include <gal/widgets/e-canvas.h>
-#include <gal/widgets/e-canvas-utils.h>
-#include <gdk/gdkkeysyms.h>
-
-static void e_minicard_label_init (EMinicardLabel *card);
-static void e_minicard_label_class_init (EMinicardLabelClass *klass);
-static void e_minicard_label_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void e_minicard_label_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-static gboolean e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event);
-static void e_minicard_label_realize (GnomeCanvasItem *item);
-static void e_minicard_label_unrealize (GnomeCanvasItem *item);
-static void e_minicard_label_reflow(GnomeCanvasItem *item, int flags);
-static void e_minicard_label_style_set (EMinicardLabel *label, GtkStyle *previous_style);
-
-static void e_minicard_label_resize_children( EMinicardLabel *e_minicard_label );
-
-static void set_colors (EMinicardLabel *label);
-
-static GnomeCanvasGroupClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- PROP_0,
- PROP_WIDTH,
- PROP_HEIGHT,
- PROP_HAS_FOCUS,
- PROP_FIELD,
- PROP_FIELDNAME,
- PROP_TEXT_MODEL,
- PROP_MAX_FIELD_NAME_WIDTH,
- PROP_EDITABLE
-};
-
-enum {
- STYLE_SET,
- LAST_SIGNAL
-};
-
-static guint e_minicard_label_signals [LAST_SIGNAL] = {0, };
-
-GType
-e_minicard_label_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EMinicardLabelClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_minicard_label_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EMinicardLabel),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_minicard_label_init,
- };
-
- type = g_type_register_static (gnome_canvas_group_get_type (), "EMinicardLabel", &info, 0);
- }
-
- return type;
-}
-
-static void
-e_minicard_label_class_init (EMinicardLabelClass *klass)
-{
- GObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- object_class = G_OBJECT_CLASS (klass);
- item_class = (GnomeCanvasItemClass *) klass;
-
- klass->style_set = e_minicard_label_style_set;
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->set_property = e_minicard_label_set_property;
- object_class->get_property = e_minicard_label_get_property;
- /* object_class->destroy = e_minicard_label_destroy; */
-
- g_object_class_install_property (object_class, PROP_WIDTH,
- g_param_spec_double ("width",
- _("Width"),
- /*_( */"XXX blurb" /*)*/,
- 0.0, G_MAXDOUBLE, 10.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_HEIGHT,
- g_param_spec_double ("height",
- _("Height"),
- /*_( */"XXX blurb" /*)*/,
- 0.0, G_MAXDOUBLE, 10.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_HAS_FOCUS,
- g_param_spec_boolean ("has_focus",
- _("Has Focus"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FIELD,
- g_param_spec_string ("field",
- _("Field"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FIELDNAME,
- g_param_spec_string ("fieldname",
- _("Field Name"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_TEXT_MODEL,
- g_param_spec_object ("text_model",
- _("Text Model"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_TEXT_MODEL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_MAX_FIELD_NAME_WIDTH,
- g_param_spec_double ("max_field_name_length",
- _("Max field name length"),
- /*_( */"XXX blurb" /*)*/,
- -1.0, G_MAXDOUBLE, -1.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_EDITABLE,
- g_param_spec_boolean ("editable",
- _("Editable"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- e_minicard_label_signals [STYLE_SET] =
- g_signal_new ("style_set",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EMinicardLabelClass, style_set),
- NULL, NULL,
- eab_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- GTK_TYPE_STYLE);
-
- /* GnomeCanvasItem method overrides */
- item_class->realize = e_minicard_label_realize;
- item_class->unrealize = e_minicard_label_unrealize;
- item_class->event = e_minicard_label_event;
-}
-
-static void
-e_minicard_label_init (EMinicardLabel *minicard_label)
-{
- minicard_label->width = 10;
- minicard_label->height = 10;
- minicard_label->rect = NULL;
- minicard_label->fieldname = NULL;
- minicard_label->field = NULL;
-
- minicard_label->max_field_name_length = -1;
-
- e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(minicard_label), e_minicard_label_reflow);
-}
-
-static void
-e_minicard_label_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- EMinicardLabel *e_minicard_label;
- GnomeCanvasItem *item;
-
- e_minicard_label = E_MINICARD_LABEL (object);
- item = GNOME_CANVAS_ITEM (object);
-
- switch (prop_id){
- case PROP_WIDTH:
- e_minicard_label->width = g_value_get_double (value);
- e_minicard_label_resize_children(e_minicard_label);
- e_canvas_item_request_reflow (item);
- break;
- case PROP_HAS_FOCUS:
- if (e_minicard_label->field && (g_value_get_boolean (value) != E_FOCUS_NONE))
- e_canvas_item_grab_focus(e_minicard_label->field, FALSE);
- break;
- case PROP_FIELD:
- gnome_canvas_item_set( e_minicard_label->field, "text", g_value_get_string (value), NULL );
- break;
- case PROP_FIELDNAME:
- gnome_canvas_item_set( e_minicard_label->fieldname, "text", g_value_get_string (value), NULL );
- break;
- case PROP_TEXT_MODEL:
- gnome_canvas_item_set( e_minicard_label->field, "model", g_value_get_object (value), NULL);
- break;
- case PROP_MAX_FIELD_NAME_WIDTH:
- e_minicard_label->max_field_name_length = g_value_get_double (value);
- break;
- case PROP_EDITABLE:
- e_minicard_label->editable = g_value_get_boolean (value);
- g_object_set (e_minicard_label->field, "editable", FALSE /* e_minicard_label->editable */, NULL);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-e_minicard_label_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- EMinicardLabel *e_minicard_label;
-
- e_minicard_label = E_MINICARD_LABEL (object);
-
- switch (prop_id) {
- case PROP_WIDTH:
- g_value_set_double (value, e_minicard_label->width);
- break;
- case PROP_HEIGHT:
- g_value_set_double (value, e_minicard_label->height);
- break;
- case PROP_HAS_FOCUS:
- g_value_set_boolean (value, e_minicard_label->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE);
- break;
- case PROP_FIELD:
- g_object_get_property (G_OBJECT (e_minicard_label->field),
- "text", value);
- break;
- case PROP_FIELDNAME:
- g_object_get_property (G_OBJECT (e_minicard_label->fieldname),
- "text", value);
- break;
- case PROP_TEXT_MODEL:
- g_object_get_property (G_OBJECT (e_minicard_label->field),
- "model", value);
- break;
- case PROP_MAX_FIELD_NAME_WIDTH:
- g_value_set_double (value, e_minicard_label->max_field_name_length);
- break;
- case PROP_EDITABLE:
- g_value_set_boolean (value, e_minicard_label->editable);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-e_minicard_label_realize (GnomeCanvasItem *item)
-{
- EMinicardLabel *e_minicard_label;
- GnomeCanvasGroup *group;
-
- e_minicard_label = E_MINICARD_LABEL (item);
- group = GNOME_CANVAS_GROUP( item );
-
- if (GNOME_CANVAS_ITEM_CLASS( parent_class )->realize)
- (* GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) (item);
-
- e_canvas_item_request_reflow(item);
-
- e_minicard_label->rect =
- gnome_canvas_item_new( group,
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) e_minicard_label->width - 1,
- "y2", (double) e_minicard_label->height - 1,
- "outline_color", NULL,
- NULL );
- e_minicard_label->fieldname =
- gnome_canvas_item_new( group,
- e_text_get_type(),
- "anchor", GTK_ANCHOR_NW,
- "clip_width", (double) ( e_minicard_label->width / 2 - 4 ),
- "clip", TRUE,
- "use_ellipsis", TRUE,
- "fill_color", "black",
- "draw_background", FALSE,
- "im_context", E_CANVAS (item->canvas)->im_context,
- NULL );
- e_canvas_item_move_absolute(e_minicard_label->fieldname, 2, 1);
-
- e_minicard_label->field =
- gnome_canvas_item_new( group,
- e_text_get_type(),
- "anchor", GTK_ANCHOR_NW,
- "clip_width", (double) ( ( e_minicard_label->width + 1 ) / 2 - 4 ),
- "clip", TRUE,
- "use_ellipsis", TRUE,
- "fill_color", "black",
- "editable", FALSE, /* e_minicard_label->editable, */
- "draw_background", FALSE,
- "im_context", E_CANVAS (item->canvas)->im_context,
- NULL );
- e_canvas_item_move_absolute(e_minicard_label->field, ( e_minicard_label->width / 2 + 2), 1);
-
- set_colors (e_minicard_label);
-
- e_canvas_item_request_reflow(item);
-}
-
-static void
-e_minicard_label_unrealize (GnomeCanvasItem *item)
-{
- EMinicardLabel *e_minicard_label;
-
- e_minicard_label = E_MINICARD_LABEL (item);
-
- if (GNOME_CANVAS_ITEM_CLASS( parent_class )->unrealize)
- (* GNOME_CANVAS_ITEM_CLASS( parent_class )->unrealize) (item);
-}
-
-static gboolean
-e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- EMinicardLabel *e_minicard_label;
-
- e_minicard_label = E_MINICARD_LABEL (item);
-
- switch( event->type ) {
- case GDK_KEY_PRESS:
- if (event->key.keyval == GDK_Escape) {
- GnomeCanvasItem *parent;
-
- e_text_cancel_editing (E_TEXT (e_minicard_label->field));
-
- parent = GNOME_CANVAS_ITEM (e_minicard_label)->parent;
- if (parent)
- e_canvas_item_grab_focus(parent, FALSE);
- }
- break;
- case GDK_FOCUS_CHANGE: {
- GdkEventFocus *focus_event = (GdkEventFocus *) event;
-
- e_minicard_label->has_focus = focus_event->in;
- set_colors (e_minicard_label);
-
- g_object_set (e_minicard_label->field,
- "handle_popup", e_minicard_label->has_focus,
- NULL);
- break;
- }
- case GDK_BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- case GDK_MOTION_NOTIFY:
- case GDK_ENTER_NOTIFY:
- case GDK_LEAVE_NOTIFY: {
- gboolean return_val;
- g_signal_emit_by_name(e_minicard_label->field, "event", event, &return_val);
- return return_val;
- }
- default:
- break;
- }
-
- if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event)
- return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event);
- else
- return 0;
-}
-
-static void
-e_minicard_label_resize_children(EMinicardLabel *e_minicard_label)
-{
- double left_width;
- if (e_minicard_label->max_field_name_length != -1 && ((e_minicard_label->width / 2) - 4 > e_minicard_label->max_field_name_length))
- left_width = e_minicard_label->max_field_name_length;
- else
- left_width = e_minicard_label->width / 2 - 4;
-
- gnome_canvas_item_set( e_minicard_label->fieldname,
- "clip_width", (double) MAX ( left_width, 0 ),
- NULL );
- gnome_canvas_item_set( e_minicard_label->field,
- "clip_width", (double) MAX ( e_minicard_label->width - 8 - left_width, 0 ),
- NULL );
-}
-
-static void
-set_colors (EMinicardLabel *label)
-{
- if ( (GTK_OBJECT_FLAGS( label ) & GNOME_CANVAS_ITEM_REALIZED) ) {
- GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (label)->canvas);
- GtkStyle *style = gtk_widget_get_style (canvas);
- if (label->has_focus) {
- gnome_canvas_item_set (label->rect,
- "outline_color_gdk", &style->mid[GTK_STATE_SELECTED],
- "fill_color_gdk", &style->bg[GTK_STATE_NORMAL],
- NULL);
-
- gnome_canvas_item_set (label->field,
- "fill_color_gdk", &canvas->style->text[GTK_STATE_NORMAL],
- NULL);
-
- gnome_canvas_item_set (label->fieldname,
- "fill_color_gdk", &canvas->style->text[GTK_STATE_NORMAL],
- NULL);
- }
- else {
- gnome_canvas_item_set (label->rect,
- "outline_color_gdk", NULL,
- "fill_color_gdk", NULL,
- NULL);
-
- gnome_canvas_item_set (label->field,
- "fill_color_gdk", &canvas->style->text[GTK_STATE_NORMAL],
- NULL);
-
- gnome_canvas_item_set (label->fieldname,
- "fill_color_gdk", &canvas->style->text[GTK_STATE_NORMAL],
- NULL);
- }
- }
-}
-
-static void
-e_minicard_label_style_set (EMinicardLabel *label, GtkStyle *previous_style)
-{
- set_colors (label);
-}
-
-static void
-e_minicard_label_reflow(GnomeCanvasItem *item, int flags)
-{
- EMinicardLabel *e_minicard_label = E_MINICARD_LABEL(item);
-
- gint old_height;
- gdouble text_height;
- gdouble left_width;
-
- old_height = e_minicard_label->height;
-
- g_object_get(e_minicard_label->fieldname,
- "text_height", &text_height,
- NULL);
-
- e_minicard_label->height = text_height;
-
-
- g_object_get(e_minicard_label->field,
- "text_height", &text_height,
- NULL);
-
- if (e_minicard_label->height < text_height)
- e_minicard_label->height = text_height;
- e_minicard_label->height += 3;
-
- gnome_canvas_item_set( e_minicard_label->rect,
- "x2", (double) e_minicard_label->width - 1,
- "y2", (double) e_minicard_label->height - 1,
- NULL );
-
- gnome_canvas_item_set( e_minicard_label->fieldname,
- "clip_height", (double) e_minicard_label->height - 3,
- NULL );
-
- if (e_minicard_label->max_field_name_length != -1 && ((e_minicard_label->width / 2) - 4 > e_minicard_label->max_field_name_length))
- left_width = e_minicard_label->max_field_name_length;
- else
- left_width = e_minicard_label->width / 2 - 4;
-
- e_canvas_item_move_absolute(e_minicard_label->field, left_width + 6, 1);
-
- if (old_height != e_minicard_label->height)
- e_canvas_item_request_parent_reflow(item);
-}
-
-GnomeCanvasItem *
-e_minicard_label_new(GnomeCanvasGroup *parent)
-{
- GnomeCanvasItem *item = gnome_canvas_item_new(parent, e_minicard_label_get_type(), NULL);
- return item;
-}
-
diff --git a/addressbook/gui/widgets/e-minicard-label.h b/addressbook/gui/widgets/e-minicard-label.h
deleted file mode 100644
index d914cb30bb..0000000000
--- a/addressbook/gui/widgets/e-minicard-label.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-minicard-label.h
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of 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_MINICARD_LABEL_H__
-#define __E_MINICARD_LABEL_H__
-
-#include <glib.h>
-#include <libgnomecanvas/gnome-canvas.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* EMinicardLabel - A label doing focus with non-marching ants.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- * width double RW width of the label
- * height double R height of the label
- * field string RW text in the field label
- * fieldname string RW text in the fieldname label
- */
-
-#define E_TYPE_MINICARD_LABEL (e_minicard_label_get_type ())
-#define E_MINICARD_LABEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_MINICARD_LABEL, EMinicardLabel))
-#define E_MINICARD_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_MINICARD_LABEL, EMiniCardLabelClass))
-#define E_IS_MINICARD_LABEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_MINICARD_LABEL))
-#define E_IS_MINICARD_LABEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_MINICARD_LABEL))
-
-
-typedef struct _EMinicardLabel EMinicardLabel;
-typedef struct _EMinicardLabelClass EMinicardLabelClass;
-
-struct _EMinicardLabel
-{
- GnomeCanvasGroup parent;
-
- /* item specific fields */
- double width;
- double height;
- double max_field_name_length;
- guint editable : 1;
- GnomeCanvasItem *fieldname;
- GnomeCanvasItem *field;
- GnomeCanvasItem *rect;
-
- gboolean has_focus;
-};
-
-struct _EMinicardLabelClass
-{
- GnomeCanvasGroupClass parent_class;
-
- void (* style_set) (EMinicardLabel *label, GtkStyle *previous_style);
-};
-
-
-GType e_minicard_label_get_type (void);
-GnomeCanvasItem *e_minicard_label_new(GnomeCanvasGroup *parent);
-void e_minicard_label_construct (GnomeCanvasItem *item);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_MINICARD_LABEL_H__ */
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.c b/addressbook/gui/widgets/e-minicard-view-widget.c
deleted file mode 100644
index ff1bdc1f06..0000000000
--- a/addressbook/gui/widgets/e-minicard-view-widget.c
+++ /dev/null
@@ -1,440 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-minicard-view-widget.c
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of 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 <gtk/gtksignal.h>
-#include <gal/widgets/e-canvas-background.h>
-#include <gal/widgets/e-canvas.h>
-#include <libgnome/gnome-i18n.h>
-
-#include "eab-marshal.h"
-#include "e-minicard-view-widget.h"
-
-static void e_minicard_view_widget_init (EMinicardViewWidget *widget);
-static void e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass);
-static void e_minicard_view_widget_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void e_minicard_view_widget_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-static void e_minicard_view_widget_dispose (GObject *object);
-static void e_minicard_view_widget_reflow (ECanvas *canvas);
-static void e_minicard_view_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
-static void e_minicard_view_widget_style_set (GtkWidget *widget, GtkStyle *previous_style);
-static void e_minicard_view_widget_realize (GtkWidget *widget);
-
-static ECanvasClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- PROP_0,
- PROP_BOOK,
- PROP_QUERY,
- PROP_EDITABLE,
- PROP_COLUMN_WIDTH
-};
-
-enum {
- SELECTION_CHANGE,
- COLUMN_WIDTH_CHANGED,
- RIGHT_CLICK,
- LAST_SIGNAL
-};
-
-static guint signals [LAST_SIGNAL] = {0, };
-
-GType
-e_minicard_view_widget_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EMinicardViewWidgetClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_minicard_view_widget_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EMinicardViewWidget),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_minicard_view_widget_init,
- };
-
- type = g_type_register_static (e_canvas_get_type (), "EMinicardViewWidget", &info, 0);
- }
-
- return type;
-}
-
-static void
-e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass)
-{
- GObjectClass *object_class;
- GtkWidgetClass *widget_class;
- ECanvasClass *canvas_class;
-
- object_class = (GObjectClass*) klass;
- widget_class = GTK_WIDGET_CLASS (klass);
- canvas_class = E_CANVAS_CLASS (klass);
-
- parent_class = gtk_type_class (e_canvas_get_type ());
-
- object_class->set_property = e_minicard_view_widget_set_property;
- object_class->get_property = e_minicard_view_widget_get_property;
- object_class->dispose = e_minicard_view_widget_dispose;
-
- g_object_class_install_property (object_class, PROP_BOOK,
- g_param_spec_object ("book",
- _("Book"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_BOOK,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_QUERY,
- g_param_spec_string ("query",
- _("Query"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_EDITABLE,
- g_param_spec_boolean ("editable",
- _("Editable"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_COLUMN_WIDTH,
- g_param_spec_double ("column_width",
- _("Column Width"),
- /*_( */"XXX blurb" /*)*/,
- 0.0, G_MAXDOUBLE, 150.0,
- G_PARAM_READWRITE));
-
- signals [SELECTION_CHANGE] =
- g_signal_new ("selection_change",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EMinicardViewWidgetClass, selection_change),
- NULL, NULL,
- eab_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- signals [COLUMN_WIDTH_CHANGED] =
- g_signal_new ("column_width_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EMinicardViewWidgetClass, column_width_changed),
- NULL, NULL,
- eab_marshal_NONE__DOUBLE,
- G_TYPE_NONE, 1, G_TYPE_DOUBLE);
-
- signals [RIGHT_CLICK] =
- g_signal_new ("right_click",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EMinicardViewWidgetClass, right_click),
- NULL, NULL,
- eab_marshal_INT__POINTER,
- G_TYPE_INT, 1, G_TYPE_POINTER);
-
- widget_class->style_set = e_minicard_view_widget_style_set;
- widget_class->realize = e_minicard_view_widget_realize;
- widget_class->size_allocate = e_minicard_view_widget_size_allocate;
-
- canvas_class->reflow = e_minicard_view_widget_reflow;
-
- klass->selection_change = NULL;
- klass->column_width_changed = NULL;
- klass->right_click = NULL;
-}
-
-static void
-e_minicard_view_widget_init (EMinicardViewWidget *view)
-{
- view->emv = NULL;
-
- view->book = NULL;
- view->query = NULL;
- view->editable = FALSE;
- view->column_width = 150;
-}
-
-GtkWidget *
-e_minicard_view_widget_new (EAddressbookReflowAdapter *adapter)
-{
- EMinicardViewWidget *widget = E_MINICARD_VIEW_WIDGET (g_object_new (e_minicard_view_widget_get_type (), NULL));
-
- widget->adapter = adapter;
- g_object_ref (widget->adapter);
-
- return GTK_WIDGET (widget);
-}
-
-static void
-e_minicard_view_widget_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- EMinicardViewWidget *emvw;
-
- emvw = E_MINICARD_VIEW_WIDGET (object);
-
- switch (prop_id){
- case PROP_BOOK:
- if (emvw->book)
- g_object_unref (emvw->book);
- if (g_value_get_object (value)) {
- emvw->book = E_BOOK(g_value_get_object (value));
- if (emvw->book)
- g_object_ref(emvw->book);
- } else
- emvw->book = NULL;
- if (emvw->emv)
- g_object_set(emvw->emv,
- "book", emvw->book,
- NULL);
- break;
- case PROP_QUERY:
- emvw->query = g_strdup(g_value_get_string (value));
- if (emvw->emv)
- g_object_set(emvw->emv,
- "query", emvw->query,
- NULL);
- break;
- case PROP_EDITABLE:
- emvw->editable = g_value_get_boolean (value);
- if (emvw->emv)
- g_object_set (emvw->emv,
- "editable", emvw->editable,
- NULL);
- break;
- case PROP_COLUMN_WIDTH:
- emvw->column_width = g_value_get_double (value);
- if (emvw->emv) {
- g_object_set (emvw->emv,
- "column_width", emvw->column_width,
- NULL);
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-e_minicard_view_widget_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EMinicardViewWidget *emvw;
-
- emvw = E_MINICARD_VIEW_WIDGET (object);
-
- switch (prop_id) {
- case PROP_BOOK:
- g_value_set_object (value, emvw->book);
- break;
- case PROP_QUERY:
- g_value_set_string (value, emvw->query);
- break;
- case PROP_EDITABLE:
- g_value_set_boolean (value, emvw->editable);
- break;
- case PROP_COLUMN_WIDTH:
- g_value_set_double (value, emvw->column_width);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-e_minicard_view_widget_dispose (GObject *object)
-{
- EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(object);
-
- if (view->book) {
- g_object_unref (view->book);
- view->book = NULL;
- }
- if (view->query) {
- g_free(view->query);
- view->query = NULL;
- }
-
- if (view->adapter) {
- g_object_unref (view->adapter);
- view->adapter = NULL;
- }
-
- if (G_OBJECT_CLASS(parent_class)->dispose)
- G_OBJECT_CLASS(parent_class)->dispose (object);
-}
-
-static void
-selection_change (ESelectionModel *esm, EMinicardViewWidget *widget)
-{
- g_signal_emit (widget,
- signals [SELECTION_CHANGE], 0);
-}
-
-static void
-selection_row_change (ESelectionModel *esm, int row, EMinicardViewWidget *widget)
-{
- gboolean selected = e_selection_model_is_row_selected (esm, row);
-
- /* we only handle the selected case here */
- if (!selected)
- return;
-
- selection_change (esm, widget);
-}
-
-static void
-column_width_changed (ESelectionModel *esm, double width, EMinicardViewWidget *widget)
-{
- g_signal_emit (widget,
- signals [COLUMN_WIDTH_CHANGED], 0, width);
-}
-
-static guint
-right_click (EMinicardView *view, GdkEvent *event, EMinicardViewWidget *widget)
-{
- guint ret_val;
- g_signal_emit (widget,
- signals [RIGHT_CLICK], 0,
- event, &ret_val);
- return ret_val;
-}
-
-static void
-e_minicard_view_widget_style_set (GtkWidget *widget, GtkStyle *previous_style)
-{
- EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(widget);
-
- if (view->background)
- gnome_canvas_item_set (view->background,
- "fill_color_gdk", &widget->style->base[GTK_STATE_NORMAL],
- NULL );
-
- if (GTK_WIDGET_CLASS(parent_class)->style_set)
- GTK_WIDGET_CLASS(parent_class)->style_set (widget, previous_style);
-}
-
-
-static void
-e_minicard_view_widget_realize (GtkWidget *widget)
-{
- EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(widget);
- GtkStyle *style = gtk_widget_get_style (widget);
-
- view->background = gnome_canvas_item_new(gnome_canvas_root( GNOME_CANVAS(view) ),
- e_canvas_background_get_type(),
- "fill_color_gdk", &style->base[GTK_STATE_NORMAL],
- NULL );
-
- view->emv = gnome_canvas_item_new(
- gnome_canvas_root( GNOME_CANVAS(view) ),
- e_minicard_view_get_type(),
- "height", (double) 100,
- "minimum_width", (double) 100,
- "adapter", view->adapter,
- "column_width", view->column_width,
- NULL );
-
- g_signal_connect (E_REFLOW(view->emv)->selection,
- "selection_changed",
- G_CALLBACK (selection_change), view);
- g_signal_connect (E_REFLOW(view->emv)->selection,
- "selection_row_changed",
- G_CALLBACK (selection_row_change), view);
- g_signal_connect (view->emv,
- "column_width_changed",
- G_CALLBACK (column_width_changed), view);
- g_signal_connect (view->emv,
- "right_click",
- G_CALLBACK (right_click), view);
-
- if (GTK_WIDGET_CLASS(parent_class)->realize)
- GTK_WIDGET_CLASS(parent_class)->realize (widget);
-}
-
-static void
-e_minicard_view_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
-{
- if (GTK_WIDGET_CLASS(parent_class)->size_allocate)
- GTK_WIDGET_CLASS(parent_class)->size_allocate (widget, allocation);
-
- if (GTK_WIDGET_REALIZED(widget)) {
- double width;
- EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(widget);
-
- gnome_canvas_item_set( view->emv,
- "height", (double) allocation->height,
- NULL );
- gnome_canvas_item_set( view->emv,
- "minimum_width", (double) allocation->width,
- NULL );
- g_object_get(view->emv,
- "width", &width,
- NULL);
- width = MAX(width, allocation->width);
- gnome_canvas_set_scroll_region (GNOME_CANVAS (view), 0, 0, width - 1, allocation->height - 1);
- }
-}
-
-static void
-e_minicard_view_widget_reflow(ECanvas *canvas)
-{
- double width;
- EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(canvas);
-
- if (E_CANVAS_CLASS(parent_class)->reflow)
- E_CANVAS_CLASS(parent_class)->reflow (canvas);
-
- g_object_get(view->emv,
- "width", &width,
- NULL);
- width = MAX(width, GTK_WIDGET(canvas)->allocation.width);
- gnome_canvas_set_scroll_region(GNOME_CANVAS(canvas), 0, 0, width - 1, GTK_WIDGET(canvas)->allocation.height - 1);
-}
-
-ESelectionModel *
-e_minicard_view_widget_get_selection_model (EMinicardViewWidget *view)
-{
- if (view->emv)
- return E_SELECTION_MODEL (E_REFLOW (view->emv)->selection);
- else
- return NULL;
-}
-
-EMinicardView *
-e_minicard_view_widget_get_view (EMinicardViewWidget *view)
-{
- if (view->emv)
- return E_MINICARD_VIEW (view->emv);
- else
- return NULL;
-}
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.h b/addressbook/gui/widgets/e-minicard-view-widget.h
deleted file mode 100644
index ef8401b88c..0000000000
--- a/addressbook/gui/widgets/e-minicard-view-widget.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-minicard-view-widget.h
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of 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_MINICARD_VIEW_WIDGET_H__
-#define __E_MINICARD_VIEW_WIDGET_H__
-
-#include <gal/widgets/e-canvas.h>
-#include <libebook/e-book.h>
-#include "e-minicard-view.h"
-
-G_BEGIN_DECLS
-
-#define E_TYPE_MINICARD_VIEW_WIDGET (e_minicard_view_widget_get_type ())
-#define E_MINICARD_VIEW_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_MINICARD_VIEW_WIDGET, EMinicardViewWidget))
-#define E_MINICARD_VIEW_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_MINICARD_VIEW_WIDGET, EMinicardViewWidgetClass))
-#define E_IS_MINICARD_VIEW_WIDGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_MINICARD_VIEW_WIDGET))
-#define E_IS_MINICARD_VIEW_WIDGET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_MINICARD_VIEW_WIDGET))
-
-
-typedef struct _EMinicardViewWidget EMinicardViewWidget;
-typedef struct _EMinicardViewWidgetClass EMinicardViewWidgetClass;
-
-struct _EMinicardViewWidget
-{
- ECanvas parent;
-
- GnomeCanvasItem *background;
- GnomeCanvasItem *emv;
-
- EAddressbookReflowAdapter *adapter;
-
- EBook *book;
- char *query;
- guint editable : 1;
-
- double column_width;
-};
-
-struct _EMinicardViewWidgetClass
-{
- ECanvasClass parent_class;
- void (*selection_change) (EMinicardViewWidget *emvw);
- void (*column_width_changed) (EMinicardViewWidget *emvw, double width);
- guint (*right_click) (EMinicardViewWidget *emvw);
-};
-
-
-GType e_minicard_view_widget_get_type (void);
-GtkWidget *e_minicard_view_widget_new (EAddressbookReflowAdapter *adapter);
-
-/* Get parts of the view widget. */
-ESelectionModel *e_minicard_view_widget_get_selection_model (EMinicardViewWidget *view);
-EMinicardView *e_minicard_view_widget_get_view (EMinicardViewWidget *view);
-
-G_END_DECLS
-
-#endif /* __E_MINICARD_VIEW_WIDGET_H__ */
diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c
deleted file mode 100644
index 3c588c9ef2..0000000000
--- a/addressbook/gui/widgets/e-minicard-view.c
+++ /dev/null
@@ -1,581 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-minicard-view.c
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of 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 "e-minicard-view.h"
-
-#include "eab-gui-util.h"
-#include "eab-marshal.h"
-#include "util/eab-book-util.h"
-
-#include <gtk/gtkselection.h>
-#include <gtk/gtkdnd.h>
-#include <gal/widgets/e-canvas.h>
-#include <libgnome/gnome-i18n.h>
-#include <string.h>
-
-static void e_minicard_view_drag_data_get(GtkWidget *widget,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- EMinicardView *view);
-
-static EReflowClass *parent_class = NULL;
-#define PARENT_TYPE (E_REFLOW_TYPE)
-
-/* The arguments we take */
-enum {
- PROP_0,
- PROP_ADAPTER,
- PROP_BOOK,
- PROP_QUERY,
- PROP_EDITABLE
-};
-
-
-enum {
- RIGHT_CLICK,
- LAST_SIGNAL
-};
-
-static guint signals [LAST_SIGNAL] = {0, };
-
-enum DndTargetType {
- DND_TARGET_TYPE_VCARD_LIST,
-};
-#define VCARD_LIST_TYPE "text/x-vcard"
-static GtkTargetEntry drag_types[] = {
- { VCARD_LIST_TYPE, 0, DND_TARGET_TYPE_VCARD_LIST }
-};
-static gint num_drag_types = sizeof(drag_types) / sizeof(drag_types[0]);
-
-static void
-e_minicard_view_drag_data_get(GtkWidget *widget,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- EMinicardView *view)
-{
- if (!E_IS_MINICARD_VIEW(view))
- return;
-
- switch (info) {
- case DND_TARGET_TYPE_VCARD_LIST: {
- char *value;
-
- value = eab_contact_list_to_string (view->drag_list);
-
- gtk_selection_data_set (selection_data,
- selection_data->target,
- 8,
- value, strlen (value));
- break;
- }
- }
-
- g_list_foreach (view->drag_list, (GFunc)g_object_unref, NULL);
- g_list_free (view->drag_list);
- view->drag_list = NULL;
-}
-
-static int
-e_minicard_view_drag_begin (EAddressbookReflowAdapter *adapter, GdkEvent *event, EMinicardView *view)
-{
- GdkDragContext *context;
- GtkTargetList *target_list;
- GdkDragAction actions = GDK_ACTION_MOVE | GDK_ACTION_COPY;
-
- view->drag_list = e_minicard_view_get_card_list (view);
-
- g_print ("dragging %d card(s)\n", g_list_length (view->drag_list));
-
- target_list = gtk_target_list_new (drag_types, num_drag_types);
-
- context = gtk_drag_begin (GTK_WIDGET (GNOME_CANVAS_ITEM (view)->canvas),
- target_list, actions, 1/*XXX*/, event);
-
- if (!view->canvas_drag_data_get_id)
- view->canvas_drag_data_get_id = g_signal_connect (GNOME_CANVAS_ITEM (view)->canvas,
- "drag_data_get",
- G_CALLBACK (e_minicard_view_drag_data_get),
- view);
-
- gtk_drag_set_icon_default (context);
-
- return TRUE;
-}
-
-static void
-set_empty_message (EMinicardView *view)
-{
- char *empty_message;
- gboolean editable = FALSE;
-
- if (view->adapter) {
- g_object_get (view->adapter,
- "editable", &editable,
- NULL);
- }
-
- if (editable)
- empty_message = _("\n\nThere are no items to show in this view.\n\n"
- "Double-click here to create a new Contact.");
- else
- empty_message = _("\n\nThere are no items to show in this view.");
-
- g_object_set (view,
- "empty_message", empty_message,
- NULL);
-}
-
-static void
-writable_status_change (EABModel *model, gboolean writable, EMinicardView *view)
-{
- set_empty_message (view);
-}
-
-static void
-adapter_changed (EMinicardView *view)
-{
- set_empty_message (view);
-
- g_signal_connect (view->adapter, "drag_begin",
- G_CALLBACK (e_minicard_view_drag_begin), view);
-}
-
-static void
-e_minicard_view_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- EMinicardView *view;
-
- view = E_MINICARD_VIEW (object);
-
- switch (prop_id){
- case PROP_ADAPTER:
- if (view->adapter) {
- if (view->writable_status_id) {
- EABModel *model;
- g_object_get (view->adapter,
- "model", &model,
- NULL);
- if (model) {
- g_signal_handler_disconnect (model, view->writable_status_id);
- }
- }
-
- g_object_unref (view->adapter);
- }
- view->writable_status_id = 0;
- view->adapter = g_value_get_object (value);
- g_object_ref (view->adapter);
- adapter_changed (view);
- g_object_set (view,
- "model", view->adapter,
- NULL);
- if (view->adapter) {
- EABModel *model;
- g_object_get (view->adapter,
- "model", &model,
- NULL);
- if (model) {
- view->writable_status_id =
- g_signal_connect (model, "writable_status",
- G_CALLBACK (writable_status_change), view);
- }
-
- }
- break;
- case PROP_BOOK:
- g_object_set (view->adapter,
- "book", g_value_get_object (value),
- NULL);
- set_empty_message (view);
- break;
- case PROP_QUERY:
- g_object_set (view->adapter,
- "query", g_value_get_string (value),
- NULL);
- break;
- case PROP_EDITABLE:
- g_object_set (view->adapter,
- "editable", g_value_get_boolean (value),
- NULL);
- set_empty_message (view);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-e_minicard_view_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EMinicardView *view;
-
- view = E_MINICARD_VIEW (object);
-
- switch (prop_id) {
- case PROP_ADAPTER:
- g_value_set_object (value, view->adapter);
- break;
- case PROP_BOOK:
- g_object_get_property (G_OBJECT (view->adapter),
- "book", value);
- break;
- case PROP_QUERY:
- g_object_get_property (G_OBJECT (view->adapter),
- "query", value);
- break;
- case PROP_EDITABLE:
- g_object_get_property (G_OBJECT (view->adapter),
- "editable", value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-e_minicard_view_dispose (GObject *object)
-{
- EMinicardView *view = E_MINICARD_VIEW(object);
-
- if (view->canvas_drag_data_get_id) {
- g_signal_handler_disconnect (GNOME_CANVAS_ITEM (view)->canvas,
- view->canvas_drag_data_get_id);
- view->canvas_drag_data_get_id = 0;
- }
-
- if (view->adapter) {
- if (view->writable_status_id) {
- EABModel *model;
- g_object_get (view->adapter,
- "model", &model,
- NULL);
- if (model) {
- g_signal_handler_disconnect (model, view->writable_status_id);
- }
- }
-
- g_object_unref (view->adapter);
- }
- view->writable_status_id = 0;
- view->adapter = NULL;
-
- if (G_OBJECT_CLASS(parent_class)->dispose)
- G_OBJECT_CLASS(parent_class)->dispose (object);
-}
-
-static guint
-e_minicard_view_right_click (EMinicardView *view, GdkEvent *event)
-{
- guint ret_val = 0;
- g_signal_emit (view, signals[RIGHT_CLICK], 0,
- event, &ret_val);
- return ret_val;
-}
-
-static gboolean
-e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- EMinicardView *view;
-
- view = E_MINICARD_VIEW (item);
-
- switch( event->type ) {
- case GDK_2BUTTON_PRESS:
- if (((GdkEventButton *)event)->button == 1) {
- gboolean editable;
-
- g_object_get(view->adapter, "editable", &editable, NULL);
-
- if (editable) {
- EBook *book;
- g_object_get(view, "book", &book, NULL);
-
- if (book && E_IS_BOOK (book))
- eab_show_contact_editor (book, e_contact_new(), TRUE, editable);
- }
- return TRUE;
- }
- case GDK_BUTTON_PRESS:
- if (event->button.button == 3) {
- e_minicard_view_right_click (view, event);
- }
- break;
- default:
- break;
- }
-
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event)
- return GNOME_CANVAS_ITEM_CLASS(parent_class)->event(item, event);
- else
- return FALSE;
-}
-
-static gint
-e_minicard_view_selection_event (EReflow *reflow, GnomeCanvasItem *item, GdkEvent *event)
-{
- EMinicardView *view;
- int return_val = FALSE;
-
- view = E_MINICARD_VIEW (reflow);
- if (parent_class->selection_event) {
- return_val = parent_class->selection_event (reflow, item, event);
- }
-
- switch (event->type) {
- case GDK_FOCUS_CHANGE:
- if (event->focus_change.in) {
- int i;
- for (i = 0; i < reflow->count; i++) {
- if (reflow->items[i] == item) {
- e_selection_model_maybe_do_something(reflow->selection, i, 0, 0);
- break;
- }
- }
- }
- break;
- case GDK_BUTTON_PRESS:
- if (event->button.button == 3) {
- return_val = e_minicard_view_right_click (view, event);
- if (!return_val)
- e_selection_model_right_click_up(reflow->selection);
- }
- break;
- default:
- break;
- }
- return return_val;
-}
-
-typedef struct {
- EMinicardView *view;
- EBookCallback cb;
- gpointer closure;
-} ViewCbClosure;
-
-static void
-do_remove (int i, gpointer user_data)
-{
- EBook *book;
- EContact *contact;
- ViewCbClosure *viewcbclosure = user_data;
- EMinicardView *view = viewcbclosure->view;
- EBookCallback cb = viewcbclosure->cb;
- gpointer closure = viewcbclosure->closure;
-
- g_object_get (view->adapter,
- "book", &book,
- NULL);
-
- contact = e_addressbook_reflow_adapter_get_contact (view->adapter, i);
-
- e_book_async_remove_contact(book, contact, cb, closure);
-
- g_object_unref (contact);
-}
-
-#if 0
-static int
-compare_to_utf_str (EMinicard *card, const char *utf_str)
-{
- g_return_val_if_fail(card != NULL, 0);
- g_return_val_if_fail(E_IS_MINICARD(card), 0);
-
- if (g_unichar_isdigit (g_utf8_get_char (utf_str))) {
- return 1;
- }
-
- if (card->card) {
- char *file_as;
- g_object_get(card->card,
- "file_as", &file_as,
- NULL);
- if (file_as)
- return g_utf8_strcasecmp (file_as, utf_str);
- else
- return 0;
- } else {
- return 0;
- }
-}
-#endif
-
-static void
-e_minicard_view_class_init (EMinicardViewClass *klass)
-{
- GObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
- EReflowClass *reflow_class;
-
- object_class = G_OBJECT_CLASS (klass);
- item_class = (GnomeCanvasItemClass *) klass;
- reflow_class = (EReflowClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->set_property = e_minicard_view_set_property;
- object_class->get_property = e_minicard_view_get_property;
- object_class->dispose = e_minicard_view_dispose;
-
- g_object_class_install_property (object_class, PROP_ADAPTER,
- g_param_spec_object ("adapter",
- _("Adapter"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_BOOK,
- g_param_spec_object ("book",
- _("Book"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_BOOK,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_QUERY,
- g_param_spec_string ("query",
- _("Query"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_EDITABLE,
- g_param_spec_boolean ("editable",
- _("Editable"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- signals [RIGHT_CLICK] =
- g_signal_new ("right_click",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EMinicardViewClass, right_click),
- NULL, NULL,
- eab_marshal_INT__POINTER,
- G_TYPE_INT, 1, G_TYPE_POINTER);
-
- item_class->event = e_minicard_view_event;
-
- reflow_class->selection_event = e_minicard_view_selection_event;
- /* GnomeCanvasItem method overrides */
-}
-
-static void
-e_minicard_view_init (EMinicardView *view)
-{
- view->adapter = NULL;
- view->canvas_drag_data_get_id = 0;
- view->writable_status_id = 0;
-
- set_empty_message (view);
-}
-
-GType
-e_minicard_view_get_type (void)
-{
- static GType reflow_type = 0;
-
- if (!reflow_type) {
- static const GTypeInfo reflow_info = {
- sizeof (EMinicardViewClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_minicard_view_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EMinicardView),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_minicard_view_init,
- };
-
- reflow_type = g_type_register_static (PARENT_TYPE, "EMinicardView", &reflow_info, 0);
- }
-
- return reflow_type;
-}
-
-void
-e_minicard_view_remove_selection(EMinicardView *view,
- EBookCallback cb,
- gpointer closure)
-{
- ViewCbClosure viewcbclosure;
- viewcbclosure.view = view;
- viewcbclosure.cb = cb;
- viewcbclosure.closure = closure;
-
- e_selection_model_foreach (E_REFLOW (view)->selection,
- do_remove,
- &viewcbclosure);
-}
-
-void
-e_minicard_view_jump_to_letter (EMinicardView *view,
- gunichar letter)
-{
-#if 0
- char uft_str[6 + 1];
-
- utf_str [g_unichar_to_utf8 (letter, utf_str)] = '\0';
- e_reflow_sorted_jump (E_REFLOW_SORTED (view),
- (GCompareFunc) compare_to_utf_str,
- utf_str);
-#endif
-}
-
-typedef struct {
- GList *list;
- EAddressbookReflowAdapter *adapter;
-} ModelAndList;
-
-static void
-add_to_list (int index, gpointer closure)
-{
- ModelAndList *mal = closure;
- mal->list = g_list_prepend (mal->list, e_addressbook_reflow_adapter_get_contact (mal->adapter, index));
-}
-
-GList *
-e_minicard_view_get_card_list (EMinicardView *view)
-{
- ModelAndList mal;
-
- mal.adapter = view->adapter;
- mal.list = NULL;
-
- e_selection_model_foreach (E_REFLOW (view)->selection, add_to_list, &mal);
-
- mal.list = g_list_reverse (mal.list);
- return mal.list;
-}
diff --git a/addressbook/gui/widgets/e-minicard-view.h b/addressbook/gui/widgets/e-minicard-view.h
deleted file mode 100644
index 2614b7577a..0000000000
--- a/addressbook/gui/widgets/e-minicard-view.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-minicard-view.h
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of 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_MINICARD_VIEW_H__
-#define __E_MINICARD_VIEW_H__
-
-#include "e-minicard.h"
-
-#include <gal/widgets/e-reflow.h>
-#include <gal/widgets/e-selection-model-simple.h>
-#include <libebook/e-book.h>
-#include "e-addressbook-reflow-adapter.h"
-
-G_BEGIN_DECLS
-
-/* EMinicardView - A canvas item container.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- * book EBook RW book to query
- * query string RW query string
- *
- * From EReflowSorted: (you should really know what you're doing if you set these.)
- * compare_func GCompareFunc RW compare function
- * string_func EReflowStringFunc RW string function
- *
- * From EReflow:
- * minimum_width double RW minimum width of the reflow. width >= minimum_width
- * width double R width of the reflow
- * height double RW height of the reflow
- */
-
-#define E_TYPE_MINICARD_VIEW (e_minicard_view_get_type ())
-#define E_MINICARD_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_MINICARD_VIEW, EMinicardView))
-#define E_MINICARD_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_MINICARD_VIEW, EMinicardViewClass))
-#define E_IS_MINICARD_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_MINICARD_VIEW))
-#define E_IS_MINICARD_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_MINICARD_VIEW))
-
-
-typedef struct _EMinicardView EMinicardView;
-typedef struct _EMinicardViewClass EMinicardViewClass;
-
-struct _EMinicardView
-{
- EReflow parent;
-
- EAddressbookReflowAdapter *adapter;
-
- /* item specific fields */
-
- GList *drag_list;
-
- guint canvas_drag_data_get_id;
-
- guint writable_status_id;
-};
-
-struct _EMinicardViewClass
-{
- EReflowClass parent_class;
-
- void (*right_click) (EMinicardView *view, GdkEvent *event);
-};
-
-GType e_minicard_view_get_type (void);
-void e_minicard_view_remove_selection (EMinicardView *view,
- EBookCallback cb,
- gpointer closure);
-void e_minicard_view_jump_to_letter (EMinicardView *view,
- gunichar letter);
-GList *e_minicard_view_get_card_list (EMinicardView *view);
-
-
-G_END_DECLS
-
-#endif /* __E_MINICARD_VIEW_H__ */
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c
deleted file mode 100644
index 259d2b12f0..0000000000
--- a/addressbook/gui/widgets/e-minicard.c
+++ /dev/null
@@ -1,968 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-minicard.c
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of 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/gtkdnd.h>
-#include <gtk/gtkmain.h>
-#include <gdk/gdkkeysyms.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
-#include <libgnomecanvas/gnome-canvas-pixbuf.h>
-#include <gal/e-text/e-text.h>
-#include <gal/util/e-util.h>
-#include <gal/widgets/e-canvas-utils.h>
-#include <gal/widgets/e-canvas.h>
-#include <libebook/e-book.h>
-#include "eab-marshal.h"
-#include "eab-gui-util.h"
-#include "e-minicard.h"
-#include "e-minicard-label.h"
-#include "e-minicard-view.h"
-#include "e-contact-editor.h"
-#include "util/eab-destination.h"
-
-static void e_minicard_init (EMinicard *card);
-static void e_minicard_class_init (EMinicardClass *klass);
-static void e_minicard_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void e_minicard_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-static void e_minicard_dispose (GObject *object);
-static void e_minicard_finalize (GObject *object);
-static gboolean e_minicard_event (GnomeCanvasItem *item, GdkEvent *event);
-static void e_minicard_realize (GnomeCanvasItem *item);
-static void e_minicard_unrealize (GnomeCanvasItem *item);
-static void e_minicard_reflow ( GnomeCanvasItem *item, int flags );
-static void e_minicard_style_set (EMinicard *minicard, GtkStyle *previous_style);
-
-static void e_minicard_resize_children( EMinicard *e_minicard );
-static void remodel( EMinicard *e_minicard );
-
-static gint e_minicard_drag_begin (EMinicard *minicard, GdkEvent *event);
-
-static GnomeCanvasGroupClass *parent_class = NULL;
-
-typedef struct _EMinicardField EMinicardField;
-
-struct _EMinicardField {
- EContactField field;
- GnomeCanvasItem *label;
-};
-
-#define d(x)
-
-#define LIST_ICON_FILENAME "contact-list-16.png"
-
-#define E_MINICARD_FIELD(field) ((EMinicardField *)(field))
-
-static void
-e_minicard_field_destroy(EMinicardField *field)
-{
- gtk_object_destroy(GTK_OBJECT(field->label));
- g_free(field);
-}
-
-/* The arguments we take */
-enum {
- PROP_0,
- PROP_WIDTH,
- PROP_HEIGHT,
- PROP_HAS_FOCUS,
- PROP_SELECTED,
- PROP_HAS_CURSOR,
- PROP_EDITABLE,
- PROP_CONTACT
-};
-
-enum {
- SELECTED,
- DRAG_BEGIN,
- STYLE_SET,
- LAST_SIGNAL
-};
-
-static guint e_minicard_signals [LAST_SIGNAL] = {0, };
-
-GType
-e_minicard_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EMinicardClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_minicard_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EMinicard),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_minicard_init,
- };
-
- type = g_type_register_static (gnome_canvas_group_get_type (), "EMinicard", &info, 0);
- }
-
- return type;
-}
-
-static void
-e_minicard_class_init (EMinicardClass *klass)
-{
- GObjectClass *object_class = (GObjectClass*) klass;
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) klass;
-
- object_class->set_property = e_minicard_set_property;
- object_class->get_property = e_minicard_get_property;
- object_class->dispose = e_minicard_dispose;
- object_class->finalize = e_minicard_finalize;
-
- klass->style_set = e_minicard_style_set;
-
- parent_class = gtk_type_class (gnome_canvas_group_get_type ());
-
- g_object_class_install_property (object_class, PROP_WIDTH,
- g_param_spec_double ("width",
- _("Width"),
- /*_( */"XXX blurb" /*)*/,
- 0.0, G_MAXDOUBLE, 10.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_HEIGHT,
- g_param_spec_double ("height",
- _("Height"),
- /*_( */"XXX blurb" /*)*/,
- 0.0, G_MAXDOUBLE, 10.0,
- G_PARAM_READABLE));
-
- g_object_class_install_property (object_class, PROP_HAS_FOCUS,
- /* XXX should be _enum */
- g_param_spec_int ("has_focus",
- _("Has Focus"),
- /*_( */"XXX blurb" /*)*/,
- E_MINICARD_FOCUS_TYPE_START, E_MINICARD_FOCUS_TYPE_END,
- E_MINICARD_FOCUS_TYPE_START,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_SELECTED,
- g_param_spec_boolean ("selected",
- _("Selected"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_HAS_CURSOR,
- g_param_spec_boolean ("has_cursor",
- _("Has Cursor"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_EDITABLE,
- g_param_spec_boolean ("editable",
- _("Editable"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_CONTACT,
- g_param_spec_object ("contact",
- _("Contact"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_CONTACT,
- G_PARAM_READWRITE));
-
- e_minicard_signals [SELECTED] =
- g_signal_new ("selected",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EMinicardClass, selected),
- NULL, NULL,
- eab_marshal_INT__POINTER,
- G_TYPE_INT, 1, G_TYPE_POINTER);
-
- e_minicard_signals [DRAG_BEGIN] =
- g_signal_new ("drag_begin",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EMinicardClass, drag_begin),
- NULL, NULL,
- eab_marshal_INT__POINTER,
- G_TYPE_INT, 1, G_TYPE_POINTER);
-
- e_minicard_signals [STYLE_SET] =
- g_signal_new ("style_set",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EMinicardClass, style_set),
- NULL, NULL,
- eab_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1,
- GTK_TYPE_STYLE);
-
- /* GnomeCanvasItem method overrides */
- item_class->realize = e_minicard_realize;
- item_class->unrealize = e_minicard_unrealize;
- item_class->event = e_minicard_event;
-
- klass->selected = NULL;
-}
-
-static void
-e_minicard_init (EMinicard *minicard)
-{
- minicard->rect = NULL;
- minicard->fields = NULL;
- minicard->width = 10;
- minicard->height = 10;
- minicard->has_focus = FALSE;
- minicard->selected = FALSE;
- minicard->editable = FALSE;
- minicard->has_cursor = FALSE;
-
- minicard->contact = NULL;
-
- minicard->list_icon_pixbuf = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" LIST_ICON_FILENAME, NULL);
- minicard->list_icon_size = gdk_pixbuf_get_height (minicard->list_icon_pixbuf);
-
- minicard->editor = NULL;
-
- minicard->changed = FALSE;
-
- e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(minicard), e_minicard_reflow);
-}
-
-static void
-set_selected (EMinicard *minicard, gboolean selected)
-{
- GtkWidget *canvas = GTK_WIDGET(GNOME_CANVAS_ITEM(minicard)->canvas);
- if (selected) {
- gnome_canvas_item_set (minicard->rect,
- "outline_color_gdk", &canvas->style->bg[GTK_STATE_ACTIVE],
- NULL);
- gnome_canvas_item_set (minicard->header_rect,
- "fill_color_gdk", &canvas->style->bg[GTK_STATE_SELECTED],
- NULL);
- gnome_canvas_item_set (minicard->header_text,
- "fill_color_gdk", &canvas->style->text[GTK_STATE_SELECTED],
- NULL);
- } else {
- gnome_canvas_item_set (minicard->rect,
- "outline_color", NULL,
- NULL);
- gnome_canvas_item_set (minicard->header_rect,
- "fill_color_gdk", &canvas->style->bg[GTK_STATE_NORMAL],
- NULL);
- gnome_canvas_item_set (minicard->header_text,
- "fill_color_gdk", &canvas->style->text[GTK_STATE_NORMAL],
- NULL);
- }
- minicard->selected = selected;
-}
-
-static void
-set_has_cursor (EMinicard *minicard, gboolean has_cursor)
-{
- if (!minicard->has_focus && has_cursor)
- e_canvas_item_grab_focus(GNOME_CANVAS_ITEM (minicard), FALSE);
- minicard->has_cursor = has_cursor;
-}
-
-
-static void
-e_minicard_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- GnomeCanvasItem *item;
- EMinicard *e_minicard;
- GList *l;
-
- item = GNOME_CANVAS_ITEM (object);
- e_minicard = E_MINICARD (object);
-
- switch (prop_id){
- case PROP_WIDTH:
- if (e_minicard->width != g_value_get_double (value)) {
- e_minicard->width = g_value_get_double (value);
- e_minicard_resize_children(e_minicard);
- if ( GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED )
- e_canvas_item_request_reflow(item);
- }
- break;
- case PROP_HAS_FOCUS:
- if (e_minicard->fields) {
- if ( g_value_get_int(value) == E_FOCUS_START ||
- g_value_get_int(value) == E_FOCUS_CURRENT) {
- gnome_canvas_item_set(E_MINICARD_FIELD(e_minicard->fields->data)->label,
- "has_focus", g_value_get_int (value),
- NULL);
- } else if ( g_value_get_int (value) == E_FOCUS_END ) {
- gnome_canvas_item_set(E_MINICARD_FIELD(g_list_last(e_minicard->fields)->data)->label,
- "has_focus", g_value_get_int (value),
- NULL);
- }
- }
- else {
- if (!e_minicard->has_focus)
- e_canvas_item_grab_focus(item, FALSE);
- }
- break;
- case PROP_SELECTED:
- if (e_minicard->selected != g_value_get_boolean (value))
- set_selected (e_minicard, g_value_get_boolean (value));
- break;
- case PROP_EDITABLE:
- e_minicard->editable = g_value_get_boolean (value);
- for (l = e_minicard->fields; l; l = l->next) {
- g_object_set (E_MINICARD_FIELD (l->data)->label,
- "editable", FALSE /* e_minicard->editable */,
- NULL);
- }
- break;
- case PROP_HAS_CURSOR:
- d(g_print("%s: PROP_HAS_CURSOR\n", G_GNUC_FUNCTION));
- if (e_minicard->has_cursor != g_value_get_boolean (value))
- set_has_cursor (e_minicard, g_value_get_boolean (value));
- break;
- case PROP_CONTACT:
- if (e_minicard->contact)
- g_object_unref (e_minicard->contact);
- e_minicard->contact = E_CONTACT(g_value_get_object (value));
- if (e_minicard->contact)
- g_object_ref (e_minicard->contact);
- remodel(e_minicard);
- e_canvas_item_request_reflow(item);
- e_minicard->changed = FALSE;
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-e_minicard_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- EMinicard *e_minicard;
-
- e_minicard = E_MINICARD (object);
-
- switch (prop_id) {
- case PROP_WIDTH:
- g_value_set_double (value, e_minicard->width);
- break;
- case PROP_HEIGHT:
- g_value_set_double (value, e_minicard->height);
- break;
- case PROP_HAS_FOCUS:
- g_value_set_int (value, e_minicard->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE);
- break;
- case PROP_SELECTED:
- g_value_set_boolean (value, e_minicard->selected);
- break;
- case PROP_HAS_CURSOR:
- g_value_set_boolean (value, e_minicard->has_cursor);
- break;
- case PROP_EDITABLE:
- g_value_set_boolean (value, e_minicard->editable);
- break;
- case PROP_CONTACT:
- g_value_set_object (value, e_minicard->contact);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-e_minicard_dispose (GObject *object)
-{
- EMinicard *e_minicard;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (E_IS_MINICARD (object));
-
- e_minicard = E_MINICARD (object);
-
- if (e_minicard->fields) {
- g_list_foreach(e_minicard->fields, (GFunc) e_minicard_field_destroy, NULL);
- g_list_free(e_minicard->fields);
- e_minicard->fields = NULL;
- }
-
- if (e_minicard->list_icon_pixbuf) {
- gdk_pixbuf_unref (e_minicard->list_icon_pixbuf);
- e_minicard->list_icon_pixbuf = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-
-
-static void
-e_minicard_finalize (GObject *object)
-{
- EMinicard *e_minicard;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (E_IS_MINICARD (object));
-
- e_minicard = E_MINICARD (object);
-
- if (e_minicard->contact)
- g_object_unref (e_minicard->contact);
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-static void
-e_minicard_style_set (EMinicard *minicard, GtkStyle *previous_style)
-{
- if ( (GTK_OBJECT_FLAGS( minicard ) & GNOME_CANVAS_ITEM_REALIZED) )
- set_selected (minicard, minicard->selected);
-}
-
-static void
-e_minicard_realize (GnomeCanvasItem *item)
-{
- EMinicard *e_minicard;
- GnomeCanvasGroup *group;
- GtkWidget *canvas;
-
- e_minicard = E_MINICARD (item);
- group = GNOME_CANVAS_GROUP( item );
- canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (item)->canvas);
-
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize)
- (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item);
-
- e_minicard->rect =
- gnome_canvas_item_new( group,
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) MAX (e_minicard->width - 1, 0),
- "y2", (double) MAX (e_minicard->height - 1, 0),
- "outline_color", NULL,
- NULL );
-
- e_minicard->header_rect =
- gnome_canvas_item_new( group,
- gnome_canvas_rect_get_type(),
- "x1", (double) 2,
- "y1", (double) 2,
- "x2", (double) MAX (e_minicard->width - 3, 0),
- "y2", (double) MAX (e_minicard->height - 3, 0),
- "fill_color_gdk", &canvas->style->bg[GTK_STATE_NORMAL],
- NULL );
-
- e_minicard->header_text =
- gnome_canvas_item_new( group,
- e_text_get_type(),
- "anchor", GTK_ANCHOR_NW,
- "width", (double) MAX( e_minicard->width - 12, 0 ),
- "clip", TRUE,
- "use_ellipsis", TRUE,
- "fill_color_gdk", &canvas->style->fg[GTK_STATE_NORMAL],
- "text", "",
- "draw_background", FALSE,
- NULL );
-
- e_canvas_item_move_absolute(e_minicard->header_text, 6, 6);
-
- e_minicard->list_icon =
- gnome_canvas_item_new ( group,
- gnome_canvas_pixbuf_get_type(),
- "pixbuf", e_minicard->list_icon_pixbuf,
- NULL);
-
- set_selected (e_minicard, e_minicard->selected);
-
- remodel(e_minicard);
- e_canvas_item_request_reflow(item);
-}
-
-static void
-e_minicard_unrealize (GnomeCanvasItem *item)
-{
- EMinicard *e_minicard;
-
- e_minicard = E_MINICARD (item);
-
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize)
- (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item);
-}
-
-/* Callback used when the contact editor is closed */
-static void
-editor_closed_cb (GtkObject *editor, gpointer data)
-{
- EMinicard *minicard = data;
- g_object_unref (editor);
- minicard->editor = NULL;
-}
-
-static gboolean
-e_minicard_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- EMinicard *e_minicard;
- GtkWidget *canvas;
-
- e_minicard = E_MINICARD (item);
- canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (item)->canvas);
-
- switch( event->type ) {
- case GDK_FOCUS_CHANGE:
- {
- GdkEventFocus *focus_event = (GdkEventFocus *) event;
- d(g_print("%s: GDK_FOCUS_CHANGE: %s\n", G_GNUC_FUNCTION, focus_event->in?"in":"out"));
- if (focus_event->in) {
- /* Chris: When EMinicard gets the cursor, if it doesn't have the focus, it should take it. */
- e_minicard->has_focus = TRUE;
- if (!e_minicard->selected) {
- e_minicard_selected(e_minicard, event);
- }
- }
- else {
- e_minicard->has_focus = FALSE;
- }
- }
- break;
- case GDK_BUTTON_PRESS: {
- if (1 <= event->button.button && event->button.button <= 2) {
- int ret_val = e_minicard_selected(e_minicard, event);
- GdkEventMask mask = ((1 << (4 + event->button.button)) |
- GDK_POINTER_MOTION_MASK |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK);
-
- e_canvas_item_grab_focus(item, TRUE);
-
- if (gnome_canvas_item_grab (GNOME_CANVAS_ITEM (e_minicard),
- mask, NULL, event->button.time)) {
- return FALSE;
- }
- gtk_grab_add (GTK_WIDGET (GNOME_CANVAS_ITEM (e_minicard)->canvas));
- e_minicard->button_x = event->button.x;
- e_minicard->button_y = event->button.y;
- e_minicard->drag_button = event->button.button;
- e_minicard->drag_button_down = TRUE;
- return ret_val;
- } else if (event->button.button == 3) {
- int ret_val = e_minicard_selected(e_minicard, event);
- if (ret_val != 0)
- return ret_val;
- }
- break;
- }
- case GDK_BUTTON_RELEASE:
- e_minicard_selected(e_minicard, event);
- if (e_minicard->drag_button == event->button.button) {
- e_minicard->drag_button = 0;
- e_minicard->drag_button_down = FALSE;
- e_minicard->button_x = -1;
- e_minicard->button_y = -1;
-
- if (GTK_WIDGET_HAS_GRAB (GNOME_CANVAS_ITEM (e_minicard)->canvas)) {
- gtk_grab_remove (GTK_WIDGET (GNOME_CANVAS_ITEM (e_minicard)->canvas));
- gnome_canvas_item_ungrab (GNOME_CANVAS_ITEM (e_minicard), event->button.time);
- }
- }
- break;
- case GDK_MOTION_NOTIFY:
- if (e_minicard->drag_button_down && event->motion.state & GDK_BUTTON1_MASK) {
- if (MAX (abs (e_minicard->button_x - event->motion.x),
- abs (e_minicard->button_y - event->motion.y)) > 3) {
- gint ret_val;
-
- ret_val = e_minicard_drag_begin(e_minicard, event);
-
- e_minicard->drag_button_down = FALSE;
-
- return ret_val;
- }
- }
- break;
- case GDK_2BUTTON_PRESS:
- if (event->button.button == 1 && E_IS_MINICARD_VIEW(item->parent)) {
- if (e_minicard->editor) {
- if (GPOINTER_TO_INT (e_contact_get (e_minicard->contact, E_CONTACT_IS_LIST)))
- e_contact_list_editor_raise (E_CONTACT_LIST_EDITOR(e_minicard->editor));
- else
- e_contact_editor_raise(E_CONTACT_EDITOR(e_minicard->editor));
- } else {
- EBook *book = NULL;
- if (E_IS_MINICARD_VIEW(item->parent)) {
- g_object_get(item->parent,
- "book", &book,
- NULL);
- }
-
- if (book != NULL) {
- if (e_contact_get (e_minicard->contact, E_CONTACT_IS_LIST)) {
- EContactListEditor *editor = eab_show_contact_list_editor (book, e_minicard->contact,
- FALSE, e_minicard->editable);
- e_minicard->editor = G_OBJECT (editor);
- }
- else {
- EContactEditor *editor = eab_show_contact_editor (book, e_minicard->contact,
- FALSE, e_minicard->editable);
- e_minicard->editor = G_OBJECT (editor);
- }
- g_object_ref (e_minicard->editor);
-
- g_signal_connect (e_minicard->editor, "editor_closed",
- G_CALLBACK (editor_closed_cb), e_minicard);
-
- g_object_unref (book);
- }
- }
- return TRUE;
- }
- break;
- default:
- break;
- }
-
- if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event)
- return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event);
- else
- return 0;
-}
-
-static void
-e_minicard_resize_children( EMinicard *e_minicard )
-{
- GList *list;
- gboolean is_list = GPOINTER_TO_INT (e_contact_get (e_minicard->contact, E_CONTACT_IS_LIST));
-
- if (e_minicard->header_text) {
- gnome_canvas_item_set( e_minicard->header_text,
- "width", ((double) e_minicard->width - 12
- - (is_list ? e_minicard->list_icon_size : 0.0)),
- NULL );
- }
- if (e_minicard->list_icon) {
- e_canvas_item_move_absolute(e_minicard->list_icon,
- e_minicard->width - e_minicard->list_icon_size - 3,
- 3);
- }
- for ( list = e_minicard->fields; list; list = g_list_next( list ) ) {
- gnome_canvas_item_set( E_MINICARD_FIELD( list->data )->label,
- "width", (double) e_minicard->width - 4.0,
- NULL );
- }
-}
-
-static void
-add_field (EMinicard *e_minicard, EContactField field, gdouble left_width)
-{
- GnomeCanvasItem *new_item;
- GnomeCanvasGroup *group;
- EMinicardField *minicard_field;
- char *name;
- char *string;
-
- group = GNOME_CANVAS_GROUP( e_minicard );
-
- name = g_strdup_printf("%s:", e_contact_pretty_name (field));
- string = e_contact_get (e_minicard->contact, field);
-
- /* Magically convert embedded XML into an address. */
- if (!strncmp (string, "<?xml", 5)) {
- EABDestination *dest = eab_destination_import (string);
- if (dest != NULL) {
- gchar *new_string = g_strdup (eab_destination_get_textrep (dest, TRUE));
- g_free (string);
- string = new_string;
- g_object_unref (dest);
- }
- }
-
- new_item = e_minicard_label_new(group);
- gnome_canvas_item_set( new_item,
- "width", e_minicard->width - 4.0,
- "fieldname", name,
- "field", string,
- "max_field_name_length", left_width,
- "editable", FALSE /* e_minicard->editable */,
- NULL );
-#if notyet
- g_object_set(E_MINICARD_LABEL(new_item)->field,
- "allow_newlines", e_card_simple_get_allow_newlines (e_minicard->contact, field),
- NULL);
-#endif
- g_object_set_data(G_OBJECT (E_MINICARD_LABEL(new_item)->field),
- "EMinicard:field",
- GINT_TO_POINTER(field));
-
- minicard_field = g_new(EMinicardField, 1);
- minicard_field->field = field;
- minicard_field->label = new_item;
-
- e_minicard->fields = g_list_append( e_minicard->fields, minicard_field);
- e_canvas_item_move_absolute(new_item, 2, e_minicard->height);
- g_free(name);
- g_free(string);
-}
-
-static int
-get_left_width(EMinicard *e_minicard)
-{
- gchar *name;
- EContactField field;
- int width = -1;
- PangoLayout *layout;
-
- layout = gtk_widget_create_pango_layout (GTK_WIDGET (GNOME_CANVAS_ITEM (e_minicard)->canvas), "");
- for(field = E_CONTACT_FULL_NAME; field != E_CONTACT_LAST_SIMPLE_STRING; field++) {
- int this_width;
-
- if (field == E_CONTACT_FAMILY_NAME || field == E_CONTACT_GIVEN_NAME)
- continue;
-
- name = g_strdup_printf("%s:", e_contact_pretty_name (field));
- pango_layout_set_text (layout, name, -1);
- pango_layout_get_pixel_size (layout, &this_width, NULL);
- if (width < this_width)
- width = this_width;
- g_free(name);
- }
- g_object_unref (layout);
- return width;
-}
-
-static void
-remodel( EMinicard *e_minicard )
-{
- int count = 0;
- if ( !(GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED) )
- return;
- if (e_minicard->contact) {
- EContactField field;
- GList *list;
- char *file_as;
- int left_width = -1;
-
- if (e_minicard->header_text) {
- file_as = e_contact_get (e_minicard->contact, E_CONTACT_FILE_AS);
- gnome_canvas_item_set (e_minicard->header_text,
- "text", file_as ? file_as : "",
- NULL );
- g_free(file_as);
- }
-
- if (e_minicard->contact && e_contact_get (e_minicard->contact, E_CONTACT_IS_LIST))
- gnome_canvas_item_show (e_minicard->list_icon);
- else
- gnome_canvas_item_hide (e_minicard->list_icon);
-
- list = e_minicard->fields;
- e_minicard->fields = NULL;
-
- for(field = E_CONTACT_FULL_NAME; field != E_CONTACT_LAST_SIMPLE_STRING && count < 5; field++) {
- EMinicardField *minicard_field = NULL;
-
- if (field == E_CONTACT_FAMILY_NAME || field == E_CONTACT_GIVEN_NAME)
- continue;
-
- if (list)
- minicard_field = list->data;
- if (minicard_field && minicard_field->field == field) {
- GList *this_list = list;
- char *string;
-
- string = e_contact_get(e_minicard->contact, field);
- if (string && *string) {
- /* Magically convert embedded XML into an address. */
- if (!strncmp (string, "<?xml", 4)) {
- EABDestination *dest = eab_destination_import (string);
- if (dest != NULL) {
- gchar *new_string = g_strdup (eab_destination_get_textrep (dest, TRUE));
- g_free (string);
- string = new_string;
- g_object_unref (dest);
- }
- }
-
- e_minicard->fields = g_list_append(e_minicard->fields, minicard_field);
- g_object_set(minicard_field->label,
- "field", string,
- NULL);
- count ++;
- } else {
- e_minicard_field_destroy(minicard_field);
- }
- list = g_list_remove_link(list, this_list);
- g_list_free_1(this_list);
- g_free(string);
- } else {
- char *string;
- if (left_width == -1) {
- left_width = get_left_width(e_minicard);
- }
-
- string = e_contact_get(e_minicard->contact, field);
- if (string && *string) {
- add_field(e_minicard, field, left_width);
- count++;
- }
- g_free(string);
- }
- }
-
- g_list_foreach(list, (GFunc) e_minicard_field_destroy, NULL);
- g_list_free(list);
- }
-}
-
-static void
-e_minicard_reflow( GnomeCanvasItem *item, int flags )
-{
- EMinicard *e_minicard = E_MINICARD(item);
- if ( GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED ) {
- GList *list;
- gdouble text_height;
- gint old_height;
-
- old_height = e_minicard->height;
-
- g_object_get( e_minicard->header_text,
- "text_height", &text_height,
- NULL );
-
- e_minicard->height = text_height + 10.0;
-
- gnome_canvas_item_set( e_minicard->header_rect,
- "y2", text_height + 9.0,
- NULL );
-
- for(list = e_minicard->fields; list; list = g_list_next(list)) {
- EMinicardField *field = E_MINICARD_FIELD(list->data);
- GnomeCanvasItem *item = field->label;
- g_object_get (item,
- "height", &text_height,
- NULL);
- e_canvas_item_move_absolute(item, 2, e_minicard->height);
- e_minicard->height += text_height;
- }
- e_minicard->height += 2;
-
- gnome_canvas_item_set( e_minicard->rect,
- "x2", (double) e_minicard->width - 1.0,
- "y2", (double) e_minicard->height - 1.0,
- NULL );
- gnome_canvas_item_set( e_minicard->header_rect,
- "x2", (double) e_minicard->width - 3.0,
- NULL );
-
- if (old_height != e_minicard->height)
- e_canvas_item_request_parent_reflow(item);
- }
-}
-
-const char *
-e_minicard_get_card_id (EMinicard *minicard)
-{
- g_return_val_if_fail(minicard != NULL, NULL);
- g_return_val_if_fail(E_IS_MINICARD(minicard), NULL);
-
- if (minicard->contact) {
- return e_contact_get_const (minicard->contact, E_CONTACT_UID);
- } else {
- return "";
- }
-}
-
-int
-e_minicard_compare (EMinicard *minicard1, EMinicard *minicard2)
-{
- int cmp = 0;
-
- g_return_val_if_fail(minicard1 != NULL, 0);
- g_return_val_if_fail(E_IS_MINICARD(minicard1), 0);
- g_return_val_if_fail(minicard2 != NULL, 0);
- g_return_val_if_fail(E_IS_MINICARD(minicard2), 0);
-
- if (minicard1->contact && minicard2->contact) {
- char *file_as1, *file_as2;
- g_object_get(minicard1->contact,
- "file_as", &file_as1,
- NULL);
- g_object_get(minicard2->contact,
- "file_as", &file_as2,
- NULL);
-
- if (file_as1 && file_as2)
- cmp = g_utf8_collate(file_as1, file_as2);
- else if (file_as1)
- cmp = -1;
- else if (file_as2)
- cmp = 1;
- else
- cmp = strcmp(e_minicard_get_card_id(minicard1), e_minicard_get_card_id(minicard2));
-
- g_free (file_as1);
- g_free (file_as2);
- }
-
- return cmp;
-}
-
-int
-e_minicard_selected (EMinicard *minicard, GdkEvent *event)
-{
- gint ret_val = 0;
- GnomeCanvasItem *item = GNOME_CANVAS_ITEM (minicard);
- if (item->parent) {
- guint signal_id = g_signal_lookup ("selection_event", G_OBJECT_TYPE (item->parent));
- /* We should probably check the signature here, but I
- * don't think it's worth the time required to code
- * it.
- */
- if (signal_id != 0) {
- g_signal_emit(item->parent,
- signal_id, 0,
- item, event, &ret_val);
- }
- }
- return ret_val;
-}
-
-static gint
-e_minicard_drag_begin (EMinicard *minicard, GdkEvent *event)
-{
- gint ret_val = 0;
- GnomeCanvasItem *parent;
- g_signal_emit (minicard,
- e_minicard_signals[DRAG_BEGIN], 0,
- event, &ret_val);
-
- parent = GNOME_CANVAS_ITEM (minicard)->parent;
- if (parent && E_IS_REFLOW (parent)) {
- E_REFLOW (parent)->maybe_in_drag = FALSE;
- }
- return ret_val;
-}
diff --git a/addressbook/gui/widgets/e-minicard.h b/addressbook/gui/widgets/e-minicard.h
deleted file mode 100644
index 2d0cfd8ed5..0000000000
--- a/addressbook/gui/widgets/e-minicard.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-minicard.h
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of 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_MINICARD_H__
-#define __E_MINICARD_H__
-
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include "addressbook/gui/contact-editor/e-contact-editor.h"
-#include <libgnomecanvas/gnome-canvas.h>
-#include <libebook/e-contact.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* EMinicard - A small card displaying information about a contact.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- * width double RW width of the card
- * height double R height of the card
- * card ECard* RW Pointer to the ECard
- */
-
-#define E_TYPE_MINICARD (e_minicard_get_type ())
-#define E_MINICARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_MINICARD, EMinicard))
-#define E_MINICARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_MINICARD, EMinicardClass))
-#define E_IS_MINICARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_MINICARD))
-#define E_IS_MINICARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_MINICARD))
-
-
-typedef struct _EMinicard EMinicard;
-typedef struct _EMinicardClass EMinicardClass;
-typedef enum _EMinicardFocusType EMinicardFocusType;
-
-enum _EMinicardFocusType {
- E_MINICARD_FOCUS_TYPE_START,
- E_MINICARD_FOCUS_TYPE_END
-};
-
-struct _EMinicard
-{
- GnomeCanvasGroup parent;
-
- /* item specific fields */
- EContact *contact;
-
- GnomeCanvasItem *rect;
- GnomeCanvasItem *header_rect;
- GnomeCanvasItem *header_text;
- GnomeCanvasItem *list_icon;
-
- GdkPixbuf *list_icon_pixbuf;
- double list_icon_size;
-
- GObject *editor;
-
- GList *fields; /* Of type EMinicardField */
- guint needs_remodeling : 1;
-
- guint changed : 1;
-
- guint selected : 1;
- guint has_cursor : 1;
-
- guint has_focus : 1;
-
- guint editable : 1;
-
- guint drag_button_down : 1;
- gint drag_button;
-
- gint button_x;
- gint button_y;
-
- double width;
- double height;
-};
-
-struct _EMinicardClass
-{
- GnomeCanvasGroupClass parent_class;
-
- gint (* selected) (EMinicard *minicard, GdkEvent *event);
- gint (* drag_begin) (EMinicard *minicard, GdkEvent *event);
-
- void (* style_set) (EMinicard *minicard, GtkStyle *previous_style);
-};
-
-
-GType e_minicard_get_type (void);
-const char *e_minicard_get_card_id (EMinicard *minicard);
-int e_minicard_compare (EMinicard *minicard1,
- EMinicard *minicard2);
-
-int e_minicard_selected (EMinicard *minicard,
- GdkEvent *event);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_MINICARD_H__ */
diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c
deleted file mode 100644
index 3de6eac380..0000000000
--- a/addressbook/gui/widgets/eab-contact-display.c
+++ /dev/null
@@ -1,486 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Chris Toshok <toshok@ximian.com>
- *
- * Copyright (C) 2003 Ximian, Inc. (www.ximian.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#include "eab-contact-display.h"
-
-#include "e-util/e-html-utils.h"
-#include "util/eab-destination.h"
-
-#include <string.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnome/gnome-url.h>
-#include <gtkhtml/gtkhtml.h>
-#include <gtkhtml/gtkhtml-stream.h>
-
-#define PARENT_TYPE (gtk_vbox_get_type ())
-
-struct _EABContactDisplayPrivate {
- GtkHTML *html;
- EContact *contact;
-};
-
-
-#define HTML_HEADER "<!doctype html public \"-//W3C//DTD HTML 4.0 TRANSITIONAL//EN\">\n<html>\n" \
- "<head>\n<meta name=\"generator\" content=\"Evolution Addressbook Component\">\n</head>\n"
-
-#define MAX_COMPACT_IMAGE_DIMENSION 48
-
-static void
-on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
- EABContactDisplay *display)
-{
- printf ("on_url_requested (%s)\n", url);
- if (!strcmp (url, "internal-contact-photo:")) {
- EContactPhoto *photo;
-
- photo = e_contact_get (display->priv->contact, E_CONTACT_PHOTO);
- if (!photo)
- photo = e_contact_get (display->priv->contact, E_CONTACT_LOGO);
-
- printf ("writing a photo of length %d\n", photo->length);
-
- gtk_html_stream_write (handle, photo->data, photo->length);
-
- gtk_html_end (html, handle, GTK_HTML_STREAM_OK);
- }
-}
-
-static void
-on_link_clicked (GtkHTML *html, const char *url, EABContactDisplay *display)
-{
- GError *err = NULL;
-
- gnome_url_show (url, &err);
-
- if (err) {
- g_warning ("gnome_url_show: %s", err->message);
- g_error_free (err);
- }
-}
-
-static void
-render_address (GtkHTMLStream *html_stream, EContact *contact, const char *html_label, EContactField adr_field, EContactField label_field)
-{
- EContactAddress *adr;
- const char *label;
-
- label = e_contact_get_const (contact, label_field);
- if (label) {
- char *html = e_text_to_html (label, E_TEXT_TO_HTML_CONVERT_NL);
-
- gtk_html_stream_printf (html_stream, "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr valign=\"top\"><td>");
- gtk_html_stream_printf (html_stream, "<b>%s:</b>&nbsp;<td>%s<br>", html_label, html);
-
- gtk_html_stream_printf (html_stream, "<a href=\"http://www.mapquest.com/\">%s</a>", _("Map It"));
- gtk_html_stream_printf (html_stream, "</td></tr></table>");
- g_free (html);
- return;
- }
-
- adr = e_contact_get (contact, adr_field);
- if (adr &&
- (adr->po || adr->ext || adr->street || adr->locality || adr->region || adr->code || adr->country)) {
-
- gtk_html_stream_printf (html_stream, "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr valign=\"top\"><td>");
- gtk_html_stream_printf (html_stream, "<b>%s:</b>&nbsp;<td>", html_label);
-
- if (adr->po && *adr->po) gtk_html_stream_printf (html_stream, "%s<br>", adr->po);
- if (adr->ext && *adr->ext) gtk_html_stream_printf (html_stream, "%s<br>", adr->ext);
- if (adr->street && *adr->street) gtk_html_stream_printf (html_stream, "%s<br>", adr->street);
- if (adr->locality && *adr->locality) gtk_html_stream_printf (html_stream, "%s<br>", adr->locality);
- if (adr->region && *adr->region) gtk_html_stream_printf (html_stream, "%s<br>", adr->region);
- if (adr->code && *adr->code) gtk_html_stream_printf (html_stream, "%s<br>", adr->code);
- if (adr->country && *adr->country) gtk_html_stream_printf (html_stream, "%s<br>", adr->country);
-
- gtk_html_stream_printf (html_stream, "<a href=\"http://www.mapquest.com/\">%s</a>", _("Map It"));
- gtk_html_stream_printf (html_stream, "</td></tr></table>");
- }
- if (adr)
- e_contact_address_free (adr);
-}
-
-static void
-render_string (GtkHTMLStream *html_stream, EContact *contact, const char *html_label, EContactField field)
-{
- const char *str;
-
- str = e_contact_get_const (contact, field);
-
- if (str && *str) {
- char *html = e_text_to_html (str, 0);
- gtk_html_stream_printf (html_stream, "<b>%s:</b> %s<br>", html_label, str);
- g_free (html);
- }
-}
-
-static void
-render_url (GtkHTMLStream *html_stream, EContact *contact, const char *html_label, EContactField field)
-{
- const char *str;
- str = e_contact_get_const (contact, field);
- if (str && *str) {
- char *html = e_text_to_html (str, E_TEXT_TO_HTML_CONVERT_URLS);
- gtk_html_stream_printf (html_stream, "<b>%s:</b> %s<br>",
- html_label, html);
- g_free (html);
- }
-}
-
-static void
-eab_contact_display_render_normal (EABContactDisplay *display, EContact *contact)
-{
- GtkHTMLStream *html_stream;
-
- if (display->priv->contact)
- g_object_unref (display->priv->contact);
- display->priv->contact = contact;
- if (display->priv->contact)
- g_object_ref (display->priv->contact);
-
- html_stream = gtk_html_begin (display->priv->html);
- gtk_html_stream_write (html_stream, HTML_HEADER, sizeof (HTML_HEADER) - 1);
- gtk_html_stream_write (html_stream, "<body>\n", 7);
-
- if (contact) {
- char *str, *html;
- EContactPhoto *photo;
-
- gtk_html_stream_printf (html_stream, "<table border=\"0\" valign=\"top\"><tr valign=\"top\"><td>");
- photo = e_contact_get (contact, E_CONTACT_PHOTO);
- if (!photo)
- photo = e_contact_get (contact, E_CONTACT_LOGO);
- if (photo) {
- gtk_html_stream_printf (html_stream, "<img src=\"internal-contact-photo:\">");
- e_contact_photo_free (photo);
- }
-
- gtk_html_stream_printf (html_stream, "</td><td>\n");
-
- str = e_contact_get_const (contact, E_CONTACT_FILE_AS);
- if (str) {
- html = e_text_to_html (str, 0);
- gtk_html_stream_printf (html_stream, "<h2>%s</h2>", html);
- g_free (html);
- }
- else {
- str = e_contact_get_const (contact, E_CONTACT_FULL_NAME);
- if (str) {
- html = e_text_to_html (str, 0);
- gtk_html_stream_printf (html_stream, "<h2>%s</h2>", html);
- g_free (html);
- }
- }
-
- if (e_contact_get (contact, E_CONTACT_IS_LIST)) {
- GList *email_list;
- GList *l;
-
- gtk_html_stream_printf (html_stream, "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr valign=\"top\"><td>");
- gtk_html_stream_printf (html_stream, "<b>%s:</b>&nbsp;<td>", _("List Members"));
-
- email_list = e_contact_get (contact, E_CONTACT_EMAIL);
- for (l = email_list; l; l = l->next) {
- EABDestination *dest = eab_destination_import (l->data);
- if (dest) {
- const char *textrep = eab_destination_get_textrep (dest, TRUE);
- char *html = e_text_to_html (textrep, 0);
- gtk_html_stream_printf (html_stream, "%s<br>", html);
- g_free (html);
- g_object_unref (dest);
- }
- }
- gtk_html_stream_printf (html_stream, "</td></tr></table>");
- }
- else {
- render_string (html_stream, contact, _("Job Title"), E_CONTACT_TITLE);
-
- render_string (html_stream, contact, _("Email"), E_CONTACT_EMAIL_1);
- render_string (html_stream, contact, _("Email"), E_CONTACT_EMAIL_2);
- render_string (html_stream, contact, _("Email"), E_CONTACT_EMAIL_3);
-
-
- render_address (html_stream, contact, _("Home Address"), E_CONTACT_ADDRESS_HOME, E_CONTACT_ADDRESS_LABEL_HOME);
- render_address (html_stream, contact, _("Work Address"), E_CONTACT_ADDRESS_WORK, E_CONTACT_ADDRESS_LABEL_WORK);
- render_address (html_stream, contact, _("Other Address"), E_CONTACT_ADDRESS_OTHER, E_CONTACT_ADDRESS_LABEL_OTHER);
-
- gtk_html_stream_printf (html_stream, "<hr>");
-
- render_url (html_stream, contact, _("Home page"), E_CONTACT_HOMEPAGE_URL);
- render_url (html_stream, contact, _("Blog"), E_CONTACT_BLOG_URL);
-
- }
-
- gtk_html_stream_printf (html_stream, "</td></tr></table>\n");
- }
-
- gtk_html_stream_write (html_stream, "</body></html>\n", 15);
- gtk_html_end (display->priv->html, html_stream, GTK_HTML_STREAM_OK);
-}
-
-static void
-eab_contact_display_render_compact (EABContactDisplay *display, EContact *contact)
-{
- GtkHTMLStream *html_stream;
-
- if (display->priv->contact)
- g_object_unref (display->priv->contact);
- display->priv->contact = contact;
- if (display->priv->contact)
- g_object_ref (display->priv->contact);
-
- html_stream = gtk_html_begin (display->priv->html);
- gtk_html_stream_write (html_stream, HTML_HEADER, sizeof (HTML_HEADER) - 1);
- gtk_html_stream_write (html_stream, "<body>\n", 7);
-
- if (contact) {
- char *str, *html;
- EContactPhoto *photo;
-
- gtk_html_stream_printf (html_stream,
- "<table width=\"100%%\" cellpadding=1 cellspacing=0 bgcolor=\"#000000\">"
- "<tr><td>"
- "<table width=\"100%%\" cellpadding=0 cellspacing=0 bgcolor=\"#eeeeee\">"
- "<tr><td>"
- "<table>"
- "<tr valign=\"top\"><td>");
-
- photo = e_contact_get (contact, E_CONTACT_PHOTO);
- if (!photo)
- photo = e_contact_get (contact, E_CONTACT_LOGO);
- if (photo) {
- int calced_width = MAX_COMPACT_IMAGE_DIMENSION, calced_height = MAX_COMPACT_IMAGE_DIMENSION;
- GdkPixbufLoader *loader = gdk_pixbuf_loader_new ();
- GdkPixbuf *pixbuf;
-
- /* figure out if we need to downscale the
- image here. we don't scale the pixbuf
- itself, just insert width/height tags in
- the html */
- gdk_pixbuf_loader_write (loader, photo->data, photo->length, NULL);
- pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
- gdk_pixbuf_loader_close (loader, NULL);
- g_object_unref (loader);
- if (pixbuf) {
- int max_dimension = gdk_pixbuf_get_height (pixbuf);
- if (max_dimension < gdk_pixbuf_get_width (pixbuf))
- max_dimension = gdk_pixbuf_get_width (pixbuf);
-
- calced_width = (float)gdk_pixbuf_get_width (pixbuf) / max_dimension * MAX_COMPACT_IMAGE_DIMENSION;
- calced_height = (float)gdk_pixbuf_get_height (pixbuf) / max_dimension * MAX_COMPACT_IMAGE_DIMENSION;
-
- calced_width = MIN (calced_width, MAX_COMPACT_IMAGE_DIMENSION);
- calced_height = MIN (calced_height, MAX_COMPACT_IMAGE_DIMENSION);
- }
-
- gdk_pixbuf_unref (pixbuf);
- gtk_html_stream_printf (html_stream, "<img width=\"%d\" height=\"%d\" src=\"internal-contact-photo:\">",
- calced_width, calced_height);
- e_contact_photo_free (photo);
- }
-
- gtk_html_stream_printf (html_stream, "</td><td>\n");
-
- str = e_contact_get_const (contact, E_CONTACT_FILE_AS);
- if (str) {
- html = e_text_to_html (str, 0);
- gtk_html_stream_printf (html_stream, "<b>%s</b>", html);
- g_free (html);
- }
- else {
- str = e_contact_get_const (contact, E_CONTACT_FULL_NAME);
- if (str) {
- html = e_text_to_html (str, 0);
- gtk_html_stream_printf (html_stream, "<b>%s</b>", html);
- g_free (html);
- }
- }
-
- gtk_html_stream_write (html_stream, "<hr>", 4);
-
- if (e_contact_get (contact, E_CONTACT_IS_LIST)) {
- GList *email_list;
- GList *l;
-
- gtk_html_stream_printf (html_stream, "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr valign=\"top\"><td>");
- gtk_html_stream_printf (html_stream, "<b>%s:</b>&nbsp;<td>", _("List Members"));
-
- email_list = e_contact_get (contact, E_CONTACT_EMAIL);
- for (l = email_list; l; l = l->next) {
- EABDestination *dest = eab_destination_import (l->data);
- if (dest) {
- const char *textrep = eab_destination_get_textrep (dest, TRUE);
- char *html = e_text_to_html (textrep, 0);
- gtk_html_stream_printf (html_stream, "%s, ", html);
- g_free (html);
- g_object_unref (dest);
- }
- }
- gtk_html_stream_printf (html_stream, "</td></tr></table>");
- }
- else {
- gboolean comma = FALSE;
- str = e_contact_get_const (contact, E_CONTACT_TITLE);
- if (str) {
- html = e_text_to_html (str, 0);
- gtk_html_stream_printf (html_stream, "<b>%s:</b> %s<br>", _("Job Title"), str);
- g_free (html);
- }
-
- gtk_html_stream_printf (html_stream, "<b>%s:</b> ", _("Email"));
- str = e_contact_get_const (contact, E_CONTACT_EMAIL_1);
- if (str) {
- html = e_text_to_html (str, 0);
- gtk_html_stream_printf (html_stream, "%s", str);
- g_free (html);
- comma = TRUE;
- }
- str = e_contact_get_const (contact, E_CONTACT_EMAIL_2);
- if (str) {
- html = e_text_to_html (str, 0);
- gtk_html_stream_printf (html_stream, "%s%s", comma ? ", " : "", str);
- g_free (html);
- comma = TRUE;
- }
- str = e_contact_get_const (contact, E_CONTACT_EMAIL_3);
- if (str) {
- html = e_text_to_html (str, 0);
- gtk_html_stream_printf (html_stream, "%s%s", comma ? ", " : "", str);
- g_free (html);
- }
- gtk_html_stream_write (html_stream, "<br>", 4);
-
- str = e_contact_get_const (contact, E_CONTACT_HOMEPAGE_URL);
- if (str) {
- html = e_text_to_html (str, E_TEXT_TO_HTML_CONVERT_URLS);
- gtk_html_stream_printf (html_stream, "<b>%s:</b> %s<br>",
- _("Home page"), html);
- g_free (html);
- }
-
- str = e_contact_get_const (contact, E_CONTACT_BLOG_URL);
- if (str) {
- html = e_text_to_html (str, E_TEXT_TO_HTML_CONVERT_URLS);
- gtk_html_stream_printf (html_stream, "<b>%s:</b> %s<br>",
- _("Blog"), html);
- }
- }
-
- gtk_html_stream_printf (html_stream, "</td></tr></table></td></tr></table></td></tr></table>\n");
- }
-
- gtk_html_stream_write (html_stream, "</body></html>\n", 15);
- gtk_html_end (display->priv->html, html_stream, GTK_HTML_STREAM_OK);
-}
-
-void
-eab_contact_display_render (EABContactDisplay *display, EContact *contact,
- EABContactDisplayRenderMode mode)
-{
- switch (mode) {
- case EAB_CONTACT_DISPLAY_RENDER_NORMAL:
- eab_contact_display_render_normal (display, contact);
- break;
- case EAB_CONTACT_DISPLAY_RENDER_COMPACT:
- eab_contact_display_render_compact (display, contact);
- break;
- }
-}
-
-GtkWidget*
-eab_contact_display_new (void)
-{
- EABContactDisplay *display;
-
- display = g_object_new (EAB_TYPE_CONTACT_DISPLAY, NULL);
-
- display->priv = g_new0 (EABContactDisplayPrivate, 1);
-
- display->priv->html = GTK_HTML (gtk_html_new ());
-
- gtk_html_set_default_content_type (display->priv->html, "text/html; charset=utf-8");
-
- gtk_html_set_editable (display->priv->html, FALSE);
-
-
- g_signal_connect (display->priv->html, "url_requested",
- G_CALLBACK (on_url_requested),
- display);
- g_signal_connect (display->priv->html, "link_clicked",
- G_CALLBACK (on_link_clicked),
- display);
-#if 0
- g_signal_connect (display->priv->html, "object_requested",
- G_CALLBACK (on_object_requested),
- mail_display);
- g_signal_connect (display->priv->html, "button_press_event",
- G_CALLBACK (html_button_press_event), mail_display);
- g_signal_connect (display->priv->html, "motion_notify_event",
- G_CALLBACK (html_motion_notify_event), mail_display);
- g_signal_connect (display->priv->html, "enter_notify_event",
- G_CALLBACK (html_enter_notify_event), mail_display);
- g_signal_connect (display->priv->html, "iframe_created",
- G_CALLBACK (html_iframe_created), mail_display);
- g_signal_connect (display->priv->html, "on_url",
- G_CALLBACK (html_on_url), mail_display);
-#endif
-
- gtk_box_pack_start_defaults (GTK_BOX (display), GTK_WIDGET (display->priv->html));
- gtk_widget_show (GTK_WIDGET (display->priv->html));
-
- return GTK_WIDGET (display);
-}
-
-
-static void
-eab_contact_display_init (GObject *object)
-{
-}
-
-static void
-eab_contact_display_class_init (GtkObjectClass *object_class)
-{
- // object_class->destroy = mail_display_destroy;
-}
-
-GType
-eab_contact_display_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EABContactDisplayClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) eab_contact_display_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EABContactDisplay),
- 0, /* n_preallocs */
- (GInstanceInitFunc) eab_contact_display_init,
- };
-
- type = g_type_register_static (PARENT_TYPE, "EABContactDisplay", &info, 0);
- }
-
- return type;
-}
diff --git a/addressbook/gui/widgets/eab-contact-display.h b/addressbook/gui/widgets/eab-contact-display.h
deleted file mode 100644
index e7f47031ce..0000000000
--- a/addressbook/gui/widgets/eab-contact-display.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors: Chris Toshok <toshok@ximian.com>
- *
- * Copyright 2003 Ximian, Inc. (www.ximian.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
- *
- */
-
-#ifndef _EAB_CONTACT_DISPLAY_H_
-#define _EAB_CONTACT_DISPLAY_H_
-
-#include <gtk/gtkvbox.h>
-#include <gtkhtml/gtkhtml.h>
-#include <libebook/e-contact.h>
-
-#define EAB_TYPE_CONTACT_DISPLAY (eab_contact_display_get_type ())
-#define EAB_CONTACT_DISPLAY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EAB_TYPE_CONTACT_DISPLAY, EABContactDisplay))
-#define EAB_CONTACT_DISPLAY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EAB_TYPE_CONTACT_DISPLAY, EABContactDisplayClass))
-#define IS_EAB_CONTACT_DISPLAY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EAB_TYPE_CONTACT_DISPLAY))
-#define IS_EAB_CONTACT_DISPLAY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EAB_TYPE_CONTACT_DISPLAY))
-
-typedef struct _EABContactDisplay EABContactDisplay;
-typedef struct _EABContactDisplayPrivate EABContactDisplayPrivate;
-typedef struct _EABContactDisplayClass EABContactDisplayClass;
-
-typedef enum {
- EAB_CONTACT_DISPLAY_RENDER_NORMAL, /* for use in the preview pane */
- EAB_CONTACT_DISPLAY_RENDER_COMPACT /* for use with embedded vcards (e.g, the EABVCardControl) */
-} EABContactDisplayRenderMode;
-
-struct _EABContactDisplay {
- GtkVBox parent;
-
- EABContactDisplayPrivate *priv;
-};
-
-struct _EABContactDisplayClass {
- GtkVBoxClass parent_class;
-};
-
-GtkType eab_contact_display_get_type (void);
-GtkWidget * eab_contact_display_new (void);
-
-void eab_contact_display_render (EABContactDisplay *display, EContact *contact,
- EABContactDisplayRenderMode render_mode);
-
-#endif /* _EAB_CONTACT_DISPLAY_H_ */
diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c
deleted file mode 100644
index bd4ed78463..0000000000
--- a/addressbook/gui/widgets/eab-gui-util.c
+++ /dev/null
@@ -1,819 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-field-chooser.c
- * Copyright (C) 2001 Ximian, Inc.
- * Author: Chris Toshok <toshok@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of 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 <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-
-#include <gal/util/e-util.h>
-#include "eab-gui-util.h"
-#include "util/eab-book-util.h"
-#include "util/eab-destination.h"
-
-#include <gnome.h>
-
-#include "addressbook/gui/contact-editor/e-contact-editor.h"
-#include "addressbook/gui/contact-list-editor/e-contact-list-editor.h"
-
-void
-eab_error_dialog (const gchar *msg, EBookStatus status)
-{
- static char *status_to_string[] = {
- N_("Success"),
- N_("Unknown error"),
- N_("Repository offline"),
- N_("Permission denied"),
- N_("Contact not found"),
- N_("Contact ID already exists"),
- N_("Protocol not supported"),
- N_("Cancelled"),
- N_("Authentication Failed"),
- N_("Authentication Required"),
- N_("TLS not Available"),
- N_("Addressbook does not exist"),
- N_("Other error")
- };
- char *error_msg;
- GtkWidget *dialog;
-
- error_msg = g_strdup_printf ("%s: %s", msg, _(status_to_string [status]));
-
- dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
- error_msg);
-
- g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
-
- gtk_widget_show (dialog);
-
- g_free (error_msg);
-}
-
-gint
-eab_prompt_save_dialog (GtkWindow *parent)
-{
- GtkWidget *dialog;
- gint response;
-
- dialog = gtk_message_dialog_new (parent,
- (GtkDialogFlags)0,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_NONE,
- _("Do you want to save changes?"));
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- _("_Discard"), GTK_RESPONSE_NO,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_SAVE, GTK_RESPONSE_YES,
- NULL);
-
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES);
-
- response = gtk_dialog_run (GTK_DIALOG (dialog));
-
- gtk_widget_destroy (dialog);
-
- return response;
-}
-
-static void
-added_cb (EBook* book, EBookStatus status, const char *id,
- gboolean is_list)
-{
- if (status != E_BOOK_ERROR_OK) {
- eab_error_dialog (is_list ? _("Error adding list") : _("Error adding contact"), status);
- }
-}
-
-static void
-modified_cb (EBook* book, EBookStatus status,
- gboolean is_list)
-{
- if (status != E_BOOK_ERROR_OK) {
- eab_error_dialog (is_list ? _("Error modifying list") : _("Error modifying contact"),
- status);
- }
-}
-
-static void
-deleted_cb (EBook* book, EBookStatus status,
- gboolean is_list)
-{
- if (status != E_BOOK_ERROR_OK) {
- eab_error_dialog (is_list ? _("Error removing list") : _("Error removing contact"),
- status);
- }
-}
-
-static void
-editor_closed_cb (GtkObject *editor, gpointer data)
-{
- g_object_unref (editor);
-}
-
-EContactEditor *
-eab_show_contact_editor (EBook *book, EContact *contact,
- gboolean is_new_contact,
- gboolean editable)
-{
- EContactEditor *ce;
-
- ce = e_contact_editor_new (book, contact, is_new_contact, editable);
-
- g_signal_connect (ce, "contact_added",
- G_CALLBACK (added_cb), GINT_TO_POINTER (FALSE));
- g_signal_connect (ce, "contact_modified",
- G_CALLBACK (modified_cb), GINT_TO_POINTER (FALSE));
- g_signal_connect (ce, "contact_deleted",
- G_CALLBACK (deleted_cb), GINT_TO_POINTER (FALSE));
- g_signal_connect (ce, "editor_closed",
- G_CALLBACK (editor_closed_cb), NULL);
-
- return ce;
-}
-
-EContactListEditor *
-eab_show_contact_list_editor (EBook *book, EContact *contact,
- gboolean is_new_contact,
- gboolean editable)
-{
- EContactListEditor *ce;
-
- ce = e_contact_list_editor_new (book, contact, is_new_contact, editable);
-
- g_signal_connect (ce, "list_added",
- G_CALLBACK (added_cb), GINT_TO_POINTER (TRUE));
- g_signal_connect (ce, "list_modified",
- G_CALLBACK (modified_cb), GINT_TO_POINTER (TRUE));
- g_signal_connect (ce, "list_deleted",
- G_CALLBACK (deleted_cb), GINT_TO_POINTER (TRUE));
- g_signal_connect (ce, "editor_closed",
- G_CALLBACK (editor_closed_cb), GINT_TO_POINTER (TRUE));
-
- e_contact_list_editor_show (ce);
-
- return ce;
-}
-
-static void
-view_contacts (EBook *book, GList *list, gboolean editable)
-{
- for (; list; list = list->next) {
- EContact *contact = list->data;
- if (e_contact_get (contact, E_CONTACT_IS_LIST))
- eab_show_contact_list_editor (book, contact, FALSE, editable);
- else
- eab_show_contact_editor (book, contact, FALSE, editable);
- }
-}
-
-void
-eab_show_multiple_contacts (EBook *book,
- GList *list,
- gboolean editable)
-{
- if (list) {
- int length = g_list_length (list);
- if (length > 5) {
- GtkWidget *dialog;
- gint response;
-
- dialog = gtk_message_dialog_new (NULL,
- 0,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_YES_NO,
- _("Opening %d contacts will open %d new windows as well.\n"
- "Do you really want to display all of these contacts?"),
- length,
- length);
-
- response = gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
- if (response == GTK_RESPONSE_YES)
- view_contacts (book, list, editable);
- } else {
- view_contacts (book, list, editable);
- }
- }
-}
-
-
-static gint
-file_exists(GtkFileSelection *filesel, const char *filename)
-{
- GtkWidget *dialog;
- gint response;
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (filesel),
- 0,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_NONE,
- _("%s already exists\nDo you want to overwrite it?"), filename);
-
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
- _("Overwrite"), GTK_RESPONSE_ACCEPT,
- NULL);
-
- response = gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
- return response;
-}
-
-typedef struct {
- GtkFileSelection *filesel;
- char *vcard;
-} SaveAsInfo;
-
-static void
-save_it(GtkWidget *widget, SaveAsInfo *info)
-{
- gint error = 0;
- gint response = 0;
-
- const char *filename = gtk_file_selection_get_filename (info->filesel);
-
- error = e_write_file (filename, info->vcard, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC);
-
- if (error == EEXIST) {
- response = file_exists(info->filesel, filename);
- switch (response) {
- case GTK_RESPONSE_ACCEPT : /* Overwrite */
- e_write_file(filename, info->vcard, O_WRONLY | O_CREAT | O_TRUNC);
- break;
- case GTK_RESPONSE_REJECT : /* cancel */
- return;
- }
- } else if (error != 0) {
- GtkWidget *dialog;
- char *str;
-
- str = g_strdup_printf (_("Error saving %s: %s"), filename, strerror(errno));
- dialog = gtk_message_dialog_new (GTK_WINDOW (info->filesel),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- str);
- g_free (str);
-
- gtk_widget_show (dialog);
-
- return;
- }
-
- gtk_widget_destroy(GTK_WIDGET(info->filesel));
-}
-
-static void
-close_it(GtkWidget *widget, SaveAsInfo *info)
-{
- gtk_widget_destroy (GTK_WIDGET (info->filesel));
-}
-
-static void
-destroy_it(void *data, GObject *where_the_object_was)
-{
- SaveAsInfo *info = data;
- g_free (info->vcard);
- g_free (info);
-}
-
-static char *
-make_safe_filename (const char *prefix, char *name)
-{
- char *safe, *p;
-
- if (!name) {
- /* This is a filename. Translators take note. */
- name = _("card.vcf");
- }
-
- p = strrchr (name, '/');
- if (p)
- safe = g_strdup_printf ("%s%s%s", prefix, p, ".vcf");
- else
- safe = g_strdup_printf ("%s/%s%s", prefix, name, ".vcf");
-
- p = strrchr (safe, '/') + 1;
- if (p)
- e_filename_make_safe (p);
-
- return safe;
-}
-
-void
-eab_contact_save (char *title, EContact *contact, GtkWindow *parent_window)
-{
- GtkFileSelection *filesel;
- char *file;
- char *name;
- SaveAsInfo *info = g_new(SaveAsInfo, 1);
-
- filesel = GTK_FILE_SELECTION(gtk_file_selection_new(title));
-
- name = e_contact_get (contact, E_CONTACT_FILE_AS);
- file = make_safe_filename (g_get_home_dir(), name);
- gtk_file_selection_set_filename (filesel, file);
- g_free (file);
-
- info->filesel = filesel;
- info->vcard = e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30);
-
- g_signal_connect(filesel->ok_button, "clicked",
- G_CALLBACK (save_it), info);
- g_signal_connect(filesel->cancel_button, "clicked",
- G_CALLBACK (close_it), info);
- g_object_weak_ref (G_OBJECT (filesel), destroy_it, info);
-
- if (parent_window) {
- gtk_window_set_transient_for (GTK_WINDOW (filesel),
- parent_window);
- gtk_window_set_modal (GTK_WINDOW (filesel), TRUE);
- }
-
- gtk_widget_show(GTK_WIDGET(filesel));
-}
-
-void
-eab_contact_list_save (char *title, GList *list, GtkWindow *parent_window)
-{
- GtkFileSelection *filesel;
- SaveAsInfo *info = g_new(SaveAsInfo, 1);
-
- filesel = GTK_FILE_SELECTION(gtk_file_selection_new(title));
-
- /* This is a filename. Translators take note. */
- if (list && list->data && list->next == NULL) {
- char *name, *file;
- name = e_contact_get (E_CONTACT (list->data), E_CONTACT_FILE_AS);
- if (!name)
- name = e_contact_get (E_CONTACT (list->data), E_CONTACT_FULL_NAME);
-
- file = make_safe_filename (g_get_home_dir(), name);
- gtk_file_selection_set_filename (filesel, file);
- g_free (file);
- } else {
- char *file;
- file = make_safe_filename (g_get_home_dir(), _("list"));
- gtk_file_selection_set_filename (filesel, file);
- g_free (file);
- }
-
- info->filesel = filesel;
- info->vcard = eab_contact_list_to_string (list);
-
- g_signal_connect(filesel->ok_button, "clicked",
- G_CALLBACK (save_it), info);
- g_signal_connect(filesel->cancel_button, "clicked",
- G_CALLBACK (close_it), info);
- g_object_weak_ref (G_OBJECT (filesel), destroy_it, info);
-
- if (parent_window) {
- gtk_window_set_transient_for (GTK_WINDOW (filesel),
- parent_window);
- gtk_window_set_modal (GTK_WINDOW (filesel), TRUE);
- }
-
- gtk_widget_show(GTK_WIDGET(filesel));
-}
-
-typedef struct ContactCopyProcess_ ContactCopyProcess;
-
-typedef void (*ContactCopyDone) (ContactCopyProcess *process);
-
-struct ContactCopyProcess_ {
- int count;
- GList *contacts;
- EBook *source;
- EBook *destination;
- ContactCopyDone done_cb;
-};
-
-static void
-contact_deleted_cb (EBook* book, EBookStatus status, gpointer user_data)
-{
- if (status != E_BOOK_ERROR_OK) {
- eab_error_dialog (_("Error removing contact"), status);
- }
-}
-
-static void
-do_delete (gpointer data, gpointer user_data)
-{
- EBook *book = user_data;
- EContact *contact = data;
-
- e_book_async_remove_contact(book, contact, contact_deleted_cb, NULL);
-}
-
-static void
-delete_contacts (ContactCopyProcess *process)
-{
- g_list_foreach (process->contacts,
- do_delete,
- process->source);
-}
-
-static void
-process_unref (ContactCopyProcess *process)
-{
- process->count --;
- if (process->count == 0) {
- if (process->done_cb) {
- process->done_cb (process);
- }
- e_free_object_list(process->contacts);
- g_object_unref (process->source);
- g_object_unref (process->destination);
- g_free (process);
- }
-}
-
-static void
-contact_added_cb (EBook* book, EBookStatus status, const char *id, gpointer user_data)
-{
- ContactCopyProcess *process = user_data;
-
- if (status != E_BOOK_ERROR_OK) {
- eab_error_dialog (_("Error adding contact"), status);
- } else {
- process_unref (process);
- }
-}
-
-static void
-do_copy (gpointer data, gpointer user_data)
-{
- EBook *book;
- EContact *contact;
- ContactCopyProcess *process;
-
- process = user_data;
- contact = data;
-
- book = process->destination;
-
- process->count ++;
- e_book_async_add_contact(book, contact, contact_added_cb, process);
-}
-
-static void
-got_book_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- ContactCopyProcess *process;
- process = closure;
- if (status == E_BOOK_ERROR_OK) {
- process->destination = book;
- g_object_ref (book);
- g_list_foreach (process->contacts,
- do_copy,
- process);
- }
- process_unref (process);
-}
-
-void
-eab_transfer_contacts (EBook *source, GList *contacts /* adopted */, gboolean delete_from_source, GtkWindow *parent_window)
-{
-#if 0
- EBook *dest;
- const char *allowed_types[] = { "contacts/*", NULL };
- GNOME_Evolution_Folder *folder;
- static char *last_uri = NULL;
- ContactCopyProcess *process;
- char *desc;
-
- if (contacts == NULL)
- return;
-
- if (last_uri == NULL)
- last_uri = g_strdup ("");
-
- if (contacts->next == NULL) {
- if (delete_from_source)
- desc = _("Move contact to");
- else
- desc = _("Copy contact to");
- } else {
- if (delete_from_source)
- desc = _("Move contacts to");
- else
- desc = _("Copy contacts to");
- }
-
- evolution_shell_client_user_select_folder (global_shell_client,
- parent_window,
- desc, last_uri, allowed_types,
- &folder);
-
- if (!folder)
- return;
-
- if (strcmp (last_uri, folder->evolutionUri) != 0) {
- g_free (last_uri);
- last_uri = g_strdup (folder->evolutionUri);
- }
-
- process = g_new (ContactCopyProcess, 1);
- process->count = 1;
- process->source = source;
- g_object_ref (source);
- process->contacts = contacts;
- process->destination = NULL;
-
- if (delete_from_source)
- process->done_cb = delete_contacts;
- else
- process->done_cb = NULL;
-
- dest = e_book_new ();
- e_book_async_load_uri (dest, folder->physicalUri, got_book_cb, process);
-
- CORBA_free (folder);
-#endif
-}
-
-#include <Evolution-Composer.h>
-
-#define COMPOSER_OAFID "OAFIID:GNOME_Evolution_Mail_Composer:" BASE_VERSION
-
-void
-eab_send_contact_list (GList *contacts, EABDisposition disposition)
-{
-#if notyet
- GNOME_Evolution_Composer composer_server;
- CORBA_Environment ev;
-
- if (contacts == NULL)
- return;
-
- CORBA_exception_init (&ev);
-
- composer_server = bonobo_activation_activate_from_id (COMPOSER_OAFID, 0, NULL, &ev);
-
- if (disposition == EAB_DISPOSITION_AS_TO) {
- GNOME_Evolution_Composer_RecipientList *to_list, *cc_list, *bcc_list;
- CORBA_char *subject;
- int to_i, bcc_i;
- GList *iter;
- gint to_length = 0, bcc_length = 0;
-
- /* Figure out how many addresses of each kind we have. */
- for (iter = contacts; iter != NULL; iter = g_list_next (iter)) {
- EContact *contact = E_CONTACT (iter->data);
- if (e_contact_get (contact, E_CONTACT_IS_LIST)) {
- gint len = card->email ? e_list_length (card->email) : 0;
- if (e_card_evolution_list_show_addresses (card))
- to_length += len;
- else
- bcc_length += len;
- } else {
- if (card->email != NULL)
- ++to_length;
- }
- }
-
- /* Now I have to make a CORBA sequences that represents a recipient list with
- the right number of entries, for the cards. */
- to_list = GNOME_Evolution_Composer_RecipientList__alloc ();
- to_list->_maximum = to_length;
- to_list->_length = to_length;
- if (to_length > 0) {
- to_list->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (to_length);
- }
-
- cc_list = GNOME_Evolution_Composer_RecipientList__alloc ();
- cc_list->_maximum = cc_list->_length = 0;
-
- bcc_list = GNOME_Evolution_Composer_RecipientList__alloc ();
- bcc_list->_maximum = bcc_length;
- bcc_list->_length = bcc_length;
- if (bcc_length > 0) {
- bcc_list->_buffer = CORBA_sequence_GNOME_Evolution_Composer_Recipient_allocbuf (bcc_length);
- }
-
- to_i = 0;
- bcc_i = 0;
- while (cards != NULL) {
- ECard *card = cards->data;
- EIterator *iterator;
- gchar *name, *addr;
- gboolean is_list, is_hidden, free_name_addr;
- GNOME_Evolution_Composer_Recipient *recipient;
-
- if (card->email != NULL) {
-
- is_list = e_card_evolution_list (card);
- is_hidden = is_list && !e_card_evolution_list_show_addresses (card);
-
- for (iterator = e_list_get_iterator (card->email); e_iterator_is_valid (iterator); e_iterator_next (iterator)) {
-
- if (is_hidden) {
- recipient = &(bcc_list->_buffer[bcc_i]);
- ++bcc_i;
- } else {
- recipient = &(to_list->_buffer[to_i]);
- ++to_i;
- }
-
- name = "";
- addr = "";
- free_name_addr = FALSE;
- if (e_iterator_is_valid (iterator)) {
-
- if (is_list) {
- /* We need to decode the list entries, which are XMLified EABDestinations. */
- EABDestination *dest = eab_destination_import (e_iterator_get (iterator));
- if (dest != NULL) {
- name = g_strdup (eab_destination_get_name (dest));
- addr = g_strdup (eab_destination_get_email (dest));
- free_name_addr = TRUE;
- g_object_unref (dest);
- }
-
- } else { /* is just a plain old card */
- if (card->name)
- name = e_card_name_to_string (card->name);
- addr = g_strdup ((char *) e_iterator_get (iterator));
- free_name_addr = TRUE;
- }
- }
-
- recipient->name = CORBA_string_dup (name ? name : "");
- recipient->address = CORBA_string_dup (addr ? addr : "");
-
- if (free_name_addr) {
- g_free ((gchar *) name);
- g_free ((gchar *) addr);
- }
-
- /* If this isn't a list, we quit after the first (i.e. the default) address. */
- if (!is_list)
- break;
-
- }
- g_object_unref (iterator);
- }
-
- cards = g_list_next (cards);
- }
-
- subject = CORBA_string_dup ("");
-
- GNOME_Evolution_Composer_setHeaders (composer_server, "", to_list, cc_list, bcc_list, subject, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_printerr ("gui/e-meeting-edit.c: I couldn't set the composer headers via CORBA! Aagh.\n");
- CORBA_exception_free (&ev);
- return;
- }
-
- CORBA_free (to_list);
- CORBA_free (cc_list);
- CORBA_free (bcc_list);
- CORBA_free (subject);
- } else if (disposition == EAB_DISPOSITION_AS_ATTACHMENT) {
- CORBA_char *content_type, *filename, *description;
- GNOME_Evolution_Composer_AttachmentData *attach_data;
- CORBA_boolean show_inline;
- char *tempstr;
-
- GNOME_Evolution_Composer_RecipientList *to_list, *cc_list, *bcc_list;
- CORBA_char *subject;
-
- content_type = CORBA_string_dup ("text/x-vcard");
- filename = CORBA_string_dup ("");
-
- if (cards->next) {
- description = CORBA_string_dup (_("Multiple VCards"));
- } else {
- char *file_as;
-
- g_object_get(cards->data,
- "file_as", &file_as,
- NULL);
-
- tempstr = g_strdup_printf (_("VCard for %s"), file_as);
- description = CORBA_string_dup (tempstr);
- g_free (tempstr);
- }
-
- show_inline = FALSE;
-
- tempstr = eab_contact_list_to_string (cards);
- attach_data = GNOME_Evolution_Composer_AttachmentData__alloc();
- attach_data->_maximum = attach_data->_length = strlen (tempstr);
- attach_data->_buffer = CORBA_sequence_CORBA_char_allocbuf (attach_data->_length);
- strcpy (attach_data->_buffer, tempstr);
- g_free (tempstr);
-
- GNOME_Evolution_Composer_attachData (composer_server,
- content_type, filename, description,
- show_inline, attach_data,
- &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_printerr ("gui/e-meeting-edit.c: I couldn't attach data to the composer via CORBA! Aagh.\n");
- CORBA_exception_free (&ev);
- return;
- }
-
- CORBA_free (content_type);
- CORBA_free (filename);
- CORBA_free (description);
- CORBA_free (attach_data);
-
- to_list = GNOME_Evolution_Composer_RecipientList__alloc ();
- to_list->_maximum = to_list->_length = 0;
-
- cc_list = GNOME_Evolution_Composer_RecipientList__alloc ();
- cc_list->_maximum = cc_list->_length = 0;
-
- bcc_list = GNOME_Evolution_Composer_RecipientList__alloc ();
- bcc_list->_maximum = bcc_list->_length = 0;
-
- if (!cards || cards->next) {
- subject = CORBA_string_dup ("Contact information");
- } else {
- ECard *card = cards->data;
- const gchar *tempstr2;
-
- tempstr2 = NULL;
- g_object_get(card,
- "file_as", &tempstr2,
- NULL);
- if (!tempstr2 || !*tempstr2)
- g_object_get(card,
- "full_name", &tempstr2,
- NULL);
- if (!tempstr2 || !*tempstr2)
- g_object_get(card,
- "org", &tempstr2,
- NULL);
- if (!tempstr2 || !*tempstr2) {
- EList *list;
- EIterator *iterator;
- g_object_get(card,
- "email", &list,
- NULL);
- iterator = e_list_get_iterator (list);
- if (e_iterator_is_valid (iterator)) {
- tempstr2 = e_iterator_get (iterator);
- }
- g_object_unref (iterator);
- }
-
- if (!tempstr2 || !*tempstr2)
- tempstr = g_strdup_printf ("Contact information");
- else
- tempstr = g_strdup_printf ("Contact information for %s", tempstr2);
- subject = CORBA_string_dup (tempstr);
- g_free (tempstr);
- }
-
- GNOME_Evolution_Composer_setHeaders (composer_server, "", to_list, cc_list, bcc_list, subject, &ev);
-
- CORBA_free (to_list);
- CORBA_free (cc_list);
- CORBA_free (bcc_list);
- CORBA_free (subject);
- }
-
- GNOME_Evolution_Composer_show (composer_server, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_printerr ("gui/e-meeting-edit.c: I couldn't show the composer via CORBA! Aagh.\n");
- CORBA_exception_free (&ev);
- return;
- }
-
- CORBA_exception_free (&ev);
-#endif
-}
-
-void
-eab_send_contact (EContact *contact, EABDisposition disposition)
-{
- GList *list;
- list = g_list_prepend (NULL, contact);
- eab_send_contact_list (list, disposition);
- g_list_free (list);
-}
diff --git a/addressbook/gui/widgets/eab-gui-util.h b/addressbook/gui/widgets/eab-gui-util.h
deleted file mode 100644
index 24a0a78577..0000000000
--- a/addressbook/gui/widgets/eab-gui-util.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* eab-gui-util.h
- * Copyright (C) 2001-2003 Ximian, Inc.
- * Author: Chris Toshok <toshok@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of 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_ADDRESSBOOK_UTIL_H__
-#define __E_ADDRESSBOOK_UTIL_H__
-
-#include <gtk/gtkwindow.h>
-#include <libebook/e-book.h>
-#include "addressbook/gui/contact-editor/e-contact-editor.h"
-#include "addressbook/gui/contact-list-editor/e-contact-list-editor.h"
-
-G_BEGIN_DECLS
-
-void eab_error_dialog (const gchar *msg,
- EBookStatus status);
-gint eab_prompt_save_dialog (GtkWindow *parent);
-
-EContactEditor *eab_show_contact_editor (EBook *book,
- EContact *contact,
- gboolean is_new_contact,
- gboolean editable);
-EContactListEditor *eab_show_contact_list_editor (EBook *book,
- EContact *contact,
- gboolean is_new_contact,
- gboolean editable);
-void eab_show_multiple_contacts (EBook *book,
- GList *list,
- gboolean editable);
-void eab_transfer_contacts (EBook *source,
- GList *contacts, /* adopted */
- gboolean delete_from_source,
- GtkWindow *parent_window);
-
-void eab_contact_save (char *title,
- EContact *contact,
- GtkWindow *parent_window);
-
-void eab_contact_list_save (char *title,
- GList *list,
- GtkWindow *parent_window);
-
-typedef enum {
- EAB_DISPOSITION_AS_ATTACHMENT,
- EAB_DISPOSITION_AS_TO,
-} EABDisposition;
-
-void eab_send_contact (EContact *contact,
- EABDisposition disposition);
-void eab_send_contact_list (GList *contacts,
- EABDisposition disposition);
-
-G_END_DECLS
-
-#endif /* __E_ADDRESSBOOK_UTIL_H__ */
diff --git a/addressbook/gui/widgets/eab-marshal.list b/addressbook/gui/widgets/eab-marshal.list
deleted file mode 100644
index 2b34707dbb..0000000000
--- a/addressbook/gui/widgets/eab-marshal.list
+++ /dev/null
@@ -1,11 +0,0 @@
-INT:POINTER
-NONE:NONE
-NONE:BOOL
-NONE:POINTER
-NONE:OBJECT
-NONE:ENUM
-NONE:INT,INT
-NONE:INT
-NONE:UINT
-NONE:DOUBLE
-INT:POINTER
diff --git a/addressbook/gui/widgets/eab-popup-control.c b/addressbook/gui/widgets/eab-popup-control.c
deleted file mode 100644
index 6e2ad6a603..0000000000
--- a/addressbook/gui/widgets/eab-popup-control.c
+++ /dev/null
@@ -1,1236 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * eab-popup-control.c
- *
- * Copyright (C) 2001-2003, Ximian, Inc.
- *
- * Authors: Jon Trowbridge <trow@ximian.com>
- * Chris Toshok <toshok@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.
- */
-
-/*
- * This file is too big and this widget is too complicated. Forgive me.
- */
-
-#include <config.h>
-#include <string.h>
-#include "addressbook.h"
-#include "eab-popup-control.h"
-#include <bonobo/bonobo-control.h>
-#include <bonobo/bonobo-property-bag.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <gal/widgets/e-popup-menu.h>
-#include <libebook/e-book-async.h>
-#include <addressbook/util/eab-book-util.h>
-#include <addressbook/gui/contact-editor/e-contact-editor.h>
-#include <addressbook/gui/contact-editor/e-contact-quick-add.h>
-#include <addressbook/gui/widgets/eab-contact-display.h>
-#include <addressbook/gui/widgets/eab-gui-util.h>
-#include "e-util/e-gui-utils.h"
-
-static void eab_popup_control_set_name (EABPopupControl *pop, const gchar *name);
-static void eab_popup_control_set_email (EABPopupControl *pop, const gchar *email);
-
-/*
- * Some general scaffolding for our widgets. Think of this as a really, really
- * lame implementation of a wizard (...which is still somewhat more general that
- * we really need it to be).
- */
-
-typedef struct _MiniWizard MiniWizard;
-struct _MiniWizard {
- GtkWidget *body;
-
- GtkWidget *vbox;
- GtkWidget *ok_button;
- GtkWidget *cancel_button;
-
- void (*ok_cb) (MiniWizard *, gpointer);
- void (*cleanup_cb) (gpointer);
- gpointer closure;
-
- void (*destroy_cb) (MiniWizard *, gpointer);
- gpointer destroy_closure;
-};
-
-static void
-mini_wizard_container_add (MiniWizard *wiz, GtkWidget *w)
-{
- GList *iter = gtk_container_get_children (GTK_CONTAINER (wiz->vbox));
- while (iter != NULL) {
- GtkWidget *oldw = (GtkWidget *) iter->data;
- iter = g_list_next (iter);
- gtk_container_remove (GTK_CONTAINER (wiz->vbox), oldw);
- }
- gtk_container_add (GTK_CONTAINER (wiz->vbox), w);
-}
-
-static void
-mini_wizard_destroy (MiniWizard *wiz)
-{
- if (wiz->cleanup_cb)
- wiz->cleanup_cb (wiz->closure);
- wiz->cleanup_cb = NULL;
-
- if (wiz->destroy_cb)
- wiz->destroy_cb (wiz, wiz->destroy_closure);
-}
-
-static void
-mini_wizard_ok_cb (GtkWidget *b, gpointer closure)
-{
- MiniWizard *wiz = (MiniWizard *) closure;
-
- gpointer old_closure = wiz->closure;
- void (*old_cleanup) (gpointer) = wiz->cleanup_cb;
-
- wiz->cleanup_cb = NULL;
-
- if (wiz->ok_cb)
- wiz->ok_cb (wiz, wiz->closure);
-
- if (old_cleanup)
- old_cleanup (old_closure);
-
-}
-
-static void
-mini_wizard_cancel_cb (GtkWidget *b, gpointer closure)
-{
- mini_wizard_destroy ((MiniWizard *) closure);
-}
-
-static void
-mini_wizard_destroy_cb (gpointer closure, GObject *where_object_was)
-{
- MiniWizard *wiz = (MiniWizard *) closure;
- if (wiz->cleanup_cb)
- wiz->cleanup_cb (wiz->closure);
- g_free (wiz);
-}
-
-static MiniWizard *
-mini_wizard_new (void)
-{
- MiniWizard *wiz = g_new (MiniWizard, 1);
- GtkWidget *bbox;
-
- wiz->body = gtk_vbox_new (FALSE, 2);
- wiz->vbox = gtk_vbox_new (FALSE, 2);
- wiz->ok_button = gtk_button_new_from_stock (GTK_STOCK_OK);
- wiz->cancel_button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
-
- wiz->ok_cb = NULL;
- wiz->cleanup_cb = NULL;
- wiz->closure = NULL;
-
- wiz->destroy_cb = NULL;
- wiz->destroy_closure = NULL;
-
- bbox = gtk_hbutton_box_new ();
- gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox),
- GTK_BUTTONBOX_END);
-
- gtk_box_pack_start (GTK_BOX (bbox), wiz->cancel_button, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (bbox), wiz->ok_button, FALSE, TRUE, 0);
-
- gtk_box_set_spacing (GTK_BOX (bbox),
- 10 /* ugh */);
-
- gtk_box_pack_start (GTK_BOX (wiz->body), wiz->vbox, TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (wiz->body), gtk_hseparator_new (), FALSE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (wiz->body), bbox, FALSE, TRUE, 2);
-
- gtk_widget_show_all (wiz->body);
-
- g_signal_connect (wiz->ok_button,
- "clicked",
- G_CALLBACK (mini_wizard_ok_cb),
- wiz);
- g_signal_connect (wiz->cancel_button,
- "clicked",
- G_CALLBACK (mini_wizard_cancel_cb),
- wiz);
-
- g_object_weak_ref (G_OBJECT (wiz->body),
- mini_wizard_destroy_cb,
- wiz);
-
- return wiz;
-
-}
-
-
-
-/*
- * This is the code for the UI thingie that lets you manipulate the e-mail
- * addresses (and *only* the e-mail addresses) associated with an existing
- * contact.
- */
-
-#define EMPTY_ENTRY N_("(none)")
-
-typedef struct _EMailMenu EMailMenu;
-struct _EMailMenu {
- GtkWidget *option_menu;
- GList *options;
- gchar *current_selection;
-};
-
-static void
-email_menu_free (EMailMenu *menu)
-{
- if (menu == NULL)
- return;
-
- g_list_foreach (menu->options, (GFunc) g_free, NULL);
- g_list_free (menu->options);
- g_free (menu);
-}
-
-static EMailMenu *
-email_menu_new (void)
-{
- EMailMenu *menu = g_new (EMailMenu, 1);
-
- menu->option_menu = gtk_option_menu_new ();
- menu->options = NULL;
- menu->current_selection = NULL;
-
- gtk_option_menu_set_menu (GTK_OPTION_MENU (menu->option_menu), gtk_menu_new ());
-
- return menu;
-}
-
-static void
-menu_activate_cb (GtkWidget *w, gpointer closure)
-{
- EMailMenu *menu = (EMailMenu *) closure;
- gchar *addr = (gchar *) g_object_get_data (G_OBJECT (w), "addr");
-
- menu->current_selection = addr;
-}
-
-static void
-email_menu_add_option (EMailMenu *menu, char *addr)
-{
- GtkWidget *menu_item;
-
- g_return_if_fail (menu != NULL);
- if (addr == NULL)
- return;
-
- menu->options = g_list_append (menu->options, addr);
-
- menu_item = gtk_menu_item_new_with_label (addr);
- g_object_set_data (G_OBJECT (menu_item), "addr", addr);
- gtk_widget_show_all (menu_item);
- gtk_menu_shell_append (GTK_MENU_SHELL (gtk_option_menu_get_menu (GTK_OPTION_MENU (menu->option_menu))), menu_item);
-
- g_signal_connect (menu_item,
- "activate",
- G_CALLBACK (menu_activate_cb),
- menu);
-}
-
-static void
-email_menu_add_options_from_contact (EMailMenu *menu, EContact *contact, const gchar *extra_addr)
-{
- g_return_if_fail (contact && E_IS_CONTACT (contact));
-
- /* If any of these three e-mail fields are NULL, email_menu_add_option will just
- return without doing anything. */
- email_menu_add_option (menu, e_contact_get (contact, E_CONTACT_EMAIL_1));
- email_menu_add_option (menu, e_contact_get (contact, E_CONTACT_EMAIL_2));
- email_menu_add_option (menu, e_contact_get (contact, E_CONTACT_EMAIL_3));
- email_menu_add_option (menu, g_strdup (extra_addr));
- email_menu_add_option (menu, EMPTY_ENTRY);
-}
-
-static void
-email_menu_set_option (EMailMenu *menu, const gchar *addr)
-{
- guint count = 0;
- GList *iter;
-
- g_return_if_fail (menu != NULL);
-
- if (addr == NULL) {
- email_menu_set_option (menu, EMPTY_ENTRY);
- return;
- }
-
- iter = menu->options;
- while (iter && strcmp (addr, (gchar *) iter->data)) {
- ++count;
- iter = g_list_next (iter);
- }
-
- if (iter) {
- gtk_option_menu_set_history (GTK_OPTION_MENU (menu->option_menu), count);
- menu->current_selection = (gchar *) iter->data;
- }
-}
-
-#ifdef UNDEFINED_FUNCTIONS_SHOULD_PLEASE_BE_INCLUDED
-static void
-email_menu_unset_option (EMailMenu *menu, const gchar *addr)
-{
- GList *iter;
-
- g_return_if_fail (menu != NULL);
- g_return_if_fail (addr != NULL);
-
- if (menu->current_selection == NULL || strcmp (addr, menu->current_selection))
- return;
-
- iter = menu->options;
- while (iter && strcmp (addr, (gchar *) iter->data)) {
- iter = g_list_next (iter);
- }
- if (iter) {
- iter = g_list_next (iter);
- if (iter) {
- email_menu_set_option (menu, (gchar *) iter->data);
- } else {
- email_menu_set_option (menu, EMPTY_ENTRY);
- }
- }
-}
-#endif
-
-
-
-typedef struct _EMailTable EMailTable;
-struct _EMailTable {
- GtkWidget *table;
- EContact *contact;
- EMailMenu *primary;
- EMailMenu *email2;
- EMailMenu *email3;
-};
-
-static void
-email_table_cleanup_cb (gpointer closure)
-{
- EMailTable *et = (EMailTable *) closure;
-
- if (et == NULL)
- return;
-
- g_object_unref (et->contact);
- email_menu_free (et->primary);
- email_menu_free (et->email2);
- email_menu_free (et->email3);
-
- g_free (et);
-}
-
-static void
-email_table_from_contact (EMailTable *et)
-{
- g_return_if_fail (et != NULL);
-
- email_menu_set_option (et->primary, e_contact_get_const (et->contact, E_CONTACT_EMAIL_1));
- email_menu_set_option (et->email2, e_contact_get_const (et->contact, E_CONTACT_EMAIL_2));
- email_menu_set_option (et->email3, e_contact_get_const (et->contact, E_CONTACT_EMAIL_3));
-}
-
-static void
-email_table_to_contact (EMailTable *et)
-{
- gchar *curr;
-
- g_return_if_fail (et != NULL);
-
- curr = et->primary->current_selection;
- if (curr && !strcmp (curr, _(EMPTY_ENTRY)))
- curr = NULL;
- e_contact_set (et->contact, E_CONTACT_EMAIL_1, curr);
-
- curr = et->email2->current_selection;
- if (curr && !strcmp (curr, _(EMPTY_ENTRY)))
- curr = NULL;
- e_contact_set (et->contact, E_CONTACT_EMAIL_2, curr);
-
- curr = et->email3->current_selection;
- if (curr && !strcmp (curr, _(EMPTY_ENTRY)))
- curr = NULL;
- e_contact_set (et->contact, E_CONTACT_EMAIL_3, curr);
-}
-
-static void
-email_table_save_contact_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- EContact *contact = E_CONTACT (closure);
-
- if (status == E_BOOK_ERROR_OK) {
- e_book_async_commit_contact (book, contact, NULL, NULL);
- }
- if (book)
- g_object_unref (book);
- g_object_unref (contact);
-}
-
-static void
-email_table_ok_cb (MiniWizard *wiz, gpointer closure)
-{
- EMailTable *et = (EMailTable *) closure;
-
- email_table_to_contact (et);
-
- g_object_ref (et->contact);
-
- addressbook_load_default_book (email_table_save_contact_cb, et->contact);
-
- mini_wizard_destroy (wiz);
-}
-
-static void
-email_table_init (MiniWizard *wiz, EContact *contact, const gchar *extra_address)
-{
- EMailTable *et;
-
- gchar *name_str;
- gint xpad, ypad;
- GtkAttachOptions label_x_opts, label_y_opts;
- GtkAttachOptions menu_x_opts, menu_y_opts;
-
- g_return_if_fail (contact && E_IS_CONTACT (contact));
-
- et = g_new (EMailTable, 1);
-
- et->contact = contact;
- g_object_ref (et->contact);
-
- et->table = gtk_table_new (4, 2, FALSE);
-
- et->primary = email_menu_new ();
- et->email2 = email_menu_new ();
- et->email3 = email_menu_new ();
-
- email_menu_add_options_from_contact (et->primary, et->contact, extra_address);
- email_menu_add_options_from_contact (et->email2, et->contact, extra_address);
- email_menu_add_options_from_contact (et->email3, et->contact, extra_address);
-
- email_table_from_contact (et);
-
- label_x_opts = GTK_FILL;
- label_y_opts = GTK_FILL;
- menu_x_opts = GTK_EXPAND | GTK_FILL;
- menu_y_opts = GTK_EXPAND | GTK_FILL;
- xpad = 3;
- ypad = 3;
-
- name_str = e_contact_get (et->contact, E_CONTACT_FULL_NAME);
- gtk_table_attach (GTK_TABLE (et->table),
- gtk_label_new (name_str),
- 0, 2, 0, 1,
- label_x_opts, label_y_opts, xpad, ypad);
- g_free (name_str);
-
- gtk_table_attach (GTK_TABLE (et->table),
- gtk_label_new (_("Primary Email")),
- 0, 1, 1, 2,
- label_x_opts, label_y_opts, xpad, ypad);
-
- gtk_table_attach (GTK_TABLE (et->table),
- et->primary->option_menu,
- 1, 2, 1, 2,
- menu_x_opts, menu_y_opts, xpad, ypad);
-
- gtk_table_attach (GTK_TABLE (et->table),
- gtk_label_new (_("Email 2")),
- 0, 1, 2, 3,
- label_x_opts, label_y_opts, xpad, ypad);
-
- gtk_table_attach (GTK_TABLE (et->table),
- et->email2->option_menu,
- 1, 2, 2, 3,
- menu_x_opts, menu_y_opts, xpad, ypad);
-
- gtk_table_attach (GTK_TABLE (et->table),
- gtk_label_new (_("Email 3")),
- 0, 1, 3, 4,
- label_x_opts, label_y_opts, xpad, ypad);
-
- gtk_table_attach (GTK_TABLE (et->table),
- et->email3->option_menu,
- 1, 2, 3, 4,
- menu_x_opts, menu_y_opts, xpad, ypad);
-
- gtk_widget_show_all (et->primary->option_menu);
- gtk_widget_show_all (et->email2->option_menu);
- gtk_widget_show_all (et->email3->option_menu);
-
- gtk_widget_show_all (et->table);
- mini_wizard_container_add (wiz, et->table);
- wiz->ok_cb = email_table_ok_cb;
- wiz->cleanup_cb = email_table_cleanup_cb;
- wiz->closure = et;
-}
-
-/*
- * This code is for the little UI thing that lets you pick from a set of contacts
- * and decide which one you want to add the e-mail address to.
- */
-
-typedef struct _ContactPicker ContactPicker;
-struct _ContactPicker {
- GtkWidget *body;
- GtkWidget *list;
- GtkListStore *model;
- GList *contacts;
- gchar *new_name;
- gchar *new_email;
-
- EContact *current_contact;
-};
-
-enum {
- COLUMN_ACTION,
- COLUMN_CONTACT
-};
-
-static void
-contact_picker_selection_changed (GtkTreeSelection *selection, gpointer closure)
-{
- MiniWizard *wiz = (MiniWizard *) closure;
- ContactPicker *pick = (ContactPicker *) wiz->closure;
- gboolean selected;
- GtkTreeIter iter;
-
- selected = gtk_tree_selection_get_selected (selection, NULL, &iter);
-
- gtk_widget_set_sensitive (wiz->ok_button, selected);
-
- if (selected) {
- gtk_tree_model_get (GTK_TREE_MODEL (pick->model), &iter,
- COLUMN_CONTACT, &pick->current_contact,
- -1);
- }
- else {
- pick->current_contact = NULL;
- }
-}
-
-static void
-contact_picker_ok_cb (MiniWizard *wiz, gpointer closure)
-{
- ContactPicker *pick = (ContactPicker *) closure;
-
- if (pick->current_contact == NULL) {
- e_contact_quick_add (pick->new_name, pick->new_email, NULL, NULL);
- mini_wizard_destroy (wiz);
- } else {
- email_table_init (wiz, pick->current_contact, pick->new_email);
- }
-}
-
-static void
-contact_picker_cleanup_cb (gpointer closure)
-{
- ContactPicker *pick = (ContactPicker *) closure;
-
- g_list_foreach (pick->contacts, (GFunc) g_object_unref, NULL);
- g_list_free (pick->contacts);
-
- g_free (pick->new_name);
- g_free (pick->new_email);
-}
-
-static void
-free_str (gpointer data,
- GObject *where_the_object_was)
-{
- g_free (data);
-}
-
-static void
-contact_picker_init (MiniWizard *wiz, const GList *contacts, const gchar *new_name, const gchar *new_email)
-{
- ContactPicker *pick;
- gchar *str;
- GtkWidget *w;
- GtkTreeIter iter;
-
- pick = g_new (ContactPicker, 1);
-
- pick->body = gtk_vbox_new (FALSE, 2);
-
- pick->model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
-
- pick->list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (pick->model));
-
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (pick->list), TRUE);
-
- gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (pick->list),
- COLUMN_ACTION,
- _("Select an Action"),
- gtk_cell_renderer_text_new (),
- "text", COLUMN_ACTION,
- NULL);
-
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (pick->list)),
- GTK_SELECTION_SINGLE);
-
- str = g_strdup_printf (_("Create a new contact \"%s\""), new_name);
- gtk_list_store_append (pick->model, &iter);
- gtk_list_store_set (pick->model, &iter,
- COLUMN_ACTION, str,
- COLUMN_CONTACT, NULL,
- -1);
- g_object_weak_ref (G_OBJECT (pick->model), free_str, str);
-
- pick->contacts = NULL;
- while (contacts) {
- EContact *contact = (EContact *) contacts->data;
- gchar *name_str = e_contact_get (contact, E_CONTACT_FULL_NAME);
-
- pick->contacts = g_list_append (pick->contacts, contact);
- g_object_ref (contact);
-
- str = g_strdup_printf (_("Add address to existing contact \"%s\""), name_str);
- gtk_list_store_append (pick->model, &iter);
- gtk_list_store_set (pick->model, &iter,
- COLUMN_ACTION, str,
- COLUMN_CONTACT, contact,
- -1);
- g_free (name_str);
-
- g_object_weak_ref (G_OBJECT (pick->model), free_str, str);
-
- contacts = g_list_next (contacts);
- }
-
- pick->new_name = g_strdup (new_name);
- pick->new_email = g_strdup (new_email);
-
- pick->current_contact = NULL;
- gtk_widget_set_sensitive (wiz->ok_button, FALSE);
-
- /* Connect some signals & callbacks */
-
- wiz->ok_cb = contact_picker_ok_cb;
- wiz->cleanup_cb = contact_picker_cleanup_cb;
-
- g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (pick->list)),
- "changed", G_CALLBACK (contact_picker_selection_changed),
- wiz);
-
- /* Build our widget */
-
- w = gtk_label_new (new_email);
- gtk_box_pack_start (GTK_BOX (pick->body), w, FALSE, TRUE, 3);
-
- gtk_box_pack_start (GTK_BOX (pick->body), pick->list, TRUE, TRUE, 2);
- gtk_widget_show_all (pick->body);
-
-
- /* Put it in our mini-wizard */
-
- wiz->closure = pick;
- mini_wizard_container_add (wiz, pick->body);
-}
-
-/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */
-
-/*
- * The code for the actual EABPopupControl widget begins here.
- */
-
-/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */
-
-
-static GtkObjectClass *parent_class;
-
-static void eab_popup_control_dispose (GObject *);
-static void eab_popup_control_query (EABPopupControl *);
-
-
-static void
-eab_popup_control_class_init (EABPopupControlClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->dispose = eab_popup_control_dispose;
-}
-
-static void
-eab_popup_control_init (EABPopupControl *pop)
-{
- pop->transitory = TRUE;
-}
-
-static void
-eab_popup_control_cleanup (EABPopupControl *pop)
-{
- if (pop->contact) {
- g_object_unref (pop->contact);
- pop->contact = NULL;
- }
-
- if (pop->scheduled_refresh) {
- g_source_remove (pop->scheduled_refresh);
- pop->scheduled_refresh = 0;
- }
-
- if (pop->query_tag) {
-#if notyet
- e_book_simple_query_cancel (pop->book, pop->query_tag);
-#endif
- pop->query_tag = 0;
- }
-
- if (pop->book) {
- g_object_unref (pop->book);
- pop->book = NULL;
- }
-
- g_free (pop->name);
- pop->name = NULL;
-
- g_free (pop->email);
- pop->email = NULL;
-}
-
-static void
-eab_popup_control_dispose (GObject *obj)
-{
- EABPopupControl *pop = EAB_POPUP_CONTROL (obj);
-
- eab_popup_control_cleanup (pop);
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (obj);
-}
-
-GType
-eab_popup_control_get_type (void)
-{
- static GType pop_type = 0;
-
- if (!pop_type) {
- static const GTypeInfo pop_info = {
- sizeof (EABPopupControlClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) eab_popup_control_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EABPopupControl),
- 0, /* n_preallocs */
- (GInstanceInitFunc) eab_popup_control_init,
- };
-
- pop_type = g_type_register_static (gtk_event_box_get_type (), "EABPopupControl", &pop_info, 0);
- }
-
- return pop_type;
-}
-
-static void
-eab_popup_control_refresh_names (EABPopupControl *pop)
-{
- if (pop->name_widget) {
- if (pop->name && *pop->name) {
- gtk_label_set_text (GTK_LABEL (pop->name_widget), pop->name);
- gtk_widget_show (pop->name_widget);
- } else {
- gtk_widget_hide (pop->name_widget);
- }
- }
-
- if (pop->email_widget) {
- if (pop->email && *pop->email) {
- gtk_label_set_text (GTK_LABEL (pop->email_widget), pop->email);
- gtk_widget_show (pop->email_widget);
- } else {
- gtk_widget_hide (pop->email_widget);
- }
- }
-
- eab_popup_control_query (pop);
-}
-
-static gint
-refresh_timeout_cb (gpointer ptr)
-{
- EABPopupControl *pop = EAB_POPUP_CONTROL (ptr);
- eab_popup_control_refresh_names (pop);
- pop->scheduled_refresh = 0;
- return 0;
-}
-
-static void
-eab_popup_control_schedule_refresh (EABPopupControl *pop)
-{
- if (pop->scheduled_refresh == 0)
- pop->scheduled_refresh = g_timeout_add (20, refresh_timeout_cb, pop);
-}
-
-/* If we are handed something of the form "Foo <bar@bar.com>",
- do the right thing. */
-static gboolean
-eab_popup_control_set_free_form (EABPopupControl *pop, const gchar *txt)
-{
- gchar *lt, *gt = NULL;
-
- g_return_val_if_fail (pop && EAB_IS_POPUP_CONTROL (pop), FALSE);
-
- if (txt == NULL)
- return FALSE;
-
- lt = strchr (txt, '<');
- if (lt)
- gt = strchr (txt, '>');
-
- if (lt && gt && lt+1 < gt) {
- gchar *name = g_strndup (txt, lt-txt);
- gchar *email = g_strndup (lt+1, gt-lt-1);
- eab_popup_control_set_name (pop, name);
- eab_popup_control_set_email (pop, email);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static void
-eab_popup_control_set_name (EABPopupControl *pop, const gchar *name)
-{
- g_return_if_fail (pop && EAB_IS_POPUP_CONTROL (pop));
-
- /* We only allow the name to be set once. */
- if (pop->name)
- return;
-
- if (!eab_popup_control_set_free_form (pop, name)) {
- pop->name = g_strdup (name);
- if (pop->name)
- g_strstrip (pop->name);
- }
-
- eab_popup_control_schedule_refresh (pop);
-}
-
-static void
-eab_popup_control_set_email (EABPopupControl *pop, const gchar *email)
-{
- g_return_if_fail (pop && EAB_IS_POPUP_CONTROL (pop));
-
- /* We only allow the e-mail to be set once. */
- if (pop->email)
- return;
-
- if (!eab_popup_control_set_free_form (pop, email)) {
- pop->email = g_strdup (email);
- if (pop->email)
- g_strstrip (pop->email);
- }
-
- eab_popup_control_schedule_refresh (pop);
-}
-
-void
-eab_popup_control_construct (EABPopupControl *pop)
-{
- GtkWidget *vbox, *name_holder;
- GdkColor color = { 0x0, 0xffff, 0xffff, 0xffff };
-
- g_return_if_fail (pop && EAB_IS_POPUP_CONTROL (pop));
-
- pop->main_vbox = gtk_vbox_new (FALSE, 0);
-
- /* Build Generic View */
-
- name_holder = gtk_event_box_new ();
- vbox = gtk_vbox_new (FALSE, 2);
- pop->name_widget = gtk_label_new ("");
- pop->email_widget = gtk_label_new ("");
-
- gtk_box_pack_start (GTK_BOX (vbox), pop->name_widget, TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (vbox), pop->email_widget, TRUE, TRUE, 2);
- gtk_container_add (GTK_CONTAINER (name_holder), GTK_WIDGET (vbox));
-
- if (gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (name_holder)), &color, FALSE, TRUE)) {
- GtkStyle *style = gtk_style_copy (gtk_widget_get_style (GTK_WIDGET (name_holder)));
- style->bg[0] = color;
- gtk_widget_set_style (GTK_WIDGET (name_holder), style);
- g_object_unref (style);
- }
-
- pop->generic_view = gtk_frame_new (NULL);
- gtk_container_add (GTK_CONTAINER (pop->generic_view), name_holder);
- gtk_box_pack_start (GTK_BOX (pop->main_vbox), pop->generic_view, TRUE, TRUE, 0);
- gtk_widget_show_all (pop->generic_view);
-
- pop->query_msg = gtk_label_new (_("Querying Addressbook..."));
- gtk_box_pack_start (GTK_BOX (pop->main_vbox), pop->query_msg, TRUE, TRUE, 0);
- gtk_widget_show (pop->query_msg);
-
- /* Build ContactDisplay */
- pop->contact_display = eab_contact_display_new ();
- gtk_box_pack_start (GTK_BOX (pop->main_vbox), pop->contact_display, TRUE, TRUE, 0);
-
-
- /* Final assembly */
-
- gtk_container_add (GTK_CONTAINER (pop), pop->main_vbox);
- gtk_widget_show (pop->main_vbox);
-
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 3);
- gtk_container_set_border_width (GTK_CONTAINER (pop), 2);
-}
-
-static GtkWidget *
-eab_popup_new (void)
-{
- EABPopupControl *pop = g_object_new (EAB_TYPE_POPUP_CONTROL, NULL);
- eab_popup_control_construct (pop);
- return GTK_WIDGET (pop);
-}
-
-static void
-emit_event (EABPopupControl *pop, const char *event)
-{
- if (pop->es) {
- BonoboArg *arg;
-
- arg = bonobo_arg_new (BONOBO_ARG_BOOLEAN);
- BONOBO_ARG_SET_BOOLEAN (arg, TRUE);
- bonobo_event_source_notify_listeners_full (pop->es,
- "GNOME/Evolution/Addressbook/AddressPopup",
- "Event",
- event,
- arg, NULL);
- bonobo_arg_release (arg);
- }
-}
-
-static void
-contact_editor_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- if (status == E_BOOK_ERROR_OK) {
- EABPopupControl *pop = EAB_POPUP_CONTROL (closure);
- EContactEditor *ce = eab_show_contact_editor (book, pop->contact, FALSE, TRUE);
- eab_popup_control_cleanup (pop);
- emit_event (pop, "Destroy");
- e_contact_editor_raise (ce);
- }
-
- if (book)
- g_object_unref (book);
-}
-
-static void
-edit_contact_info_cb (GtkWidget *button, EABPopupControl *pop)
-{
- emit_event (pop, "Hide");
-
- addressbook_load_default_book (contact_editor_cb, pop);
-}
-
-static void
-eab_popup_control_display_contact (EABPopupControl *pop, EContact *contact)
-{
- GtkWidget *b;
-
- g_return_if_fail (pop && EAB_IS_POPUP_CONTROL (pop));
- g_return_if_fail (contact && E_IS_CONTACT (contact));
- g_return_if_fail (pop->contact == NULL);
-
- pop->contact = contact;
- g_object_ref (pop->contact);
-
- eab_contact_display_render (EAB_CONTACT_DISPLAY (pop->contact_display),
- contact,
- EAB_CONTACT_DISPLAY_RENDER_COMPACT);
- gtk_widget_show (pop->contact_display);
- gtk_widget_hide (pop->generic_view);
-
- b = gtk_button_new_with_label (_("Edit Contact Info"));
- gtk_box_pack_start (GTK_BOX (pop->main_vbox), b, TRUE, TRUE, 0);
- g_signal_connect (b,
- "clicked",
- G_CALLBACK (edit_contact_info_cb),
- pop);
- gtk_widget_show (b);
-}
-
-static void
-add_contacts_cb (GtkWidget *button, EABPopupControl *pop)
-{
- if (pop->email && *pop->email) {
- if (pop->name && *pop->name)
- e_contact_quick_add (pop->name, pop->email, NULL, NULL);
- else
- e_contact_quick_add_free_form (pop->email, NULL, NULL);
-
- }
- eab_popup_control_cleanup (pop);
- emit_event (pop, "Destroy");
-}
-
-static void
-eab_popup_control_no_matches (EABPopupControl *pop)
-{
- GtkWidget *b;
-
- g_return_if_fail (pop && EAB_IS_POPUP_CONTROL (pop));
-
- b = e_button_new_with_stock_icon (_("Add to Contacts"), "gtk-add");
-
- gtk_box_pack_start (GTK_BOX (pop->main_vbox), b, TRUE, TRUE, 0);
- g_signal_connect (b,
- "clicked",
- G_CALLBACK (add_contacts_cb),
- pop);
- gtk_widget_show (b);
-}
-
-static void
-wizard_destroy_cb (MiniWizard *wiz, gpointer closure)
-{
- gtk_widget_destroy (GTK_WIDGET (closure));
-}
-
-static void
-eab_popup_control_ambiguous_email_add (EABPopupControl *pop, const GList *contacts)
-{
- MiniWizard *wiz = mini_wizard_new ();
- GtkWidget *win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- wiz->destroy_cb = wizard_destroy_cb;
- wiz->destroy_closure = win;
-
- gtk_window_set_title (GTK_WINDOW (win), _("Merge E-Mail Address"));
- gtk_window_set_position (GTK_WINDOW (win), GTK_WIN_POS_MOUSE);
-
- contact_picker_init (wiz, contacts, pop->name, pop->email);
-
- eab_popup_control_cleanup (pop);
- emit_event (pop, "Destroy");
-
- gtk_container_add (GTK_CONTAINER (win), wiz->body);
- gtk_widget_show_all (win);
-}
-
-static void
-eab_popup_control_multiple_matches (EABPopupControl *pop, const GList *contacts)
-{
- pop->multiple_matches = TRUE;
-
- eab_popup_control_ambiguous_email_add (pop, contacts);
-}
-
-/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
-
-/*
- * Addressbook Query Fun
- */
-
-static void
-name_only_query_cb (EBook *book, EBookStatus status, GList *contacts, gpointer closure)
-{
- EABPopupControl *pop;
-
- if (status != E_BOOK_ERROR_OK)
- return;
-
- pop = EAB_POPUP_CONTROL (closure);
-
- pop->query_tag = 0;
-
- if (contacts == NULL) {
- eab_popup_control_no_matches (pop);
- } else {
- eab_popup_control_ambiguous_email_add (pop, contacts);
- g_list_foreach (contacts, (GFunc)g_object_unref, NULL);
- g_list_free (contacts);
- }
-}
-
-static void
-query_cb (EBook *book, EBookStatus status, GList *contacts, gpointer closure)
-{
- EABPopupControl *pop;
-
- if (status != E_BOOK_ERROR_OK)
- return;
-
- pop = EAB_POPUP_CONTROL (closure);
-
- pop->query_tag = 0;
- gtk_widget_hide (pop->query_msg);
-
- if (contacts == NULL) {
-
- /* Do a name-only query if:
- (1) The name is non-empty.
- (2) The e-mail is also non-empty (so that the query we just did wasn't actually a name-only query.
- */
- if (pop->name && *pop->name && pop->email && *pop->email) {
- pop->query_tag = eab_name_and_email_query (book, pop->name, NULL, name_only_query_cb, pop);
- } else {
- eab_popup_control_no_matches (pop);
- }
-
- } else {
- if (g_list_length ((GList *) contacts) == 1)
- eab_popup_control_display_contact (pop, E_CONTACT (contacts->data));
- else
- eab_popup_control_multiple_matches (pop, contacts);
-
- g_list_foreach (contacts, (GFunc)g_object_unref, NULL);
- g_list_free (contacts);
- }
-}
-
-static void
-start_query (EBook *book, EBookStatus status, gpointer closure)
-{
- EABPopupControl *pop = EAB_POPUP_CONTROL (closure);
-
- if (status != E_BOOK_ERROR_OK) {
- eab_popup_control_no_matches (pop);
- if (book)
- g_object_unref (book);
- return;
- }
-
-#if notyet
- if (pop->query_tag)
- e_book_simple_query_cancel (book, pop->query_tag);
-#endif
-
- if (pop->book != book) {
- g_object_ref (book);
- if (pop->book)
- g_object_unref (pop->book);
- pop->book = book;
- }
-
- pop->query_tag = eab_name_and_email_query (book, pop->name, pop->email, query_cb, pop);
-
- g_object_unref (pop);
-}
-
-static void
-eab_popup_control_query (EABPopupControl *pop)
-{
- g_return_if_fail (pop && EAB_IS_POPUP_CONTROL (pop));
-
- g_object_ref (pop);
-
- addressbook_load_default_book (start_query, pop);
-}
-
-/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
-
-enum {
- PROPERTY_NAME,
- PROPERTY_EMAIL,
- PROPERTY_TRANSITORY
-};
-
-static void
-set_prop (BonoboPropertyBag *bag, const BonoboArg *arg, guint arg_id, CORBA_Environment *ev, gpointer user_data)
-{
- EABPopupControl *pop = EAB_POPUP_CONTROL (user_data);
-
- switch (arg_id) {
-
- case PROPERTY_NAME:
- eab_popup_control_set_name (pop, BONOBO_ARG_GET_STRING (arg));
- break;
-
- case PROPERTY_EMAIL:
- eab_popup_control_set_email (pop, BONOBO_ARG_GET_STRING (arg));
- break;
-
- default:
- g_assert_not_reached ();
- }
-}
-
-static void
-get_prop (BonoboPropertyBag *bag, BonoboArg *arg, guint arg_id, CORBA_Environment *ev, gpointer user_data)
-{
- EABPopupControl *pop = EAB_POPUP_CONTROL (user_data);
-
- switch (arg_id) {
-
- case PROPERTY_NAME:
- BONOBO_ARG_SET_STRING (arg, pop->name);
- break;
-
- case PROPERTY_EMAIL:
- BONOBO_ARG_SET_STRING (arg, pop->email);
- break;
-
- case PROPERTY_TRANSITORY:
- BONOBO_ARG_SET_BOOLEAN (arg, pop->transitory);
- break;
-
- default:
- g_assert_not_reached ();
- }
-}
-
-BonoboControl *
-eab_popup_control_new (void)
-{
- BonoboControl *control;
- BonoboPropertyBag *bag;
- EABPopupControl *addy;
- GtkWidget *w;
-
- w = eab_popup_new ();
- addy = EAB_POPUP_CONTROL (w);
-
- control = bonobo_control_new (w);
- gtk_widget_show (w);
-
- bag = bonobo_property_bag_new (get_prop, set_prop, w);
- bonobo_property_bag_add (bag, "name", PROPERTY_NAME,
- BONOBO_ARG_STRING, NULL, NULL,
- BONOBO_PROPERTY_WRITEABLE | BONOBO_PROPERTY_READABLE);
-
- bonobo_property_bag_add (bag, "email", PROPERTY_EMAIL,
- BONOBO_ARG_STRING, NULL, NULL,
- BONOBO_PROPERTY_WRITEABLE | BONOBO_PROPERTY_READABLE);
-
- bonobo_property_bag_add (bag, "transitory", PROPERTY_TRANSITORY,
- BONOBO_ARG_BOOLEAN, NULL, NULL,
- BONOBO_PROPERTY_READABLE);
-
- bonobo_control_set_properties (control, bonobo_object_corba_objref (BONOBO_OBJECT (bag)), NULL);
- bonobo_object_unref (BONOBO_OBJECT (bag));
-
- addy->es = bonobo_event_source_new ();
- bonobo_object_add_interface (BONOBO_OBJECT (control),
- BONOBO_OBJECT (addy->es));
-
- return control;
-}
diff --git a/addressbook/gui/widgets/eab-popup-control.h b/addressbook/gui/widgets/eab-popup-control.h
deleted file mode 100644
index 2feb3ac7d0..0000000000
--- a/addressbook/gui/widgets/eab-popup-control.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/*
- * eab-popup-control.h
- *
- * Copyright (C) 2001-2003, Ximian, Inc.
- *
- * Authors: Jon Trowbridge <trow@ximian.com>
- * Chris Toshok <toshok@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 __EAB_POPUP_CONTROL_H__
-#define __EAB_POPUP_CONTROL_H__
-
-#include <bonobo/bonobo-event-source.h>
-#include <gtk/gtk.h>
-#include <libebook/e-book-async.h>
-#include <libebook/e-contact.h>
-
-G_BEGIN_DECLS
-
-#define EAB_TYPE_POPUP_CONTROL (eab_popup_control_get_type ())
-#define EAB_POPUP_CONTROL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EAB_TYPE_POPUP_CONTROL, EABPopupControl))
-#define EAB_POPUP_CONTROL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EAB_TYPE_POPUP_CONTROL, EABPopupControlClass))
-#define EAB_IS_POPUP_CONTROL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EAB_TYPE_POPUP_CONTROL))
-#define EAB_IS_POPUP_CONTROL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EAB_TYPE_POPUP_CONTROL))
-
-typedef struct _EABPopupControl EABPopupControl;
-typedef struct _EABPopupControlClass EABPopupControlClass;
-
-struct _EABPopupControl {
- GtkEventBox parent;
-
- gchar *name;
- gchar *email;
-
- GtkWidget *name_widget;
- GtkWidget *email_widget;
- GtkWidget *query_msg;
-
- GtkWidget *main_vbox;
- GtkWidget *generic_view;
- GtkWidget *contact_display;
-
- gboolean transitory;
-
- guint scheduled_refresh;
- EBook *book;
- guint query_tag;
- gboolean multiple_matches;
- EContact *contact;
-
- BonoboEventSource *es;
-};
-
-struct _EABPopupControlClass {
- GtkEventBoxClass parent_class;
-};
-
-GType eab_popup_control_get_type (void);
-
-void eab_popup_control_construct (EABPopupControl *);
-
-BonoboControl *eab_popup_control_new (void);
-
-G_END_DECLS
-
-#endif /* __EAB_POPUP_CONTROL_H__ */
-
diff --git a/addressbook/gui/widgets/eab-vcard-control.c b/addressbook/gui/widgets/eab-vcard-control.c
deleted file mode 100644
index c161333f15..0000000000
--- a/addressbook/gui/widgets/eab-vcard-control.c
+++ /dev/null
@@ -1,310 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * eab-vcard-control.c
- *
- * Copyright (C) 1999, 2000, 2001, 2002, 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.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Chris Toshok <toshok@ximian.com>
- */
-
-#include <config.h>
-#include <string.h>
-
-#include <gtk/gtk.h>
-#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-persist.h>
-#include <bonobo/bonobo-persist-stream.h>
-#include <bonobo/bonobo-stream-client.h>
-#include <gal/util/e-util.h>
-
-#include <libebook/e-book-async.h>
-#include <libebook/e-contact.h>
-#include <addressbook/gui/component/addressbook.h>
-#include <addressbook/gui/widgets/eab-contact-display.h>
-#include <addressbook/util/eab-book-util.h>
-
-#include "eab-vcard-control.h"
-#include "eab-contact-merging.h"
-
-typedef struct {
- EABContactDisplay *display;
- GList *card_list;
- GtkWidget *label;
- EABContactDisplayRenderMode render_mode;
-} EABVCardControl;
-
-#define VCARD_CONTROL_ID "OAFIID:GNOME_Evolution_Addressbook_VCard_Control:" BASE_VERSION
-
-/*
- * Bonobo::PersistStream
- *
- * These two functions implement the Bonobo::PersistStream load and
- * save methods which allow data to be loaded into and out of the
- * BonoboObject.
- */
-static char *
-stream_read (Bonobo_Stream stream)
-{
- Bonobo_Stream_iobuf *buffer;
- CORBA_Environment ev;
- char *data = NULL;
- gint length = 0;
-
- CORBA_exception_init (&ev);
- do {
-#define READ_CHUNK_SIZE 65536
- Bonobo_Stream_read (stream, READ_CHUNK_SIZE,
- &buffer, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- if (buffer->_length <= 0)
- break;
-
- data = g_realloc (data, length + buffer->_length + 1);
-
- memcpy (data + length, buffer->_buffer, buffer->_length);
-
- length += buffer->_length;
-
- CORBA_free (buffer);
- } while (1);
-
- CORBA_free (buffer);
- CORBA_exception_free (&ev);
-
- if (data)
- data[length] = '\0';
- else
- data = g_strdup("");
-
- return data;
-} /* stream_read */
-
-/*
- * This function implements the Bonobo::PersistStream:load method.
- */
-static void
-pstream_load (BonoboPersistStream *ps, const Bonobo_Stream stream,
- Bonobo_Persist_ContentType type, void *data,
- CORBA_Environment *ev)
-{
- GList *list;
- char *vcard;
- EABVCardControl *vcard_control = data;
-
- if (type && g_ascii_strcasecmp (type, "text/vCard") != 0 &&
- g_ascii_strcasecmp (type, "text/x-vCard") != 0) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_Bonobo_Persist_WrongDataType, NULL);
- return;
- }
-
- if ((vcard = stream_read (stream)) == NULL) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_Bonobo_Persist_FileNotFound, NULL);
- return;
- }
-
- e_free_object_list (vcard_control->card_list);
- list = eab_contact_list_from_string (vcard);
- g_free(vcard);
- vcard_control->card_list = list;
- if (list) {
- eab_contact_display_render (vcard_control->display, E_CONTACT (list->data),
- vcard_control->render_mode);
- }
- if (list && list->next) {
- char *message;
- int length = g_list_length (list) - 1;
- if (length > 1) {
- message = g_strdup_printf (_("and %d other contacts."), length);
- } else {
- message = g_strdup_printf (_("and one other contact."));
- }
- gtk_label_set_text (GTK_LABEL (vcard_control->label), message);
- g_free (message);
- gtk_widget_show (vcard_control->label);
- } else {
- gtk_widget_hide (vcard_control->label);
- }
-} /* pstream_load */
-
-/*
- * This function implements the Bonobo::PersistStream:save method.
- */
-static void
-pstream_save (BonoboPersistStream *ps, const Bonobo_Stream stream,
- Bonobo_Persist_ContentType type, void *data,
- CORBA_Environment *ev)
-{
- EABVCardControl *vcard_control = data;
- char *vcard;
- int length;
-
- if (type && g_ascii_strcasecmp (type, "text/vCard") != 0 &&
- g_ascii_strcasecmp (type, "text/x-vCard") != 0) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_Bonobo_Persist_WrongDataType, NULL);
- return;
- }
-
- vcard = eab_contact_list_to_string (vcard_control->card_list);
- length = strlen (vcard);
- bonobo_stream_client_write (stream, vcard, length, ev);
- g_free (vcard);
-} /* pstream_save */
-
-static Bonobo_Persist_ContentTypeList *
-pstream_get_content_types (BonoboPersistStream *ps, void *closure,
- CORBA_Environment *ev)
-{
- return bonobo_persist_generate_content_types (2, "text/vCard", "text/x-vCard");
-}
-
-static void
-book_open_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- GList *list = closure;
- if (status == E_BOOK_ERROR_OK) {
- GList *p;
- for (p = list; p; p = p->next) {
- /* XXX argh, more passing of NULL's for callbacks */
- eab_merging_book_add_contact (book, E_CONTACT (p->data), NULL, NULL);
- }
- }
- if (book)
- g_object_unref (book);
- e_free_object_list (list);
-}
-
-static void
-save_in_addressbook(GtkWidget *button, gpointer data)
-{
- EABVCardControl *vcard_control = data;
- GList *list, *p;
-
- list = g_list_copy (vcard_control->card_list);
-
- for (p = list; p; p = p->next)
- g_object_ref (p->data);
-
- addressbook_load_default_book (book_open_cb, list);
-}
-
-static void
-toggle_full_vcard(GtkWidget *button, gpointer data)
-{
- EABVCardControl *vcard_control = data;
- char *label;
-
- if (!vcard_control->card_list)
- return;
-
- if (vcard_control->render_mode == EAB_CONTACT_DISPLAY_RENDER_NORMAL) {
- vcard_control->render_mode = EAB_CONTACT_DISPLAY_RENDER_COMPACT;
- label = _("Show Full VCard");
- }
- else {
- vcard_control->render_mode = EAB_CONTACT_DISPLAY_RENDER_NORMAL;
- label = _("Show Compact VCard");
- }
-
- gtk_button_set_label (GTK_BUTTON (button), label);
- eab_contact_display_render (vcard_control->display, E_CONTACT (vcard_control->card_list->data),
- vcard_control->render_mode);
-}
-
-static void
-free_struct (gpointer data, GObject *where_object_was)
-{
- EABVCardControl *vcard_control = data;
- e_free_object_list (vcard_control->card_list);
- g_free (vcard_control);
-}
-
-BonoboControl *
-eab_vcard_control_new (void)
-{
- BonoboControl *control;
- BonoboPersistStream *stream;
- GtkWidget *display;
- GtkWidget *button1, *button2;
- GtkWidget *label;
- GtkWidget *table;
-
- EABVCardControl *vcard_control = g_new (EABVCardControl, 1);
-
- printf ("inside eab_vcard_control_new\n");
-
- vcard_control->card_list = NULL;
- vcard_control->display = NULL;
- vcard_control->label = NULL;
-
- vcard_control->render_mode = EAB_CONTACT_DISPLAY_RENDER_COMPACT;
-
- /* Create the control. */
-
- display = eab_contact_display_new ();
- gtk_widget_show (display);
- vcard_control->display = EAB_CONTACT_DISPLAY (display);
-
- /* This is intentionally not shown. */
- label = gtk_label_new ("");
- vcard_control->label = label;
-
- button1 = gtk_button_new_with_label(_("Show Full VCard"));
- g_signal_connect (button1, "clicked",
- G_CALLBACK (toggle_full_vcard), vcard_control);
- gtk_widget_show (button1);
-
- button2 = gtk_button_new_with_label(_("Save in addressbook"));
- g_signal_connect (button2, "clicked",
- G_CALLBACK (save_in_addressbook), vcard_control);
- gtk_widget_show (button2);
-
- table = gtk_table_new (6, 6, FALSE);
- gtk_table_attach (GTK_TABLE (table), display, 0, 6, 3, 6, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
- gtk_table_attach (GTK_TABLE (table), label, 0, 3, 2, 3, GTK_FILL, 0, 0, 0);
- gtk_table_attach (GTK_TABLE (table), button1, 0, 1, 1, 2, 0, 0, 0, 0);
- gtk_table_attach (GTK_TABLE (table), button2, 1, 2, 1, 2, 0, 0, 0, 0);
- gtk_widget_show (table);
-
- control = bonobo_control_new (table);
-
- g_object_weak_ref (G_OBJECT (control), free_struct, vcard_control);
-
- stream = bonobo_persist_stream_new (pstream_load, pstream_save,
- pstream_get_content_types,
- VCARD_CONTROL_ID,
- vcard_control);
-
- if (stream == NULL) {
- bonobo_object_unref (BONOBO_OBJECT (control));
- return NULL;
- }
-
- bonobo_object_add_interface (BONOBO_OBJECT (control),
- BONOBO_OBJECT (stream));
-
- return control;
-}
diff --git a/addressbook/gui/widgets/eab-vcard-control.h b/addressbook/gui/widgets/eab-vcard-control.h
deleted file mode 100644
index 5f6643c1ca..0000000000
--- a/addressbook/gui/widgets/eab-vcard-control.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef __EAB_VCARD_CONTROL_H__
-#define __EAB_VCARD_CONTROL_H__
-
-#include <bonobo/bonobo-control.h>
-
-BonoboControl *eab_vcard_control_new (void);
-
-#endif /* __EAB_VCARD_CONTROL_H__ */
diff --git a/addressbook/gui/widgets/gal-view-factory-minicard.c b/addressbook/gui/widgets/gal-view-factory-minicard.c
deleted file mode 100644
index 212ac79b53..0000000000
--- a/addressbook/gui/widgets/gal-view-factory-minicard.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-factory-minicard.c: A View Factory
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * (C) 2000, 2001 Ximian, Inc.
- */
-#include <config.h>
-#include <glib.h>
-#include <libgnome/gnome-i18n.h>
-#include "gal-view-factory-minicard.h"
-#include "gal-view-minicard.h"
-#include "gal/util/e-util.h"
-
-#define PARENT_TYPE GAL_VIEW_FACTORY_TYPE
-
-static GalViewFactoryClass *gal_view_factory_minicard_parent_class;
-
-static const char *
-gal_view_factory_minicard_get_title (GalViewFactory *factory)
-{
- return _("Card View");
-}
-
-static GalView *
-gal_view_factory_minicard_new_view (GalViewFactory *factory,
- const char *name)
-{
- return gal_view_minicard_new(name);
-}
-
-static const char *
-gal_view_factory_minicard_get_type_code (GalViewFactory *factory)
-{
- return "minicard";
-}
-
-static void
-gal_view_factory_minicard_class_init (GObjectClass *object_class)
-{
- GalViewFactoryClass *view_factory_class = GAL_VIEW_FACTORY_CLASS(object_class);
- gal_view_factory_minicard_parent_class = g_type_class_ref (PARENT_TYPE);
-
- view_factory_class->get_title = gal_view_factory_minicard_get_title;
- view_factory_class->new_view = gal_view_factory_minicard_new_view;
- view_factory_class->get_type_code = gal_view_factory_minicard_get_type_code;
-}
-
-static void
-gal_view_factory_minicard_init (GalViewFactoryMinicard *factory)
-{
-}
-
-/**
- * gal_view_minicard_new
- *
- * A new GalViewFactory for creating Minicard views. Create one of
- * these and pass it to GalViewCollection for use.
- *
- * Returns: The new GalViewFactoryMinicard.
- */
-GalViewFactory *
-gal_view_factory_minicard_new (void)
-{
- return gal_view_factory_minicard_construct (g_object_new (GAL_TYPE_VIEW_FACTORY_MINICARD, NULL));
-}
-
-/**
- * gal_view_minicard_construct
- * @factory: The factory to construct
- *
- * constructs the GalViewFactoryMinicard. To be used by subclasses and
- * language bindings.
- *
- * Returns: The GalViewFactoryMinicard.
- */
-GalViewFactory *
-gal_view_factory_minicard_construct (GalViewFactoryMinicard *factory)
-{
- return GAL_VIEW_FACTORY(factory);
-}
-
-E_MAKE_TYPE(gal_view_factory_minicard, "GalViewFactoryMinicard", GalViewFactoryMinicard, gal_view_factory_minicard_class_init, gal_view_factory_minicard_init, PARENT_TYPE)
diff --git a/addressbook/gui/widgets/gal-view-factory-minicard.h b/addressbook/gui/widgets/gal-view-factory-minicard.h
deleted file mode 100644
index 02eea99e47..0000000000
--- a/addressbook/gui/widgets/gal-view-factory-minicard.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-factory-minicard.c: A View Factory
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * (C) 2000, 2001 Ximian, Inc.
- */
-#ifndef _GAL_VIEW_FACTORY_MINICARD_H_
-#define _GAL_VIEW_FACTORY_MINICARD_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/menus/gal-view-factory.h>
-
-#define GAL_TYPE_VIEW_FACTORY_MINICARD (gal_view_factory_minicard_get_type ())
-#define GAL_VIEW_FACTORY_MINICARD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_TYPE_VIEW_FACTORY_MINICARD, GalViewFactoryMinicard))
-#define GAL_VIEW_FACTORY_MINICARD_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_TYPE_VIEW_FACTORY_MINICARD, GalViewFactoryMinicardClass))
-#define GAL_IS_VIEW_FACTORY_MINICARD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_TYPE_VIEW_FACTORY_MINICARD))
-#define GAL_IS_VIEW_FACTORY_MINICARD_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_TYPE_VIEW_FACTORY_MINICARD))
-
-typedef struct {
- GalViewFactory base;
-} GalViewFactoryMinicard;
-
-typedef struct {
- GalViewFactoryClass parent_class;
-} GalViewFactoryMinicardClass;
-
-/* Standard functions */
-GType gal_view_factory_minicard_get_type (void);
-GalViewFactory *gal_view_factory_minicard_new (void);
-GalViewFactory *gal_view_factory_minicard_construct (GalViewFactoryMinicard *factory);
-
-#endif /* _GAL_VIEW_FACTORY_MINICARD_H_ */
diff --git a/addressbook/gui/widgets/gal-view-factory-treeview.c b/addressbook/gui/widgets/gal-view-factory-treeview.c
deleted file mode 100644
index b14c8dec59..0000000000
--- a/addressbook/gui/widgets/gal-view-factory-treeview.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8
- -*- */
-/*
- * gal-view-factory-treeview.c: A View Factory
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * (C) 2000, 2001 Ximian, Inc.
- */
-#include <config.h>
-#include <glib.h>
-#include <libgnome/gnome-i18n.h>
-#include <gal/util/e-util.h>
-#include "gal-view-factory-treeview.h"
-#include "gal-view-treeview.h"
-
-#define PARENT_TYPE GAL_VIEW_FACTORY_TYPE
-
-static GalViewFactoryClass *gal_view_factory_treeview_parent_class;
-
-static const char *
-gal_view_factory_treeview_get_title (GalViewFactory *factory)
-{
- return _("GTK Tree View");
-}
-
-static GalView *
-gal_view_factory_treeview_new_view (GalViewFactory *factory,
- const char *name)
-{
- return gal_view_treeview_new(name);
-}
-
-static const char *
-gal_view_factory_treeview_get_type_code (GalViewFactory *factory)
-{
- return "treeview";
-}
-
-static void
-gal_view_factory_treeview_class_init (GObjectClass *object_class)
-{
- GalViewFactoryClass *view_factory_class = GAL_VIEW_FACTORY_CLASS(object_class);
- gal_view_factory_treeview_parent_class = g_type_class_ref (PARENT_TYPE);
-
- view_factory_class->get_title = gal_view_factory_treeview_get_title;
- view_factory_class->new_view = gal_view_factory_treeview_new_view;
- view_factory_class->get_type_code = gal_view_factory_treeview_get_type_code;
-}
-
-static void
-gal_view_factory_treeview_init (GalViewFactoryTreeView *factory)
-{
-}
-
-/**
- * gal_view_treeview_new
- *
- * A new GalViewFactory for creating TreeView views. Create one of
- * these and pass it to GalViewCollection for use.
- *
- * Returns: The new GalViewFactoryTreeView.
- */
-GalViewFactory *
-gal_view_factory_treeview_new (void)
-{
- return gal_view_factory_treeview_construct (g_object_new (GAL_TYPE_VIEW_FACTORY_TREEVIEW, NULL));
-}
-
-/**
- * gal_view_treeview_construct
- * @factory: The factory to construct
- *
- * constructs the GalViewFactoryTreeView. To be used by subclasses and
- * language bindings.
- *
- * Returns: The GalViewFactoryTreeView.
- */
-GalViewFactory *
-gal_view_factory_treeview_construct (GalViewFactoryTreeView *factory)
-{
- return GAL_VIEW_FACTORY(factory);
-}
-
-E_MAKE_TYPE(gal_view_factory_treeview, "GalViewFactoryTreeView", GalViewFactoryTreeView, gal_view_factory_treeview_class_init, gal_view_factory_treeview_init, PARENT_TYPE)
diff --git a/addressbook/gui/widgets/gal-view-factory-treeview.h b/addressbook/gui/widgets/gal-view-factory-treeview.h
deleted file mode 100644
index 4795c6d3aa..0000000000
--- a/addressbook/gui/widgets/gal-view-factory-treeview.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-factory-treeview.c: A View Factory
- *
- * Authors:
- * Chris Toshok <toshok@ximian.com>
- *
- * (C) 2000, 2001 Ximian, Inc.
- */
-#ifndef _GAL_VIEW_FACTORY_TREEVIEW_H_
-#define _GAL_VIEW_FACTORY_TREEVIEW_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/menus/gal-view-factory.h>
-
-#define GAL_TYPE_VIEW_FACTORY_TREEVIEW (gal_view_factory_treeview_get_type ())
-#define GAL_VIEW_FACTORY_TREEVIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_TYPE_VIEW_FACTORY_TREEVIEW, GalViewFactoryTreeView))
-#define GAL_VIEW_FACTORY_TREEVIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_TYPE_VIEW_FACTORY_TREEVIEW, GalViewFactoryTreeViewClass))
-#define GAL_IS_VIEW_FACTORY_TREEVIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_TYPE_VIEW_FACTORY_TREEVIEW))
-#define GAL_IS_VIEW_FACTORY_TREEVIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_TYPE_VIEW_FACTORY_TREEVIEW))
-
-typedef struct {
- GalViewFactory base;
-} GalViewFactoryTreeView;
-
-typedef struct {
- GalViewFactoryClass parent_class;
-} GalViewFactoryTreeViewClass;
-
-/* Standard functions */
-GType gal_view_factory_treeview_get_type (void);
-GalViewFactory *gal_view_factory_treeview_new (void);
-GalViewFactory *gal_view_factory_treeview_construct (GalViewFactoryTreeView *factory);
-
-#endif /* _GAL_VIEW_FACTORY_TREEVIEW_H_ */
diff --git a/addressbook/gui/widgets/gal-view-minicard.c b/addressbook/gui/widgets/gal-view-minicard.c
deleted file mode 100644
index da60497cdb..0000000000
--- a/addressbook/gui/widgets/gal-view-minicard.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-minicard.c: An Minicard View
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * (C) 2000, 2001 Ximian, Inc.
- */
-#include <config.h>
-#include "gal-view-minicard.h"
-#include <libxml/parser.h>
-#include <gal/util/e-xml-utils.h>
-
-#define PARENT_TYPE gal_view_get_type ()
-#define d(x) x
-
-static GalViewClass *gal_view_minicard_parent_class;
-
-static void
-gal_view_minicard_edit (GalView *view, GtkWindow *parent_window)
-{
- /* GalViewMinicard *minicard_view = GAL_VIEW_MINICARD(view); */
-}
-
-static void
-gal_view_minicard_load (GalView *view,
- const char *filename)
-{
- xmlDoc *doc;
- doc = xmlParseFile (filename);
- if (doc) {
- xmlNode *root = xmlDocGetRootElement(doc);
- GAL_VIEW_MINICARD (view)->column_width = e_xml_get_double_prop_by_name_with_default (root, "column_width", 150);
- xmlFreeDoc(doc);
- }
-}
-
-static void
-gal_view_minicard_save (GalView *view,
- const char *filename)
-{
- xmlDoc *doc;
- xmlNode *root;
-
- doc = xmlNewDoc("1.0");
- root = xmlNewNode (NULL, "EMinicardViewState");
- e_xml_set_double_prop_by_name (root, "column_width", GAL_VIEW_MINICARD (view)->column_width);
- xmlDocSetRootElement(doc, root);
- xmlSaveFile(filename, doc);
- xmlFreeDoc(doc);
-}
-
-static const char *
-gal_view_minicard_get_title (GalView *view)
-{
- return GAL_VIEW_MINICARD(view)->title;
-}
-
-static void
-gal_view_minicard_set_title (GalView *view,
- const char *title)
-{
- g_free(GAL_VIEW_MINICARD(view)->title);
- GAL_VIEW_MINICARD(view)->title = g_strdup(title);
-}
-
-static const char *
-gal_view_minicard_get_type_code (GalView *view)
-{
- return "minicard";
-}
-
-static GalView *
-gal_view_minicard_clone (GalView *view)
-{
- GalViewMinicard *gvm, *new;
-
- gvm = GAL_VIEW_MINICARD(view);
-
- new = g_object_new (GAL_TYPE_VIEW_MINICARD, NULL);
- new->title = g_strdup (gvm->title);
- new->column_width = gvm->column_width;
-
- return GAL_VIEW(new);
-}
-
-static void
-gal_view_minicard_dispose (GObject *object)
-{
- GalViewMinicard *view = GAL_VIEW_MINICARD(object);
-
- if (view->title != NULL) {
- gal_view_minicard_detach (view);
- g_free(view->title);
- view->title = NULL;
- }
-
- if (G_OBJECT_CLASS (gal_view_minicard_parent_class)->dispose)
- (* G_OBJECT_CLASS (gal_view_minicard_parent_class)->dispose) (object);
-}
-
-static void
-gal_view_minicard_class_init (GObjectClass *object_class)
-{
- GalViewClass *gal_view_class = GAL_VIEW_CLASS(object_class);
- gal_view_minicard_parent_class = g_type_class_ref (PARENT_TYPE);
-
- gal_view_class->edit = gal_view_minicard_edit ;
- gal_view_class->load = gal_view_minicard_load ;
- gal_view_class->save = gal_view_minicard_save ;
- gal_view_class->get_title = gal_view_minicard_get_title ;
- gal_view_class->set_title = gal_view_minicard_set_title ;
- gal_view_class->get_type_code = gal_view_minicard_get_type_code;
- gal_view_class->clone = gal_view_minicard_clone ;
-
- object_class->dispose = gal_view_minicard_dispose ;
-}
-
-static void
-gal_view_minicard_init (GalViewMinicard *gvm)
-{
- gvm->title = NULL;
- gvm->column_width = 150.0;
-
- gvm->emvw = NULL;
- gvm->emvw_column_width_changed_id = 0;
-}
-
-/**
- * gal_view_minicard_new
- * @title: The name of the new view.
- *
- * Returns a new GalViewMinicard. This is primarily for use by
- * GalViewFactoryMinicard.
- *
- * Returns: The new GalViewMinicard.
- */
-GalView *
-gal_view_minicard_new (const gchar *title)
-{
- return gal_view_minicard_construct (g_object_new (GAL_TYPE_VIEW_MINICARD, NULL), title);
-}
-
-/**
- * gal_view_minicard_construct
- * @view: The view to construct.
- * @title: The name of the new view.
- *
- * constructs the GalViewMinicard. To be used by subclasses and
- * language bindings.
- *
- * Returns: The GalViewMinicard.
- */
-GalView *
-gal_view_minicard_construct (GalViewMinicard *view,
- const gchar *title)
-{
- view->title = g_strdup(title);
- return GAL_VIEW(view);
-}
-
-GType
-gal_view_minicard_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (GalViewMinicardClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gal_view_minicard_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GalViewMinicard),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gal_view_minicard_init,
- };
-
- type = g_type_register_static (PARENT_TYPE, "GalViewMinicard", &info, 0);
- }
-
- return type;
-}
-
-static void
-column_width_changed (EMinicardViewWidget *w, double width, GalViewMinicard *view)
-{
- d(g_print("%s: Old width = %f, New width = %f\n", G_GNUC_FUNCTION, view->column_width, width));
- if (view->column_width != width) {
- view->column_width = width;
- gal_view_changed(GAL_VIEW(view));
- }
-}
-
-void
-gal_view_minicard_attach (GalViewMinicard *view, EMinicardViewWidget *emvw)
-{
- gal_view_minicard_detach (view);
-
- view->emvw = emvw;
-
- g_object_ref (view->emvw);
-
- g_object_set (view->emvw,
- "column_width", view->column_width,
- NULL);
-
- view->emvw_column_width_changed_id =
- g_signal_connect(view->emvw, "column_width_changed",
- G_CALLBACK (column_width_changed), view);
-}
-
-void
-gal_view_minicard_detach (GalViewMinicard *view)
-{
- if (view->emvw == NULL)
- return;
- if (view->emvw_column_width_changed_id) {
- g_signal_handler_disconnect (view->emvw,
- view->emvw_column_width_changed_id);
- view->emvw_column_width_changed_id = 0;
- }
- g_object_unref (view->emvw);
- view->emvw = NULL;
-}
diff --git a/addressbook/gui/widgets/gal-view-minicard.h b/addressbook/gui/widgets/gal-view-minicard.h
deleted file mode 100644
index e586012f73..0000000000
--- a/addressbook/gui/widgets/gal-view-minicard.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-minicard.h: An Minicard View
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * (C) 2000, 2001 Ximian, Inc.
- */
-#ifndef _GAL_VIEW_MINICARD_H_
-#define _GAL_VIEW_MINICARD_H_
-
-#include <gal/menus/gal-view.h>
-#include <e-minicard-view-widget.h>
-
-#define GAL_TYPE_VIEW_MINICARD (gal_view_minicard_get_type ())
-#define GAL_VIEW_MINICARD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_TYPE_VIEW_MINICARD, GalViewMinicard))
-#define GAL_VIEW_MINICARD_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_TYPE_VIEW_MINICARD, GalViewMinicardClass))
-#define GAL_IS_VIEW_MINICARD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_TYPE_VIEW_MINICARD))
-#define GAL_IS_VIEW_MINICARD_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_TYPE_VIEW_MINICARD))
-
-typedef struct {
- GalView base;
-
- char *title;
- double column_width;
-
- EMinicardViewWidget *emvw;
- guint emvw_column_width_changed_id;
-} GalViewMinicard;
-
-typedef struct {
- GalViewClass parent_class;
-} GalViewMinicardClass;
-
-/* Standard functions */
-GType gal_view_minicard_get_type (void);
-GalView *gal_view_minicard_new (const gchar *title);
-GalView *gal_view_minicard_construct (GalViewMinicard *view,
- const gchar *title);
-void gal_view_minicard_attach (GalViewMinicard *view,
- EMinicardViewWidget *emvw);
-void gal_view_minicard_detach (GalViewMinicard *view);
-
-#endif /* _GAL_VIEW_MINICARD_H_ */
diff --git a/addressbook/gui/widgets/gal-view-treeview.c b/addressbook/gui/widgets/gal-view-treeview.c
deleted file mode 100644
index e18ae6341b..0000000000
--- a/addressbook/gui/widgets/gal-view-treeview.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-treeview.c: An TreeView View
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * (C) 2000, 2001 Ximian, Inc.
- */
-#include <config.h>
-#include "gal-view-treeview.h"
-#include <libxml/parser.h>
-#include <gal/util/e-xml-utils.h>
-
-#define PARENT_TYPE gal_view_get_type ()
-#define d(x) x
-
-static GalViewClass *gal_view_treeview_parent_class;
-
-static void
-gal_view_treeview_edit (GalView *view, GtkWindow *parent_window)
-{
- /* GalViewTreeView *treeview_view = GAL_VIEW_TREEVIEW(view); */
-}
-
-static void
-gal_view_treeview_load (GalView *view,
- const char *filename)
-{
-#if 0
- xmlDoc *doc;
- doc = xmlParseFile (filename);
- if (doc) {
- xmlNode *root = xmlDocGetRootElement(doc);
- GAL_VIEW_TREEVIEW (view)->column_width = e_xml_get_double_prop_by_name_with_default (root, "column_width", 150);
- xmlFreeDoc(doc);
- }
-#endif
-}
-
-static void
-gal_view_treeview_save (GalView *view,
- const char *filename)
-{
-#if 0
- xmlDoc *doc;
- xmlNode *root;
-
- doc = xmlNewDoc("1.0");
- root = xmlNewNode (NULL, "ETreeViewViewState");
- e_xml_set_double_prop_by_name (root, "column_width", GAL_VIEW_TREEVIEW (view)->column_width);
- xmlDocSetRootElement(doc, root);
- xmlSaveFile(filename, doc);
- xmlFreeDoc(doc);
-#endif
-}
-
-static const char *
-gal_view_treeview_get_title (GalView *view)
-{
- return GAL_VIEW_TREEVIEW(view)->title;
-}
-
-static void
-gal_view_treeview_set_title (GalView *view,
- const char *title)
-{
- g_free(GAL_VIEW_TREEVIEW(view)->title);
- GAL_VIEW_TREEVIEW(view)->title = g_strdup(title);
-}
-
-static const char *
-gal_view_treeview_get_type_code (GalView *view)
-{
- return "treeview";
-}
-
-static GalView *
-gal_view_treeview_clone (GalView *view)
-{
- GalViewTreeView *gvm, *new;
-
- gvm = GAL_VIEW_TREEVIEW(view);
-
- new = g_object_new (GAL_TYPE_VIEW_TREEVIEW, NULL);
- new->title = g_strdup (gvm->title);
-
- return GAL_VIEW(new);
-}
-
-static void
-gal_view_treeview_dispose (GObject *object)
-{
- GalViewTreeView *view = GAL_VIEW_TREEVIEW(object);
-
- if (view->title != NULL) {
- gal_view_treeview_detach (view);
- g_free(view->title);
- view->title = NULL;
- }
-
- if (G_OBJECT_CLASS (gal_view_treeview_parent_class)->dispose)
- (* G_OBJECT_CLASS (gal_view_treeview_parent_class)->dispose) (object);
-}
-
-static void
-gal_view_treeview_class_init (GObjectClass *object_class)
-{
- GalViewClass *gal_view_class = GAL_VIEW_CLASS(object_class);
- gal_view_treeview_parent_class = g_type_class_ref (PARENT_TYPE);
-
- gal_view_class->edit = gal_view_treeview_edit ;
- gal_view_class->load = gal_view_treeview_load ;
- gal_view_class->save = gal_view_treeview_save ;
- gal_view_class->get_title = gal_view_treeview_get_title ;
- gal_view_class->set_title = gal_view_treeview_set_title ;
- gal_view_class->get_type_code = gal_view_treeview_get_type_code;
- gal_view_class->clone = gal_view_treeview_clone ;
-
- object_class->dispose = gal_view_treeview_dispose ;
-}
-
-static void
-gal_view_treeview_init (GalViewTreeView *gvm)
-{
- gvm->title = NULL;
-
- gvm->tree = NULL;
-}
-
-/**
- * gal_view_treeview_new
- * @title: The name of the new view.
- *
- * Returns a new GalViewTreeView. This is primarily for use by
- * GalViewFactoryTreeView.
- *
- * Returns: The new GalViewTreeView.
- */
-GalView *
-gal_view_treeview_new (const gchar *title)
-{
- return gal_view_treeview_construct (g_object_new (GAL_TYPE_VIEW_TREEVIEW, NULL), title);
-}
-
-/**
- * gal_view_treeview_construct
- * @view: The view to construct.
- * @title: The name of the new view.
- *
- * constructs the GalViewTreeView. To be used by subclasses and
- * language bindings.
- *
- * Returns: The GalViewTreeView.
- */
-GalView *
-gal_view_treeview_construct (GalViewTreeView *view,
- const gchar *title)
-{
- view->title = g_strdup(title);
- return GAL_VIEW(view);
-}
-
-GType
-gal_view_treeview_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- static const GTypeInfo info = {
- sizeof (GalViewTreeViewClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) gal_view_treeview_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GalViewTreeView),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gal_view_treeview_init,
- };
-
- type = g_type_register_static (PARENT_TYPE, "GalViewTreeView", &info, 0);
- }
-
- return type;
-}
-
-#if 0
-static void
-column_width_changed (ETable *table, double width, GalViewMinicard *view)
-{
- d(g_print("%s: Old width = %f, New width = %f\n", G_GNUC_FUNCTION, view->column_width, width));
- if (view->column_width != width) {
- view->column_width = width;
- gal_view_changed(GAL_VIEW(view));
- }
-}
-#endif
-
-void
-gal_view_treeview_attach (GalViewTreeView *view, GtkTreeView *tree)
-{
-#if 0
- gal_view_treeview_detach (view);
-
- view->emvw = emvw;
-
- g_object_ref (view->emvw);
-
- g_object_set (view->emvw,
- "column_width", view->column_width,
- NULL);
-
- view->emvw_column_width_changed_id =
- g_signal_connect(view->emvw, "column_width_changed",
- G_CALLBACK (column_width_changed), view);
-#endif
-}
-
-void
-gal_view_treeview_detach (GalViewTreeView *view)
-{
-#if 0
- if (view->emvw == NULL)
- return;
- if (view->emvw_column_width_changed_id) {
- g_signal_handler_disconnect (view->emvw,
- view->emvw_column_width_changed_id);
- view->emvw_column_width_changed_id = 0;
- }
- g_object_unref (view->emvw);
- view->emvw = NULL;
-#endif
-}
diff --git a/addressbook/gui/widgets/gal-view-treeview.h b/addressbook/gui/widgets/gal-view-treeview.h
deleted file mode 100644
index a0313856a6..0000000000
--- a/addressbook/gui/widgets/gal-view-treeview.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-treeview.h: An TreeView View
- *
- * Authors:
- * Chris Toshok <toshok@ximian.com>
- *
- * (C) 2000, 2001 Ximian, Inc.
- */
-#ifndef _GAL_VIEW_TREEVIEW_H_
-#define _GAL_VIEW_TREEVIEW_H_
-
-#include <gal/menus/gal-view.h>
-#include <gtk/gtktreeview.h>
-
-#define GAL_TYPE_VIEW_TREEVIEW (gal_view_treeview_get_type ())
-#define GAL_VIEW_TREEVIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_TYPE_VIEW_TREEVIEW, GalViewTreeView))
-#define GAL_VIEW_TREEVIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_TYPE_VIEW_TREEVIEW, GalViewTreeViewClass))
-#define GAL_IS_VIEW_TREEVIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_TYPE_VIEW_TREEVIEW))
-#define GAL_IS_VIEW_TREEVIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_TYPE_VIEW_TREEVIEW))
-
-typedef struct {
- GalView base;
-
- char *title;
-
- GtkTreeView *tree;
-} GalViewTreeView;
-
-typedef struct {
- GalViewClass parent_class;
-} GalViewTreeViewClass;
-
-/* Standard functions */
-GType gal_view_treeview_get_type (void);
-GalView *gal_view_treeview_new (const gchar *title);
-GalView *gal_view_treeview_construct (GalViewTreeView *view,
- const gchar *title);
-void gal_view_treeview_attach (GalViewTreeView *view,
- GtkTreeView *tree);
-void gal_view_treeview_detach (GalViewTreeView *view);
-
-#endif /* _GAL_VIEW_TREEVIEW_H_ */
diff --git a/addressbook/gui/widgets/test-reflow.c b/addressbook/gui/widgets/test-reflow.c
deleted file mode 100644
index 66f003fe2c..0000000000
--- a/addressbook/gui/widgets/test-reflow.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* test-reflow.c
- *
- * Copyright (C) 2000 Ximian, Inc.
- * Author: Chris Lahey <clahey@ximian.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of 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.
- */
-
-#define TEST_VCARD \
-"BEGIN:VCARD
-" \
-"FN:Nat
-" \
-"N:Friedman;Nat;D;Mr.
-" \
-"TITLE:Head Geek
-" \
-"BDAY:1977-08-06
-" \
-"TEL;WORK:617 679 1984
-" \
-"TEL;CELL:123 456 7890
-" \
-"EMAIL;INTERNET:nat@nat.org
-" \
-"EMAIL;INTERNET:nat@ximian.com
-" \
-"ADR;WORK;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234;
-" \
-"ADR;HOME;POSTAL;INTL:P.O. Box 202;;;Any Town 2;MI;12344-4321;USA
-" \
-"END:VCARD
-" \
-"
-"
-
-
-#include "config.h"
-
-#include <gtk/gtkmain.h>
-#include <gtk/gtkvbox.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include <libgnomeui/gnome-init.h>
-#include <gal/widgets/e-canvas.h>
-#include <gal/widgets/e-reflow.h>
-#include <gal/widgets/e-scroll-frame.h>
-
-#include "e-minicard.h"
-
-/* This is a horrible thing to do, but it is just a test. */
-GnomeCanvasItem *reflow;
-GnomeCanvasItem *rect;
-GtkAllocation last_alloc;
-
-static void destroy_callback(gpointer data, GObject *where_object_was)
-{
- exit(0);
-}
-
-static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data)
-{
- double width;
- last_alloc = *allocation;
- gnome_canvas_item_set( reflow,
- "height", (double) allocation->height,
- NULL );
- gnome_canvas_item_set( reflow,
- "minimum_width", (double) allocation->width,
- NULL );
- g_object_get(reflow,
- "width", &width,
- NULL);
- width = MAX(width, allocation->width);
- gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, width - 1, allocation->height - 1);
- gnome_canvas_item_set( rect,
- "x2", (double) width,
- "y2", (double) allocation->height,
- NULL );
-}
-
-static void resize(GnomeCanvas *canvas, gpointer data)
-{
- double width;
- g_object_get(reflow,
- "width", &width,
- NULL);
- width = MAX(width, last_alloc.width);
- gnome_canvas_set_scroll_region(canvas , 0, 0, width - 1, last_alloc.height - 1);
- gnome_canvas_item_set( rect,
- "x2", (double) width,
- "y2", (double) last_alloc.height,
- NULL );
-}
-
-#if 0
-static void about_callback( GtkWidget *widget, gpointer data )
-{
-
- const gchar *authors[] =
- {
- "Christopher James Lahey <clahey@umich.edu>",
- NULL
- };
-
- GtkWidget *about =
- gnome_about_new ( _( "Reflow Test" ), VERSION,
- _( "Copyright (C) 2000, Ximian, Inc." ),
- authors,
- _( "This should test the reflow canvas item" ),
- NULL);
- gtk_widget_show (about);
-}
-#endif
-
-int main( int argc, char *argv[] )
-{
- GtkWidget *app;
- GtkWidget *canvas;
- GtkWidget *vbox;
- GtkWidget *scrollframe;
- int i;
-
- /* bindtextdomain (PACKAGE, GNOMELOCALEDIR);
- textdomain (PACKAGE);*/
-
- gnome_init( "Reflow Test", VERSION, argc, argv);
- app = gnome_app_new("Reflow Test", NULL);
-
- vbox = gtk_vbox_new(FALSE, 0);
-
- canvas = e_canvas_new();
- rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) 100,
- "y2", (double) 100,
- "fill_color", "white",
- NULL );
- reflow = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ),
- e_reflow_get_type(),
- "height", (double) 100,
- "minimum_width", (double) 100,
- NULL );
- g_signal_connect( canvas, "reflow",
- G_CALLBACK ( resize ),
- ( gpointer ) app);
- for ( i = 0; i < 200; i++ )
- {
- GnomeCanvasItem *item;
- ECard *card = e_card_new (TEST_VCARD);
- item = gnome_canvas_item_new( GNOME_CANVAS_GROUP(reflow),
- e_minicard_get_type(),
- "card", card,
- NULL);
- e_reflow_add_item(E_REFLOW(reflow), item, NULL);
- }
- gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ),
- 0, 0,
- 100, 100 );
-
- scrollframe = e_scroll_frame_new (gtk_layout_get_hadjustment(GTK_LAYOUT(canvas)),
- gtk_layout_get_vadjustment(GTK_LAYOUT(canvas)));
- e_scroll_frame_set_policy (E_SCROLL_FRAME (scrollframe),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_NEVER);
-
- gtk_container_add (GTK_CONTAINER (scrollframe), canvas);
-
- gnome_app_set_contents( GNOME_APP( app ), scrollframe );
-
- /* Connect the signals */
- g_object_weak_ref (app, destroy_callback, app);
-
- g_signal_connect( canvas, "size_allocate",
- G_CALLBACK ( allocate_callback ),
- ( gpointer ) app );
-
- gtk_widget_show_all( app );
- gdk_window_set_back_pixmap( GTK_LAYOUT(canvas)->bin_window, NULL, FALSE);
-
- gtk_main();
-
- /* Not reached. */
- return 0;
-}