aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-04-09 06:10:47 +0800
committerChris Lahey <clahey@src.gnome.org>2000-04-09 06:10:47 +0800
commit58e7df4e0376d1248ced78659d27d61adc1434b9 (patch)
treeedda4073e9e79d89b8bb9a34498049259998718d
parent6beb74f53508f0f92ad5ed0fe7e823b6a5be76f3 (diff)
downloadgsoc2013-evolution-58e7df4e0376d1248ced78659d27d61adc1434b9.tar.gz
gsoc2013-evolution-58e7df4e0376d1248ced78659d27d61adc1434b9.tar.zst
gsoc2013-evolution-58e7df4e0376d1248ced78659d27d61adc1434b9.zip
pixmap_DATA isn't defined so don't use it as a variable.
2000-04-08 Christopher James Lahey <clahey@helixcode.com> * art/Makefile.am: pixmap_DATA isn't defined so don't use it as a variable. * addressbook/gui/component/, addressbook/gui/component/.cvsignore, addressbook/gui/Makefile.am, addressbook/gui/component/addressbook-factory.c, addressbook/gui/component/addressbook.c, addressbook/gui/component/addressbook.gnorba, addressbook/gui/component/addressbook.h: New directory to proivde the component for contact management. Simply uses an e-minicard-view. * addressbook/gui/minicard/e-minicard-view.c, addressbook/gui/minicard/e-minicard-view.h: New subclass of e-reflow-sorted that takes an EBook and uses it to compute the card data to display. * addressbook/gui/minicard/e-minicard.c, addressbook/gui/minicard/e-minicard.h: This now backends to a ECard instead of a ETableModel. * addressbook/gui/minicard/e-reflow.c, addressbook/gui/minicard/e-reflow.h: This now has a virtualized add method. * addressbook/gui/minicard/e-reflow-sorted.c, addressbook/gui/minicard/e-reflow-sorted.h: New subclass of e-reflow that allows the data to be sorted on the fly. * addressbook/gui/minicard/test-minicard-view.c: New test to test the new minicard view. * addressbook/gui/minicard/test-reflow.c: Uses the new ECard backend of the e-minicard. * addressbook/gui/minicard/.cvsignore, addressbook/gui/minicard/Makefile.am: Added new test. Fixed dependencies. Added new files. * addressbook/gui/, addressbook/gui/Makefile.am, addressbook/gui/.cvsignore: New directory for addressbook gui bits. Added subdirectories. Created an initial .cvsignore. * addressbook/Makefile.am (SUBDIRS): Removed demo and added gui. * addressbook/backend/pas/pas-backend-file.c: Added code to do notification on bookviews when changes in the backend are made. * addressbook/backend/pas/pas-book-view.c, addressbook/backend/pas/pas-book-view.h: Added helper functions to notify the view about the addition or modification of a single card. Fixed a mistaken extra free. * addressbook/backend/ebook/e-card-list-iterator.h: Fixed incorrect parent class. * addressbook/backend/ebook/test-client.c: Made this accept an optional parameter that specifies the vcard to add. * configure.in: Replaced widgets/e-minicard/Makefile and addressbook/demo/Makefile with addressbook/gui/minicard/Makefile and addressbook/gui/component/Makefile respectively. * widgets/Makefile.am: Removed e-minicard since it's being moved to addressbook/gui/minicard. * widgets/e-text/e-text.c: Fixed the border width around tooltips and made the main tooltip area yellow. From camel/ChangeLog: 2000-04-08 Christopher James Lahey <clahey@helixcode.com> * providers/smtp/.cvsignore: Added a .cvsignore file. From calendar/ChangeLog: 2000-04-08 Christopher James Lahey <clahey@helixcode.com> * gui/Makefile.am: Removed linking with libetable and libeminicard since they weren't being used. svn path=/trunk/; revision=2343
-rw-r--r--ChangeLog69
-rw-r--r--addressbook/Makefile.am2
-rw-r--r--addressbook/backend/ebook/e-card-list-iterator.h4
-rw-r--r--addressbook/backend/ebook/test-client.c38
-rw-r--r--addressbook/backend/pas/pas-backend-file.c79
-rw-r--r--addressbook/backend/pas/pas-book-view.c20
-rw-r--r--addressbook/backend/pas/pas-book-view.h4
-rw-r--r--addressbook/gui/.cvsignore6
-rw-r--r--addressbook/gui/Makefile.am1
-rw-r--r--addressbook/gui/component/.cvsignore8
-rw-r--r--addressbook/gui/component/Makefile.am36
-rw-r--r--addressbook/gui/component/addressbook-factory.c47
-rw-r--r--addressbook/gui/component/addressbook.c275
-rw-r--r--addressbook/gui/component/addressbook.gnorba11
-rw-r--r--addressbook/gui/component/addressbook.h8
-rw-r--r--art/Makefile.am5
-rw-r--r--calendar/ChangeLog5
-rw-r--r--calendar/gui/Makefile.am2
-rw-r--r--camel/ChangeLog4
-rw-r--r--camel/providers/smtp/.cvsignore6
-rw-r--r--configure.in5
-rw-r--r--widgets/Makefile.am2
-rw-r--r--widgets/e-minicard/.cvsignore1
-rw-r--r--widgets/e-minicard/Makefile.am41
-rw-r--r--widgets/e-minicard/e-minicard-view.c239
-rw-r--r--widgets/e-minicard/e-minicard-view.h79
-rw-r--r--widgets/e-minicard/e-minicard.c216
-rw-r--r--widgets/e-minicard/e-minicard.h13
-rw-r--r--widgets/e-minicard/e-reflow-sorted.c185
-rw-r--r--widgets/e-minicard/e-reflow-sorted.h87
-rw-r--r--widgets/e-minicard/e-reflow.c36
-rw-r--r--widgets/e-minicard/e-reflow.h16
-rw-r--r--widgets/e-minicard/test-minicard-view.c206
-rw-r--r--widgets/e-minicard/test-reflow.c28
-rw-r--r--widgets/e-text/e-text.c33
-rw-r--r--widgets/text/e-text.c33
36 files changed, 1677 insertions, 173 deletions
diff --git a/ChangeLog b/ChangeLog
index 9d91b8913b..30ce5091cb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,72 @@
+2000-04-08 Christopher James Lahey <clahey@helixcode.com>
+
+ * art/Makefile.am: pixmap_DATA isn't defined so don't use it as a variable.
+
+ * addressbook/gui/component/,
+ addressbook/gui/component/.cvsignore, addressbook/gui/Makefile.am,
+ addressbook/gui/component/addressbook-factory.c,
+ addressbook/gui/component/addressbook.c,
+ addressbook/gui/component/addressbook.gnorba,
+ addressbook/gui/component/addressbook.h: New directory to proivde
+ the component for contact management. Simply uses an e-minicard-view.
+
+ * addressbook/gui/minicard/e-minicard-view.c,
+ addressbook/gui/minicard/e-minicard-view.h: New subclass of
+ e-reflow-sorted that takes an EBook and uses it to compute the
+ card data to display.
+
+ * addressbook/gui/minicard/e-minicard.c,
+ addressbook/gui/minicard/e-minicard.h: This now backends to a
+ ECard instead of a ETableModel.
+
+ * addressbook/gui/minicard/e-reflow.c,
+ addressbook/gui/minicard/e-reflow.h: This now has a virtualized
+ add method.
+
+ * addressbook/gui/minicard/e-reflow-sorted.c,
+ addressbook/gui/minicard/e-reflow-sorted.h: New subclass of
+ e-reflow that allows the data to be sorted on the fly.
+
+ * addressbook/gui/minicard/test-minicard-view.c: New test to test
+ the new minicard view.
+
+ * addressbook/gui/minicard/test-reflow.c: Uses the new ECard
+ backend of the e-minicard.
+
+ * addressbook/gui/minicard/.cvsignore,
+ addressbook/gui/minicard/Makefile.am: Added new test. Fixed
+ dependencies. Added new files.
+
+ * addressbook/gui/, addressbook/gui/Makefile.am,
+ addressbook/gui/.cvsignore: New directory for addressbook gui
+ bits. Added subdirectories. Created an initial .cvsignore.
+
+ * addressbook/Makefile.am (SUBDIRS): Removed demo and added gui.
+
+ * addressbook/backend/pas/pas-backend-file.c: Added code to do
+ notification on bookviews when changes in the backend are made.
+
+ * addressbook/backend/pas/pas-book-view.c,
+ addressbook/backend/pas/pas-book-view.h: Added helper functions to
+ notify the view about the addition or modification of a single
+ card. Fixed a mistaken extra free.
+
+ * addressbook/backend/ebook/e-card-list-iterator.h: Fixed
+ incorrect parent class.
+
+ * addressbook/backend/ebook/test-client.c: Made this accept an
+ optional parameter that specifies the vcard to add.
+
+ * configure.in: Replaced widgets/e-minicard/Makefile and
+ addressbook/demo/Makefile with addressbook/gui/minicard/Makefile
+ and addressbook/gui/component/Makefile respectively.
+
+ * widgets/Makefile.am: Removed e-minicard since it's being moved
+ to addressbook/gui/minicard.
+
+ * widgets/e-text/e-text.c: Fixed the border width around tooltips
+ and made the main tooltip area yellow.
+
2000-04-08 Dan Winship <danw@helixcode.com>
* configure.in, acconfig.h: add SYSTEM_MAIL_DIR
diff --git a/addressbook/Makefile.am b/addressbook/Makefile.am
index 8e421f8e2d..b5d6387af6 100644
--- a/addressbook/Makefile.am
+++ b/addressbook/Makefile.am
@@ -1,2 +1,2 @@
SUBDIRS = \
- backend contact-editor printing demo
+ backend gui contact-editor printing
diff --git a/addressbook/backend/ebook/e-card-list-iterator.h b/addressbook/backend/ebook/e-card-list-iterator.h
index cdc7a312b1..67d56cfb9c 100644
--- a/addressbook/backend/ebook/e-card-list-iterator.h
+++ b/addressbook/backend/ebook/e-card-list-iterator.h
@@ -26,14 +26,14 @@ typedef struct _ECardListIterator ECardListIterator;
typedef struct _ECardListIteratorClass ECardListIteratorClass;
struct _ECardListIterator {
- GtkObject object;
+ ECardIterator parent;
ECardList *list;
GList *iterator;
};
struct _ECardListIteratorClass {
- GtkObjectClass parent_class;
+ ECardIteratorClass parent_class;
};
ECardIterator *e_card_list_iterator_new (ECardList *list);
diff --git a/addressbook/backend/ebook/test-client.c b/addressbook/backend/ebook/test-client.c
index f535d2db1a..15c5410146 100644
--- a/addressbook/backend/ebook/test-client.c
+++ b/addressbook/backend/ebook/test-client.c
@@ -30,8 +30,9 @@
"
"
-CORBA_Environment ev;
-CORBA_ORB orb;
+static CORBA_Environment ev;
+static CORBA_ORB orb;
+static char *cardstr;
static void
init_bonobo (int argc, char **argv)
@@ -99,7 +100,7 @@ add_card_cb (EBook *book, EBookStatus status, const gchar *id, gpointer closure)
static void
book_open_cb (EBook *book, EBookStatus status, gpointer closure)
{
- e_book_add_vcard(book, TEST_VCARD, add_card_cb, NULL);
+ e_book_add_vcard(book, cardstr, add_card_cb, NULL);
}
static guint
@@ -125,6 +126,30 @@ ebook_create (void)
return FALSE;
}
+static char *
+read_file (char *name)
+{
+ int len;
+ char buff[65536];
+ char line[1024];
+ FILE *f;
+
+ f = fopen (name, "r");
+ if (f == NULL)
+ g_error ("Unable to open %s!\n", name);
+
+ len = 0;
+ while (fgets (line, sizeof (line), f) != NULL) {
+ strcpy (buff + len, line);
+ len += strlen (line);
+ }
+
+ fclose (f);
+
+ return g_strdup (buff);
+}
+
+
int
main (int argc, char **argv)
{
@@ -132,6 +157,13 @@ main (int argc, char **argv)
CORBA_exception_init (&ev);
init_bonobo (argc, argv);
+ cardstr = NULL;
+ if (argc == 2)
+ cardstr = read_file (argv [1]);
+
+ if (cardstr == NULL)
+ cardstr = TEST_VCARD;
+
gtk_idle_add ((GtkFunction) ebook_create, NULL);
bonobo_main ();
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index 706ab1f9a2..935dab19d5 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -25,11 +25,13 @@
static PASBackendClass *pas_backend_file_parent_class;
typedef struct _PASBackendFileCursorPrivate PASBackendFileCursorPrivate;
+typedef struct _PASBackendFileBookView PASBackendFileBookView;
struct _PASBackendFilePrivate {
GList *clients;
gboolean loaded;
DB *file_db;
+ GList *book_views;
};
struct _PASBackendFileCursorPrivate {
@@ -40,6 +42,11 @@ struct _PASBackendFileCursorPrivate {
guint32 num_elements;
};
+struct _PASBackendFileBookView {
+ PASBookView *book_view;
+ gchar *search;
+};
+
static long
get_length(PASCardCursor *cursor, gpointer data)
{
@@ -89,6 +96,20 @@ view_destroy(GtkObject *object, gpointer data)
CORBA_Environment ev;
Evolution_Book corba_book;
PASBook *book = (PASBook *)data;
+ PASBackendFile *bf;
+ GList *list;
+
+ bf = PAS_BACKEND_FILE(pas_book_get_backend(book));
+ for (list = bf->priv->book_views; list; list = g_list_next(list)) {
+ PASBackendFileBookView *view = list->data;
+ if (view->book_view == PAS_BOOK_VIEW(object)) {
+ g_free (view->search);
+ g_free (view);
+ bf->priv->book_views = g_list_remove_link(bf->priv->book_views, list);
+ g_list_free_1(list);
+ break;
+ }
+ }
corba_book = bonobo_object_corba_objref(BONOBO_OBJECT(book));
@@ -131,6 +152,7 @@ pas_backend_file_process_create_card (PASBackend *backend,
DBT id_dbt, vcard_dbt;
int db_error;
char *id;
+ GList *list;
id = pas_backend_file_create_unique_id (req->vcard);
@@ -140,9 +162,11 @@ pas_backend_file_process_create_card (PASBackend *backend,
db_error = db->put (db, &id_dbt, &vcard_dbt, 0);
if (0 == db_error) {
-#if 0
- pas_book_notify_add(book, id);
-#endif
+ for (list = bf->priv->book_views; list; list = g_list_next(list)) {
+ PASBackendFileBookView *view = list->data;
+ /* if (card matches view->search) */
+ pas_book_view_notify_add_1 (view->book_view, req->vcard);
+ }
pas_book_respond_create (
book,
@@ -175,15 +199,18 @@ pas_backend_file_process_remove_card (PASBackend *backend,
DB *db = bf->priv->file_db;
DBT id_dbt;
int db_error;
+ GList *list;
string_to_dbt (req->id, &id_dbt);
db_error = db->del (db, &id_dbt, 0);
if (0 == db_error) {
-#if 0
- pas_book_notify_remove (book, req->id);
-#endif
+ for (list = bf->priv->book_views; list; list = g_list_next(list)) {
+ PASBackendFileBookView *view = list->data;
+ /* if (card matches view->search) */
+ pas_book_view_notify_remove (view->book_view, req->id);
+ }
pas_book_respond_remove (
book,
@@ -211,6 +238,7 @@ pas_backend_file_process_modify_card (PASBackend *backend,
DB *db = bf->priv->file_db;
DBT id_dbt, vcard_dbt;
int db_error;
+ GList *list;
string_to_dbt (req->id, &id_dbt);
string_to_dbt (req->vcard, &vcard_dbt);
@@ -218,9 +246,16 @@ pas_backend_file_process_modify_card (PASBackend *backend,
db_error = db->put (db, &id_dbt, &vcard_dbt, 0);
if (0 == db_error) {
-#if 0
- pas_book_notify_change (book, req->id);
-#endif
+ for (list = bf->priv->book_views; list; list = g_list_next(list)) {
+ PASBackendFileBookView *view = list->data;
+ /* if (card matches view->search) */
+ pas_book_view_notify_change_1 (view->book_view, req->vcard);
+ /* else if (card changes to match view->search )
+ pas_book_view_notify_add_1 (view->book_view, req->vcard);
+ else if (card changes to not match view->search )
+ pas_book_view_notify_remove (view->book_view, req->id);
+ */
+ }
pas_book_respond_modify (
book,
@@ -335,9 +370,11 @@ pas_backend_file_process_get_book_view (PASBackend *backend,
DBT id_dbt, vcard_dbt;
CORBA_Environment ev;
int db_error = 0;
- PASBookView *view;
+ PASBookView *book_view;
Evolution_Book corba_book;
GList *cards = NULL;
+ PASBackendFileBookView *view;
+
g_return_if_fail (req->listener != NULL);
@@ -354,16 +391,16 @@ pas_backend_file_process_get_book_view (PASBackend *backend,
CORBA_exception_free(&ev);
- view = pas_book_view_new (req->listener);
+ book_view = pas_book_view_new (req->listener);
- gtk_signal_connect(GTK_OBJECT(view), "destroy",
+ gtk_signal_connect(GTK_OBJECT(book_view), "destroy",
GTK_SIGNAL_FUNC(view_destroy), book);
pas_book_respond_get_book_view (book,
(db_error == 0
? Evolution_BookListener_Success
: Evolution_BookListener_CardNotFound /* XXX */),
- view);
+ book_view);
/*
** no reason to not iterate through the file now and notify
@@ -390,14 +427,19 @@ pas_backend_file_process_get_book_view (PASBackend *backend,
g_warning ("pas_backend_file_process_get_book_view: error building list\n");
}
else {
- pas_book_view_notify_add (view, cards);
+ pas_book_view_notify_add (book_view, cards);
}
/*
- ** the following should be done when the view is destroyed
+ ** It's fine to do this now since the data has been handed off.
*/
g_list_foreach (cards, (GFunc)g_free, NULL);
g_list_free (cards);
+
+ view = g_new(PASBackendFileBookView, 1);
+ view->book_view = book_view;
+ view->search = g_strdup(req->search);
+ bf->priv->book_views = g_list_prepend(bf->priv->book_views, view);
}
static void
@@ -684,9 +726,10 @@ pas_backend_file_init (PASBackendFile *backend)
{
PASBackendFilePrivate *priv;
- priv = g_new0 (PASBackendFilePrivate, 1);
- priv->loaded = FALSE;
- priv->clients = NULL;
+ priv = g_new0 (PASBackendFilePrivate, 1);
+ priv->loaded = FALSE;
+ priv->clients = NULL;
+ priv->book_views = NULL;
backend->priv = priv;
}
diff --git a/addressbook/backend/pas/pas-book-view.c b/addressbook/backend/pas/pas-book-view.c
index fc706bc897..f712cc8ccf 100644
--- a/addressbook/backend/pas/pas-book-view.c
+++ b/addressbook/backend/pas/pas-book-view.c
@@ -50,6 +50,15 @@ pas_book_view_notify_change (PASBookView *book_view,
CORBA_free(card_sequence._buffer);
}
+void
+pas_book_view_notify_change_1 (PASBookView *book_view,
+ const char *card)
+{
+ GList *list = g_list_append(NULL, (char *) card);
+ pas_book_view_notify_change(book_view, list);
+ g_list_free(list);
+}
+
/**
* pas_book_view_notify_remove:
*/
@@ -89,7 +98,7 @@ pas_book_view_notify_add (PASBookView *book_view,
card_sequence._length = length;
for ( i = 0; cards; cards = g_list_next(cards), i++ ) {
- card_sequence._buffer[i] = (char *) cards->data;
+ card_sequence._buffer[i] = CORBA_string_dup((char *) cards->data);
}
CORBA_exception_init (&ev);
@@ -106,6 +115,15 @@ pas_book_view_notify_add (PASBookView *book_view,
CORBA_free(card_sequence._buffer);
}
+void
+pas_book_view_notify_add_1 (PASBookView *book_view,
+ const char *card)
+{
+ GList *list = g_list_append(NULL, (char *) card);
+ pas_book_view_notify_add(book_view, list);
+ g_list_free(list);
+}
+
static gboolean
pas_book_view_construct (PASBookView *book_view,
Evolution_BookViewListener listener)
diff --git a/addressbook/backend/pas/pas-book-view.h b/addressbook/backend/pas/pas-book-view.h
index b742b2ba1a..9644c79de1 100644
--- a/addressbook/backend/pas/pas-book-view.h
+++ b/addressbook/backend/pas/pas-book-view.h
@@ -33,10 +33,14 @@ PASBookView *pas_book_view_new (Evolution_BookView
void pas_book_view_notify_change (PASBookView *book_view,
const GList *cards);
+void pas_book_view_notify_change_1 (PASBookView *book_view,
+ const char *card);
void pas_book_view_notify_remove (PASBookView *book_view,
const char *id);
void pas_book_view_notify_add (PASBookView *book_view,
const GList *cards);
+void pas_book_view_notify_add_1 (PASBookView *book_view,
+ const char *card);
GtkType pas_book_view_get_type (void);
diff --git a/addressbook/gui/.cvsignore b/addressbook/gui/.cvsignore
new file mode 100644
index 0000000000..09980ae6ba
--- /dev/null
+++ b/addressbook/gui/.cvsignore
@@ -0,0 +1,6 @@
+.deps
+.libs
+Makefile
+Makefile.in
+*.lo
+*.la
diff --git a/addressbook/gui/Makefile.am b/addressbook/gui/Makefile.am
new file mode 100644
index 0000000000..50c258b544
--- /dev/null
+++ b/addressbook/gui/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = minicard component \ No newline at end of file
diff --git a/addressbook/gui/component/.cvsignore b/addressbook/gui/component/.cvsignore
new file mode 100644
index 0000000000..a0427f184f
--- /dev/null
+++ b/addressbook/gui/component/.cvsignore
@@ -0,0 +1,8 @@
+.deps
+.libs
+Makefile
+Makefile.in
+*.lo
+*.la
+evolution-addressbook
+test-addressbook \ No newline at end of file
diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am
new file mode 100644
index 0000000000..f5269071c4
--- /dev/null
+++ b/addressbook/gui/component/Makefile.am
@@ -0,0 +1,36 @@
+INCLUDES = \
+ $(EXTRA_GNOME_CFLAGS) \
+ $(GNOME_INCLUDEDIR) \
+ -I$(top_srcdir)/widgets/e-text \
+ -I$(top_srcdir)/e-util \
+ -I$(top_srcdir) \
+ -I$(top_srcdir)/addressbook/gui/minicard \
+ -I$(top_srcdir)/addressbook/backend/ebook \
+ $(BONOBO_HTML_GNOME_CFLAGS) \
+ -DEVOLUTION_VERSION=\""$(VERSION)"\" \
+ -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
+ -DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \
+ -DEVOLUTION_LOCALEDIR=\""$(datadir)/locale"\" \
+ -DCAMEL_PROVIDERDIR=\""$(providerdir)"\"
+
+bin_PROGRAMS = \
+ evolution-addressbook
+
+evolution_addressbook_SOURCES = \
+ addressbook-factory.c \
+ addressbook.c \
+ addressbook.h
+
+evolution_addressbook_LDADD = \
+ $(EXTRA_GNOME_LIBS) \
+ $(BONOBO_HTML_GNOME_LIBS) \
+ $(top_builddir)/addressbook/gui/minicard/libeminicard.a \
+ $(top_builddir)/widgets/e-text/libetext.a \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/addressbook/backend/ebook/libebook.la \
+ $(top_builddir)/libversit/libversit.la
+
+evolution_addressbook_LDFLAGS = `gnome-config --libs gdk_pixbuf`
+
+gnorbadir = $(sysconfdir)/CORBA/servers
+gnorba_DATA = addressbook.gnorba
diff --git a/addressbook/gui/component/addressbook-factory.c b/addressbook/gui/component/addressbook-factory.c
new file mode 100644
index 0000000000..cf59177f84
--- /dev/null
+++ b/addressbook/gui/component/addressbook-factory.c
@@ -0,0 +1,47 @@
+/**
+ * sample-control-factory.c
+ *
+ * Copyright 1999, Helix Code, Inc.
+ *
+ * Author:
+ * Nat Friedman (nat@nat.org)
+ *
+ */
+
+#include <config.h>
+#include <gnome.h>
+#include <libgnorba/gnorba.h>
+#include <bonobo.h>
+
+#include "addressbook.h"
+
+CORBA_Environment ev;
+CORBA_ORB orb;
+
+static void
+init_bonobo (int argc, char **argv)
+{
+
+ gnome_CORBA_init_with_popt_table (
+ "evolution-addressbook", "0.0",
+ &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"));
+}
+
+int
+main (int argc, char **argv)
+{
+ CORBA_exception_init (&ev);
+
+ init_bonobo (argc, argv);
+
+ addressbook_factory_init ();
+
+ bonobo_main ();
+
+ return 0;
+}
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
new file mode 100644
index 0000000000..3fb9a036ca
--- /dev/null
+++ b/addressbook/gui/component/addressbook.c
@@ -0,0 +1,275 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * folder-browser-factory.c: A Bonobo Control factory for Folder Browsers
+ *
+ * Author:
+ * Miguel de Icaza (miguel@helixcode.com)
+ *
+ * (C) 2000 Helix Code, Inc.
+ */
+/*
+ * bonobo-clock-control.c
+ *
+ * Copyright 1999, Helix Code, Inc.
+ *
+ * Author:
+ * Nat Friedman (nat@nat.org)
+ */
+
+#include <config.h>
+#include <gnome.h>
+#include <libgnorba/gnorba.h>
+#include <bonobo.h>
+
+#include "addressbook.h"
+
+#include "e-book.h"
+#include "e-canvas.h"
+#include "e-minicard-view.h"
+
+static void
+control_deactivate (BonoboControl *control, BonoboUIHandler *uih)
+{
+ /* how to remove a menu item */
+ bonobo_ui_handler_menu_remove (uih, "/Actions/New Contact");
+
+ /* remove our toolbar */
+ bonobo_ui_handler_dock_remove (uih, "/Toolbar");
+}
+
+static void
+do_nothing_cb (BonoboUIHandler *uih, void *user_data, const char *path)
+{
+ printf ("Yow! I am called back!\n");
+}
+
+static GnomeUIInfo gnome_toolbar [] = {
+ GNOMEUIINFO_ITEM_STOCK (N_("New"), N_("Create a new contact"), do_nothing_cb, GNOME_STOCK_PIXMAP_NEW),
+
+ GNOMEUIINFO_SEPARATOR,
+
+ GNOMEUIINFO_ITEM_STOCK (N_("Find"), N_("Find a contact"), do_nothing_cb, GNOME_STOCK_PIXMAP_SEARCH),
+ GNOMEUIINFO_ITEM_STOCK (N_("Print"), N_("Print contacts"), do_nothing_cb, GNOME_STOCK_PIXMAP_PRINT),
+ GNOMEUIINFO_ITEM_STOCK (N_("Delete"), N_("Delete a contact"), do_nothing_cb, GNOME_STOCK_PIXMAP_TRASH),
+
+ GNOMEUIINFO_END
+};
+
+
+
+
+static void
+control_activate (BonoboControl *control, BonoboUIHandler *uih)
+{
+ Bonobo_UIHandler remote_uih;
+ GtkWidget *toolbar;
+ BonoboControl *toolbar_control;
+
+ remote_uih = bonobo_control_get_remote_ui_handler (control);
+ bonobo_ui_handler_set_container (uih, remote_uih);
+
+ bonobo_ui_handler_menu_new_item (uih, "/Actions/New Contact", N_("_New Contact"),
+ NULL, -1,
+ BONOBO_UI_HANDLER_PIXMAP_NONE, NULL,
+ 0, 0, do_nothing_cb, NULL);
+
+ toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL,
+ GTK_TOOLBAR_BOTH);
+
+ gnome_app_fill_toolbar (GTK_TOOLBAR (toolbar),
+ gnome_toolbar,
+ NULL);
+
+ gtk_widget_show_all (toolbar);
+
+ toolbar_control = bonobo_control_new (toolbar);
+ bonobo_ui_handler_dock_add (
+ uih, "/Toolbar",
+ bonobo_object_corba_objref (BONOBO_OBJECT (toolbar_control)),
+ GNOME_DOCK_ITEM_BEH_LOCKED |
+ GNOME_DOCK_ITEM_BEH_EXCLUSIVE,
+ GNOME_DOCK_TOP,
+ 1, 1, 0);
+}
+
+static void
+control_activate_cb (BonoboControl *control,
+ gboolean activate,
+ gpointer user_data)
+{
+ BonoboUIHandler *uih;
+
+ uih = bonobo_control_get_ui_handler (control);
+ g_assert (uih);
+
+ if (activate)
+ control_activate (control, uih);
+ else
+ control_deactivate (control, uih);
+}
+
+typedef struct {
+ GtkWidget *canvas;
+ GnomeCanvasItem *view;
+ GnomeCanvasItem *rect;
+ GtkAllocation last_alloc;
+} AddressbookView;
+
+static void
+book_open_cb (EBook *book, EBookStatus status, gpointer closure)
+{
+ AddressbookView *view = closure;
+ if (status == E_BOOK_STATUS_SUCCESS)
+ gnome_canvas_item_set(view->view,
+ "book", book,
+ NULL);
+}
+
+static EBook *
+ebook_create (AddressbookView *view)
+{
+ EBook *book;
+
+ book = e_book_new ();
+
+ if (!book) {
+ printf ("%s: %s(): Couldn't create EBook, bailing.\n",
+ __FILE__,
+ __FUNCTION__);
+ return NULL;
+ }
+
+
+ if (! e_book_load_uri (book, "file:/tmp/test.db", book_open_cb, view)) {
+ printf ("error calling load_uri!\n");
+ }
+
+
+ return book;
+}
+
+static void destroy_callback(GtkWidget *widget, gpointer data)
+{
+ AddressbookView *view = data;
+ g_free(view);
+}
+
+static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpointer data)
+{
+ double width;
+ AddressbookView *view = data;
+ view->last_alloc = *allocation;
+ gnome_canvas_item_set( view->view,
+ "height", (double) allocation->height,
+ NULL );
+ gnome_canvas_item_set( view->view,
+ "minimum_width", (double) allocation->width,
+ NULL );
+ gtk_object_get(GTK_OBJECT(view->view),
+ "width", &width,
+ NULL);
+ width = MAX(width, allocation->width);
+ gnome_canvas_set_scroll_region(GNOME_CANVAS( view->canvas ), 0, 0, width, allocation->height );
+ gnome_canvas_item_set( view->rect,
+ "x2", (double) width,
+ "y2", (double) allocation->height,
+ NULL );
+}
+
+static void resize(GnomeCanvas *canvas, gpointer data)
+{
+ double width;
+ AddressbookView *view = data;
+ gtk_object_get(GTK_OBJECT(view->view),
+ "width", &width,
+ NULL);
+ width = MAX(width, view->last_alloc.width);
+ gnome_canvas_set_scroll_region(GNOME_CANVAS(view->canvas), 0, 0, width, view->last_alloc.height );
+ gnome_canvas_item_set( view->rect,
+ "x2", (double) width,
+ "y2", (double) view->last_alloc.height,
+ NULL );
+}
+
+static BonoboObject *
+addressbook_factory (BonoboGenericFactory *Factory, void *closure)
+{
+ BonoboControl *control;
+ EBook *book;
+ GtkWidget *vbox, *scrollbar;
+ AddressbookView *view;
+ view = g_new (AddressbookView, 1);
+
+ vbox = gtk_vbox_new(FALSE, 0);
+
+ view->canvas = e_canvas_new();
+ view->rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( view->canvas ) ),
+ gnome_canvas_rect_get_type(),
+ "x1", (double) 0,
+ "y1", (double) 0,
+ "x2", (double) 100,
+ "y2", (double) 100,
+ "fill_color", "white",
+ NULL );
+ view->view = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( view->canvas ) ),
+ e_minicard_view_get_type(),
+ "height", (double) 100,
+ "minimum_width", (double) 100,
+ NULL );
+ gtk_signal_connect( GTK_OBJECT( view->canvas ), "reflow",
+ GTK_SIGNAL_FUNC( resize ),
+ view);
+
+ gnome_canvas_set_scroll_region ( GNOME_CANVAS( view->canvas ),
+ 0, 0,
+ 100, 100 );
+
+ gtk_box_pack_start(GTK_BOX(vbox), view->canvas, TRUE, TRUE, 0);
+
+ scrollbar = gtk_hscrollbar_new(gtk_layout_get_hadjustment(GTK_LAYOUT(view->canvas)));
+
+ gtk_box_pack_start(GTK_BOX(vbox), scrollbar, FALSE, FALSE, 0);
+
+ /* Connect the signals */
+ gtk_signal_connect( GTK_OBJECT( vbox ), "destroy",
+ GTK_SIGNAL_FUNC( destroy_callback ),
+ ( gpointer ) view );
+
+ gtk_signal_connect( GTK_OBJECT( view->canvas ), "size_allocate",
+ GTK_SIGNAL_FUNC( allocate_callback ),
+ ( gpointer ) view );
+
+ gtk_widget_show_all( vbox );
+#if 0
+ gdk_window_set_back_pixmap( GTK_LAYOUT(view->canvas)->bin_window, NULL, FALSE);
+#endif
+
+
+ book = ebook_create(view);
+
+ /* Create the control. */
+ control = bonobo_control_new(vbox);
+
+ gtk_signal_connect (GTK_OBJECT (control), "activate",
+ control_activate_cb, NULL);
+
+ return BONOBO_OBJECT (control);
+}
+
+void
+addressbook_factory_init (void)
+{
+ static BonoboGenericFactory *addressbook_control_factory = NULL;
+
+ if (addressbook_control_factory != NULL)
+ return;
+
+ addressbook_control_factory =
+ bonobo_generic_factory_new (
+ "control-factory:addressbook",
+ addressbook_factory, NULL);
+
+ if (addressbook_control_factory == NULL) {
+ g_error ("I could not register a Addressbook factory.");
+ }
+}
diff --git a/addressbook/gui/component/addressbook.gnorba b/addressbook/gui/component/addressbook.gnorba
new file mode 100644
index 0000000000..7114b1c332
--- /dev/null
+++ b/addressbook/gui/component/addressbook.gnorba
@@ -0,0 +1,11 @@
+[control-factory:addressbook]
+type=exe
+repo_id=IDL:GNOME/GenericFactory:1.0
+description=Factory for the sample Addressbook control
+location_info=evolution-addressbook
+
+[control:addressbook]
+type=factory
+repo_id=IDL:BonoboControl/addressbook-control:1.0 IDL:GNOME/Control:1.0
+description=A sample Bonobo control which displays an addressbook.
+location_info=control-factory:addressbook
diff --git a/addressbook/gui/component/addressbook.h b/addressbook/gui/component/addressbook.h
new file mode 100644
index 0000000000..e9289128a6
--- /dev/null
+++ b/addressbook/gui/component/addressbook.h
@@ -0,0 +1,8 @@
+#ifndef __ADDRESSBOOK_H__
+#define __ADDRESSBOOK_H__
+
+#include <bonobo/bonobo-control.h>
+
+void addressbook_factory_init (void);
+
+#endif /* __ADDRESSBOOK_H__ */
diff --git a/art/Makefile.am b/art/Makefile.am
index df8dcdc588..5feb519e21 100644
--- a/art/Makefile.am
+++ b/art/Makefile.am
@@ -16,5 +16,6 @@ EXTRA_DIST = \
mark.xpm \
meeting.xpm \
priority-high.xpm \
- priority-low.xpm \
- $(pixmap_DATA)
+ priority-low.xpm
+# \
+# $(pixmap_DATA)
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 59a6c729e3..d3618c86e4 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,8 @@
+2000-04-08 Christopher James Lahey <clahey@helixcode.com>
+
+ * gui/Makefile.am: Removed linking with libetable and libeminicard
+ since they weren't being used.
+
2000-04-08 Seth Alves <alves@hungry.com>
* gui/gnome-cal.c (gnome_calendar_create): new function:
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 15f1492739..9ccfa96672 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -81,8 +81,6 @@ evolution_calendar_SOURCES = \
evolution_calendar_LDADD = \
$(EXTRA_GNOME_LIBS) \
$(BONOBO_HTML_GNOME_LIBS) \
- $(top_builddir)/widgets/e-minicard/libeminicard.a \
- $(top_builddir)/widgets/e-table/libetable.a \
$(top_builddir)/widgets/e-text/libetext.a \
$(top_builddir)/e-util/libeutil.la \
$(LINK_FLAGS)
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 254ae3aa8e..1d99752ea1 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,7 @@
+2000-04-08 Christopher James Lahey <clahey@helixcode.com>
+
+ * providers/smtp/.cvsignore: Added a .cvsignore file.
+
2000-04-08 Dan Winship <danw@helixcode.com>
* providers/sendmail/camel-sendmail-transport.c (_send_internal):
diff --git a/camel/providers/smtp/.cvsignore b/camel/providers/smtp/.cvsignore
new file mode 100644
index 0000000000..09980ae6ba
--- /dev/null
+++ b/camel/providers/smtp/.cvsignore
@@ -0,0 +1,6 @@
+.deps
+.libs
+Makefile
+Makefile.in
+*.lo
+*.la
diff --git a/configure.in b/configure.in
index 9dfd99edcd..6d3fa2eb31 100644
--- a/configure.in
+++ b/configure.in
@@ -277,18 +277,19 @@ tests/Makefile
tests/ui-tests/Makefile
widgets/Makefile
widgets/e-text/Makefile
-widgets/e-minicard/Makefile
widgets/meeting-time-sel/Makefile
widgets/shortcut-bar/Makefile
widgets/e-table/Makefile
addressbook/Makefile
addressbook/contact-editor/Makefile
-addressbook/demo/Makefile
addressbook/printing/Makefile
addressbook/backend/Makefile
addressbook/backend/idl/Makefile
addressbook/backend/pas/Makefile
addressbook/backend/ebook/Makefile
+addressbook/gui/Makefile
+addressbook/gui/minicard/Makefile
+addressbook/gui/component/Makefile
shell/Makefile
mail/Makefile
data/Makefile
diff --git a/widgets/Makefile.am b/widgets/Makefile.am
index 73f2805d32..65afb0d471 100644
--- a/widgets/Makefile.am
+++ b/widgets/Makefile.am
@@ -1,3 +1,3 @@
SUBDIRS = \
- e-text meeting-time-sel shortcut-bar e-table e-minicard
+ e-text meeting-time-sel shortcut-bar e-table
diff --git a/widgets/e-minicard/.cvsignore b/widgets/e-minicard/.cvsignore
index 4af6725b43..1c59f4a4ec 100644
--- a/widgets/e-minicard/.cvsignore
+++ b/widgets/e-minicard/.cvsignore
@@ -6,4 +6,5 @@ Makefile.in
*.la
minicard-label-test
minicard-test
+minicard-view-test
reflow-test \ No newline at end of file
diff --git a/widgets/e-minicard/Makefile.am b/widgets/e-minicard/Makefile.am
index e1b130bc2a..3534e9cb69 100644
--- a/widgets/e-minicard/Makefile.am
+++ b/widgets/e-minicard/Makefile.am
@@ -1,7 +1,7 @@
INCLUDES = \
+ -I$(top_srcdir)/addressbook/backend/ebook \
-I$(top_srcdir)/widgets/e-text \
-I$(top_srcdir)/e-util \
- -I$(top_srcdir)/widgets/e-table \
$(GNOME_INCLUDEDIR)
noinst_LIBRARIES = \
@@ -12,40 +12,65 @@ libeminicard_a_SOURCES = \
e-minicard.h \
e-minicard-label.c \
e-minicard-label.h \
+ e-minicard-view.c \
+ e-minicard-view.h \
+ e-reflow-sorted.c \
+ e-reflow-sorted.h \
e-reflow.c \
e-reflow.h
noinst_PROGRAMS = \
minicard-label-test \
minicard-test \
- reflow-test
+ reflow-test \
+ minicard-view-test
minicard_label_test_SOURCES = \
test-minicard-label.c
minicard_label_test_LDADD = \
$(EXTRA_GNOME_LIBS) \
+ $(GNOMEGNORBA_LIBS) \
libeminicard.a \
+ -lbonobo \
$(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/widgets/e-text/libetext.a \
- $(top_builddir)/widgets/e-table/libetable.a
+ $(top_builddir)/widgets/e-text/libetext.a
minicard_test_SOURCES = \
test-minicard.c
minicard_test_LDADD = \
$(EXTRA_GNOME_LIBS) \
+ $(GNOMEGNORBA_LIBS) \
libeminicard.a \
+ -lbonobo \
$(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/widgets/e-text/libetext.a \
- $(top_builddir)/widgets/e-table/libetable.a
+ $(top_builddir)/addressbook/backend/ebook/libebook.la \
+ $(top_builddir)/libversit/libversit.la \
+ $(top_builddir)/widgets/e-text/libetext.a
reflow_test_SOURCES = \
test-reflow.c
reflow_test_LDADD = \
$(EXTRA_GNOME_LIBS) \
+ $(GNOMEGNORBA_LIBS) \
libeminicard.a \
+ -lbonobo \
$(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/widgets/e-text/libetext.a \
- $(top_builddir)/widgets/e-table/libetable.a
+ $(top_builddir)/addressbook/backend/ebook/libebook.la \
+ $(top_builddir)/libversit/libversit.la \
+ $(top_builddir)/widgets/e-text/libetext.a
+
+minicard_view_test_SOURCES = \
+ test-minicard-view.c
+
+minicard_view_test_LDADD = \
+ $(EXTRA_GNOME_LIBS) \
+ $(GNOMEGNORBA_LIBS) \
+ libeminicard.a \
+ -lbonobo \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/addressbook/backend/ebook/libebook.la \
+ $(top_builddir)/libversit/libversit.la \
+ $(top_builddir)/widgets/e-text/libetext.a
diff --git a/widgets/e-minicard/e-minicard-view.c b/widgets/e-minicard/e-minicard-view.c
new file mode 100644
index 0000000000..6e7b432a8e
--- /dev/null
+++ b/widgets/e-minicard/e-minicard-view.c
@@ -0,0 +1,239 @@
+/* -*- 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-minicard-view.h"
+#include "e-minicard.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);
+
+#define E_MINICARD_VIEW_DIVIDER_WIDTH 2
+#define E_MINICARD_VIEW_BORDER_WIDTH 7
+#define E_MINICARD_VIEW_FULL_GUTTER (E_MINICARD_VIEW_DIVIDER_WIDTH + E_MINICARD_VIEW_BORDER_WIDTH * 2)
+
+static EReflowSortedClass *parent_class = NULL;
+
+/* The arguments we take */
+enum {
+ ARG_0,
+ ARG_BOOK
+};
+
+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);
+
+ 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;
+
+ /* GnomeCanvasItem method overrides */
+}
+
+static void
+e_minicard_view_init (EMinicardView *view)
+{
+ view->book = NULL;
+ view->book_view = NULL;
+ view->get_view_idle = 0;
+ view->create_card_id = 0;
+ view->remove_card_id = 0;
+ view->modify_card_id = 0;
+
+ 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)) {
+ GnomeCanvasItem *item = gnome_canvas_item_new(GNOME_CANVAS_GROUP(view),
+ e_minicard_get_type(),
+ "card", cards->data,
+ NULL);
+ e_reflow_sorted_replace_item(E_REFLOW_SORTED(view), item);
+ }
+}
+
+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;
+ 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);
+ if (view->book_view)
+ gtk_object_unref(GTK_OBJECT(view->book_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_destroy, NULL);
+ g_list_free(E_REFLOW(view)->items);
+}
+
+static gboolean
+get_view(EMinicardView *view)
+{
+ E_REFLOW(view)->items = NULL;
+ e_book_get_book_view(view->book, "", 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));
+ view->book = E_BOOK(GTK_VALUE_OBJECT (*arg));
+ if (view->book) {
+ gtk_object_ref(GTK_OBJECT(view->book));
+ if (view->get_view_idle == 0)
+ 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;
+ 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->book)
+ gtk_object_unref(GTK_OBJECT(view->book));
+ 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);
+ if (view->book_view)
+ gtk_object_unref(GTK_OBJECT(view->book_view));
+}
diff --git a/widgets/e-minicard/e-minicard-view.h b/widgets/e-minicard/e-minicard-view.h
new file mode 100644
index 0000000000..a88e6c7dcb
--- /dev/null
+++ b/widgets/e-minicard/e-minicard-view.h
@@ -0,0 +1,79 @@
+/* -*- 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 "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
+ * --------------------------------------------------------------------------------
+ * 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;
+ EBookView *book_view;
+
+ int get_view_idle;
+
+ int create_card_id, remove_card_id, modify_card_id;
+};
+
+struct _EMinicardViewClass
+{
+ EReflowSortedClass parent_class;
+};
+
+GtkType e_minicard_view_get_type (void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+
+#endif /* __E_MINICARD_VIEW_H__ */
diff --git a/widgets/e-minicard/e-minicard.c b/widgets/e-minicard/e-minicard.c
index 2a98a574c7..02c7670df9 100644
--- a/widgets/e-minicard/e-minicard.c
+++ b/widgets/e-minicard/e-minicard.c
@@ -24,7 +24,7 @@
#include "e-minicard.h"
#include "e-minicard-label.h"
#include "e-text.h"
-#include "e-table-text-model.h"
+#include "e-book.h"
#include "e-canvas.h"
#include "e-util.h"
#include "e-canvas-utils.h"
@@ -49,9 +49,7 @@ enum {
ARG_WIDTH,
ARG_HEIGHT,
ARG_HAS_FOCUS,
- ARG_CARD,
- ARG_MODEL,
- ARG_ROW
+ ARG_CARD
};
GtkType
@@ -98,10 +96,6 @@ e_minicard_class_init (EMinicardClass *klass)
GTK_ARG_READWRITE, ARG_HAS_FOCUS);
gtk_object_add_arg_type ("EMinicard::card", GTK_TYPE_OBJECT,
GTK_ARG_READWRITE, ARG_CARD);
- gtk_object_add_arg_type ("EMinicard::model", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_MODEL);
- gtk_object_add_arg_type ("EMinicard::row", GTK_TYPE_INT,
- GTK_ARG_READWRITE, ARG_ROW);
object_class->set_arg = e_minicard_set_arg;
object_class->get_arg = e_minicard_get_arg;
@@ -123,8 +117,7 @@ e_minicard_init (EMinicard *minicard)
minicard->height = 10;
minicard->has_focus = FALSE;
- minicard->model = NULL;
- minicard->row = 0;
+ minicard->card = NULL;
e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(minicard), e_minicard_reflow);
}
@@ -164,21 +157,11 @@ e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
e_canvas_item_grab_focus(item);
break;
case ARG_CARD:
- /* e_minicard->card = GTK_VALUE_OBJECT (*arg);
- _update_card(e_minicard);
- gnome_canvas_item_request_update (item);*/
- break;
- case ARG_MODEL:
- if (e_minicard->model)
- gtk_object_unref (e_minicard->model);
- e_minicard->model = E_TABLE_MODEL(GTK_VALUE_OBJECT (*arg));
- if (e_minicard->model)
- gtk_object_ref (e_minicard->model);
- remodel(e_minicard);
- e_canvas_item_request_reflow(item);
- break;
- case ARG_ROW:
- e_minicard->row = GTK_VALUE_INT (*arg);
+ 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));
remodel(e_minicard);
e_canvas_item_request_reflow(item);
break;
@@ -203,13 +186,7 @@ e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
GTK_VALUE_ENUM (*arg) = e_minicard->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE;
break;
case ARG_CARD:
- /* GTK_VALUE_OBJECT (*arg) = e_minicard->card; */
- break;
- case ARG_MODEL:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_minicard->model);
- break;
- case ARG_ROW:
- GTK_VALUE_INT (*arg) = e_minicard->row;
+ GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_minicard->card);
break;
default:
arg->type = GTK_TYPE_INVALID;
@@ -227,8 +204,8 @@ e_minicard_destroy (GtkObject *object)
e_minicard = E_MINICARD (object);
- if (e_minicard->model)
- gtk_object_unref (e_minicard->model);
+ if (e_minicard->card)
+ gtk_object_unref (GTK_OBJECT(e_minicard->card));
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
@@ -239,7 +216,6 @@ e_minicard_realize (GnomeCanvasItem *item)
{
EMinicard *e_minicard;
GnomeCanvasGroup *group;
- GnomeCanvasItem *new_item;
e_minicard = E_MINICARD (item);
group = GNOME_CANVAS_GROUP( item );
@@ -276,46 +252,10 @@ e_minicard_realize (GnomeCanvasItem *item)
"use_ellipsis", TRUE,
"font", "lucidasans-bold-10",
"fill_color", "black",
- "text", "Chris Lahey",
+ "text", "",
NULL );
e_canvas_item_move_absolute(e_minicard->header_text, 6, 6);
- new_item = e_minicard_label_new(group);
- gnome_canvas_item_set( new_item,
- "width", e_minicard->width - 4.0,
- "fieldname", "Email:",
- "field", "clahey@address.com",
- NULL );
- e_minicard->fields = g_list_append( e_minicard->fields, new_item);
- e_canvas_item_move_absolute(new_item, 2, e_minicard->height);
-
- new_item = e_minicard_label_new(group);
- gnome_canvas_item_set( new_item,
- "width", e_minicard->width - 4,
- "fieldname", "Full Name:",
- "field", "Christopher James Lahey",
- NULL );
- e_minicard->fields = g_list_append( e_minicard->fields, new_item);
- e_canvas_item_move_absolute(new_item, 2, e_minicard->height);
-
- new_item = e_minicard_label_new(group);
- gnome_canvas_item_set( new_item,
- "width", e_minicard->width - 4,
- "fieldname", "Street Address:",
- "field", "100 Main St\nHome town, USA",
- NULL );
- e_minicard->fields = g_list_append( e_minicard->fields, new_item);
- e_canvas_item_move_absolute(new_item, 2, e_minicard->height);
-
- new_item = e_minicard_label_new(group);
- gnome_canvas_item_set( new_item,
- "width", e_minicard->width - 4,
- "fieldname", "Phone:",
- "field", "000-0000",
- NULL );
- e_minicard->fields = g_list_append( e_minicard->fields, new_item);
- e_canvas_item_move_absolute(new_item, 2, e_minicard->height);
-
remodel(e_minicard);
e_canvas_item_request_reflow(item);
@@ -439,31 +379,92 @@ e_minicard_resize_children( EMinicard *e_minicard )
}
static void
-remodel( EMinicard *e_minicard )
+add_field (EMinicard *e_minicard, char *fieldname, char* field)
{
+ GnomeCanvasItem *new_item;
GnomeCanvasGroup *group;
group = GNOME_CANVAS_GROUP( e_minicard );
- if ( e_minicard->model ) {
- gint column = 0;
- GList *list = e_minicard->fields;
- ETableTextModel *model;
- for ( ; list; list = list->next, column++ ) {
- ETableTextModel *model = e_table_text_model_new(e_minicard->model, e_minicard->row, column);
- gnome_canvas_item_set(GNOME_CANVAS_ITEM(list->data),
- "text_model", model,
- NULL);
- gtk_object_sink(GTK_OBJECT(model));
+ new_item = e_minicard_label_new(group);
+ gnome_canvas_item_set( new_item,
+ "width", e_minicard->width - 4.0,
+ "fieldname", fieldname,
+ "field", field,
+ NULL );
+ e_minicard->fields = g_list_append( e_minicard->fields, new_item);
+ e_canvas_item_move_absolute(new_item, 2, e_minicard->height);
+}
+
+
+static void
+remodel( EMinicard *e_minicard )
+{
+ if (e_minicard->card) {
+ char *fname;
+ ECardList *address_list;
+ ECardList *phone_list;
+ ECardList *email_list;
+
+ ECardIterator *iterator;
+
+ GList *list;
+
+ for ( list = e_minicard->fields; list; list = g_list_next( list ) ) {
+ gtk_object_destroy( GTK_OBJECT( list->data ) );
}
- if ( e_minicard->header_text ) {
- model = e_table_text_model_new(e_minicard->model, e_minicard->row, 1);
- gnome_canvas_item_set(GNOME_CANVAS_ITEM(e_minicard->header_text),
- "model", model,
- NULL);
- gtk_object_sink(GTK_OBJECT(model));
+ g_list_free(e_minicard->fields);
+ e_minicard->fields = NULL;
+
+ gtk_object_get(GTK_OBJECT(e_minicard->card),
+ "full_name", &fname,
+ "address", &address_list,
+ "phone", &phone_list,
+ "email", &email_list,
+ NULL);
+
+ if (fname) {
+ add_field(e_minicard, "Name:", fname);
+ if (e_minicard->header_text)
+ gnome_canvas_item_set(e_minicard->header_text,
+ "text", fname,
+ NULL);
+ } else
+ if (e_minicard->header_text)
+ gnome_canvas_item_set(e_minicard->header_text,
+ "text", "",
+ NULL);
+ if (address_list) {
+ for (iterator = e_card_list_get_iterator(address_list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
+ const ECardDeliveryAddress *address = e_card_iterator_get(iterator);
+ if (address->flags & ADDR_WORK) {
+ add_field(e_minicard, "Work Address:", address->city);
+ } else if (address->flags & ADDR_HOME) {
+ add_field(e_minicard, "Home Address:", address->city);
+ } else {
+ add_field(e_minicard, "Address:", address->city);
+ }
+ }
+ }
+ if (phone_list) {
+ for (iterator = e_card_list_get_iterator(phone_list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
+ const ECardPhone *phone = e_card_iterator_get(iterator);
+ if (phone->flags & E_CARD_PHONE_WORK) {
+ add_field(e_minicard, "Work Phone:", phone->number);
+ } else if (phone->flags & E_CARD_PHONE_HOME) {
+ add_field(e_minicard, "Home Phone:", phone->number);
+ } else if (phone->flags & E_CARD_PHONE_CELL) {
+ add_field(e_minicard, "Mobile Phone:", phone->number);
+ } else {
+ add_field(e_minicard, "Phone:", phone->number);
+ }
+ }
+ }
+ if (email_list) {
+ for (iterator = e_card_list_get_iterator(email_list); e_card_iterator_is_valid(iterator); e_card_iterator_next(iterator)) {
+ add_field(e_minicard, "Email:", (char *) e_card_iterator_get(iterator));
+ }
}
-
}
}
@@ -513,3 +514,38 @@ e_minicard_reflow( GnomeCanvasItem *item, int flags )
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 NULL;
+ }
+}
+
+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 *fname1, *fname2;
+ gtk_object_get(GTK_OBJECT(minicard1->card),
+ "full_name", &fname1,
+ NULL);
+ gtk_object_get(GTK_OBJECT(minicard2->card),
+ "full_name", &fname2,
+ NULL);
+ return strcmp(fname1, fname2);
+ } else {
+ return 0;
+ }
+}
diff --git a/widgets/e-minicard/e-minicard.h b/widgets/e-minicard/e-minicard.h
index 05d95a743e..85481d586e 100644
--- a/widgets/e-minicard/e-minicard.h
+++ b/widgets/e-minicard/e-minicard.h
@@ -22,7 +22,7 @@
#define __E_MINICARD_H__
#include <gnome.h>
-#include "e-table-model.h"
+#include "e-card.h"
#ifdef __cplusplus
extern "C" {
@@ -37,10 +37,6 @@ extern "C" {
* --------------------------------------------------------------------------------
* width double RW width of the card
* height double R height of the card
- * model ETableModel RW model to read from
- * row int RW ETableModel row to read from
- *
- * Later:
* card ECard* RW Pointer to the ECard
*/
@@ -72,8 +68,7 @@ struct _EMinicard
GnomeCanvasItem *header_text;
GList *fields; /* Of type GnomeCanvasItem. */
- ETableModel *model;
- int row;
+ ECard *card;
guint needs_remodeling : 1;
gboolean has_focus;
@@ -90,7 +85,9 @@ struct _EMinicardClass
};
-GtkType e_minicard_get_type (void);
+GtkType e_minicard_get_type (void);
+char *e_minicard_get_card_id (EMinicard *minicard);
+int e_minicard_compare (EMinicard *minicard1, EMinicard *minicard2);
#ifdef __cplusplus
}
diff --git a/widgets/e-minicard/e-reflow-sorted.c b/widgets/e-minicard/e-reflow-sorted.c
new file mode 100644
index 0000000000..696efe454a
--- /dev/null
+++ b/widgets/e-minicard/e-reflow-sorted.c
@@ -0,0 +1,185 @@
+/* -*- 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 <gnome.h>
+#include <math.h>
+#include "e-reflow-sorted.h"
+#include "e-canvas-utils.h"
+#include "e-canvas.h"
+#include "e-util.h"
+#include <glib.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);
+
+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;
+ }
+}
+
+void
+e_reflow_sorted_remove_item(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)) {
+ reflow->items = g_list_remove_link(reflow->items, list);
+ g_list_free_1(list);
+ gtk_object_destroy(GTK_OBJECT(item));
+ if ( GTK_OBJECT_FLAGS( e_reflow_sorted ) & GNOME_CANVAS_ITEM_REALIZED ) {
+ e_canvas_item_request_reflow(item);
+ }
+ return;
+ }
+ }
+ }
+}
+
+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);
+ }
+}
+
+
+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);
+
+ 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(item);
+ }
+ }
+}
diff --git a/widgets/e-minicard/e-reflow-sorted.h b/widgets/e-minicard/e-reflow-sorted.h
new file mode 100644
index 0000000000..4ffec7579b
--- /dev/null
+++ b/widgets/e-minicard/e-reflow-sorted.h
@@ -0,0 +1,87 @@
+/* -*- 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 <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);
+GtkType e_reflow_sorted_get_type (void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __E_REFLOW_SORTED_H__ */
diff --git a/widgets/e-minicard/e-reflow.c b/widgets/e-minicard/e-reflow.c
index 4af46bd4a4..0ff8c0f4ea 100644
--- a/widgets/e-minicard/e-reflow.c
+++ b/widgets/e-minicard/e-reflow.c
@@ -26,10 +26,11 @@
#include "e-canvas-utils.h"
#include "e-canvas.h"
#include "e-util.h"
-static void e_reflow_init (EReflow *card);
+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);
@@ -38,6 +39,7 @@ static void e_reflow_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
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 e_reflow_resize_children (GnomeCanvasItem *item);
@@ -97,10 +99,12 @@ e_reflow_class_init (EReflowClass *klass)
GTK_ARG_READABLE, ARG_WIDTH);
gtk_object_add_arg_type ("EReflow::height", GTK_TYPE_DOUBLE,
GTK_ARG_READWRITE, ARG_HEIGHT);
+
+ 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; */
+ 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;
@@ -114,7 +118,6 @@ e_reflow_class_init (EReflowClass *klass)
static void
e_reflow_init (EReflow *reflow)
{
- /* reflow->card = NULL;*/
reflow->items = NULL;
reflow->columns = NULL;
reflow->column_width = 150;
@@ -181,6 +184,14 @@ e_reflow_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
}
static void
+e_reflow_destroy (GtkObject *object)
+{
+ EReflow *reflow = E_REFLOW(object);
+
+ g_list_free(reflow->items);
+}
+
+static void
e_reflow_realize (GnomeCanvasItem *item)
{
EReflow *e_reflow;
@@ -228,9 +239,11 @@ e_reflow_unrealize (GnomeCanvasItem *item)
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->items);
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);
@@ -428,8 +441,8 @@ e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
return 0;
}
-void
-e_reflow_add_item(EReflow *e_reflow, GnomeCanvasItem *item)
+static void
+e_reflow_real_add_item(EReflow *e_reflow, GnomeCanvasItem *item)
{
e_reflow->items = g_list_append(e_reflow->items, item);
if ( GTK_OBJECT_FLAGS( e_reflow ) & GNOME_CANVAS_ITEM_REALIZED ) {
@@ -747,3 +760,10 @@ e_reflow_reflow( GnomeCanvasItem *item, int flags )
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);
+}
diff --git a/widgets/e-minicard/e-reflow.h b/widgets/e-minicard/e-reflow.h
index 3a731474cb..54de59ba55 100644
--- a/widgets/e-minicard/e-reflow.h
+++ b/widgets/e-minicard/e-reflow.h
@@ -54,10 +54,8 @@ struct _EReflow
GnomeCanvasGroup parent;
/* item specific fields */
- /* EBook *book; */
-
GList *items; /* Of type GnomeCanvasItem */
- GList *columns; /* Of type GList pointing to type GnomeCanvasItem (points into items) */
+ GList *columns; /* Of type GList of type GnomeCanvasItem (points into items) */
gint column_count; /* Number of columnns */
double minimum_width;
@@ -87,12 +85,16 @@ struct _EReflowClass
{
GnomeCanvasGroupClass parent_class;
- void (* resize) (EReflow *reflow);
+ /* Virtual methods. */
+ void (* add_item) (EReflow *reflow, GnomeCanvasItem *item);
};
-/* To be added to a reflow, an item must have the arguments "x", "y",
- and "width" as Read/Write arguments and "height" as a Read Only
- argument. It must also have a "resize" signal. */
+/*
+ * 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);
diff --git a/widgets/e-minicard/test-minicard-view.c b/widgets/e-minicard/test-minicard-view.c
new file mode 100644
index 0000000000..d3ceff228e
--- /dev/null
+++ b/widgets/e-minicard/test-minicard-view.c
@@ -0,0 +1,206 @@
+/* -*- 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-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/widgets/e-minicard/test-reflow.c b/widgets/e-minicard/test-reflow.c
index 8cedbaac28..64c2b89a37 100644
--- a/widgets/e-minicard/test-reflow.c
+++ b/widgets/e-minicard/test-reflow.c
@@ -16,6 +16,32 @@
*/
+#define TEST_VCARD \
+"BEGIN:VCARD
+" \
+"FN:Nat
+" \
+"N:Friedman;Nat;D;Mr.
+" \
+"BDAY:1977-08-06
+" \
+"TEL;WORK:617 679 1984
+" \
+"TEL;CELL:123 456 7890
+" \
+"EMAIL;INTERNET:nat@nat.org
+" \
+"EMAIL;INTERNET:nat@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"
@@ -127,8 +153,10 @@ int main( int argc, char *argv[] )
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);
}
diff --git a/widgets/e-text/e-text.c b/widgets/e-text/e-text.c
index 4b3831c30b..8828f1b8e1 100644
--- a/widgets/e-text/e-text.c
+++ b/widgets/e-text/e-text.c
@@ -26,6 +26,7 @@
#include <libart_lgpl/art_rgb_bitmap_affine.h>
#include <gtk/gtkinvisible.h>
#include "e-util/e-canvas.h"
+#include "e-util/e-canvas-utils.h"
#include "e-text-event-processor-emacs-like.h"
@@ -2163,6 +2164,7 @@ _do_tooltip (gpointer data)
ArtPoint origin = {0, 0};
ArtPoint pixel_origin;
int canvas_x, canvas_y;
+ GnomeCanvasItem *tooltip_text;
text->tooltip_count = 0;
@@ -2194,7 +2196,7 @@ _do_tooltip (gpointer data)
pixel_origin.y -= (int) gtk_layout_get_vadjustment(GTK_LAYOUT(GNOME_CANVAS_ITEM(text)->canvas))->value;
text->tooltip_window = gtk_window_new (GTK_WINDOW_POPUP);
- gtk_container_set_border_width (GTK_CONTAINER (text->tooltip_window), 2);
+ gtk_container_set_border_width (GTK_CONTAINER (text->tooltip_window), 1);
canvas = e_canvas_new ();
gtk_container_add (GTK_CONTAINER (text->tooltip_window), canvas);
@@ -2212,15 +2214,26 @@ _do_tooltip (gpointer data)
}
gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)),
- e_text_get_type (),
- "anchor", GTK_ANCHOR_NW,
- "font_gdk", text->font,
- "text", text->text,
- "editable", FALSE,
- "clip_width", max_width,
- "clip_height", (double)text->height,
- "clip", TRUE,
- NULL);
+ gnome_canvas_rect_get_type (),
+ "x1", (double) 0,
+ "y1", (double) 0,
+ "x2", (double) max_width + 4,
+ "y2", (double) text->height + 4,
+ "fill_color", "yellow",
+ NULL);
+
+ tooltip_text = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)),
+ e_text_get_type (),
+ "anchor", GTK_ANCHOR_NW,
+ "font_gdk", text->font,
+ "text", text->text,
+ "editable", FALSE,
+ "clip_width", max_width,
+ "clip_height", (double)text->height,
+ "clip", TRUE,
+ NULL);
+
+ e_canvas_item_move_absolute(tooltip_text, 1, 1);
gtk_widget_set_usize (text->tooltip_window,
(int)max_width + 4,
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index 4b3831c30b..8828f1b8e1 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -26,6 +26,7 @@
#include <libart_lgpl/art_rgb_bitmap_affine.h>
#include <gtk/gtkinvisible.h>
#include "e-util/e-canvas.h"
+#include "e-util/e-canvas-utils.h"
#include "e-text-event-processor-emacs-like.h"
@@ -2163,6 +2164,7 @@ _do_tooltip (gpointer data)
ArtPoint origin = {0, 0};
ArtPoint pixel_origin;
int canvas_x, canvas_y;
+ GnomeCanvasItem *tooltip_text;
text->tooltip_count = 0;
@@ -2194,7 +2196,7 @@ _do_tooltip (gpointer data)
pixel_origin.y -= (int) gtk_layout_get_vadjustment(GTK_LAYOUT(GNOME_CANVAS_ITEM(text)->canvas))->value;
text->tooltip_window = gtk_window_new (GTK_WINDOW_POPUP);
- gtk_container_set_border_width (GTK_CONTAINER (text->tooltip_window), 2);
+ gtk_container_set_border_width (GTK_CONTAINER (text->tooltip_window), 1);
canvas = e_canvas_new ();
gtk_container_add (GTK_CONTAINER (text->tooltip_window), canvas);
@@ -2212,15 +2214,26 @@ _do_tooltip (gpointer data)
}
gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)),
- e_text_get_type (),
- "anchor", GTK_ANCHOR_NW,
- "font_gdk", text->font,
- "text", text->text,
- "editable", FALSE,
- "clip_width", max_width,
- "clip_height", (double)text->height,
- "clip", TRUE,
- NULL);
+ gnome_canvas_rect_get_type (),
+ "x1", (double) 0,
+ "y1", (double) 0,
+ "x2", (double) max_width + 4,
+ "y2", (double) text->height + 4,
+ "fill_color", "yellow",
+ NULL);
+
+ tooltip_text = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)),
+ e_text_get_type (),
+ "anchor", GTK_ANCHOR_NW,
+ "font_gdk", text->font,
+ "text", text->text,
+ "editable", FALSE,
+ "clip_width", max_width,
+ "clip_height", (double)text->height,
+ "clip", TRUE,
+ NULL);
+
+ e_canvas_item_move_absolute(tooltip_text, 1, 1);
gtk_widget_set_usize (text->tooltip_window,
(int)max_width + 4,