aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/Makefile.am2
-rw-r--r--addressbook/gui/component/Makefile.am1
-rw-r--r--addressbook/gui/minicard/Makefile.am119
-rw-r--r--addressbook/gui/minicard/e-minicard-control.c331
-rw-r--r--addressbook/gui/minicard/e-minicard-control.h8
-rw-r--r--addressbook/gui/minicard/e-minicard-label.c444
-rw-r--r--addressbook/gui/minicard/e-minicard-label.h83
-rw-r--r--addressbook/gui/minicard/e-minicard-view-widget.c267
-rw-r--r--addressbook/gui/minicard/e-minicard-view-widget.h73
-rw-r--r--addressbook/gui/minicard/e-minicard-view.c432
-rw-r--r--addressbook/gui/minicard/e-minicard-view.h95
-rw-r--r--addressbook/gui/minicard/e-minicard-widget-test.c113
-rw-r--r--addressbook/gui/minicard/e-minicard-widget.c236
-rw-r--r--addressbook/gui/minicard/e-minicard-widget.h76
-rw-r--r--addressbook/gui/minicard/e-minicard.c797
-rw-r--r--addressbook/gui/minicard/e-minicard.h98
-rw-r--r--addressbook/gui/minicard/e-reflow-sorted.c272
-rw-r--r--addressbook/gui/minicard/e-reflow-sorted.h90
-rw-r--r--addressbook/gui/minicard/e-reflow.c859
-rw-r--r--addressbook/gui/minicard/e-reflow.h112
-rw-r--r--addressbook/gui/minicard/test-minicard-label.c126
-rw-r--r--addressbook/gui/minicard/test-minicard-view.c206
-rw-r--r--addressbook/gui/minicard/test-minicard.c115
-rw-r--r--addressbook/gui/minicard/test-reflow.c194
-rw-r--r--addressbook/gui/widgets/.cvsignore (renamed from addressbook/gui/minicard/.cvsignore)0
-rw-r--r--addressbook/gui/widgets/Makefile.am10
26 files changed, 7 insertions, 5152 deletions
diff --git a/addressbook/gui/Makefile.am b/addressbook/gui/Makefile.am
index a9fdef3273..cd8fe38705 100644
--- a/addressbook/gui/Makefile.am
+++ b/addressbook/gui/Makefile.am
@@ -1 +1 @@
-SUBDIRS = minicard search component \ No newline at end of file
+SUBDIRS = widgets search component
diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am
index 0e28fc57db..f420c6dc5d 100644
--- a/addressbook/gui/component/Makefile.am
+++ b/addressbook/gui/component/Makefile.am
@@ -53,6 +53,7 @@ evolution_addressbook_LDADD = \
$(top_builddir)/addressbook/ename/libename.la \
$(top_builddir)/addressbook/contact-editor/libecontacteditor.a \
$(top_builddir)/libversit/libversit.la \
+ $(top_builddir)/widgets/e-reflow/libereflow.a \
$(top_builddir)/widgets/e-text/libetext.a \
$(top_builddir)/widgets/e-table/libetable.a \
$(top_builddir)/widgets/misc/libemiscwidgets.a \
diff --git a/addressbook/gui/minicard/Makefile.am b/addressbook/gui/minicard/Makefile.am
deleted file mode 100644
index 9c1e459fd7..0000000000
--- a/addressbook/gui/minicard/Makefile.am
+++ /dev/null
@@ -1,119 +0,0 @@
-INCLUDES = \
- -DG_LOG_DOMAIN=\"e-minicard\" \
- -I$(top_srcdir) \
- -I$(top_srcdir)/addressbook/backend \
- -I$(top_builddir)/addressbook/backend \
- -I$(top_srcdir)/addressbook/contact-editor \
- -I$(top_srcdir)/widgets/e-text \
- -I$(top_srcdir)/widgets/misc \
- $(BONOBO_GNOME_CFLAGS)
-
-noinst_LIBRARIES = \
- libeminicard.a
-
-libeminicard_a_SOURCES = \
- e-minicard-control.c \
- e-minicard-control.h \
- e-minicard-label.c \
- e-minicard-label.h \
- e-minicard-view-widget.c \
- e-minicard-view-widget.h \
- e-minicard-view.c \
- e-minicard-view.h \
- e-minicard-widget.c \
- e-minicard-widget.h \
- e-minicard.c \
- e-minicard.h \
- e-reflow-sorted.c \
- e-reflow-sorted.h \
- e-reflow.c \
- e-reflow.h
-
-noinst_PROGRAMS = \
- minicard-widget-test \
- minicard-label-test \
- minicard-test \
- reflow-test
-# minicard-view-test
-
-minicard_label_test_SOURCES = \
- test-minicard-label.c
-
-minicard_label_test_LDADD = \
- $(EXTRA_GNOME_LIBS) \
- libeminicard.a \
- $(BONOBO_GNOME_LIBS) \
- $(top_builddir)/widgets/e-text/libetext.a \
- $(top_builddir)/e-util/libeutil.la
-
-minicard_test_SOURCES = \
- test-minicard.c
-
-minicard_test_LDADD = \
- $(EXTRA_GNOME_LIBS) \
- libeminicard.a \
- $(BONOBO_GNOME_LIBS) \
- $(top_builddir)/addressbook/backend/ebook/libebook.la \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/libversit/libversit.la \
- $(top_builddir)/addressbook/ename/libename.la \
- $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \
- $(top_builddir)/addressbook/printing/libecontactprint.a \
- $(top_builddir)/widgets/e-table/libetable.a \
- $(top_builddir)/widgets/misc/libemiscwidgets.a \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/widgets/e-text/libetext.a
-
-reflow_test_SOURCES = \
- test-reflow.c
-
-reflow_test_LDADD = \
- $(EXTRA_GNOME_LIBS) \
- $(BONOBO_GNOME_LIBS) \
- libeminicard.a \
- $(top_builddir)/addressbook/backend/ebook/libebook.la \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/libversit/libversit.la \
- $(top_builddir)/addressbook/ename/libename.la \
- $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \
- $(top_builddir)/addressbook/printing/libecontactprint.a \
- $(top_builddir)/widgets/e-table/libetable.a \
- $(top_builddir)/widgets/misc/libemiscwidgets.a \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/widgets/e-text/libetext.a
-
-#minicard_view_test_SOURCES = \
-# test-minicard-view.c
-
-#minicard_view_test_LDADD = \
-# $(EXTRA_GNOME_LIBS) \
-# $(BONOBO_GNOME_LIBS) \
-# libeminicard.a \
-# $(top_builddir)/addressbook/backend/ebook/libebook.la \
-# $(top_builddir)/e-util/libeutil.la \
-# $(top_builddir)/libversit/libversit.la \
-# $(top_builddir)/addressbook/ename/libename.la \
-# $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \
-# $(top_builddir)/addressbook/printing/libecontactprint.a \
-# $(top_builddir)/widgets/e-table/libetable.a \
-# $(top_builddir)/widgets/misc/libemiscwidgets.a \
-# $(top_builddir)/e-util/libeutil.la \
-# $(top_builddir)/widgets/e-text/libetext.a
-
-minicard_widget_test_SOURCES = \
- e-minicard-widget-test.c
-
-minicard_widget_test_LDADD = \
- $(EXTRA_GNOME_LIBS) \
- $(BONOBO_GNOME_LIBS) \
- libeminicard.a \
- $(top_builddir)/addressbook/backend/ebook/libebook.la \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/libversit/libversit.la \
- $(top_builddir)/addressbook/ename/libename.la \
- $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \
- $(top_builddir)/addressbook/printing/libecontactprint.a \
- $(top_builddir)/widgets/e-table/libetable.a \
- $(top_builddir)/widgets/misc/libemiscwidgets.a \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/widgets/e-text/libetext.a
diff --git a/addressbook/gui/minicard/e-minicard-control.c b/addressbook/gui/minicard/e-minicard-control.c
deleted file mode 100644
index a5d2038a8a..0000000000
--- a/addressbook/gui/minicard/e-minicard-control.c
+++ /dev/null
@@ -1,331 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-minicard-control.c
- *
- * Authors:
- * Chris Lahey <clahey@helixcode.com>
- *
- * Copyright 1999, 2000, Helix Code, Inc.
- */
-
-#include <config.h>
-#include <gnome.h>
-#include <bonobo.h>
-
-#include "addressbook/backend/ebook/e-book.h"
-
-#include "e-minicard-control.h"
-#include "e-minicard-widget.h"
-#include "addressbook/backend/ebook/e-card.h"
-
-#if 0
-enum {
- PROP_RUNNING
-} MyArgs;
-
-#define RUNNING_KEY "Clock::Running"
-
-static void
-get_prop (BonoboPropertyBag *bag,
- BonoboArg *arg,
- guint arg_id,
- gpointer user_data)
-{
- GtkObject *clock = user_data;
-
- switch (arg_id) {
-
- case PROP_RUNNING:
- {
- gboolean b = GPOINTER_TO_UINT (gtk_object_get_data (clock, RUNNING_KEY));
- BONOBO_ARG_SET_BOOLEAN (arg, b);
- break;
- }
-
- default:
- g_warning ("Unhandled arg %d", arg_id);
- break;
- }
-}
-
-static void
-set_prop (BonoboPropertyBag *bag,
- const BonoboArg *arg,
- guint arg_id,
- gpointer user_data)
-{
- GtkClock *clock = user_data;
-
- switch (arg_id) {
-
- case PROP_RUNNING:
- {
- guint i;
-
- i = BONOBO_ARG_GET_BOOLEAN (arg);
-
- if (i)
- gtk_clock_start (clock);
- else
- gtk_clock_stop (clock);
-
- gtk_object_set_data (GTK_OBJECT (clock), RUNNING_KEY,
- GUINT_TO_POINTER (i));
- break;
- }
-
- default:
- g_warning ("Unhandled arg %d", arg_id);
- break;
- }
-}
-#endif
-
-/*
- * Bonobo::PersistStream
- *
- * These two functions implement the Bonobo::PersistStream load and
- * save methods which allow data to be loaded into and out of the
- * BonoboObject.
- */
-static char *
-stream_read (Bonobo_Stream stream)
-{
- Bonobo_Stream_iobuf *buffer;
- CORBA_Environment ev;
- char *data = NULL;
- gint length = 0;
-
- CORBA_exception_init (&ev);
- do {
-#define READ_CHUNK_SIZE 65536
- Bonobo_Stream_read (stream, READ_CHUNK_SIZE,
- &buffer, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- CORBA_exception_free (&ev);
- return NULL;
- }
-
- if (buffer->_length <= 0)
- break;
-
- data = g_realloc (data,
- length + buffer->_length);
-
- memcpy (data + length,
- buffer->_buffer, buffer->_length);
-
- length += buffer->_length;
-
- CORBA_free (buffer);
- } while (1);
-
- CORBA_free (buffer);
- CORBA_exception_free (&ev);
-
- if (data == NULL)
- data = g_strdup("");
-
- return data;
-} /* stream_read */
-
-/*
- * This function implements the Bonobo::PersistStream:load method.
- */
-static void
-pstream_load (BonoboPersistStream *ps, const Bonobo_Stream stream,
- Bonobo_Persist_ContentType type, void *data,
- CORBA_Environment *ev)
-{
- ECard *card;
- char *vcard;
- GtkWidget *minicard = data;
-
- if (type && g_strcasecmp (type, "text/vCard") != 0 &&
- g_strcasecmp (type, "text/x-vCard") != 0) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_Bonobo_Persist_WrongDataType, NULL);
- return;
- }
-
- if ((vcard = stream_read (stream)) == NULL) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_Bonobo_Persist_FileNotFound, NULL);
- return;
- }
-
- card = e_card_new(vcard);
- g_free(vcard);
- gtk_object_set(GTK_OBJECT(minicard),
- "card", card,
- NULL);
- gtk_object_unref(GTK_OBJECT(card));
-} /* pstream_load */
-
-/*
- * This function implements the Bonobo::PersistStream:save method.
- */
-static void
-pstream_save (BonoboPersistStream *ps, const Bonobo_Stream stream,
- Bonobo_Persist_ContentType type, void *data,
- CORBA_Environment *ev)
-{
- char *vcard;
- ECard *card;
- EMinicardWidget *minicard = data;
- int length;
-
- if (type && g_strcasecmp (type, "text/vCard") != 0 &&
- g_strcasecmp (type, "text/x-vCard") != 0) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_Bonobo_Persist_WrongDataType, NULL);
- return;
- }
-
- gtk_object_get (GTK_OBJECT (minicard),
- "card", &card,
- NULL);
- vcard = e_card_get_vcard(card);
- length = strlen (vcard);
- bonobo_stream_client_write (stream, vcard, length, ev);
- g_free (vcard);
-} /* pstream_save */
-
-static CORBA_long
-pstream_get_max_size (BonoboPersistStream *ps, void *data,
- CORBA_Environment *ev)
-{
- GtkWidget *minicard = data;
- ECard *card;
- char *vcard;
- gint length;
-
- gtk_object_get (GTK_OBJECT (minicard),
- "card", &card, NULL);
- vcard = e_card_get_vcard(card);
- length = strlen (vcard);
- g_free (vcard);
-
- return length;
-}
-
-static Bonobo_Persist_ContentTypeList *
-pstream_get_content_types (BonoboPersistStream *ps, void *closure,
- CORBA_Environment *ev)
-{
- return bonobo_persist_generate_content_types (2, "text/vCard", "text/x-vCard");
-}
-
-static void
-book_open_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- ECard *card = closure;
- e_book_add_card(book, card, NULL, NULL);
- gtk_object_unref(GTK_OBJECT(card));
-}
-
-static void
-save_in_addressbook(GtkWidget *button, EMinicardWidget *minicard)
-{
- EBook *book;
- gchar *path, *uri;
- ECard *card;
-
- book = e_book_new ();
-
- if (!book) {
- printf ("%s: %s(): Couldn't create EBook, bailing.\n",
- __FILE__,
- __FUNCTION__);
- return;
- }
-
-
- path = g_concat_dir_and_file (g_get_home_dir (),
- "evolution/local/Contacts/addressbook.db");
- uri = g_strdup_printf ("file://%s", path);
- g_free (path);
-
- gtk_object_get(GTK_OBJECT(minicard),
- "card", &card,
- NULL);
- gtk_object_ref(GTK_OBJECT(card));
-
- if (! e_book_load_uri (book, uri, book_open_cb, card)) {
- printf ("error calling load_uri!\n");
- }
- g_free(uri);
-}
-
-static BonoboObject *
-e_minicard_control_factory (BonoboGenericFactory *Factory, void *closure)
-{
-#if 0
- BonoboPropertyBag *pb;
-#endif
- BonoboControl *control;
- BonoboPersistStream *stream;
- GtkWidget *minicard;
- GtkWidget *button;
- GtkWidget *vbox;
-
- /* Create the control. */
-
- minicard = e_minicard_widget_new ();
- gtk_widget_show (minicard);
-
- button = gtk_button_new_with_label(_("Save in addressbook"));
- gtk_signal_connect(GTK_OBJECT(button), "clicked",
- GTK_SIGNAL_FUNC(save_in_addressbook), minicard);
- gtk_widget_show (button);
-
- vbox = gtk_vbox_new(FALSE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), minicard, TRUE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
- gtk_widget_show (vbox);
-
- control = bonobo_control_new (vbox);
-
- stream = bonobo_persist_stream_new (pstream_load, pstream_save,
- pstream_get_max_size,
- pstream_get_content_types,
- minicard);
-
-#if 0
- /* Create the properties. */
- pb = bonobo_property_bag_new (get_prop, set_prop, clock);
- bonobo_control_set_property_bag (control, pb);
-
- bonobo_property_bag_add (pb, "running", PROP_RUNNING,
- BONOBO_ARG_BOOLEAN, NULL,
- "Whether or not the clock is running", 0);
-#endif
-
- if (stream == NULL) {
- bonobo_object_unref (BONOBO_OBJECT (control));
- return NULL;
- }
-
- bonobo_object_add_interface (BONOBO_OBJECT (control),
- BONOBO_OBJECT (stream));
-
- return BONOBO_OBJECT (control);
-}
-
-void
-e_minicard_control_factory_init (void)
-{
- static BonoboGenericFactory *factory = NULL;
-
- if (factory != NULL)
- return;
-
- factory =
- bonobo_generic_factory_new (
- "OAFIID:control-factory:e_minicard:16bb7c25-c7d2-46dc-a5f0-a0975d0e0595",
- e_minicard_control_factory, NULL);
-
- if (factory == NULL)
- g_error ("I could not register a EMinicard control factory.");
-}
diff --git a/addressbook/gui/minicard/e-minicard-control.h b/addressbook/gui/minicard/e-minicard-control.h
deleted file mode 100644
index 4a0da88435..0000000000
--- a/addressbook/gui/minicard/e-minicard-control.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef __E_MINICARD_CONTROL_H__
-#define __E_MINICARD_CONTROL_H__
-
-#include <bonobo/bonobo-control.h>
-
-void e_minicard_control_factory_init (void);
-
-#endif /* __E_MINICARD_CONTROL_H__ */
diff --git a/addressbook/gui/minicard/e-minicard-label.c b/addressbook/gui/minicard/e-minicard-label.c
deleted file mode 100644
index c0f45f67c9..0000000000
--- a/addressbook/gui/minicard/e-minicard-label.c
+++ /dev/null
@@ -1,444 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-minicard-label.c
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <gnome.h>
-#include "e-minicard-label.h"
-#include "e-text.h"
-#include <e-util/e-canvas.h>
-#include <e-util/e-util.h>
-#include <e-util/e-canvas-utils.h>
-
-static void e_minicard_label_init (EMinicardLabel *card);
-static void e_minicard_label_class_init (EMinicardLabelClass *klass);
-static void e_minicard_label_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static gboolean e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event);
-static void e_minicard_label_realize (GnomeCanvasItem *item);
-static void e_minicard_label_unrealize (GnomeCanvasItem *item);
-static void e_minicard_label_reflow(GnomeCanvasItem *item, int flags);
-
-static void e_minicard_label_resize_children( EMinicardLabel *e_minicard_label );
-
-static GnomeCanvasGroupClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_WIDTH,
- ARG_HEIGHT,
- ARG_HAS_FOCUS,
- ARG_FIELD,
- ARG_FIELDNAME,
- ARG_TEXT_MODEL,
- ARG_MAX_FIELD_NAME_WIDTH,
-};
-
-GtkType
-e_minicard_label_get_type (void)
-{
- static GtkType minicard_label_type = 0;
-
- if (!minicard_label_type)
- {
- static const GtkTypeInfo minicard_label_info =
- {
- "EMinicardLabel",
- sizeof (EMinicardLabel),
- sizeof (EMinicardLabelClass),
- (GtkClassInitFunc) e_minicard_label_class_init,
- (GtkObjectInitFunc) e_minicard_label_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- minicard_label_type = gtk_type_unique (gnome_canvas_group_get_type (), &minicard_label_info);
- }
-
- return minicard_label_type;
-}
-
-static void
-e_minicard_label_class_init (EMinicardLabelClass *klass)
-{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- object_class = (GtkObjectClass*) klass;
- item_class = (GnomeCanvasItemClass *) klass;
-
- parent_class = gtk_type_class (gnome_canvas_group_get_type ());
-
- gtk_object_add_arg_type ("EMinicardLabel::width", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_WIDTH);
- gtk_object_add_arg_type ("EMinicardLabel::height", GTK_TYPE_DOUBLE,
- GTK_ARG_READABLE, ARG_HEIGHT);
- gtk_object_add_arg_type ("EMinicardLabel::has_focus", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_HAS_FOCUS);
- gtk_object_add_arg_type ("EMinicardLabel::field", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_FIELD);
- gtk_object_add_arg_type ("EMinicardLabel::fieldname", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_FIELDNAME);
- gtk_object_add_arg_type ("EMinicardLabel::text_model", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_TEXT_MODEL);
- gtk_object_add_arg_type ("EMinicardLabel::max_field_name_length", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_MAX_FIELD_NAME_WIDTH);
-
- object_class->set_arg = e_minicard_label_set_arg;
- object_class->get_arg = e_minicard_label_get_arg;
- /* object_class->destroy = e_minicard_label_destroy; */
-
- /* GnomeCanvasItem method overrides */
- item_class->realize = e_minicard_label_realize;
- item_class->unrealize = e_minicard_label_unrealize;
- item_class->event = e_minicard_label_event;
-}
-
-static void
-e_minicard_label_init (EMinicardLabel *minicard_label)
-{
- minicard_label->width = 10;
- minicard_label->height = 10;
- minicard_label->rect = NULL;
- minicard_label->fieldname = NULL;
- minicard_label->field = NULL;
-
- minicard_label->max_field_name_length = -1;
-
- e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(minicard_label), e_minicard_label_reflow);
-}
-
-static void
-e_minicard_label_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- EMinicardLabel *e_minicard_label;
-
- item = GNOME_CANVAS_ITEM (o);
- e_minicard_label = E_MINICARD_LABEL (o);
-
- switch (arg_id){
- case ARG_WIDTH:
- e_minicard_label->width = GTK_VALUE_DOUBLE (*arg);
- e_minicard_label_resize_children(e_minicard_label);
- e_canvas_item_request_reflow (item);
- break;
- case ARG_HAS_FOCUS:
- if (e_minicard_label->field && (GTK_VALUE_ENUM(*arg) != E_FOCUS_NONE))
- e_canvas_item_grab_focus(e_minicard_label->field);
- break;
- case ARG_FIELD:
- gnome_canvas_item_set( e_minicard_label->field, "text", GTK_VALUE_STRING (*arg), NULL );
- break;
- case ARG_FIELDNAME:
- gnome_canvas_item_set( e_minicard_label->fieldname, "text", GTK_VALUE_STRING (*arg), NULL );
- break;
- case ARG_TEXT_MODEL:
- gnome_canvas_item_set( e_minicard_label->field, "model", GTK_VALUE_OBJECT (*arg), NULL);
- break;
- case ARG_MAX_FIELD_NAME_WIDTH:
- e_minicard_label->max_field_name_length = GTK_VALUE_DOUBLE (*arg);
- break;
- }
-}
-
-static void
-e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EMinicardLabel *e_minicard_label;
- char *temp;
- ETextModel *tempmodel;
-
- e_minicard_label = E_MINICARD_LABEL (object);
-
- switch (arg_id) {
- case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = e_minicard_label->width;
- break;
- case ARG_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = e_minicard_label->height;
- break;
- case ARG_HAS_FOCUS:
- GTK_VALUE_ENUM (*arg) = e_minicard_label->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE;
- break;
- case ARG_FIELD:
- gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "text", &temp, NULL );
- GTK_VALUE_STRING (*arg) = temp;
- break;
- case ARG_FIELDNAME:
- gtk_object_get( GTK_OBJECT( e_minicard_label->fieldname ), "text", &temp, NULL );
- GTK_VALUE_STRING (*arg) = temp;
- break;
- case ARG_TEXT_MODEL:
- gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "model", &tempmodel, NULL );
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(tempmodel);
- break;
- case ARG_MAX_FIELD_NAME_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = e_minicard_label->max_field_name_length;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-e_minicard_label_realize (GnomeCanvasItem *item)
-{
- if (GNOME_CANVAS_ITEM_CLASS( parent_class )->realize)
- (* GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) (item);
-
- e_canvas_item_request_reflow(item);
-
- if (!item->canvas->aa)
- {
- }
-}
-
-void
-e_minicard_label_construct (GnomeCanvasItem *item)
-{
- EMinicardLabel *e_minicard_label;
- GnomeCanvasGroup *group;
- GdkFont *font;
-
- font = ((GtkWidget *) item->canvas)->style->font;
-
- e_minicard_label = E_MINICARD_LABEL (item);
- group = GNOME_CANVAS_GROUP( item );
-
- e_minicard_label->rect =
- gnome_canvas_item_new( group,
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) e_minicard_label->width - 1,
- "y2", (double) e_minicard_label->height - 1,
- "outline_color", NULL,
- NULL );
- e_minicard_label->fieldname =
- gnome_canvas_item_new( group,
- e_text_get_type(),
- "anchor", GTK_ANCHOR_NW,
- "clip_width", (double) ( e_minicard_label->width / 2 - 4 ),
- "clip", TRUE,
- "use_ellipsis", TRUE,
- "font_gdk", font,
- "fill_color", "black",
- NULL );
- e_canvas_item_move_absolute(e_minicard_label->fieldname, 2, 1);
-
- e_minicard_label->field =
- gnome_canvas_item_new( group,
- e_text_get_type(),
- "anchor", GTK_ANCHOR_NW,
- "clip_width", (double) ( ( e_minicard_label->width + 1 ) / 2 - 4 ),
- "clip", TRUE,
- "use_ellipsis", TRUE,
- "font_gdk", font,
- "fill_color", "black",
- "editable", TRUE,
- NULL );
- e_canvas_item_move_absolute(e_minicard_label->field, ( e_minicard_label->width / 2 + 2), 1);
-
- e_canvas_item_request_reflow(item);
-}
-
-static void
-e_minicard_label_unrealize (GnomeCanvasItem *item)
-{
- EMinicardLabel *e_minicard_label;
-
- e_minicard_label = E_MINICARD_LABEL (item);
-
- if (!item->canvas->aa)
- {
- }
-
- if (GNOME_CANVAS_ITEM_CLASS( parent_class )->unrealize)
- (* GNOME_CANVAS_ITEM_CLASS( parent_class )->unrealize) (item);
-}
-
-static gboolean
-e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- EMinicardLabel *e_minicard_label;
-
- e_minicard_label = E_MINICARD_LABEL (item);
-
- switch( event->type )
- {
- case GDK_FOCUS_CHANGE:
- {
- GdkEventFocus *focus_event = (GdkEventFocus *) event;
- if ( focus_event->in )
- {
- gnome_canvas_item_set( e_minicard_label->rect,
- "outline_color", "grey50",
- "fill_color", "grey90",
- NULL );
- e_minicard_label->has_focus = TRUE;
- }
- else
- {
- gnome_canvas_item_set( e_minicard_label->rect,
- "outline_color", NULL,
- "fill_color", NULL,
- NULL );
- e_minicard_label->has_focus = FALSE;
- }
- }
- break;
- case GDK_BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- case GDK_MOTION_NOTIFY:
- case GDK_ENTER_NOTIFY:
- case GDK_LEAVE_NOTIFY: {
- gboolean return_val;
-#if 0
- GnomeCanvasItem *field;
- ArtPoint p;
- double inv[6], affine[6];
-
- field = e_minicard_label->field;
- art_affine_identity (affine);
-
- if (field->xform != NULL) {
- if (field->object.flags & GNOME_CANVAS_ITEM_AFFINE_FULL) {
- art_affine_multiply (affine, affine, field->xform);
- } else {
- affine[4] += field->xform[0];
- affine[5] += field->xform[1];
- }
- }
-
- art_affine_invert (inv, affine);
- switch(event->type) {
- case GDK_MOTION_NOTIFY:
- p.x = event->motion.x;
- p.y = event->motion.y;
- art_affine_point (&p, &p, inv);
- event->motion.x = p.x;
- event->motion.y = p.y;
- break;
- case GDK_BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- p.x = event->button.x;
- p.y = event->button.y;
- art_affine_point (&p, &p, inv);
- event->button.x = p.x;
- event->button.y = p.y;
- break;
- case GDK_ENTER_NOTIFY:
- case GDK_LEAVE_NOTIFY:
- p.x = event->crossing.x;
- p.y = event->crossing.y;
- art_affine_point (&p, &p, inv);
- event->crossing.x = p.x;
- event->crossing.y = p.y;
- break;
- default:
- break;
- }
-#endif
- gtk_signal_emit_by_name(GTK_OBJECT(e_minicard_label->field), "event", event, &return_val);
- return return_val;
- break;
- }
- default:
- break;
- }
-
- if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event)
- return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event);
- else
- return 0;
-}
-
-static void
-e_minicard_label_resize_children(EMinicardLabel *e_minicard_label)
-{
- double left_width;
- if (e_minicard_label->max_field_name_length != -1 && ((e_minicard_label->width / 2) - 4 > e_minicard_label->max_field_name_length))
- left_width = e_minicard_label->max_field_name_length;
- else
- left_width = e_minicard_label->width / 2 - 4;
-
- gnome_canvas_item_set( e_minicard_label->fieldname,
- "clip_width", (double) ( left_width ),
- NULL );
- gnome_canvas_item_set( e_minicard_label->field,
- "clip_width", (double) ( e_minicard_label->width - 8 - left_width ),
- NULL );
-}
-
-static void
-e_minicard_label_reflow(GnomeCanvasItem *item, int flags)
-{
- EMinicardLabel *e_minicard_label = E_MINICARD_LABEL(item);
-
- gint old_height;
- gdouble text_height;
- gdouble left_width;
-
- old_height = e_minicard_label->height;
-
- gtk_object_get(GTK_OBJECT(e_minicard_label->fieldname),
- "text_height", &text_height,
- NULL);
-
- e_minicard_label->height = text_height;
-
-
- gtk_object_get(GTK_OBJECT(e_minicard_label->field),
- "text_height", &text_height,
- NULL);
-
- if (e_minicard_label->height < text_height)
- e_minicard_label->height = text_height;
- e_minicard_label->height += 3;
-
- gnome_canvas_item_set( e_minicard_label->rect,
- "x2", (double) e_minicard_label->width - 1,
- "y2", (double) e_minicard_label->height - 1,
- NULL );
-
- if (e_minicard_label->max_field_name_length != -1 && ((e_minicard_label->width / 2) - 4 > e_minicard_label->max_field_name_length))
- left_width = e_minicard_label->max_field_name_length;
- else
- left_width = e_minicard_label->width / 2 - 4;
-
- e_canvas_item_move_absolute(e_minicard_label->field, left_width + 6, 1);
-
- if (old_height != e_minicard_label->height)
- e_canvas_item_request_parent_reflow(item);
-}
-
-GnomeCanvasItem *
-e_minicard_label_new(GnomeCanvasGroup *parent)
-{
- GnomeCanvasItem *item = gnome_canvas_item_new(parent, e_minicard_label_get_type(), NULL);
- e_minicard_label_construct(item);
- return item;
-}
-
diff --git a/addressbook/gui/minicard/e-minicard-label.h b/addressbook/gui/minicard/e-minicard-label.h
deleted file mode 100644
index 08eb51ee53..0000000000
--- a/addressbook/gui/minicard/e-minicard-label.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-minicard-label.h
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifndef __E_MINICARD_LABEL_H__
-#define __E_MINICARD_LABEL_H__
-
-#include <gnome.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* EMinicardLabel - A label doing focus with non-marching ants.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- * width double RW width of the label
- * height double R height of the label
- * field string RW text in the field label
- * fieldname string RW text in the fieldname label
- */
-
-#define E_MINICARD_LABEL_TYPE (e_minicard_label_get_type ())
-#define E_MINICARD_LABEL(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_LABEL_TYPE, EMinicardLabel))
-#define E_MINICARD_LABEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_LABEL_TYPE, EMiniCardLabelClass))
-#define E_IS_MINICARD_LABEL(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_LABEL_TYPE))
-#define E_IS_MINICARD_LABEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_LABEL_TYPE))
-
-
-typedef struct _EMinicardLabel EMinicardLabel;
-typedef struct _EMinicardLabelClass EMinicardLabelClass;
-
-struct _EMinicardLabel
-{
- GnomeCanvasGroup parent;
-
- /* item specific fields */
- double width;
- double height;
- double max_field_name_length;
- GnomeCanvasItem *fieldname;
- GnomeCanvasItem *field;
- GnomeCanvasItem *rect;
-
- gboolean has_focus;
-};
-
-struct _EMinicardLabelClass
-{
- GnomeCanvasGroupClass parent_class;
-};
-
-
-GtkType e_minicard_label_get_type (void);
-GnomeCanvasItem *e_minicard_label_new(GnomeCanvasGroup *parent);
-void e_minicard_label_construct (GnomeCanvasItem *item);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_MINICARD_LABEL_H__ */
diff --git a/addressbook/gui/minicard/e-minicard-view-widget.c b/addressbook/gui/minicard/e-minicard-view-widget.c
deleted file mode 100644
index cd1a999f14..0000000000
--- a/addressbook/gui/minicard/e-minicard-view-widget.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-minicard-view-widget.c
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <gnome.h>
-#include <e-util/e-canvas.h>
-#include "e-minicard-view-widget.h"
-static void e_minicard_view_widget_init (EMinicardViewWidget *widget);
-static void e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass);
-static void e_minicard_view_widget_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_minicard_view_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_minicard_view_widget_destroy (GtkObject *object);
-static void e_minicard_view_widget_reflow (ECanvas *canvas);
-static void e_minicard_view_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
-static void e_minicard_view_widget_realize (GtkWidget *widget);
-
-static ECanvasClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_BOOK,
- ARG_QUERY
-};
-
-GtkType
-e_minicard_view_widget_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type)
- {
- static const GtkTypeInfo info =
- {
- "EMinicardViewWidget",
- sizeof (EMinicardViewWidget),
- sizeof (EMinicardViewWidgetClass),
- (GtkClassInitFunc) e_minicard_view_widget_class_init,
- (GtkObjectInitFunc) e_minicard_view_widget_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (e_canvas_get_type (), &info);
- }
-
- return type;
-}
-
-static void
-e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- ECanvasClass *canvas_class;
-
- object_class = (GtkObjectClass*) klass;
- widget_class = GTK_WIDGET_CLASS (klass);
- canvas_class = E_CANVAS_CLASS (klass);
-
- parent_class = gtk_type_class (e_canvas_get_type ());
-
- gtk_object_add_arg_type ("EMinicardViewWidget::book", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_BOOK);
- gtk_object_add_arg_type ("EMinicardViewWidget::query", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_QUERY);
-
- object_class->set_arg = e_minicard_view_widget_set_arg;
- object_class->get_arg = e_minicard_view_widget_get_arg;
- object_class->destroy = e_minicard_view_widget_destroy;
-
- widget_class->realize = e_minicard_view_widget_realize;
- widget_class->size_allocate = e_minicard_view_widget_size_allocate;
-
- canvas_class->reflow = e_minicard_view_widget_reflow;
-}
-
-static void
-e_minicard_view_widget_init (EMinicardViewWidget *view)
-{
- view->emv = NULL;
- view->rect = NULL;
-
- view->book = NULL;
- view->query = NULL;
-}
-
-GtkWidget *
-e_minicard_view_widget_new (void)
-{
- return GTK_WIDGET (gtk_type_new (e_minicard_view_widget_get_type ()));
-}
-
-static void
-e_minicard_view_widget_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- EMinicardViewWidget *emvw;
-
- emvw = E_MINICARD_VIEW_WIDGET (o);
-
- switch (arg_id){
- case ARG_BOOK:
- if (emvw->book)
- gtk_object_unref(GTK_OBJECT(emvw->book));
- emvw->book = E_BOOK(GTK_VALUE_OBJECT (*arg));
- if (emvw->book)
- gtk_object_ref(GTK_OBJECT(emvw->book));
- if (emvw->emv)
- gtk_object_set(GTK_OBJECT(emvw->emv),
- "book", emvw->book,
- NULL);
- break;
- case ARG_QUERY:
- emvw->query = g_strdup(GTK_VALUE_STRING (*arg));
- if (emvw->emv)
- gtk_object_set(GTK_OBJECT(emvw->emv),
- "query", emvw->query,
- NULL);
- break;
- }
-}
-
-static void
-e_minicard_view_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EMinicardViewWidget *emvw;
-
- emvw = E_MINICARD_VIEW_WIDGET (object);
-
- switch (arg_id) {
- case ARG_BOOK:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(emvw->book);
- break;
- case ARG_QUERY:
- GTK_VALUE_STRING (*arg) = g_strdup(emvw->query);
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-e_minicard_view_widget_destroy (GtkObject *object)
-{
- EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(object);
-
- if (view->book)
- gtk_object_unref(GTK_OBJECT(view->book));
- g_free(view->query);
-
- GTK_OBJECT_CLASS(parent_class)->destroy (object);
-}
-
-static void
-e_minicard_view_widget_realize (GtkWidget *widget)
-{
- EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(widget);
-
- view->rect = gnome_canvas_item_new(
- gnome_canvas_root( GNOME_CANVAS(view) ),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) 100,
- "y2", (double) 100,
- "fill_color", "white",
- NULL );
-
- view->emv = gnome_canvas_item_new(
- gnome_canvas_root( GNOME_CANVAS(view) ),
- e_minicard_view_get_type(),
- "height", (double) 100,
- "minimum_width", (double) 100,
- NULL );
- gtk_object_set(GTK_OBJECT(view->emv),
- "book", view->book,
- "query", view->query,
- NULL);
-
- if (GTK_WIDGET_CLASS(parent_class)->realize)
- GTK_WIDGET_CLASS(parent_class)->realize (widget);
-}
-
-static void
-e_minicard_view_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
-{
- if (GTK_WIDGET_CLASS(parent_class)->size_allocate)
- GTK_WIDGET_CLASS(parent_class)->size_allocate (widget, allocation);
-
- if (GTK_WIDGET_REALIZED(widget)) {
- double width;
- EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(widget);
-
- gnome_canvas_item_set( view->emv,
- "height", (double) allocation->height,
- NULL );
- gnome_canvas_item_set( view->emv,
- "minimum_width", (double) allocation->width,
- NULL );
- gtk_object_get(GTK_OBJECT(view->emv),
- "width", &width,
- NULL);
- width = MAX(width, allocation->width);
- gnome_canvas_set_scroll_region (GNOME_CANVAS (view), 0, 0, width - 1, allocation->height - 1);
- gnome_canvas_item_set( view->rect,
- "x2", (double) width,
- "y2", (double) allocation->height,
- NULL );
- }
-}
-
-static void
-e_minicard_view_widget_reflow(ECanvas *canvas)
-{
- double width;
- EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(canvas);
-
- if (E_CANVAS_CLASS(parent_class)->reflow)
- E_CANVAS_CLASS(parent_class)->reflow (canvas);
-
- gtk_object_get(GTK_OBJECT(view->emv),
- "width", &width,
- NULL);
- width = MAX(width, GTK_WIDGET(canvas)->allocation.width);
- gnome_canvas_set_scroll_region(GNOME_CANVAS(canvas), 0, 0, width - 1, GTK_WIDGET(canvas)->allocation.width - 1);
- gnome_canvas_item_set( view->rect,
- "x2", (double) width,
- "y2", (double) GTK_WIDGET(canvas)->allocation.height,
- NULL );
-}
-
-void
-e_minicard_view_widget_remove_selection(EMinicardViewWidget *view,
- EBookCallback cb,
- gpointer closure)
-{
- if (view->emv)
- e_minicard_view_remove_selection(E_MINICARD_VIEW(view->emv), cb, closure);
-}
-
-void e_minicard_view_widget_jump_to_letter (EMinicardViewWidget *view,
- char letter)
-{
- if (view->emv)
- e_minicard_view_jump_to_letter(E_MINICARD_VIEW(view->emv), letter);
-}
diff --git a/addressbook/gui/minicard/e-minicard-view-widget.h b/addressbook/gui/minicard/e-minicard-view-widget.h
deleted file mode 100644
index 340fb1e03c..0000000000
--- a/addressbook/gui/minicard/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 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifndef __E_MINICARD_VIEW_WIDGET_H__
-#define __E_MINICARD_VIEW_WIDGET_H__
-
-#include <gnome.h>
-#include "e-minicard-view.h"
-#include "e-util/e-canvas.h"
-#include <ebook/e-book.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#define E_MINICARD_VIEW_WIDGET_TYPE (e_minicard_view_widget_get_type ())
-#define E_MINICARD_VIEW_WIDGET(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_VIEW_WIDGET_TYPE, EMinicardViewWidget))
-#define E_MINICARD_VIEW_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_VIEW_WIDGET_TYPE, EMinicardViewWidgetClass))
-#define E_IS_MINICARD_VIEW_WIDGET(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_VIEW_WIDGET_TYPE))
-#define E_IS_MINICARD_VIEW_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_VIEW_WIDGET_TYPE))
-
-
-typedef struct _EMinicardViewWidget EMinicardViewWidget;
-typedef struct _EMinicardViewWidgetClass EMinicardViewWidgetClass;
-
-struct _EMinicardViewWidget
-{
- ECanvas parent;
-
- GnomeCanvasItem *rect;
- GnomeCanvasItem *emv;
-
- EBook *book;
- char *query;
-};
-
-struct _EMinicardViewWidgetClass
-{
- ECanvasClass parent_class;
-};
-
-GtkType e_minicard_view_widget_get_type (void);
-void e_minicard_view_widget_remove_selection (EMinicardViewWidget *view,
- EBookCallback cb,
- gpointer closure);
-void e_minicard_view_widget_jump_to_letter (EMinicardViewWidget *view,
- char letter);
-
-GtkWidget *e_minicard_view_widget_new (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __E_MINICARD_VIEW_WIDGET_H__ */
diff --git a/addressbook/gui/minicard/e-minicard-view.c b/addressbook/gui/minicard/e-minicard-view.c
deleted file mode 100644
index 011ff9158f..0000000000
--- a/addressbook/gui/minicard/e-minicard-view.c
+++ /dev/null
@@ -1,432 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-minicard-view.c
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <gnome.h>
-#include <e-util/e-canvas.h>
-#include "e-minicard-view.h"
-#include "e-minicard.h"
-#include "e-contact-editor.h"
-static void e_minicard_view_init (EMinicardView *reflow);
-static void e_minicard_view_class_init (EMinicardViewClass *klass);
-static void e_minicard_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_minicard_view_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_minicard_view_destroy (GtkObject *object);
-static gboolean e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event);
-static void canvas_destroy (GtkObject *object, EMinicardView *view);
-static void disconnect_signals (EMinicardView *view);
-
-static EReflowSortedClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_BOOK,
- ARG_QUERY
-};
-
-GtkType
-e_minicard_view_get_type (void)
-{
- static GtkType reflow_type = 0;
-
- if (!reflow_type)
- {
- static const GtkTypeInfo reflow_info =
- {
- "EMinicardView",
- sizeof (EMinicardView),
- sizeof (EMinicardViewClass),
- (GtkClassInitFunc) e_minicard_view_class_init,
- (GtkObjectInitFunc) e_minicard_view_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- reflow_type = gtk_type_unique (e_reflow_sorted_get_type (), &reflow_info);
- }
-
- return reflow_type;
-}
-
-static void
-e_minicard_view_class_init (EMinicardViewClass *klass)
-{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- object_class = (GtkObjectClass*) klass;
- item_class = (GnomeCanvasItemClass *) klass;
-
- parent_class = gtk_type_class (e_reflow_sorted_get_type ());
-
- gtk_object_add_arg_type ("EMinicardView::book", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_BOOK);
- gtk_object_add_arg_type ("EMinicardView::query", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_QUERY);
-
- object_class->set_arg = e_minicard_view_set_arg;
- object_class->get_arg = e_minicard_view_get_arg;
- object_class->destroy = e_minicard_view_destroy;
-
- item_class->event = e_minicard_view_event;
-
- /* GnomeCanvasItem method overrides */
-}
-
-static void
-e_minicard_view_init (EMinicardView *view)
-{
- view->book = NULL;
- view->query = g_strdup("(contains \"x-evolution-any-field\" \"\")");
- view->book_view = NULL;
- view->get_view_idle = 0;
- view->create_card_id = 0;
- view->remove_card_id = 0;
- view->modify_card_id = 0;
- view->canvas_destroy_id = 0;
-
- gtk_object_set(GTK_OBJECT(view),
- "empty_message", _("\n\nThere are no items to show in this view\n\n"
- "Double-click here to create a new Contact."),
- NULL);
-
- E_REFLOW_SORTED(view)->compare_func = (GCompareFunc) e_minicard_compare;
- E_REFLOW_SORTED(view)->string_func = (EReflowStringFunc) e_minicard_get_card_id;
-}
-
-static void
-create_card(EBookView *book_view, const GList *cards, EMinicardView *view)
-{
- for (; cards; cards = g_list_next(cards)) {
- GnomeCanvasItem *item = gnome_canvas_item_new(GNOME_CANVAS_GROUP(view),
- e_minicard_get_type(),
- "card", cards->data,
- NULL);
- e_reflow_add_item(E_REFLOW(view), item);
- }
-}
-
-static void
-modify_card(EBookView *book_view, const GList *cards, EMinicardView *view)
-{
- for (; cards; cards = g_list_next(cards)) {
- ECard *card = cards->data;
- gchar *id = e_card_get_id(card);
- GnomeCanvasItem *item = e_reflow_sorted_get_item(E_REFLOW_SORTED(view), id);
- if (item && !GTK_OBJECT_DESTROYED(item)) {
- gnome_canvas_item_set(item,
- "card", card,
- NULL);
- e_reflow_sorted_reorder_item(E_REFLOW_SORTED(view), id);
- }
- }
-}
-
-static void
-remove_card(EBookView *book_view, const char *id, EMinicardView *view)
-{
- e_reflow_sorted_remove_item(E_REFLOW_SORTED(view), id);
-}
-
-static void
-book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointer closure)
-{
- EMinicardView *view = closure;
- disconnect_signals(view);
- if (view->book_view)
- gtk_object_unref(GTK_OBJECT(view->book_view));
-
- if (!view->canvas_destroy_id)
- view->canvas_destroy_id =
- gtk_signal_connect(GTK_OBJECT(GNOME_CANVAS_ITEM(view)->canvas),
- "destroy", GTK_SIGNAL_FUNC(canvas_destroy),
- view);
-
- view->book_view = book_view;
- if (view->book_view)
- gtk_object_ref(GTK_OBJECT(view->book_view));
-
-
- view->create_card_id = gtk_signal_connect(GTK_OBJECT(view->book_view),
- "card_added",
- GTK_SIGNAL_FUNC(create_card),
- view);
- view->remove_card_id = gtk_signal_connect(GTK_OBJECT(view->book_view),
- "card_removed",
- GTK_SIGNAL_FUNC(remove_card),
- view);
- view->modify_card_id = gtk_signal_connect(GTK_OBJECT(view->book_view),
- "card_changed",
- GTK_SIGNAL_FUNC(modify_card),
- view);
-
- g_list_foreach(E_REFLOW(view)->items, (GFunc) gtk_object_unref, NULL);
- g_list_foreach(E_REFLOW(view)->items, (GFunc) gtk_object_destroy, NULL);
- g_list_free(E_REFLOW(view)->items);
- E_REFLOW(view)->items = NULL;
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(view));
-}
-
-static gboolean
-get_view(EMinicardView *view)
-{
- if (view->book && view->query)
- e_book_get_book_view(view->book, view->query, book_view_loaded, view);
-
- view->get_view_idle = 0;
- return FALSE;
-}
-
-static void
-e_minicard_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- EMinicardView *view;
-
- item = GNOME_CANVAS_ITEM (o);
- view = E_MINICARD_VIEW (o);
-
- switch (arg_id){
- case ARG_BOOK:
- if (view->book)
- gtk_object_unref(GTK_OBJECT(view->book));
- if (GTK_VALUE_OBJECT (*arg)) {
- view->book = E_BOOK(GTK_VALUE_OBJECT (*arg));
- gtk_object_ref(GTK_OBJECT(view->book));
- if (view->get_view_idle == 0)
- view->get_view_idle = g_idle_add((GSourceFunc)get_view, view);
- }
- else
- view->book = NULL;
- break;
- case ARG_QUERY:
- g_free(view->query);
- view->query = g_strdup(GTK_VALUE_STRING (*arg));
- if (view->get_view_idle == 0)
- view->get_view_idle = g_idle_add((GSourceFunc)get_view, view);
- break;
- }
-}
-
-static void
-e_minicard_view_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EMinicardView *e_minicard_view;
-
- e_minicard_view = E_MINICARD_VIEW (object);
-
- switch (arg_id) {
- case ARG_BOOK:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_minicard_view->book);
- break;
- case ARG_QUERY:
- GTK_VALUE_STRING (*arg) = g_strdup(e_minicard_view->query);
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-e_minicard_view_destroy (GtkObject *object)
-{
- EMinicardView *view = E_MINICARD_VIEW(object);
-
- if (view->get_view_idle)
- g_source_remove(view->get_view_idle);
- if (view->canvas_destroy_id)
- gtk_signal_disconnect(GTK_OBJECT (GNOME_CANVAS_ITEM(view)->canvas),
- view->canvas_destroy_id);
- disconnect_signals(view);
- g_free(view->query);
- if (view->book)
- gtk_object_unref(GTK_OBJECT(view->book));
- if (view->book_view)
- gtk_object_unref(GTK_OBJECT(view->book_view));
-
- GTK_OBJECT_CLASS(parent_class)->destroy (object);
-}
-
-static void
-card_added_cb (EBook* book, EBookStatus status, const char *id,
- gpointer user_data)
-{
- g_print ("%s: %s(): a card was added\n", __FILE__, __FUNCTION__);
-}
-
-static void
-card_changed_cb (EBook* book, EBookStatus status, gpointer user_data)
-{
- g_print ("%s: %s(): a card was changed with status %d\n", __FILE__, __FUNCTION__, status);
-}
-
-/* Callback for the add_card signal from the contact editor */
-static void
-add_card_cb (EContactEditor *ce, ECard *card, gpointer data)
-{
- EBook *book;
-
- book = E_BOOK (data);
- e_book_add_card (book, card, card_added_cb, NULL);
-}
-
-/* Callback for the commit_card signal from the contact editor */
-static void
-commit_card_cb (EContactEditor *ce, ECard *card, gpointer data)
-{
- EBook *book;
-
- book = E_BOOK (data);
- e_book_commit_card (book, card, card_changed_cb, NULL);
-}
-
-/* Callback used when the contact editor is closed */
-static void
-editor_closed_cb (EContactEditor *ce, gpointer data)
-{
- gtk_object_unref (GTK_OBJECT (ce));
-}
-
-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)
- {
- ECard *card;
- EContactEditor *ce;
- EBook *book;
-
- card = e_card_new("");
-
- gtk_object_get(GTK_OBJECT(view), "book", &book, NULL);
- g_assert (E_IS_BOOK (book));
-
- ce = e_contact_editor_new (card, TRUE);
-
- gtk_signal_connect (GTK_OBJECT (ce), "add_card",
- GTK_SIGNAL_FUNC (add_card_cb), book);
- gtk_signal_connect (GTK_OBJECT (ce), "commit_card",
- GTK_SIGNAL_FUNC (commit_card_cb), book);
- gtk_signal_connect (GTK_OBJECT (ce), "editor_closed",
- GTK_SIGNAL_FUNC (editor_closed_cb), NULL);
-
- gtk_object_sink(GTK_OBJECT(card));
- }
- return TRUE;
- default:
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event)
- return GNOME_CANVAS_ITEM_CLASS(parent_class)->event(item, event);
- else
- return FALSE;
- break;
- }
-}
-
-static void
-disconnect_signals(EMinicardView *view)
-{
- if (view->book_view && view->create_card_id)
- gtk_signal_disconnect(GTK_OBJECT (view->book_view),
- view->create_card_id);
- if (view->book_view && view->remove_card_id)
- gtk_signal_disconnect(GTK_OBJECT (view->book_view),
- view->remove_card_id);
- if (view->book_view && view->modify_card_id)
- gtk_signal_disconnect(GTK_OBJECT (view->book_view),
- view->modify_card_id);
-
- view->create_card_id = 0;
- view->remove_card_id = 0;
- view->modify_card_id = 0;
-}
-
-static void
-canvas_destroy(GtkObject *object, EMinicardView *view)
-{
- disconnect_signals(view);
-}
-
-void
-e_minicard_view_remove_selection(EMinicardView *view,
- EBookCallback cb,
- gpointer closure)
-{
- if (view->book) {
- EReflow *reflow = E_REFLOW(view);
- GList *list;
- for (list = reflow->items; list; list = g_list_next(list)) {
- GnomeCanvasItem *item = list->data;
- gboolean has_focus;
- gtk_object_get(GTK_OBJECT(item),
- "has_focus", &has_focus,
- NULL);
- if (has_focus) {
- ECard *card;
- gtk_object_get(GTK_OBJECT(item),
- "card", &card,
- NULL);
- e_book_remove_card(view->book, card, cb, closure);
- return;
- }
- }
- }
-}
-
-static int
-compare_to_letter(EMinicard *card, char *letter)
-{
- g_return_val_if_fail(card != NULL, 0);
- g_return_val_if_fail(E_IS_MINICARD(card), 0);
-
- if (*letter == '1')
- return 1;
-
- if (card->card) {
- char *file_as;
- gtk_object_get(GTK_OBJECT(card->card),
- "file_as", &file_as,
- NULL);
- if (file_as)
- return strncasecmp(file_as, letter, 1);
- else
- return 0;
- } else {
- return 0;
- }
-}
-
-void e_minicard_view_jump_to_letter (EMinicardView *view,
- char letter)
-{
- e_reflow_sorted_jump(E_REFLOW_SORTED(view),
- (GCompareFunc) compare_to_letter,
- &letter);
-}
diff --git a/addressbook/gui/minicard/e-minicard-view.h b/addressbook/gui/minicard/e-minicard-view.h
deleted file mode 100644
index a166a6ade1..0000000000
--- a/addressbook/gui/minicard/e-minicard-view.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-minicard-view.h
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifndef __E_MINICARD_VIEW_H__
-#define __E_MINICARD_VIEW_H__
-
-#include <gnome.h>
-#include "e-reflow-sorted.h"
-#include <ebook/e-book.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* EMinicardView - A canvas item container.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- * book EBook RW book to query
- * query string RW query string
- *
- * From EReflowSorted: (you should really know what you're doing if you set these.)
- * compare_func GCompareFunc RW compare function
- * string_func EReflowStringFunc RW string function
- *
- * From EReflow:
- * minimum_width double RW minimum width of the reflow. width >= minimum_width
- * width double R width of the reflow
- * height double RW height of the reflow
- */
-
-#define E_MINICARD_VIEW_TYPE (e_minicard_view_get_type ())
-#define E_MINICARD_VIEW(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_VIEW_TYPE, EMinicardView))
-#define E_MINICARD_VIEW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_VIEW_TYPE, EMinicardViewClass))
-#define E_IS_MINICARD_VIEW(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_VIEW_TYPE))
-#define E_IS_MINICARD_VIEW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_VIEW_TYPE))
-
-
-typedef struct _EMinicardView EMinicardView;
-typedef struct _EMinicardViewClass EMinicardViewClass;
-
-struct _EMinicardView
-{
- EReflowSorted parent;
-
- /* item specific fields */
- EBook *book;
- char *query;
- EBookView *book_view;
-
- int get_view_idle;
-
- int canvas_destroy_id;
-
- int create_card_id, remove_card_id, modify_card_id;
-};
-
-struct _EMinicardViewClass
-{
- EReflowSortedClass parent_class;
-};
-
-GtkType e_minicard_view_get_type (void);
-void e_minicard_view_remove_selection (EMinicardView *view,
- EBookCallback cb,
- gpointer closure);
-void e_minicard_view_jump_to_letter (EMinicardView *view,
- char letter);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_MINICARD_VIEW_H__ */
diff --git a/addressbook/gui/minicard/e-minicard-widget-test.c b/addressbook/gui/minicard/e-minicard-widget-test.c
deleted file mode 100644
index f6489f2a6a..0000000000
--- a/addressbook/gui/minicard/e-minicard-widget-test.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* test-minicard.c
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#define TEST_VCARD \
-"BEGIN:VCARD
-" \
-"FN:Nat
-" \
-"N:Friedman;Nat;D;Mr.
-" \
-"ORG:Helix Code, Inc.
-" \
-"TITLE:Head Geek
-" \
-"ROLE:Programmer/Executive
-" \
-"BDAY:1977-08-06
-" \
-"TEL;WORK:617 679 1984
-" \
-"TEL;CELL:123 456 7890
-" \
-"EMAIL;INTERNET:nat@nat.org
-" \
-"EMAIL;INTERNET:nat@helixcode.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 <gnome.h>
-#include "e-minicard-widget.h"
-
-/* This is a horrible thing to do, but it is just a test. */
-
-static void destroy_callback(GtkWidget *app, gpointer data)
-{
- exit(0);
-}
-
-#if 0
-static void about_callback( GtkWidget *widget, gpointer data )
-{
-
- const gchar *authors[] =
- {
- "Christopher James Lahey <clahey@umich.edu>",
- NULL
- };
-
- GtkWidget *about =
- gnome_about_new ( _( "Minicard Widget Test" ), VERSION,
- _( "Copyright (C) 2000, Helix Code, Inc." ),
- authors,
- _( "This should test the minicard widget" ),
- NULL);
- gtk_widget_show (about);
-}
-#endif
-
-int main( int argc, char *argv[] )
-{
- GtkWidget *app;
- GtkWidget *minicard;
- ECard *card;
-
- /* bindtextdomain (PACKAGE, GNOMELOCALEDIR);
- textdomain (PACKAGE);*/
-
- gnome_init( "Minicard Widget Test", VERSION, argc, argv);
- app = gnome_app_new("Minicard Widget Test", NULL);
-
- minicard = e_minicard_widget_new();
- card = e_card_new(TEST_VCARD);
- gtk_object_set(GTK_OBJECT(minicard),
- "card", card,
- NULL);
-
- gnome_app_set_contents( GNOME_APP( app ), minicard );
-
- /* Connect the signals */
- gtk_signal_connect( GTK_OBJECT( app ), "destroy",
- GTK_SIGNAL_FUNC( destroy_callback ),
- ( gpointer ) app );
-
- gtk_widget_show_all( app );
-
- gtk_main();
-
- /* Not reached. */
- return 0;
-}
diff --git a/addressbook/gui/minicard/e-minicard-widget.c b/addressbook/gui/minicard/e-minicard-widget.c
deleted file mode 100644
index 3f765425e4..0000000000
--- a/addressbook/gui/minicard/e-minicard-widget.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-field-chooser.c
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <gnome.h>
-#include "e-minicard-widget.h"
-#include "e-minicard.h"
-
-static void e_minicard_widget_init (EMinicardWidget *card);
-static void e_minicard_widget_class_init (EMinicardWidgetClass *klass);
-static void e_minicard_widget_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_minicard_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_minicard_widget_destroy (GtkObject *object);
-static void e_minicard_widget_size_request (GtkWidget *widget, GtkRequisition *requisition);
-static void e_minicard_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation);
-static void e_minicard_widget_reflow (ECanvas *canvas);
-
-static ECanvasClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_CARD,
-};
-
-GtkType
-e_minicard_widget_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type)
- {
- static const GtkTypeInfo info =
- {
- "EMinicardWidget",
- sizeof (EMinicardWidget),
- sizeof (EMinicardWidgetClass),
- (GtkClassInitFunc) e_minicard_widget_class_init,
- (GtkObjectInitFunc) e_minicard_widget_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (e_canvas_get_type (), &info);
- }
-
- return type;
-}
-
-static void
-e_minicard_widget_class_init (EMinicardWidgetClass *klass)
-{
- GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- ECanvasClass *ecanvas_class;
-
- object_class = GTK_OBJECT_CLASS(klass);
- widget_class = GTK_WIDGET_CLASS(klass);
- ecanvas_class = E_CANVAS_CLASS(klass);
-
- parent_class = gtk_type_class (e_canvas_get_type ());
-
- object_class->set_arg = e_minicard_widget_set_arg;
- object_class->get_arg = e_minicard_widget_get_arg;
- object_class->destroy = e_minicard_widget_destroy;
-
- widget_class->size_request = e_minicard_widget_size_request;
- widget_class->size_allocate = e_minicard_widget_size_allocate;
-
- ecanvas_class->reflow = e_minicard_widget_reflow;
-
- gtk_object_add_arg_type ("EMinicardWidget::card", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_CARD);
-}
-
-static void
-e_minicard_widget_size_request(GtkWidget *widget, GtkRequisition *requisition)
-{
- double height;
- EMinicardWidget *emw = E_MINICARD_WIDGET(widget);
- gtk_object_get(GTK_OBJECT(emw->item),
- "height", &height,
- NULL);
- if (height <= 0)
- height = 1;
- widget->requisition.height = height;
- widget->requisition.width = 200;
- requisition->height = height;
- requisition->width = 200;
-}
-
-static void
-e_minicard_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
-{
- double height;
- EMinicardWidget *emw = E_MINICARD_WIDGET(widget);
- gnome_canvas_item_set( emw->item,
- "width", (double) allocation->width,
- NULL );
- gtk_object_get(GTK_OBJECT(emw->item),
- "height", &height,
- NULL);
- height = MAX(height, allocation->height);
- gnome_canvas_set_scroll_region(GNOME_CANVAS( emw ), 0, 0, allocation->width - 1, height - 1);
- gnome_canvas_item_set( emw->rect,
- "x2", (double) allocation->width,
- "y2", (double) height,
- NULL );
- if (GTK_WIDGET_CLASS(parent_class)->size_allocate)
- GTK_WIDGET_CLASS(parent_class)->size_allocate(widget, allocation);
-}
-
-static void e_minicard_widget_reflow(ECanvas *canvas)
-{
- double height;
- EMinicardWidget *emw = E_MINICARD_WIDGET(canvas);
- gtk_object_get(GTK_OBJECT(emw->item),
- "height", &height,
- NULL);
-
- height = MAX(height, GTK_WIDGET(emw)->allocation.height);
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS(emw), 0, 0, GTK_WIDGET(emw)->allocation.width - 1, height - 1);
- gnome_canvas_item_set( emw->rect,
- "x2", (double) GTK_WIDGET(emw)->allocation.width,
- "y2", (double) height,
- NULL );
-
- gtk_widget_queue_resize(GTK_WIDGET(canvas));
-}
-
-static void
-e_minicard_widget_init (EMinicardWidget *emw)
-{
- emw->rect = gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(emw)),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) 100,
- "y2", (double) 100,
- "fill_color", "white",
- NULL );
-
- emw->item = gnome_canvas_item_new(gnome_canvas_root(GNOME_CANVAS(emw)),
- e_minicard_get_type(),
- "width", (double) 100,
- NULL );
-
- gnome_canvas_set_scroll_region ( GNOME_CANVAS( emw ),
- 0, 0,
- 100, 100 );
-
- emw->card = NULL;
-}
-
-static void
-e_minicard_widget_destroy (GtkObject *object)
-{
- EMinicardWidget *emw = E_MINICARD_WIDGET(object);
-
- if (emw->card)
- gtk_object_unref(GTK_OBJECT(emw->card));
-
- if (GTK_OBJECT_CLASS(parent_class)->destroy)
- GTK_OBJECT_CLASS(parent_class)->destroy(object);
-}
-
-GtkWidget*
-e_minicard_widget_new (void)
-{
- GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_minicard_widget_get_type ()));
- return widget;
-}
-
-static void
-e_minicard_widget_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EMinicardWidget *emw = E_MINICARD_WIDGET(object);
-
- switch (arg_id){
- case ARG_CARD:
- if (emw->card)
- gtk_object_unref(GTK_OBJECT(emw->card));
- if (GTK_VALUE_OBJECT(*arg)) {
- emw->card = E_CARD(GTK_VALUE_OBJECT(*arg));
- gtk_object_ref(GTK_OBJECT(emw->card));
- }
- else
- emw->card = NULL;
- if (emw->item)
- gtk_object_set(GTK_OBJECT(emw->item),
- "card", emw->card,
- NULL);
- break;
- default:
- break;
- }
-}
-
-static void
-e_minicard_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EMinicardWidget *emw = E_MINICARD_WIDGET(object);
-
- switch (arg_id) {
- case ARG_CARD:
- if (emw->card)
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(emw->card);
- else
- GTK_VALUE_OBJECT (*arg) = NULL;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
diff --git a/addressbook/gui/minicard/e-minicard-widget.h b/addressbook/gui/minicard/e-minicard-widget.h
deleted file mode 100644
index 8a3ec0ae16..0000000000
--- a/addressbook/gui/minicard/e-minicard-widget.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-minicard-widget.h
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifndef __E_MINICARD_WIDGET_H__
-#define __E_MINICARD_WIDGET_H__
-
-#include <gnome.h>
-#include "addressbook/backend/ebook/e-card.h"
-#include "e-util/e-canvas.h"
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* EMinicardWidget - A card displaying information about a contact.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- */
-
-#define E_MINICARD_WIDGET_TYPE (e_minicard_widget_get_type ())
-#define E_MINICARD_WIDGET(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_WIDGET_TYPE, EMinicardWidget))
-#define E_MINICARD_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_WIDGET_TYPE, EMinicardWidgetClass))
-#define E_IS_MINICARD_WIDGET(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_WIDGET_TYPE))
-#define E_IS_MINICARD_WIDGET_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_WIDGET_TYPE))
-
-
-typedef struct _EMinicardWidget EMinicardWidget;
-typedef struct _EMinicardWidgetClass EMinicardWidgetClass;
-
-struct _EMinicardWidget
-{
- ECanvas parent;
-
- /* item specific fields */
- GnomeCanvasItem *item;
-
- GnomeCanvasItem *rect;
- ECard *card;
-};
-
-struct _EMinicardWidgetClass
-{
- ECanvasClass parent_class;
-};
-
-
-GtkWidget *e_minicard_widget_new(void);
-GtkType e_minicard_widget_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_MINICARD_WIDGET_H__ */
diff --git a/addressbook/gui/minicard/e-minicard.c b/addressbook/gui/minicard/e-minicard.c
deleted file mode 100644
index d870de7b25..0000000000
--- a/addressbook/gui/minicard/e-minicard.c
+++ /dev/null
@@ -1,797 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-minicard.c
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <gnome.h>
-#include "e-minicard.h"
-#include "e-minicard-label.h"
-#include "e-text.h"
-#include <ebook/e-book.h>
-#include <e-util/e-canvas.h>
-#include <e-util/e-util.h>
-#include <e-util/e-canvas-utils.h>
-#include <e-util/e-popup-menu.h>
-#include "addressbook/printing/e-contact-print.h"
-#include "e-contact-editor.h"
-#include "e-contact-save-as.h"
-#include "e-minicard-view.h"
-
-static void e_minicard_init (EMinicard *card);
-static void e_minicard_class_init (EMinicardClass *klass);
-static void e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_minicard_destroy (GtkObject *object);
-static gboolean e_minicard_event (GnomeCanvasItem *item, GdkEvent *event);
-static void e_minicard_realize (GnomeCanvasItem *item);
-static void e_minicard_unrealize (GnomeCanvasItem *item);
-static void e_minicard_reflow ( GnomeCanvasItem *item, int flags );
-
-static void e_minicard_resize_children( EMinicard *e_minicard );
-static void remodel( EMinicard *e_minicard );
-
-static GnomeCanvasGroupClass *parent_class = NULL;
-
-typedef struct _EMinicardField EMinicardField;
-
-struct _EMinicardField {
- ECardSimpleField field;
- GnomeCanvasItem *label;
-};
-
-#define E_MINICARD_FIELD(field) ((EMinicardField *)(field))
-
-static void
-e_minicard_field_destroy(EMinicardField *field)
-{
- gtk_object_destroy(GTK_OBJECT(field->label));
- g_free(field);
-}
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_WIDTH,
- ARG_HEIGHT,
- ARG_HAS_FOCUS,
- ARG_CARD
-};
-
-GtkType
-e_minicard_get_type (void)
-{
- static GtkType minicard_type = 0;
-
- if (!minicard_type)
- {
- static const GtkTypeInfo minicard_info =
- {
- "EMinicard",
- sizeof (EMinicard),
- sizeof (EMinicardClass),
- (GtkClassInitFunc) e_minicard_class_init,
- (GtkObjectInitFunc) e_minicard_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- minicard_type = gtk_type_unique (gnome_canvas_group_get_type (), &minicard_info);
- }
-
- return minicard_type;
-}
-
-static void
-e_minicard_class_init (EMinicardClass *klass)
-{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- object_class = (GtkObjectClass*) klass;
- item_class = (GnomeCanvasItemClass *) klass;
-
- parent_class = gtk_type_class (gnome_canvas_group_get_type ());
-
- gtk_object_add_arg_type ("EMinicard::width", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_WIDTH);
- gtk_object_add_arg_type ("EMinicard::height", GTK_TYPE_DOUBLE,
- GTK_ARG_READABLE, ARG_HEIGHT);
- gtk_object_add_arg_type ("EMinicard::has_focus", GTK_TYPE_ENUM,
- GTK_ARG_READWRITE, ARG_HAS_FOCUS);
- gtk_object_add_arg_type ("EMinicard::card", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_CARD);
-
- object_class->set_arg = e_minicard_set_arg;
- object_class->get_arg = e_minicard_get_arg;
- object_class->destroy = e_minicard_destroy;
-
- /* GnomeCanvasItem method overrides */
- item_class->realize = e_minicard_realize;
- item_class->unrealize = e_minicard_unrealize;
- item_class->event = e_minicard_event;
-}
-
-static void
-e_minicard_init (EMinicard *minicard)
-{
- /* minicard->card = NULL;*/
- minicard->rect = NULL;
- minicard->fields = NULL;
- minicard->width = 10;
- minicard->height = 10;
- minicard->has_focus = FALSE;
-
- minicard->card = NULL;
- minicard->simple = e_card_simple_new(NULL);
-
- e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(minicard), e_minicard_reflow);
-}
-
-static void
-e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- EMinicard *e_minicard;
-
- item = GNOME_CANVAS_ITEM (o);
- e_minicard = E_MINICARD (o);
-
- switch (arg_id){
- case ARG_WIDTH:
- if (e_minicard->width != GTK_VALUE_DOUBLE (*arg)) {
- e_minicard->width = GTK_VALUE_DOUBLE (*arg);
- e_minicard_resize_children(e_minicard);
- if ( GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED )
- e_canvas_item_request_reflow(item);
- }
- break;
- case ARG_HAS_FOCUS:
- if (e_minicard->fields) {
- if ( GTK_VALUE_ENUM(*arg) == E_FOCUS_START ||
- GTK_VALUE_ENUM(*arg) == E_FOCUS_CURRENT) {
- gnome_canvas_item_set(E_MINICARD_FIELD(e_minicard->fields->data)->label,
- "has_focus", GTK_VALUE_ENUM(*arg),
- NULL);
- } else if ( GTK_VALUE_ENUM(*arg) == E_FOCUS_END ) {
- gnome_canvas_item_set(E_MINICARD_FIELD(g_list_last(e_minicard->fields)->data)->label,
- "has_focus", GTK_VALUE_ENUM(*arg),
- NULL);
- }
- }
- else
- e_canvas_item_grab_focus(item);
- break;
- case ARG_CARD:
- if (e_minicard->card)
- gtk_object_unref (GTK_OBJECT(e_minicard->card));
- e_minicard->card = E_CARD(GTK_VALUE_OBJECT (*arg));
- if (e_minicard->card)
- gtk_object_ref (GTK_OBJECT(e_minicard->card));
- gtk_object_set(GTK_OBJECT(e_minicard->simple),
- "card", e_minicard->card,
- NULL);
- remodel(e_minicard);
- e_canvas_item_request_reflow(item);
- break;
- }
-}
-
-static void
-e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EMinicard *e_minicard;
-
- e_minicard = E_MINICARD (object);
-
- switch (arg_id) {
- case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = e_minicard->width;
- break;
- case ARG_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = e_minicard->height;
- break;
- case ARG_HAS_FOCUS:
- GTK_VALUE_ENUM (*arg) = e_minicard->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE;
- break;
- case ARG_CARD:
- e_card_simple_sync_card(e_minicard->simple);
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_minicard->card);
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-e_minicard_destroy (GtkObject *object)
-{
- EMinicard *e_minicard;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (E_IS_MINICARD (object));
-
- e_minicard = E_MINICARD (object);
-
- g_list_foreach(e_minicard->fields, (GFunc) e_minicard_field_destroy, NULL);
- g_list_free(e_minicard->fields);
-
- if (e_minicard->card)
- gtk_object_unref (GTK_OBJECT(e_minicard->card));
- if (e_minicard->simple)
- gtk_object_unref (GTK_OBJECT(e_minicard->simple));
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
-e_minicard_realize (GnomeCanvasItem *item)
-{
- EMinicard *e_minicard;
- GnomeCanvasGroup *group;
- GtkWidget *canvas;
-
- e_minicard = E_MINICARD (item);
- group = GNOME_CANVAS_GROUP( item );
- canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (item)->canvas);
-
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize)
- (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item);
-
- e_minicard->rect =
- gnome_canvas_item_new( group,
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) e_minicard->width - 1,
- "y2", (double) e_minicard->height - 1,
- "outline_color", NULL,
- NULL );
-
- e_minicard->header_rect =
- gnome_canvas_item_new( group,
- gnome_canvas_rect_get_type(),
- "x1", (double) 2,
- "y1", (double) 2,
- "x2", (double) e_minicard->width - 3,
- "y2", (double) e_minicard->height - 3,
- "fill_color_gdk", &canvas->style->bg[GTK_STATE_NORMAL],
- NULL );
-
- e_minicard->header_text =
- gnome_canvas_item_new( group,
- e_text_get_type(),
- "anchor", GTK_ANCHOR_NW,
- "width", (double) ( e_minicard->width - 12 ),
- "clip", TRUE,
- "use_ellipsis", TRUE,
-#if 0
- "font", "fixed-bold-10",
-#endif
- "fill_color_gdk", &canvas->style->fg[GTK_STATE_NORMAL],
- "text", "",
- NULL );
- e_canvas_item_move_absolute(e_minicard->header_text, 6, 6);
-
- remodel(e_minicard);
- e_canvas_item_request_reflow(item);
-
- if (!item->canvas->aa) {
- }
-}
-
-static void
-e_minicard_unrealize (GnomeCanvasItem *item)
-{
- EMinicard *e_minicard;
-
- e_minicard = E_MINICARD (item);
-
- if (!item->canvas->aa)
- {
- }
-
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize)
- (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item);
-}
-
-static void
-card_added_cb (EBook* book, EBookStatus status, const char *id, gpointer user_data)
-{
- g_print ("%s: %s(): a card was added\n", __FILE__, __FUNCTION__);
-}
-
-static void
-card_changed_cb (EBook* book, EBookStatus status, gpointer user_data)
-{
- g_print ("%s: %s(): a card was changed with status %d\n", __FILE__, __FUNCTION__, status);
-}
-
-static void
-save_as (GtkWidget *widget, EMinicard *minicard)
-{
- e_card_simple_sync_card(minicard->simple);
- e_contact_save_as(_("Save as VCard"), minicard->card);
-}
-
-static void
-delete (GtkWidget *widget, EMinicard *minicard)
-{
- EBook *book;
-
- if (e_contact_editor_confirm_delete()) {
- e_card_simple_sync_card(minicard->simple);
-
- gtk_object_get(GTK_OBJECT(GNOME_CANVAS_ITEM(minicard)->parent),
- "book", &book,
- NULL);
-
- /* Add the card in the contact editor to our ebook */
- e_book_remove_card (book,
- minicard->card,
- card_changed_cb,
- NULL);
- }
-}
-
-static void
-print (GtkWidget *widget, EMinicard *minicard)
-{
- e_card_simple_sync_card(minicard->simple);
-
- gtk_widget_show(e_contact_print_card_dialog_new(minicard->card));
-}
-
-/* Callback for the add_card signal from the contact editor */
-static void
-add_card_cb (EContactEditor *ce, ECard *card, gpointer data)
-{
- EBook *book;
-
- book = E_BOOK (data);
- e_book_add_card (book, card, card_added_cb, NULL);
-}
-
-/* Callback for the commit_card signal from the contact editor */
-static void
-commit_card_cb (EContactEditor *ce, ECard *card, gpointer data)
-{
- EBook *book;
-
- book = E_BOOK (data);
- e_book_commit_card (book, card, card_changed_cb, NULL);
-}
-
-/* Callback for the commit_card signal from the contact editor */
-static void
-delete_card_cb (EContactEditor *ce, ECard *card, gpointer data)
-{
- EBook *book;
-
- book = E_BOOK (data);
- e_book_remove_card (book, card, card_changed_cb, NULL);
-}
-
-/* Callback used when the contact editor is closed */
-static void
-editor_closed_cb (EContactEditor *ce, gpointer data)
-{
- gtk_object_unref (GTK_OBJECT (ce));
-}
-
-static gboolean
-e_minicard_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- EMinicard *e_minicard;
- GtkWidget *canvas;
-
- e_minicard = E_MINICARD (item);
- canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (item)->canvas);
-
- switch( event->type ) {
- case GDK_FOCUS_CHANGE:
- {
- GdkEventFocus *focus_event = (GdkEventFocus *) event;
- if ( focus_event->in ) {
- gnome_canvas_item_set( e_minicard->rect,
- "outline_color_gdk", &canvas->style->bg[GTK_STATE_NORMAL],
- NULL );
- gnome_canvas_item_set( e_minicard->header_rect,
- "fill_color_gdk", &canvas->style->bg[GTK_STATE_SELECTED],
- NULL );
- gnome_canvas_item_set( e_minicard->header_text,
- "fill_color_gdk", &canvas->style->text[GTK_STATE_SELECTED],
- NULL );
- e_minicard->has_focus = TRUE;
- } else {
- EBook *book = NULL;
-
- e_card_simple_sync_card(e_minicard->simple);
-
- if (E_IS_MINICARD_VIEW(GNOME_CANVAS_ITEM(e_minicard)->parent)) {
-
- gtk_object_get(GTK_OBJECT(GNOME_CANVAS_ITEM(e_minicard)->parent),
- "book", &book,
- NULL);
-
- }
-
- if (book) {
-
- /* Add the card in the contact editor to our ebook */
- e_book_commit_card (book,
- e_minicard->card,
- card_changed_cb,
- NULL);
- } else {
- remodel(e_minicard);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(e_minicard));
- }
-
- gnome_canvas_item_set( e_minicard->rect,
- "outline_color", NULL,
- NULL );
- gnome_canvas_item_set( e_minicard->header_rect,
- "fill_color_gdk",
- &canvas->style->bg[GTK_STATE_NORMAL],
- NULL );
- gnome_canvas_item_set( e_minicard->header_text,
- "fill_color_gdk",
- &canvas->style->fg[GTK_STATE_NORMAL],
- NULL );
- e_minicard->has_focus = FALSE;
- }
- }
- break;
- case GDK_BUTTON_PRESS:
- if (event->button.button == 1) {
- e_canvas_item_grab_focus(item);
- } else if (event->button.button == 3) {
- if (E_IS_MINICARD_VIEW(item->parent)) {
- EPopupMenu menu[] = { {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), 0},
- {"Print", NULL, GTK_SIGNAL_FUNC(print), 0},
- {"Delete", NULL, GTK_SIGNAL_FUNC(delete), 0},
- {NULL, NULL, NULL, 0}};
- e_popup_menu_run (menu, (GdkEventButton *)event, 0, 0, e_minicard);
- } else {
- EPopupMenu menu[] = { {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), 0},
- {"Print", NULL, GTK_SIGNAL_FUNC(print), 0},
- {NULL, NULL, NULL, 0}};
- e_popup_menu_run (menu, (GdkEventButton *)event, 0, 0, e_minicard);
- }
- }
- break;
-
- case GDK_2BUTTON_PRESS:
- if (event->button.button == 1 && E_IS_MINICARD_VIEW(item->parent)) {
- EContactEditor *ce;
- EBook *book = NULL;
- if (E_IS_MINICARD_VIEW(item->parent)) {
-
- gtk_object_get(GTK_OBJECT(item->parent),
- "book", &book,
- NULL);
- }
- ce = e_contact_editor_new (e_minicard->card, FALSE);
-
- if (book != NULL) {
- gtk_signal_connect (GTK_OBJECT (ce), "add_card",
- GTK_SIGNAL_FUNC (add_card_cb), book);
- gtk_signal_connect (GTK_OBJECT (ce), "commit_card",
- GTK_SIGNAL_FUNC (commit_card_cb), book);
- gtk_signal_connect (GTK_OBJECT (ce), "delete_card",
- GTK_SIGNAL_FUNC (delete_card_cb), book);
- }
-
- gtk_signal_connect (GTK_OBJECT (ce), "editor_closed",
- GTK_SIGNAL_FUNC (editor_closed_cb), NULL);
- return TRUE;
- }
- break;
- case GDK_KEY_PRESS:
- if (event->key.keyval == GDK_Tab ||
- event->key.keyval == GDK_KP_Tab ||
- event->key.keyval == GDK_ISO_Left_Tab) {
- GList *list;
- for (list = e_minicard->fields; list; list = list->next) {
- EMinicardField *field = E_MINICARD_FIELD(list->data);
- GnomeCanvasItem *item = field->label;
- EFocus has_focus;
- gtk_object_get(GTK_OBJECT(item),
- "has_focus", &has_focus,
- NULL);
- if (has_focus != E_FOCUS_NONE) {
- if (event->key.state & GDK_SHIFT_MASK)
- list = list->prev;
- else
- list = list->next;
- if (list) {
- EMinicardField *field = E_MINICARD_FIELD(list->data);
- GnomeCanvasItem *item = field->label;
- gnome_canvas_item_set(item,
- "has_focus", (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START,
- NULL);
- return 1;
- } else {
- return 0;
- }
- }
- }
- }
- default:
- break;
- }
-
- if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event)
- return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event);
- else
- return 0;
-}
-
-static void
-e_minicard_resize_children( EMinicard *e_minicard )
-{
- GList *list;
-
- if (e_minicard->header_text) {
- gnome_canvas_item_set( e_minicard->header_text,
- "width", (double) e_minicard->width - 12,
- NULL );
- }
- for ( list = e_minicard->fields; list; list = g_list_next( list ) ) {
- gnome_canvas_item_set( E_MINICARD_FIELD( list->data )->label,
- "width", (double) e_minicard->width - 4.0,
- NULL );
- }
-}
-
-static void
-field_changed (EText *text, EMinicard *e_minicard)
-{
- ECardSimpleType type;
- char *string;
-
- type = GPOINTER_TO_INT
- (gtk_object_get_data(GTK_OBJECT(text),
- "EMinicard:field"));
- gtk_object_get(GTK_OBJECT(text),
- "text", &string,
- NULL);
- e_card_simple_set(e_minicard->simple,
- type,
- string);
- g_free(string);
-}
-
-static void
-add_field (EMinicard *e_minicard, ECardSimpleField field, gdouble left_width)
-{
- GnomeCanvasItem *new_item;
- GnomeCanvasGroup *group;
- ECardSimpleType type;
- EMinicardField *minicard_field;
- char *name;
- char *string;
-
- group = GNOME_CANVAS_GROUP( e_minicard );
-
- type = e_card_simple_type(e_minicard->simple, field);
- name = g_strdup_printf("%s:", e_card_simple_get_name(e_minicard->simple, field));
- string = e_card_simple_get(e_minicard->simple, field);
-
- 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,
- NULL );
- gtk_signal_connect(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field),
- "changed", GTK_SIGNAL_FUNC(field_changed), e_minicard);
- gtk_object_set_data(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field),
- "EMinicard:field",
- GINT_TO_POINTER(field));
-
- minicard_field = g_new(EMinicardField, 1);
- minicard_field->field = field;
- minicard_field->label = new_item;
-
- e_minicard->fields = g_list_append( e_minicard->fields, minicard_field);
- e_canvas_item_move_absolute(new_item, 2, e_minicard->height);
- g_free(name);
- g_free(string);
-}
-
-static gdouble
-get_left_width(EMinicard *e_minicard)
-{
- gchar *name;
- ECardSimpleField field;
- gdouble width = -1;
- GdkFont *font;
-
- font = ((GtkWidget *) ((GnomeCanvasItem *) e_minicard)->canvas)->style->font;
-
- for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST; field++) {
- gdouble this_width;
- name = g_strdup_printf("%s:", e_card_simple_get_name(e_minicard->simple, field));
- this_width = gdk_text_width(font, name, strlen(name));
- if (width < this_width)
- width = this_width;
- g_free(name);
- }
- return width;
-}
-
-static void
-remodel( EMinicard *e_minicard )
-{
- int count = 0;
- if (e_minicard->simple) {
- ECardSimpleField field;
- GList *list;
- char *file_as;
- gdouble left_width = -1;
-
- if (e_minicard->header_text) {
- file_as = e_card_simple_get(e_minicard->simple, E_CARD_SIMPLE_FIELD_FILE_AS);
- gnome_canvas_item_set( e_minicard->header_text,
- "text", file_as ? file_as : "",
- NULL );
- g_free(file_as);
- }
-
- list = e_minicard->fields;
- e_minicard->fields = NULL;
-
- for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST - 2 && count < 5; field++) {
- EMinicardField *minicard_field = NULL;
-
- if (list)
- minicard_field = list->data;
- if (minicard_field && minicard_field->field == field) {
- GList *this_list = list;
- char *string;
-
- string = e_card_simple_get(e_minicard->simple, field);
- if (string && *string) {
- e_minicard->fields = g_list_append(e_minicard->fields, minicard_field);
- gtk_object_set(GTK_OBJECT(minicard_field->label),
- "field", string,
- NULL);
- count ++;
- } else {
- e_minicard_field_destroy(minicard_field);
- }
- list = g_list_remove_link(list, this_list);
- g_list_free_1(this_list);
- g_free(string);
- } else {
- char *string;
- if (left_width == -1) {
- left_width = get_left_width(e_minicard);
- }
-
- string = e_card_simple_get(e_minicard->simple, field);
- if (string && *string) {
- add_field(e_minicard, field, left_width);
- count++;
- }
- g_free(string);
- }
- }
-
- g_list_foreach(list, (GFunc) e_minicard_field_destroy, NULL);
- g_list_free(list);
- }
-}
-
-static void
-e_minicard_reflow( GnomeCanvasItem *item, int flags )
-{
- EMinicard *e_minicard = E_MINICARD(item);
- if ( GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED ) {
- GList *list;
- gdouble text_height;
- gint old_height;
-
- old_height = e_minicard->height;
-
- gtk_object_get( GTK_OBJECT( e_minicard->header_text ),
- "text_height", &text_height,
- NULL );
-
- e_minicard->height = text_height + 10.0;
-
- gnome_canvas_item_set( e_minicard->header_rect,
- "y2", text_height + 9.0,
- NULL );
-
- for(list = e_minicard->fields; list; list = g_list_next(list)) {
- EMinicardField *field = E_MINICARD_FIELD(list->data);
- GnomeCanvasItem *item = field->label;
- gtk_object_get (GTK_OBJECT(item),
- "height", &text_height,
- NULL);
- e_canvas_item_move_absolute(item, 2, e_minicard->height);
- e_minicard->height += text_height;
- }
- e_minicard->height += 2;
-
- gnome_canvas_item_set( e_minicard->rect,
- "y2", (double) e_minicard->height - 1,
- NULL );
-
- gnome_canvas_item_set( e_minicard->rect,
- "x2", (double) e_minicard->width - 1.0,
- "y2", (double) e_minicard->height - 1.0,
- NULL );
- gnome_canvas_item_set( e_minicard->header_rect,
- "x2", (double) e_minicard->width - 3.0,
- NULL );
-
- if (old_height != e_minicard->height)
- e_canvas_item_request_parent_reflow(item);
- }
-}
-
-char *
-e_minicard_get_card_id (EMinicard *minicard)
-{
- g_return_val_if_fail(minicard != NULL, NULL);
- g_return_val_if_fail(E_IS_MINICARD(minicard), NULL);
-
- if (minicard->card) {
- return e_card_get_id(minicard->card);
- } else {
- return "";
- }
-}
-
-int
-e_minicard_compare (EMinicard *minicard1, EMinicard *minicard2)
-{
- g_return_val_if_fail(minicard1 != NULL, 0);
- g_return_val_if_fail(E_IS_MINICARD(minicard1), 0);
- g_return_val_if_fail(minicard2 != NULL, 0);
- g_return_val_if_fail(E_IS_MINICARD(minicard2), 0);
-
- if (minicard1->card && minicard2->card) {
- char *file_as1, *file_as2;
- gtk_object_get(GTK_OBJECT(minicard1->card),
- "file_as", &file_as1,
- NULL);
- gtk_object_get(GTK_OBJECT(minicard2->card),
- "file_as", &file_as2,
- NULL);
- if (file_as1 && file_as2)
- return strcasecmp(file_as1, file_as2);
- if (file_as1)
- return -1;
- if (file_as2)
- return 1;
- return strcmp(e_minicard_get_card_id(minicard1), e_minicard_get_card_id(minicard2));
- } else {
- return 0;
- }
-}
diff --git a/addressbook/gui/minicard/e-minicard.h b/addressbook/gui/minicard/e-minicard.h
deleted file mode 100644
index 47da8110c2..0000000000
--- a/addressbook/gui/minicard/e-minicard.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-minicard.h
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifndef __E_MINICARD_H__
-#define __E_MINICARD_H__
-
-#include <gnome.h>
-#include <ebook/e-card.h>
-#include <ebook/e-card-simple.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* EMinicard - A small card displaying information about a contact.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- * width double RW width of the card
- * height double R height of the card
- * card ECard* RW Pointer to the ECard
- */
-
-#define E_MINICARD_TYPE (e_minicard_get_type ())
-#define E_MINICARD(obj) (GTK_CHECK_CAST ((obj), E_MINICARD_TYPE, EMinicard))
-#define E_MINICARD_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_MINICARD_TYPE, EMinicardClass))
-#define E_IS_MINICARD(obj) (GTK_CHECK_TYPE ((obj), E_MINICARD_TYPE))
-#define E_IS_MINICARD_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_MINICARD_TYPE))
-
-
-typedef struct _EMinicard EMinicard;
-typedef struct _EMinicardClass EMinicardClass;
-typedef enum _EMinicardFocusType EMinicardFocusType;
-
-enum _EMinicardFocusType {
- E_MINICARD_FOCUS_TYPE_START,
- E_MINICARD_FOCUS_TYPE_END
-};
-
-struct _EMinicard
-{
- GnomeCanvasGroup parent;
-
- /* item specific fields */
- ECard *card;
- ECardSimple *simple;
-
- GnomeCanvasItem *rect;
- GnomeCanvasItem *header_rect;
- GnomeCanvasItem *header_text;
-
- GList *fields; /* Of type EMinicardField */
- guint needs_remodeling : 1;
-
- gboolean has_focus;
-
- double width;
- double height;
-};
-
-struct _EMinicardClass
-{
- GnomeCanvasGroupClass parent_class;
-
- void (* resize) (EMinicard *minicard);
-};
-
-
-GtkType e_minicard_get_type (void);
-char *e_minicard_get_card_id (EMinicard *minicard);
-int e_minicard_compare (EMinicard *minicard1, EMinicard *minicard2);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_MINICARD_H__ */
diff --git a/addressbook/gui/minicard/e-reflow-sorted.c b/addressbook/gui/minicard/e-reflow-sorted.c
deleted file mode 100644
index 2d2dcee787..0000000000
--- a/addressbook/gui/minicard/e-reflow-sorted.c
+++ /dev/null
@@ -1,272 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-reflow-sorted.c
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <math.h>
-#include <gnome.h>
-#include "e-reflow-sorted.h"
-#include <e-util/e-canvas-utils.h>
-#include <e-util/e-canvas.h>
-#include <e-util/e-util.h>
-
-static void e_reflow_sorted_init (EReflowSorted *card);
-static void e_reflow_sorted_class_init (EReflowSortedClass *klass);
-static void e_reflow_sorted_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_reflow_sorted_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_reflow_sorted_add_item(EReflow *e_reflow, GnomeCanvasItem *item);
-
-#define E_REFLOW_DIVIDER_WIDTH 2
-#define E_REFLOW_BORDER_WIDTH 7
-#define E_REFLOW_FULL_GUTTER (E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH * 2)
-
-static EReflowClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_COMPARE_FUNC,
- ARG_STRING_FUNC
-};
-
-GtkType
-e_reflow_sorted_get_type (void)
-{
- static GtkType reflow_type = 0;
-
- if (!reflow_type)
- {
- static const GtkTypeInfo reflow_info =
- {
- "EReflowSorted",
- sizeof (EReflowSorted),
- sizeof (EReflowSortedClass),
- (GtkClassInitFunc) e_reflow_sorted_class_init,
- (GtkObjectInitFunc) e_reflow_sorted_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- reflow_type = gtk_type_unique (e_reflow_get_type (), &reflow_info);
- }
-
- return reflow_type;
-}
-
-static void
-e_reflow_sorted_class_init (EReflowSortedClass *klass)
-{
- GtkObjectClass *object_class;
- EReflowClass *reflow_class;
-
- object_class = (GtkObjectClass*) klass;
- reflow_class = E_REFLOW_CLASS (klass);
-
- parent_class = gtk_type_class (e_reflow_get_type ());
-
- gtk_object_add_arg_type ("EReflowSorted::compare_func", GTK_TYPE_POINTER,
- GTK_ARG_READWRITE, ARG_COMPARE_FUNC);
- gtk_object_add_arg_type ("EReflowSorted::string_func", GTK_TYPE_POINTER,
- GTK_ARG_READWRITE, ARG_STRING_FUNC);
-
- reflow_class->add_item = e_reflow_sorted_add_item;
-
- object_class->set_arg = e_reflow_sorted_set_arg;
- object_class->get_arg = e_reflow_sorted_get_arg;
-}
-
-static void
-e_reflow_sorted_init (EReflowSorted *reflow)
-{
- reflow->compare_func = NULL;
- reflow->string_func = NULL;
-}
-
-static void
-e_reflow_sorted_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- EReflowSorted *e_reflow_sorted;
-
- item = GNOME_CANVAS_ITEM (o);
- e_reflow_sorted = E_REFLOW_SORTED (o);
-
- switch (arg_id){
- case ARG_COMPARE_FUNC:
- e_reflow_sorted->compare_func = GTK_VALUE_POINTER (*arg);
- break;
- case ARG_STRING_FUNC:
- e_reflow_sorted->string_func = GTK_VALUE_POINTER (*arg);
- break;
- }
-}
-
-static void
-e_reflow_sorted_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EReflowSorted *e_reflow_sorted;
-
- e_reflow_sorted = E_REFLOW_SORTED (object);
-
- switch (arg_id) {
- case ARG_COMPARE_FUNC:
- GTK_VALUE_POINTER (*arg) = e_reflow_sorted->compare_func;
- break;
- case ARG_STRING_FUNC:
- GTK_VALUE_POINTER (*arg) = e_reflow_sorted->string_func;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static GList *
-e_reflow_sorted_get_list(EReflowSorted *e_reflow_sorted, const gchar *id)
-{
- if (e_reflow_sorted->string_func) {
- EReflow *reflow = E_REFLOW(e_reflow_sorted);
- GList *list;
- for (list = reflow->items; list; list = g_list_next(list)) {
- GnomeCanvasItem *item = list->data;
- char *string = e_reflow_sorted->string_func (item);
- if (string && !strcmp(string, id)) {
- return list;
- }
- }
- }
- return NULL;
-}
-
-void
-e_reflow_sorted_remove_item(EReflowSorted *e_reflow_sorted, const gchar *id)
-{
- GList *list;
- GnomeCanvasItem *item = NULL;
-
- list = e_reflow_sorted_get_list(e_reflow_sorted, id);
- if (list)
- item = list->data;
-
- if (item) {
- EReflow *reflow = E_REFLOW(e_reflow_sorted);
- reflow->items = g_list_remove_link(reflow->items, list);
- g_list_free_1(list);
- gtk_object_unref(GTK_OBJECT(item));
- gtk_object_destroy(GTK_OBJECT(item));
- if ( GTK_OBJECT_FLAGS( e_reflow_sorted ) & GNOME_CANVAS_ITEM_REALIZED ) {
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(e_reflow_sorted));
- e_reflow_post_add_item(E_REFLOW(e_reflow_sorted), NULL);
- }
- }
-}
-
-void
-e_reflow_sorted_replace_item(EReflowSorted *e_reflow_sorted, GnomeCanvasItem *item)
-{
- if (e_reflow_sorted->string_func) {
- char *string = e_reflow_sorted->string_func (item);
- e_reflow_sorted_remove_item(e_reflow_sorted, string);
- e_reflow_sorted_add_item(E_REFLOW(e_reflow_sorted), item);
- }
-}
-
-GnomeCanvasItem *
-e_reflow_sorted_get_item(EReflowSorted *e_reflow_sorted, const gchar *id)
-{
- GList *list;
- list = e_reflow_sorted_get_list(e_reflow_sorted, id);
- if (list)
- return list->data;
- else
- return NULL;
-}
-
-void
-e_reflow_sorted_reorder_item(EReflowSorted *e_reflow_sorted, const gchar *id)
-{
- GList *list;
- GnomeCanvasItem *item = NULL;
-
- list = e_reflow_sorted_get_list(e_reflow_sorted, id);
- if (list)
- item = list->data;
- if (item) {
- EReflow *reflow = E_REFLOW(e_reflow_sorted);
- reflow->items = g_list_remove_link(reflow->items, list);
- gtk_object_unref(GTK_OBJECT(item));
- g_list_free_1(list);
- e_reflow_sorted_add_item(reflow, item);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(e_reflow_sorted));
- }
-}
-
-static void
-e_reflow_sorted_add_item(EReflow *reflow, GnomeCanvasItem *item)
-{
- EReflowSorted *e_reflow_sorted = E_REFLOW_SORTED(reflow);
- if ( e_reflow_sorted->compare_func ) {
- reflow->items = g_list_insert_sorted(reflow->items, item, e_reflow_sorted->compare_func);
- gtk_object_ref(GTK_OBJECT(item));
-
- if ( GTK_OBJECT_FLAGS( e_reflow_sorted ) & GNOME_CANVAS_ITEM_REALIZED ) {
- gnome_canvas_item_set(item,
- "width", (double) reflow->column_width,
- NULL);
-
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(e_reflow_sorted));
- }
- }
- e_reflow_post_add_item(reflow, item);
-}
-
-void e_reflow_sorted_jump (EReflowSorted *sorted,
- GCompareFunc compare_func,
- void *value)
-{
- int columns = 0;
- EReflow *reflow = E_REFLOW(sorted);
- GList *list;
- GtkAdjustment *adjustment;
-
- for (list = reflow->columns; list; list = g_list_next(list)) {
- if (compare_func(((GList *)list->data)->data, value) >= 0) {
- GList *last = list->prev;
- if (last) {
- GList *walk;
- for (walk = last->data; walk != list->data; walk = g_list_next(walk)) {
- if (compare_func(walk->data, value) >= 0) {
- columns --;
- break;
- }
- }
- }
- adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(GNOME_CANVAS_ITEM(sorted)->canvas));
- gtk_adjustment_set_value(adjustment, (reflow->column_width + E_REFLOW_FULL_GUTTER) * columns);
- return;
- }
- columns ++;
- }
- columns --;
- adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(GNOME_CANVAS_ITEM(sorted)->canvas));
- gtk_adjustment_set_value(adjustment, (reflow->column_width + E_REFLOW_FULL_GUTTER) * columns);
-}
diff --git a/addressbook/gui/minicard/e-reflow-sorted.h b/addressbook/gui/minicard/e-reflow-sorted.h
deleted file mode 100644
index 1be4971fb2..0000000000
--- a/addressbook/gui/minicard/e-reflow-sorted.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-reflow-sorted.h
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifndef __E_REFLOW_SORTED_H__
-#define __E_REFLOW_SORTED_H__
-
-#include <addressbook/gui/minicard/e-reflow.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* EReflowSorted - A canvas item container.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- * 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_REFLOW_SORTED_TYPE (e_reflow_sorted_get_type ())
-#define E_REFLOW_SORTED(obj) (GTK_CHECK_CAST ((obj), E_REFLOW_SORTED_TYPE, EReflowSorted))
-#define E_REFLOW_SORTED_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_REFLOW_SORTED_TYPE, EReflowSortedClass))
-#define E_IS_REFLOW_SORTED(obj) (GTK_CHECK_TYPE ((obj), E_REFLOW_SORTED_TYPE))
-#define E_IS_REFLOW_SORTED_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_REFLOW_SORTED_TYPE))
-
-typedef char * (* EReflowStringFunc) (GnomeCanvasItem *);
-
-typedef struct _EReflowSorted EReflowSorted;
-typedef struct _EReflowSortedClass EReflowSortedClass;
-
-/* FIXME: Try reimplementing this as a hash table with key as string
- and change EReflow to use a GTree. */
-struct _EReflowSorted
-{
- EReflow parent;
-
- /* item specific fields */
- GCompareFunc compare_func;
- EReflowStringFunc string_func;
-};
-
-struct _EReflowSortedClass
-{
- EReflowClass parent_class;
-};
-
-/*
- * To be added to a reflow, an item must have the argument "width" as
- * a Read/Write argument and "height" as a Read Only argument. It
- * should also do an ECanvas parent reflow request if its size
- * changes.
- */
-void e_reflow_sorted_remove_item (EReflowSorted *sorted, const char *id);
-void e_reflow_sorted_replace_item (EReflowSorted *sorted, GnomeCanvasItem *item);
-void e_reflow_sorted_reorder_item (EReflowSorted *e_reflow_sorted, const gchar *id);
-GnomeCanvasItem *e_reflow_sorted_get_item (EReflowSorted *e_reflow_sorted, const gchar *id);
-GtkType e_reflow_sorted_get_type (void);
-void e_reflow_sorted_jump (EReflowSorted *sorted, GCompareFunc compare_func, void *value);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __E_REFLOW_SORTED_H__ */
diff --git a/addressbook/gui/minicard/e-reflow.c b/addressbook/gui/minicard/e-reflow.c
deleted file mode 100644
index 0e9c8b92b1..0000000000
--- a/addressbook/gui/minicard/e-reflow.c
+++ /dev/null
@@ -1,859 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-reflow.c
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <gnome.h>
-#include <math.h>
-#include "e-reflow.h"
-#include "e-text.h"
-#include <e-util/e-canvas-utils.h>
-#include <e-util/e-canvas.h>
-#include <e-util/e-util.h>
-
-static void e_reflow_init (EReflow *reflow);
-static void e_reflow_class_init (EReflowClass *klass);
-static void e_reflow_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_reflow_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_reflow_destroy (GtkObject *object);
-static gboolean e_reflow_event (GnomeCanvasItem *item, GdkEvent *event);
-static void e_reflow_realize (GnomeCanvasItem *item);
-static void e_reflow_unrealize (GnomeCanvasItem *item);
-static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
- int x, int y, int width, int height);
-static void e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gint flags);
-static double e_reflow_point (GnomeCanvasItem *item, double x, double y, int cx, int cy, GnomeCanvasItem **actual_item);
-static void e_reflow_reflow (GnomeCanvasItem *item, int flags);
-static void e_reflow_real_add_item(EReflow *e_reflow, GnomeCanvasItem *item);
-static void set_empty(EReflow *e_reflow);
-
-static void e_reflow_resize_children (GnomeCanvasItem *item);
-
-#define E_REFLOW_DIVIDER_WIDTH 2
-#define E_REFLOW_BORDER_WIDTH 7
-#define E_REFLOW_FULL_GUTTER (E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH * 2)
-
-static GnomeCanvasGroupClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_MINIMUM_WIDTH,
- ARG_WIDTH,
- ARG_HEIGHT,
- ARG_EMPTY_MESSAGE,
-};
-
-GtkType
-e_reflow_get_type (void)
-{
- static GtkType reflow_type = 0;
-
- if (!reflow_type)
- {
- static const GtkTypeInfo reflow_info =
- {
- "EReflow",
- sizeof (EReflow),
- sizeof (EReflowClass),
- (GtkClassInitFunc) e_reflow_class_init,
- (GtkObjectInitFunc) e_reflow_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- reflow_type = gtk_type_unique (gnome_canvas_group_get_type (), &reflow_info);
- }
-
- return reflow_type;
-}
-
-static void
-e_reflow_class_init (EReflowClass *klass)
-{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- object_class = (GtkObjectClass*) klass;
- item_class = (GnomeCanvasItemClass *) klass;
-
- parent_class = gtk_type_class (gnome_canvas_group_get_type ());
-
- gtk_object_add_arg_type ("EReflow::minimum_width", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH);
- gtk_object_add_arg_type ("EReflow::width", GTK_TYPE_DOUBLE,
- GTK_ARG_READABLE, ARG_WIDTH);
- gtk_object_add_arg_type ("EReflow::height", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_HEIGHT);
- gtk_object_add_arg_type ("EReflow::empty_message", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_EMPTY_MESSAGE);
-
- klass->add_item = e_reflow_real_add_item;
-
- object_class->set_arg = e_reflow_set_arg;
- object_class->get_arg = e_reflow_get_arg;
- object_class->destroy = e_reflow_destroy;
-
- /* GnomeCanvasItem method overrides */
- item_class->event = e_reflow_event;
- item_class->realize = e_reflow_realize;
- item_class->unrealize = e_reflow_unrealize;
- item_class->draw = e_reflow_draw;
- item_class->update = e_reflow_update;
- item_class->point = e_reflow_point;
-}
-
-static void
-e_reflow_init (EReflow *reflow)
-{
- reflow->items = NULL;
- reflow->columns = NULL;
- reflow->column_width = 150;
-
- reflow->minimum_width = 10;
- reflow->width = 10;
- reflow->height = 10;
- reflow->idle = 0;
-
- reflow->empty_message = NULL;
- reflow->empty_text = NULL;
-
- reflow->column_drag = FALSE;
-
- reflow->need_height_update = FALSE;
- reflow->need_column_resize = FALSE;
-
- reflow->default_cursor_shown = TRUE;
- reflow->arrow_cursor = NULL;
- reflow->default_cursor = NULL;
-
- e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(reflow), e_reflow_reflow);
-}
-
-static void
-e_reflow_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- EReflow *e_reflow;
-
- item = GNOME_CANVAS_ITEM (o);
- e_reflow = E_REFLOW (o);
-
- switch (arg_id){
- case ARG_HEIGHT:
- e_reflow->height = GTK_VALUE_DOUBLE (*arg);
- e_canvas_item_request_reflow(item);
- break;
- case ARG_MINIMUM_WIDTH:
- e_reflow->minimum_width = GTK_VALUE_DOUBLE (*arg);
- if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(o))
- set_empty(e_reflow);
- e_canvas_item_request_reflow(item);
- break;
- case ARG_EMPTY_MESSAGE:
- g_free(e_reflow->empty_message);
- e_reflow->empty_message = g_strdup(GTK_VALUE_STRING (*arg));
- if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(o))
- set_empty(e_reflow);
- }
-}
-
-static void
-e_reflow_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EReflow *e_reflow;
-
- e_reflow = E_REFLOW (object);
-
- switch (arg_id) {
- case ARG_MINIMUM_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = e_reflow->minimum_width;
- break;
- case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = e_reflow->width;
- break;
- case ARG_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = e_reflow->height;
- break;
- case ARG_EMPTY_MESSAGE:
- GTK_VALUE_STRING (*arg) = g_strdup(e_reflow->empty_message);
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-e_reflow_destroy (GtkObject *object)
-{
- EReflow *reflow = E_REFLOW(object);
-
- g_list_foreach(reflow->items, (GFunc) gtk_object_unref, NULL);
- g_list_free(reflow->items);
- reflow->items = NULL;
-
- g_free(reflow->empty_message);
-
- GTK_OBJECT_CLASS(parent_class)->destroy (object);
-}
-
-static void
-e_reflow_realize (GnomeCanvasItem *item)
-{
- EReflow *e_reflow;
- GnomeCanvasGroup *group;
- GList *list;
- GtkAdjustment *adjustment;
-
- e_reflow = E_REFLOW (item);
- group = GNOME_CANVAS_GROUP( item );
-
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize)
- (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item);
-
- e_reflow->arrow_cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW);
- e_reflow->default_cursor = gdk_cursor_new (GDK_LEFT_PTR);
-
- for(list = e_reflow->items; list; list = g_list_next(list)) {
- GnomeCanvasItem *item = GNOME_CANVAS_ITEM(list->data);
- gnome_canvas_item_set(item,
- "width", (double) e_reflow->column_width,
- NULL);
- }
-
- set_empty(e_reflow);
-
- e_canvas_item_request_reflow(item);
-
- adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
- adjustment->step_increment = (e_reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
- adjustment->page_increment = adjustment->page_size - adjustment->step_increment;
- gtk_adjustment_changed(adjustment);
-
- if (!item->canvas->aa) {
- }
-}
-
-static void
-e_reflow_unrealize (GnomeCanvasItem *item)
-{
- EReflow *e_reflow;
-
- e_reflow = E_REFLOW (item);
-
- if (!item->canvas->aa)
- {
- }
-
- gdk_cursor_destroy (e_reflow->arrow_cursor);
- gdk_cursor_destroy (e_reflow->default_cursor);
- e_reflow->arrow_cursor = NULL;
- e_reflow->default_cursor = NULL;
-
- g_list_free (e_reflow->columns);
- e_reflow->columns = NULL;
-
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize)
- (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item);
-}
-
-static gint
-e_reflow_pick_line (EReflow *e_reflow, double x)
-{
- x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
- x /= e_reflow->column_width + E_REFLOW_FULL_GUTTER;
- return x;
-}
-
-static gboolean
-e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- EReflow *e_reflow;
-
- e_reflow = E_REFLOW (item);
-
- switch( event->type )
- {
- case GDK_KEY_PRESS:
- if (event->key.keyval == GDK_Tab ||
- event->key.keyval == GDK_KP_Tab ||
- event->key.keyval == GDK_ISO_Left_Tab) {
- GList *list;
- for (list = e_reflow->items; list; list = list->next) {
- GnomeCanvasItem *item = GNOME_CANVAS_ITEM (list->data);
- EFocus has_focus;
- gtk_object_get(GTK_OBJECT(item),
- "has_focus", &has_focus,
- NULL);
- if (has_focus) {
- if (event->key.state & GDK_SHIFT_MASK)
- list = list->prev;
- else
- list = list->next;
- if (list) {
- item = GNOME_CANVAS_ITEM(list->data);
- gnome_canvas_item_set(item,
- "has_focus", (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START,
- NULL);
- return 1;
- } else {
- return 0;
- }
- }
- }
- }
- break;
- case GDK_BUTTON_PRESS:
- switch(event->button.button)
- {
- case 1:
- {
- GdkEventButton *button = (GdkEventButton *) event;
- double n_x, max_x;
- n_x = button->x;
- n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
- n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
-
- max_x = E_REFLOW_BORDER_WIDTH;
- max_x += (e_reflow->column_width + E_REFLOW_FULL_GUTTER) * e_reflow->column_count;
- if ( button->y >= E_REFLOW_BORDER_WIDTH && button->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > button->x ) {
- e_reflow->which_column_dragged = e_reflow_pick_line(e_reflow, button->x);
- e_reflow->start_x = e_reflow->which_column_dragged * (e_reflow->column_width + E_REFLOW_FULL_GUTTER) - E_REFLOW_DIVIDER_WIDTH / 2;
- e_reflow->temp_column_width = e_reflow->column_width;
- e_reflow->column_drag = TRUE;
-
- gnome_canvas_item_grab (item,
- GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK,
- e_reflow->arrow_cursor,
- button->time);
-
- e_reflow->previous_temp_column_width = -1;
- e_reflow->need_column_resize = TRUE;
- gnome_canvas_item_request_update(item);
- return TRUE;
- }
- }
- break;
- case 4:
- {
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
- gdouble new_value = adjustment->value;
- new_value -= adjustment->step_increment;
- gtk_adjustment_set_value(adjustment, new_value);
- }
- break;
- case 5:
- {
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
- gdouble new_value = adjustment->value;
- new_value += adjustment->step_increment;
- if ( new_value > adjustment->upper - adjustment->page_size )
- new_value = adjustment->upper - adjustment->page_size;
- gtk_adjustment_set_value(adjustment, new_value);
- }
- break;
- }
- break;
- case GDK_BUTTON_RELEASE:
- if (e_reflow->column_drag) {
- gdouble old_width = e_reflow->column_width;
- GdkEventButton *button = (GdkEventButton *) event;
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
- e_reflow->temp_column_width = e_reflow->column_width +
- (button->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value));
- if ( e_reflow->temp_column_width < 50 )
- e_reflow->temp_column_width = 50;
- e_reflow->column_drag = FALSE;
- if ( old_width != e_reflow->temp_column_width ) {
- gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(e_reflow, adjustment->value) * (e_reflow->temp_column_width - e_reflow->column_width));
- e_reflow->column_width = e_reflow->temp_column_width;
- adjustment->step_increment = (e_reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
- adjustment->page_increment = adjustment->page_size - adjustment->step_increment;
- gtk_adjustment_changed(adjustment);
- e_reflow_resize_children(item);
- e_canvas_item_request_reflow(item);
- }
- e_reflow->need_column_resize = TRUE;
- gnome_canvas_item_request_update(item);
- gnome_canvas_item_ungrab (item, button->time);
- return TRUE;
- }
- break;
- case GDK_MOTION_NOTIFY:
- if (e_reflow->column_drag) {
- double old_width = e_reflow->temp_column_width;
- GdkEventMotion *motion = (GdkEventMotion *) event;
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
- e_reflow->temp_column_width = e_reflow->column_width +
- (motion->x - e_reflow->start_x)/(e_reflow->which_column_dragged - e_reflow_pick_line(e_reflow, adjustment->value));
- if (e_reflow->temp_column_width < 50)
- e_reflow->temp_column_width = 50;
- if (old_width != e_reflow->temp_column_width) {
- e_reflow->need_column_resize = TRUE;
- gnome_canvas_item_request_update(item);
- }
- return TRUE;
- } else {
- GdkEventMotion *motion = (GdkEventMotion *) event;
- double n_x, max_x;
-
- n_x = motion->x;
- n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
- n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
-
- max_x = E_REFLOW_BORDER_WIDTH;
- max_x += (e_reflow->column_width + E_REFLOW_FULL_GUTTER) * e_reflow->column_count;
-
- if ( motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > motion->x) {
- if ( e_reflow->default_cursor_shown ) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
- e_reflow->default_cursor_shown = FALSE;
- }
- } else
- if ( ! e_reflow->default_cursor_shown ) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor);
- e_reflow->default_cursor_shown = TRUE;
- }
-
- }
- break;
- case GDK_ENTER_NOTIFY:
- if (!e_reflow->column_drag) {
- GdkEventCrossing *crossing = (GdkEventCrossing *) event;
- double n_x, max_x;
- n_x = crossing->x;
- n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
- n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
-
- max_x = E_REFLOW_BORDER_WIDTH;
- max_x += (e_reflow->column_width + E_REFLOW_FULL_GUTTER) * e_reflow->column_count;
- if ( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > crossing->x) {
- if ( e_reflow->default_cursor_shown ) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->arrow_cursor);
- e_reflow->default_cursor_shown = FALSE;
- }
- }
- }
- break;
- case GDK_LEAVE_NOTIFY:
- if (!e_reflow->column_drag) {
- GdkEventCrossing *crossing = (GdkEventCrossing *) event;
- double n_x;
- n_x = crossing->x;
- n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
- n_x = fmod(n_x,(e_reflow->column_width + E_REFLOW_FULL_GUTTER));
- if ( !( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= e_reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) ) {
- if ( ! e_reflow->default_cursor_shown ) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, e_reflow->default_cursor);
- e_reflow->default_cursor_shown = 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_reflow_real_add_item(EReflow *e_reflow, GnomeCanvasItem *item)
-{
- e_reflow->items = g_list_append(e_reflow->items, item);
- gtk_object_ref(GTK_OBJECT(item));
- if ( GTK_OBJECT_FLAGS( e_reflow ) & GNOME_CANVAS_ITEM_REALIZED ) {
- gnome_canvas_item_set(item,
- "width", (double) e_reflow->column_width,
- NULL);
- e_reflow_post_add_item(e_reflow, item);
- e_canvas_item_request_reflow(item);
- }
-
-}
-
-static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
- int x, int y, int width, int height)
-{
- int x_rect, y_rect, width_rect, height_rect;
- gdouble running_width;
- EReflow *e_reflow = E_REFLOW(item);
- int i;
- double column_width;
-
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->draw)
- GNOME_CANVAS_ITEM_CLASS(parent_class)->draw (item, drawable, x, y, width, height);
- column_width = e_reflow->column_width;
- running_width = E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
- x_rect = running_width;
- y_rect = E_REFLOW_BORDER_WIDTH;
- width_rect = E_REFLOW_DIVIDER_WIDTH;
- height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
-
- /* Compute first column to draw. */
- i = x;
- i /= column_width + E_REFLOW_FULL_GUTTER;
- running_width += i * (column_width + E_REFLOW_FULL_GUTTER);
-
- for ( ; i < e_reflow->column_count; i++) {
- if ( running_width > x + width )
- break;
- x_rect = running_width;
- gtk_paint_flat_box(GTK_WIDGET(item->canvas)->style,
- drawable,
- GTK_STATE_ACTIVE,
- GTK_SHADOW_NONE,
- NULL,
- GTK_WIDGET(item->canvas),
- "reflow",
- x_rect - x,
- y_rect - y,
- width_rect,
- height_rect);
- running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
- }
- if (e_reflow->column_drag) {
- int start_line = e_reflow_pick_line(e_reflow,
- gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value);
- i = x - start_line * (column_width + E_REFLOW_FULL_GUTTER);
- running_width = start_line * (column_width + E_REFLOW_FULL_GUTTER);
- column_width = e_reflow->temp_column_width;
- running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
- i += start_line * (column_width + E_REFLOW_FULL_GUTTER);
- running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
- x_rect = running_width;
- y_rect = E_REFLOW_BORDER_WIDTH;
- width_rect = E_REFLOW_DIVIDER_WIDTH;
- height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
-
- /* Compute first column to draw. */
- i /= column_width + E_REFLOW_FULL_GUTTER;
- running_width += i * (column_width + E_REFLOW_FULL_GUTTER);
-
- for ( ; i < e_reflow->column_count; i++) {
- if ( running_width > x + width )
- break;
- x_rect = running_width;
- gdk_draw_rectangle(drawable,
- GTK_WIDGET(item->canvas)->style->fg_gc[GTK_STATE_NORMAL],
- TRUE,
- x_rect - x,
- y_rect - y,
- width_rect - 1,
- height_rect - 1);
- running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
- }
- }
-}
-
-static void
-e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *clip_path, gint flags)
-{
- EReflow *e_reflow;
- double x0, x1, y0, y1;
-
- e_reflow = E_REFLOW (item);
-
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->update)
- GNOME_CANVAS_ITEM_CLASS(parent_class)->update (item, affine, clip_path, flags);
-
- x0 = item->x1;
- y0 = item->y1;
- x1 = item->x2;
- y1 = item->y2;
- if ( x1 < x0 + e_reflow->width )
- x1 = x0 + e_reflow->width;
- if ( y1 < y0 + e_reflow->height )
- y1 = y0 + e_reflow->height;
- item->x2 = x1;
- item->y2 = y1;
-
- if (e_reflow->need_height_update) {
- x0 = item->x1;
- y0 = item->y1;
- x1 = item->x2;
- y1 = item->y2;
- if ( x0 > 0 )
- x0 = 0;
- if ( y0 > 0 )
- y0 = 0;
- if ( x1 < E_REFLOW(item)->width )
- x1 = E_REFLOW(item)->width;
- if ( x1 < E_REFLOW(item)->height )
- x1 = E_REFLOW(item)->height;
-
- gnome_canvas_request_redraw(item->canvas, x0, y0, x1, y1);
- e_reflow->need_height_update = FALSE;
- } else if (e_reflow->need_column_resize) {
- int x_rect, y_rect, width_rect, height_rect;
- int start_line = e_reflow_pick_line(e_reflow,
- gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value);
- gdouble running_width;
- int i;
- double column_width;
-
- if ( e_reflow->previous_temp_column_width != -1 ) {
- running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER);
- column_width = e_reflow->previous_temp_column_width;
- running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
- running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
- y_rect = E_REFLOW_BORDER_WIDTH;
- width_rect = E_REFLOW_DIVIDER_WIDTH;
- height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
-
- for ( i = 0; i < e_reflow->column_count; i++) {
- x_rect = running_width;
- gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
- running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
- }
- }
-
- if ( e_reflow->temp_column_width != -1 ) {
- running_width = start_line * (e_reflow->column_width + E_REFLOW_FULL_GUTTER);
- column_width = e_reflow->temp_column_width;
- running_width -= start_line * (column_width + E_REFLOW_FULL_GUTTER);
- running_width += E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
- y_rect = E_REFLOW_BORDER_WIDTH;
- width_rect = E_REFLOW_DIVIDER_WIDTH;
- height_rect = e_reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
-
- for ( i = 0; i < e_reflow->column_count; i++) {
- x_rect = running_width;
- gnome_canvas_request_redraw(item->canvas, x_rect, y_rect, x_rect + width_rect, y_rect + height_rect);
- running_width += E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH + column_width + E_REFLOW_BORDER_WIDTH;
- }
- }
-
- e_reflow->previous_temp_column_width = e_reflow->temp_column_width;
- e_reflow->need_column_resize = FALSE;
- }
-}
-
-static void
-e_reflow_resize_children (GnomeCanvasItem *item)
-{
- GList *list;
- EReflow *e_reflow;
-
- e_reflow = E_REFLOW (item);
- for ( list = e_reflow->items; list; list = list->next ) {
- GnomeCanvasItem *child = GNOME_CANVAS_ITEM(list->data);
- gnome_canvas_item_set(child,
- "width", (double) e_reflow->column_width,
- NULL);
- }
-}
-
-static double
-e_reflow_point (GnomeCanvasItem *item,
- double x, double y, int cx, int cy,
- GnomeCanvasItem **actual_item)
-{
- double distance = 1;
-
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->point)
- distance = GNOME_CANVAS_ITEM_CLASS(parent_class)->point (item, x, y, cx, cy, actual_item);
- if (*actual_item)
- return 0;
-
- *actual_item = item;
- return 0;
-#if 0
- if (y >= E_REFLOW_BORDER_WIDTH && y <= e_reflow->height - E_REFLOW_BORDER_WIDTH) {
- float n_x;
- n_x = x;
- n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
- n_x = fmod(n_x, (e_reflow->column_width + E_REFLOW_FULL_GUTTER));
- if (n_x < E_REFLOW_FULL_GUTTER) {
- *actual_item = item;
- return 0;
- }
- }
- return distance;
-#endif
-}
-
-static void
-_reflow( EReflow *e_reflow )
-{
- gdouble running_height;
- GList *list;
- double item_height;
-
- if (e_reflow->columns) {
- g_list_free (e_reflow->columns);
- e_reflow->columns = NULL;
- }
-
- e_reflow->column_count = 0;
-
- if (e_reflow->items == NULL) {
- e_reflow->columns = NULL;
- e_reflow->column_count = 0;
- return;
- }
-
- list = e_reflow->items;
-
- gtk_object_get (GTK_OBJECT(list->data),
- "height", &item_height,
- NULL);
- running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH;
- e_reflow->columns = g_list_append (e_reflow->columns, list);
- e_reflow->column_count = 1;
-
- list = g_list_next(list);
-
- for ( ; list; list = g_list_next(list)) {
- gtk_object_get (GTK_OBJECT(list->data),
- "height", &item_height,
- NULL);
- if (running_height + item_height + E_REFLOW_BORDER_WIDTH > e_reflow->height) {
- running_height = E_REFLOW_BORDER_WIDTH + item_height + E_REFLOW_BORDER_WIDTH;
- e_reflow->columns = g_list_append (e_reflow->columns, list);
- e_reflow->column_count ++;
- } else {
- running_height += item_height + E_REFLOW_BORDER_WIDTH;
- }
- }
-}
-
-static void
-set_empty(EReflow *e_reflow)
-{
- if (e_reflow->items == NULL) {
- if (e_reflow->empty_text) {
- if (e_reflow->empty_message) {
- gnome_canvas_item_set(e_reflow->empty_text,
- "width", e_reflow->minimum_width,
- "text", e_reflow->empty_message,
- NULL);
- e_canvas_item_move_absolute(e_reflow->empty_text,
- e_reflow->minimum_width / 2,
- 0);
- } else {
- gtk_object_destroy(GTK_OBJECT(e_reflow->empty_text));
- e_reflow->empty_text = NULL;
- }
- } else {
- if (e_reflow->empty_message)
- e_reflow->empty_text =
- gnome_canvas_item_new(GNOME_CANVAS_GROUP(e_reflow),
- e_text_get_type(),
- "anchor", GTK_ANCHOR_N,
- "width", e_reflow->minimum_width,
- "clip", TRUE,
- "use_ellipsis", TRUE,
- "font_gdk", GTK_WIDGET(GNOME_CANVAS_ITEM(e_reflow)->canvas)->style->font,
- "fill_color", "black",
- "justification", GTK_JUSTIFY_CENTER,
- "text", e_reflow->empty_message,
- NULL);
- e_canvas_item_move_absolute(e_reflow->empty_text,
- e_reflow->minimum_width / 2,
- 0);
- }
- } else {
- if (e_reflow->empty_text) {
- gtk_object_destroy(GTK_OBJECT(e_reflow->empty_text));
- e_reflow->empty_text = NULL;
- }
- }
-}
-
-static void
-e_reflow_reflow( GnomeCanvasItem *item, int flags )
-{
- EReflow *e_reflow = E_REFLOW(item);
- if ( GTK_OBJECT_FLAGS( e_reflow ) & GNOME_CANVAS_ITEM_REALIZED ) {
-
- gdouble old_width;
- gdouble running_width;
-
- _reflow (e_reflow);
-
- old_width = e_reflow->width;
-
- running_width = E_REFLOW_BORDER_WIDTH;
-
- if (e_reflow->items == NULL) {
- } else {
- GList *list;
- GList *next_column;
- gdouble item_height;
- gdouble running_height;
-
- running_height = E_REFLOW_BORDER_WIDTH;
-
- list = e_reflow->items;
- gtk_object_get (GTK_OBJECT(list->data),
- "height", &item_height,
- NULL);
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
- (double) running_width,
- (double) running_height);
- running_height += item_height + E_REFLOW_BORDER_WIDTH;
- next_column = g_list_next(e_reflow->columns);
- list = g_list_next(list);
-
- for( ; list; list = g_list_next(list)) {
- gtk_object_get (GTK_OBJECT(list->data),
- "height", &item_height,
- NULL);
-
- if (next_column && (next_column->data == list)) {
- next_column = g_list_next (next_column);
- running_height = E_REFLOW_BORDER_WIDTH;
- running_width += e_reflow->column_width + E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH + E_REFLOW_BORDER_WIDTH;
- }
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
- (double) running_width,
- (double) running_height);
-
- running_height += item_height + E_REFLOW_BORDER_WIDTH;
- }
-
- }
- e_reflow->width = running_width + e_reflow->column_width + E_REFLOW_BORDER_WIDTH;
- if ( e_reflow->width < e_reflow->minimum_width )
- e_reflow->width = e_reflow->minimum_width;
- if (old_width != e_reflow->width)
- e_canvas_item_request_parent_reflow(item);
- }
-}
-
-void
-e_reflow_add_item(EReflow *e_reflow, GnomeCanvasItem *item)
-{
- if (E_REFLOW_CLASS(GTK_OBJECT(e_reflow)->klass)->add_item)
- (E_REFLOW_CLASS(GTK_OBJECT(e_reflow)->klass)->add_item) (e_reflow, item);
-}
-
-void
-e_reflow_post_add_item(EReflow *e_reflow, GnomeCanvasItem *item)
-{
- set_empty(e_reflow);
-}
diff --git a/addressbook/gui/minicard/e-reflow.h b/addressbook/gui/minicard/e-reflow.h
deleted file mode 100644
index eb66b094a5..0000000000
--- a/addressbook/gui/minicard/e-reflow.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* e-reflow.h
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#ifndef __E_REFLOW_H__
-#define __E_REFLOW_H__
-
-#include <gnome.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* EReflow - A canvas item container.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- * 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_REFLOW_TYPE (e_reflow_get_type ())
-#define E_REFLOW(obj) (GTK_CHECK_CAST ((obj), E_REFLOW_TYPE, EReflow))
-#define E_REFLOW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_REFLOW_TYPE, EReflowClass))
-#define E_IS_REFLOW(obj) (GTK_CHECK_TYPE ((obj), E_REFLOW_TYPE))
-#define E_IS_REFLOW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_REFLOW_TYPE))
-
-
-typedef struct _EReflow EReflow;
-typedef struct _EReflowClass EReflowClass;
-
-struct _EReflow
-{
- GnomeCanvasGroup parent;
-
- /* item specific fields */
- GList *items; /* Of type GnomeCanvasItem */
- GList *columns; /* Of type GList of type GnomeCanvasItem (points into items) */
- gint column_count; /* Number of columnns */
-
- GnomeCanvasItem *empty_text;
- gchar *empty_message;
-
- double minimum_width;
- double width;
- double height;
-
- double column_width;
-
- int idle;
-
- /* These are all for when the column is being dragged. */
- gboolean column_drag;
- gdouble start_x;
- gint which_column_dragged;
- double temp_column_width;
- double previous_temp_column_width;
-
- guint need_height_update : 1;
- guint need_column_resize : 1;
-
- guint default_cursor_shown : 1;
- GdkCursor *arrow_cursor;
- GdkCursor *default_cursor;
-};
-
-struct _EReflowClass
-{
- GnomeCanvasGroupClass parent_class;
-
- /* Virtual methods. */
- void (* add_item) (EReflow *reflow, GnomeCanvasItem *item);
-};
-
-/*
- * To be added to a reflow, an item must have the argument "width" as
- * a Read/Write argument and "height" as a Read Only argument. It
- * should also do an ECanvas parent reflow request if its size
- * changes.
- */
-void e_reflow_add_item(EReflow *e_reflow, GnomeCanvasItem *item);
-GtkType e_reflow_get_type (void);
-
-/* Internal usage only: */
-void e_reflow_post_add_item(EReflow *e_reflow, GnomeCanvasItem *item);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_REFLOW_H__ */
diff --git a/addressbook/gui/minicard/test-minicard-label.c b/addressbook/gui/minicard/test-minicard-label.c
deleted file mode 100644
index 57bc69222a..0000000000
--- a/addressbook/gui/minicard/test-minicard-label.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* test-minicard-label.c
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-
-
-#include "config.h"
-
-#include <gnome.h>
-#include "e-minicard-label.h"
-#include <e-util/e-canvas.h>
-
-/* This is a horrible thing to do, but it is just a test. */
-GnomeCanvasItem *label;
-GnomeCanvasItem *rect;
-
-static void destroy_callback(GtkWidget *app, gpointer data)
-{
- exit(0);
-}
-
-static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data)
-{
- gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, allocation->height );
- gnome_canvas_item_set( label,
- "width", (double) allocation->width,
- "height", (double) allocation->height,
- NULL );
- gnome_canvas_item_set( rect,
- "x2", (double) allocation->width,
- "y2", (double) allocation->height,
- NULL );
-}
-
-#if 0
-static void about_callback( GtkWidget *widget, gpointer data )
-{
-
- const gchar *authors[] =
- {
- "Christopher James Lahey <clahey@umich.edu>",
- NULL
- };
-
- GtkWidget *about =
- gnome_about_new ( _( "Minicard Label Test" ), VERSION,
- _( "Copyright (C) 2000, Helix Code, Inc." ),
- authors,
- _( "This should test the minicard label canvas item" ),
- NULL);
- gtk_widget_show (about);
-}
-#endif
-
-static void button_press_callback( GtkWidget *widget, gpointer data )
-{
- gnome_canvas_item_grab_focus( label );
-}
-
-int main( int argc, char *argv[] )
-{
- GtkWidget *app;
- GtkWidget *canvas;
-
- /* bindtextdomain (PACKAGE, GNOMELOCALEDIR);
- textdomain (PACKAGE);*/
-
- gnome_init( "Minicard Label Test", VERSION, argc, argv);
- app = gnome_app_new("Minicard Label Test", NULL);
-
- canvas = e_canvas_new();
- rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) 100,
- "y2", (double) 100,
- "fill_color", "white",
- NULL );
- label = e_minicard_label_new(gnome_canvas_root( GNOME_CANVAS( canvas ) ));
- gnome_canvas_item_set( label,
- "width", (double) 100,
- "height", (double) 100,
- "fieldname", "Full Name:",
- "field", "Christopher James Lahey",
- NULL );
- gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ),
- 0, 0,
- 100, 100 );
-
- gnome_app_set_contents( GNOME_APP( app ), canvas );
-
-
- /* Connect the signals */
- gtk_signal_connect( GTK_OBJECT( app ), "destroy",
- GTK_SIGNAL_FUNC( destroy_callback ),
- ( gpointer ) app );
-
- gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate",
- GTK_SIGNAL_FUNC( allocate_callback ),
- ( gpointer ) app );
-
- gtk_signal_connect( GTK_OBJECT( canvas ), "button_press_event",
- GTK_SIGNAL_FUNC( button_press_callback ),
- ( gpointer ) app );
-
- gtk_widget_show_all( app );
-
- gtk_main();
-
- /* Not reached. */
- return 0;
-}
diff --git a/addressbook/gui/minicard/test-minicard-view.c b/addressbook/gui/minicard/test-minicard-view.c
deleted file mode 100644
index c03d11d07e..0000000000
--- a/addressbook/gui/minicard/test-minicard-view.c
+++ /dev/null
@@ -1,206 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* test-reflow.c
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#include "config.h"
-
-#include <gnome.h>
-#include <libgnorba/gnorba.h>
-#include <bonobo.h>
-#include <e-util/e-canvas.h>
-#include "e-minicard-view.h"
-
-/* This is a horrible thing to do, but it is just a test. */
-GnomeCanvasItem *reflow;
-GnomeCanvasItem *rect;
-GtkAllocation last_alloc;
-
-CORBA_Environment ev;
-CORBA_ORB orb;
-
-static void
-init_bonobo (int argc, char **argv)
-{
-
- gnome_CORBA_init_with_popt_table (
- "Reflow Test", VERSION,
- &argc, argv, NULL, 0, NULL, GNORBA_INIT_SERVER_FUNC, &ev);
-
- orb = gnome_CORBA_ORB ();
-
- if (bonobo_init (orb, NULL, NULL) == FALSE)
- g_error (_("Could not initialize Bonobo"));
-
-}
-
-static void destroy_callback(GtkWidget *app, gpointer data)
-{
- exit(0);
-}
-
-static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data)
-{
- double width;
- last_alloc = *allocation;
- gnome_canvas_item_set( reflow,
- "height", (double) allocation->height,
- NULL );
- gnome_canvas_item_set( reflow,
- "minimum_width", (double) allocation->width,
- NULL );
- gtk_object_get(GTK_OBJECT(reflow),
- "width", &width,
- NULL);
- width = MAX(width, allocation->width);
- gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, width, allocation->height );
- gnome_canvas_item_set( rect,
- "x2", (double) width,
- "y2", (double) allocation->height,
- NULL );
-}
-
-static void resize(GnomeCanvas *canvas, gpointer data)
-{
- double width;
- gtk_object_get(GTK_OBJECT(reflow),
- "width", &width,
- NULL);
- width = MAX(width, last_alloc.width);
- gnome_canvas_set_scroll_region(canvas , 0, 0, width, last_alloc.height );
- gnome_canvas_item_set( rect,
- "x2", (double) width,
- "y2", (double) last_alloc.height,
- NULL );
-}
-
-#if 0
-static void about_callback( GtkWidget *widget, gpointer data )
-{
-
- const gchar *authors[] =
- {
- "Christopher James Lahey <clahey@umich.edu>",
- NULL
- };
-
- GtkWidget *about =
- gnome_about_new ( _( "Reflow Test" ), VERSION,
- _( "Copyright (C) 2000, Helix Code, Inc." ),
- authors,
- _( "This should test the reflow canvas item" ),
- NULL);
- gtk_widget_show (about);
-}
-#endif
-
-static void
-book_open_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- if (status == E_BOOK_STATUS_SUCCESS)
- gnome_canvas_item_set(reflow,
- "book", book,
- NULL);
-}
-
-static guint
-ebook_create (void)
-{
- EBook *book;
-
- book = e_book_new ();
-
- if (!book) {
- printf ("%s: %s(): Couldn't create EBook, bailing.\n",
- __FILE__,
- __FUNCTION__);
- return FALSE;
- }
-
-
- if (! e_book_load_uri (book, "file:/tmp/test.db", book_open_cb, NULL)) {
- printf ("error calling load_uri!\n");
- }
-
-
- return FALSE;
-}
-
-int main( int argc, char *argv[] )
-{
- GtkWidget *app;
- GtkWidget *canvas;
- GtkWidget *vbox;
- GtkWidget *scrollbar;
-
- /* bindtextdomain (PACKAGE, GNOMELOCALEDIR);
- textdomain (PACKAGE);*/
-
- CORBA_exception_init (&ev);
- init_bonobo (argc, argv);
-
- app = gnome_app_new("Reflow Test", NULL);
-
- vbox = gtk_vbox_new(FALSE, 0);
-
- canvas = e_canvas_new();
- rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) 100,
- "y2", (double) 100,
- "fill_color", "white",
- NULL );
- reflow = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ),
- e_minicard_view_get_type(),
- "height", (double) 100,
- "minimum_width", (double) 100,
- NULL );
- gtk_signal_connect( GTK_OBJECT( canvas ), "reflow",
- GTK_SIGNAL_FUNC( resize ),
- ( gpointer ) app);
-
- gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ),
- 0, 0,
- 100, 100 );
-
- gtk_box_pack_start(GTK_BOX(vbox), canvas, TRUE, TRUE, 0);
-
- scrollbar = gtk_hscrollbar_new(gtk_layout_get_hadjustment(GTK_LAYOUT(canvas)));
-
- gtk_box_pack_start(GTK_BOX(vbox), scrollbar, FALSE, FALSE, 0);
-
- gnome_app_set_contents( GNOME_APP( app ), vbox );
-
- /* Connect the signals */
- gtk_signal_connect( GTK_OBJECT( app ), "destroy",
- GTK_SIGNAL_FUNC( destroy_callback ),
- ( gpointer ) app );
-
- gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate",
- GTK_SIGNAL_FUNC( allocate_callback ),
- ( gpointer ) app );
-
- gtk_widget_show_all( app );
- gdk_window_set_back_pixmap( GTK_LAYOUT(canvas)->bin_window, NULL, FALSE);
-
- gtk_idle_add ((GtkFunction) ebook_create, NULL);
-
- bonobo_main ();
-
- /* Not reached. */
- return 0;
-}
diff --git a/addressbook/gui/minicard/test-minicard.c b/addressbook/gui/minicard/test-minicard.c
deleted file mode 100644
index e16ca675b3..0000000000
--- a/addressbook/gui/minicard/test-minicard.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* test-minicard.c
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-
-
-#include "config.h"
-
-#include <gnome.h>
-#include "e-minicard.h"
-
-/* This is a horrible thing to do, but it is just a test. */
-GnomeCanvasItem *card;
-GnomeCanvasItem *rect;
-
-static void destroy_callback(GtkWidget *app, gpointer data)
-{
- exit(0);
-}
-
-static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data)
-{
- gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, allocation->height );
- gnome_canvas_item_set( card,
- "width", (double) allocation->width,
- NULL );
- gnome_canvas_item_set( rect,
- "x2", (double) allocation->width,
- "y2", (double) allocation->height,
- NULL );
-}
-
-#if 0
-static void about_callback( GtkWidget *widget, gpointer data )
-{
-
- const gchar *authors[] =
- {
- "Christopher James Lahey <clahey@umich.edu>",
- NULL
- };
-
- GtkWidget *about =
- gnome_about_new ( _( "Minicard Test" ), VERSION,
- _( "Copyright (C) 2000, Helix Code, Inc." ),
- authors,
- _( "This should test the minicard canvas item" ),
- NULL);
- gtk_widget_show (about);
-}
-#endif
-
-int main( int argc, char *argv[] )
-{
- GtkWidget *app;
- GtkWidget *canvas;
- int i;
-
- /* bindtextdomain (PACKAGE, GNOMELOCALEDIR);
- textdomain (PACKAGE);*/
-
- gnome_init( "Minicard Test", VERSION, argc, argv);
- app = gnome_app_new("Minicard Test", NULL);
-
- canvas = gnome_canvas_new();
- rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) 100,
- "y2", (double) 100,
- "fill_color", "white",
- NULL );
- for ( i = 0; i < 1; i++ )
- {
- card = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ),
- e_minicard_get_type(),
- "width", (double) 100,
- NULL );
- }
- gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ),
- 0, 0,
- 100, 100 );
-
- gnome_app_set_contents( GNOME_APP( app ), canvas );
-
- /* Connect the signals */
- gtk_signal_connect( GTK_OBJECT( app ), "destroy",
- GTK_SIGNAL_FUNC( destroy_callback ),
- ( gpointer ) app );
-
- gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate",
- GTK_SIGNAL_FUNC( allocate_callback ),
- ( gpointer ) app );
-
- gtk_widget_show_all( app );
-
- gtk_main();
-
- /* Not reached. */
- return 0;
-}
diff --git a/addressbook/gui/minicard/test-reflow.c b/addressbook/gui/minicard/test-reflow.c
deleted file mode 100644
index 8013c428d5..0000000000
--- a/addressbook/gui/minicard/test-reflow.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* test-reflow.c
- *
- * Copyright (C) 2000 Helix Code, Inc.
- * Author: Chris Lahey <clahey@helixcode.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-
-#define TEST_VCARD \
-"BEGIN:VCARD
-" \
-"FN:Nat
-" \
-"N:Friedman;Nat;D;Mr.
-" \
-"TITLE:Head Geek
-" \
-"BDAY:1977-08-06
-" \
-"TEL;WORK:617 679 1984
-" \
-"TEL;CELL:123 456 7890
-" \
-"EMAIL;INTERNET:nat@nat.org
-" \
-"EMAIL;INTERNET:nat@helixcode.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 <gnome.h>
-#include <e-util/e-canvas.h>
-#include "e-reflow.h"
-#include "e-minicard.h"
-#include "e-scroll-frame.h"
-
-/* This is a horrible thing to do, but it is just a test. */
-GnomeCanvasItem *reflow;
-GnomeCanvasItem *rect;
-GtkAllocation last_alloc;
-
-static void destroy_callback(GtkWidget *app, gpointer data)
-{
- exit(0);
-}
-
-static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data)
-{
- double width;
- last_alloc = *allocation;
- gnome_canvas_item_set( reflow,
- "height", (double) allocation->height,
- NULL );
- gnome_canvas_item_set( reflow,
- "minimum_width", (double) allocation->width,
- NULL );
- gtk_object_get(GTK_OBJECT(reflow),
- "width", &width,
- NULL);
- width = MAX(width, allocation->width);
- gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, width - 1, allocation->height - 1);
- gnome_canvas_item_set( rect,
- "x2", (double) width,
- "y2", (double) allocation->height,
- NULL );
-}
-
-static void resize(GnomeCanvas *canvas, gpointer data)
-{
- double width;
- gtk_object_get(GTK_OBJECT(reflow),
- "width", &width,
- NULL);
- width = MAX(width, last_alloc.width);
- gnome_canvas_set_scroll_region(canvas , 0, 0, width - 1, last_alloc.height - 1);
- gnome_canvas_item_set( rect,
- "x2", (double) width,
- "y2", (double) last_alloc.height,
- NULL );
-}
-
-#if 0
-static void about_callback( GtkWidget *widget, gpointer data )
-{
-
- const gchar *authors[] =
- {
- "Christopher James Lahey <clahey@umich.edu>",
- NULL
- };
-
- GtkWidget *about =
- gnome_about_new ( _( "Reflow Test" ), VERSION,
- _( "Copyright (C) 2000, Helix Code, Inc." ),
- authors,
- _( "This should test the reflow canvas item" ),
- NULL);
- gtk_widget_show (about);
-}
-#endif
-
-int main( int argc, char *argv[] )
-{
- GtkWidget *app;
- GtkWidget *canvas;
- GtkWidget *vbox;
- GtkWidget *scrollframe;
- int i;
-
- /* bindtextdomain (PACKAGE, GNOMELOCALEDIR);
- textdomain (PACKAGE);*/
-
- gnome_init( "Reflow Test", VERSION, argc, argv);
- app = gnome_app_new("Reflow Test", NULL);
-
- vbox = gtk_vbox_new(FALSE, 0);
-
- canvas = e_canvas_new();
- rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) 100,
- "y2", (double) 100,
- "fill_color", "white",
- NULL );
- reflow = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ),
- e_reflow_get_type(),
- "height", (double) 100,
- "minimum_width", (double) 100,
- NULL );
- gtk_signal_connect( GTK_OBJECT( canvas ), "reflow",
- GTK_SIGNAL_FUNC( resize ),
- ( gpointer ) app);
- for ( i = 0; i < 200; i++ )
- {
- GnomeCanvasItem *item;
- ECard *card = e_card_new (TEST_VCARD);
- item = gnome_canvas_item_new( GNOME_CANVAS_GROUP(reflow),
- e_minicard_get_type(),
- "card", card,
- NULL);
- e_reflow_add_item(E_REFLOW(reflow), item);
- }
- gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ),
- 0, 0,
- 100, 100 );
-
- scrollframe = e_scroll_frame_new (gtk_layout_get_hadjustment(GTK_LAYOUT(canvas)),
- gtk_layout_get_vadjustment(GTK_LAYOUT(canvas)));
- e_scroll_frame_set_policy (E_SCROLL_FRAME (scrollframe),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_NEVER);
-
- gtk_container_add (GTK_CONTAINER (scrollframe), canvas);
-
- gnome_app_set_contents( GNOME_APP( app ), scrollframe );
-
- /* Connect the signals */
- gtk_signal_connect( GTK_OBJECT( app ), "destroy",
- GTK_SIGNAL_FUNC( destroy_callback ),
- ( gpointer ) app );
-
- gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate",
- GTK_SIGNAL_FUNC( allocate_callback ),
- ( gpointer ) app );
-
- gtk_widget_show_all( app );
- gdk_window_set_back_pixmap( GTK_LAYOUT(canvas)->bin_window, NULL, FALSE);
-
- gtk_main();
-
- /* Not reached. */
- return 0;
-}
diff --git a/addressbook/gui/minicard/.cvsignore b/addressbook/gui/widgets/.cvsignore
index 472fd2593f..472fd2593f 100644
--- a/addressbook/gui/minicard/.cvsignore
+++ b/addressbook/gui/widgets/.cvsignore
diff --git a/addressbook/gui/widgets/Makefile.am b/addressbook/gui/widgets/Makefile.am
index 9c1e459fd7..15b98e152c 100644
--- a/addressbook/gui/widgets/Makefile.am
+++ b/addressbook/gui/widgets/Makefile.am
@@ -5,6 +5,7 @@ INCLUDES = \
-I$(top_builddir)/addressbook/backend \
-I$(top_srcdir)/addressbook/contact-editor \
-I$(top_srcdir)/widgets/e-text \
+ -I$(top_srcdir)/widgets/e-reflow \
-I$(top_srcdir)/widgets/misc \
$(BONOBO_GNOME_CFLAGS)
@@ -23,11 +24,7 @@ libeminicard_a_SOURCES = \
e-minicard-widget.c \
e-minicard-widget.h \
e-minicard.c \
- e-minicard.h \
- e-reflow-sorted.c \
- e-reflow-sorted.h \
- e-reflow.c \
- e-reflow.h
+ e-minicard.h
noinst_PROGRAMS = \
minicard-widget-test \
@@ -61,6 +58,7 @@ minicard_test_LDADD = \
$(top_builddir)/addressbook/printing/libecontactprint.a \
$(top_builddir)/widgets/e-table/libetable.a \
$(top_builddir)/widgets/misc/libemiscwidgets.a \
+ $(top_builddir)/widgets/e-reflow/libereflow.a \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/widgets/e-text/libetext.a
@@ -79,6 +77,7 @@ reflow_test_LDADD = \
$(top_builddir)/addressbook/printing/libecontactprint.a \
$(top_builddir)/widgets/e-table/libetable.a \
$(top_builddir)/widgets/misc/libemiscwidgets.a \
+ $(top_builddir)/widgets/e-reflow/libereflow.a \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/widgets/e-text/libetext.a
@@ -115,5 +114,6 @@ minicard_widget_test_LDADD = \
$(top_builddir)/addressbook/printing/libecontactprint.a \
$(top_builddir)/widgets/e-table/libetable.a \
$(top_builddir)/widgets/misc/libemiscwidgets.a \
+ $(top_builddir)/widgets/e-reflow/libereflow.a \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/widgets/e-text/libetext.a