aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addressbook/ChangeLog13
-rw-r--r--addressbook/gui/minicard/e-minicard-view.c77
-rw-r--r--addressbook/gui/minicard/e-minicard.c2
-rw-r--r--addressbook/gui/minicard/e-reflow-sorted.c2
-rw-r--r--addressbook/gui/minicard/e-reflow.c172
-rw-r--r--addressbook/gui/minicard/e-reflow.h6
-rw-r--r--addressbook/gui/widgets/e-minicard-view.c77
-rw-r--r--addressbook/gui/widgets/e-minicard.c2
-rw-r--r--addressbook/printing/e-contact-print.c4
-rw-r--r--addressbook/printing/medbook.ecps8
-rw-r--r--widgets/e-reflow/e-reflow-sorted.c2
-rw-r--r--widgets/e-reflow/e-reflow.c172
-rw-r--r--widgets/e-reflow/e-reflow.h6
-rw-r--r--widgets/misc/e-reflow.c172
-rw-r--r--widgets/misc/e-reflow.h6
15 files changed, 563 insertions, 158 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 6aef5a787e..e8759231c0 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,5 +1,18 @@
2000-05-30 Christopher James Lahey <clahey@helixcode.com>
+ * gui/minicard/e-minicard-view.c: Made double clicking create a
+ new card. Set the empty message.
+
+ * gui/minicard/e-minicard.c: Made sorting be case insensitive.
+
+ * gui/minicard/e-reflow-sorted.c, e-reflow.c, e-reflow.h: Added a
+ message for when the reflow is empty.
+
+ * printing/e-contact-print.c, printing/medbook.ecps: Made the
+ default printout be full page. Made sorting case insensitive.
+
+2000-05-30 Christopher James Lahey <clahey@helixcode.com>
+
* backend/ebook/e-book-view-listener.c,
backend/ebook/e-book-view-listener.h, backend/ebook/e-book-view.c,
backend/ebook/e-book-view.h, backend/idl/addressbook.idl,
diff --git a/addressbook/gui/minicard/e-minicard-view.c b/addressbook/gui/minicard/e-minicard-view.c
index 566b798987..d3acb1ad54 100644
--- a/addressbook/gui/minicard/e-minicard-view.c
+++ b/addressbook/gui/minicard/e-minicard-view.c
@@ -25,11 +25,13 @@
#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);
@@ -86,6 +88,8 @@ e_minicard_view_class_init (EMinicardViewClass *klass)
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 */
}
@@ -101,6 +105,11 @@ e_minicard_view_init (EMinicardView *view)
view->remove_card_id = 0;
view->modify_card_id = 0;
view->canvas_destroy_id = 0;
+
+ gtk_object_set(GTK_OBJECT(view),
+ "empty_message", _("There 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;
@@ -259,6 +268,74 @@ e_minicard_view_destroy (GtkObject *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 gboolean
+e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event)
+{
+ EMinicardView *view;
+
+ view = E_MINICARD_VIEW (item);
+
+ switch( event->type ) {
+ case GDK_2BUTTON_PRESS:
+ {
+ gint result;
+ ECard *card;
+ GtkWidget* contact_editor;
+ EBook *book;
+ GtkWidget* dlg = gnome_dialog_new ("Contact Editor", "Save", "Cancel", NULL);
+
+ card = e_card_new("");
+ contact_editor = e_contact_editor_new(card);
+ gtk_object_sink(GTK_OBJECT(card));
+
+ gtk_window_set_policy(GTK_WINDOW(dlg), FALSE, TRUE, FALSE);
+
+ gtk_object_get(GTK_OBJECT(view), "book", &book, NULL);
+
+
+ g_assert (E_IS_BOOK (book));
+
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox),
+ contact_editor, TRUE, TRUE, 0);
+
+ gtk_widget_show (contact_editor);
+ gtk_widget_show (dlg);
+
+ gnome_dialog_close_hides (GNOME_DIALOG (dlg), TRUE);
+ result = gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
+
+
+ /* If the user clicks "okay"...*/
+ if (result == 0) {
+ ECard *card;
+ g_assert (contact_editor);
+ g_assert (GTK_IS_OBJECT (contact_editor));
+ gtk_object_get(GTK_OBJECT(contact_editor),
+ "card", &card,
+ NULL);
+
+ /* Add the card in the contact editor to our ebook */
+ e_book_add_card (
+ book,
+ card,
+ card_added_cb,
+ NULL);
+ }
+ }
+ return FALSE;
+ default:
+ return TRUE;
+ break;
+ }
+}
+
+static void
disconnect_signals(EMinicardView *view)
{
if (view->book_view && view->create_card_id)
diff --git a/addressbook/gui/minicard/e-minicard.c b/addressbook/gui/minicard/e-minicard.c
index 7831b3152d..834bd3a0b0 100644
--- a/addressbook/gui/minicard/e-minicard.c
+++ b/addressbook/gui/minicard/e-minicard.c
@@ -674,7 +674,7 @@ e_minicard_compare (EMinicard *minicard1, EMinicard *minicard2)
"file_as", &file_as2,
NULL);
if (file_as1 && file_as2)
- return strcmp(file_as1, file_as2);
+ return strcasecmp(file_as1, file_as2);
if (file_as1)
return -1;
if (file_as2)
diff --git a/addressbook/gui/minicard/e-reflow-sorted.c b/addressbook/gui/minicard/e-reflow-sorted.c
index 415537825b..7205785c6c 100644
--- a/addressbook/gui/minicard/e-reflow-sorted.c
+++ b/addressbook/gui/minicard/e-reflow-sorted.c
@@ -171,6 +171,7 @@ e_reflow_sorted_remove_item(EReflowSorted *e_reflow_sorted, const gchar *id)
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);
}
}
}
@@ -231,4 +232,5 @@ e_reflow_sorted_add_item(EReflow *reflow, GnomeCanvasItem *item)
e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(e_reflow_sorted));
}
}
+ e_reflow_post_add_item(reflow, item);
}
diff --git a/addressbook/gui/minicard/e-reflow.c b/addressbook/gui/minicard/e-reflow.c
index eee8e695c7..ba7bf36c4d 100644
--- a/addressbook/gui/minicard/e-reflow.c
+++ b/addressbook/gui/minicard/e-reflow.c
@@ -24,6 +24,7 @@
#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>
@@ -42,6 +43,7 @@ static void e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *cl
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);
@@ -56,7 +58,8 @@ enum {
ARG_0,
ARG_MINIMUM_WIDTH,
ARG_WIDTH,
- ARG_HEIGHT
+ ARG_HEIGHT,
+ ARG_EMPTY_MESSAGE,
};
GtkType
@@ -87,58 +90,63 @@ e_reflow_get_type (void)
static void
e_reflow_class_init (EReflowClass *klass)
{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
+ GtkObjectClass *object_class;
+ GnomeCanvasItemClass *item_class;
- object_class = (GtkObjectClass*) klass;
- item_class = (GnomeCanvasItemClass *) klass;
+ object_class = (GtkObjectClass*) klass;
+ item_class = (GnomeCanvasItemClass *) klass;
- parent_class = gtk_type_class (gnome_canvas_group_get_type ());
+ 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);
-
- klass->add_item = e_reflow_real_add_item;
+ 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;
+ 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;
+ /* 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->items = NULL;
+ reflow->columns = NULL;
+ reflow->column_width = 150;
+
+ reflow->minimum_width = 10;
+ reflow->width = 10;
+ reflow->height = 10;
+ reflow->idle = 0;
- 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->column_drag = FALSE;
- reflow->need_height_update = FALSE;
- reflow->need_column_resize = FALSE;
+ reflow->need_height_update = FALSE;
+ reflow->need_column_resize = FALSE;
- reflow->default_cursor_shown = TRUE;
- reflow->arrow_cursor = NULL;
- reflow->default_cursor = NULL;
+ 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);
+ e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(reflow), e_reflow_reflow);
}
static void
@@ -152,13 +160,20 @@ e_reflow_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
switch (arg_id){
case ARG_HEIGHT:
- e_reflow->height = GTK_VALUE_DOUBLE (*arg);
- e_canvas_item_request_reflow(item);
- break;
+ 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);
}
}
@@ -171,17 +186,20 @@ e_reflow_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
switch (arg_id) {
case ARG_MINIMUM_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = e_reflow->minimum_width;
- break;
+ GTK_VALUE_DOUBLE (*arg) = e_reflow->minimum_width;
+ break;
case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = e_reflow->width;
- break;
+ GTK_VALUE_DOUBLE (*arg) = e_reflow->width;
+ break;
case ARG_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = e_reflow->height;
- break;
+ 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;
+ arg->type = GTK_TYPE_INVALID;
+ break;
}
}
@@ -193,6 +211,8 @@ e_reflow_destroy (GtkObject *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);
}
@@ -221,6 +241,8 @@ e_reflow_realize (GnomeCanvasItem *item)
NULL);
}
+ set_empty(e_reflow);
+
e_canvas_item_request_reflow(item);
adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
@@ -456,6 +478,7 @@ e_reflow_real_add_item(EReflow *e_reflow, GnomeCanvasItem *item)
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);
}
@@ -678,7 +701,7 @@ _reflow( EReflow *e_reflow )
if (e_reflow->items == NULL) {
e_reflow->columns = NULL;
- e_reflow->column_count = 1;
+ e_reflow->column_count = 0;
return;
}
@@ -708,6 +731,49 @@ _reflow( EReflow *e_reflow )
}
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);
@@ -774,3 +840,9 @@ 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
index 54de59ba55..eb66b094a5 100644
--- a/addressbook/gui/minicard/e-reflow.h
+++ b/addressbook/gui/minicard/e-reflow.h
@@ -57,6 +57,9 @@ struct _EReflow
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;
@@ -98,6 +101,9 @@ struct _EReflowClass
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 */
diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c
index 566b798987..d3acb1ad54 100644
--- a/addressbook/gui/widgets/e-minicard-view.c
+++ b/addressbook/gui/widgets/e-minicard-view.c
@@ -25,11 +25,13 @@
#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);
@@ -86,6 +88,8 @@ e_minicard_view_class_init (EMinicardViewClass *klass)
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 */
}
@@ -101,6 +105,11 @@ e_minicard_view_init (EMinicardView *view)
view->remove_card_id = 0;
view->modify_card_id = 0;
view->canvas_destroy_id = 0;
+
+ gtk_object_set(GTK_OBJECT(view),
+ "empty_message", _("There 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;
@@ -259,6 +268,74 @@ e_minicard_view_destroy (GtkObject *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 gboolean
+e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event)
+{
+ EMinicardView *view;
+
+ view = E_MINICARD_VIEW (item);
+
+ switch( event->type ) {
+ case GDK_2BUTTON_PRESS:
+ {
+ gint result;
+ ECard *card;
+ GtkWidget* contact_editor;
+ EBook *book;
+ GtkWidget* dlg = gnome_dialog_new ("Contact Editor", "Save", "Cancel", NULL);
+
+ card = e_card_new("");
+ contact_editor = e_contact_editor_new(card);
+ gtk_object_sink(GTK_OBJECT(card));
+
+ gtk_window_set_policy(GTK_WINDOW(dlg), FALSE, TRUE, FALSE);
+
+ gtk_object_get(GTK_OBJECT(view), "book", &book, NULL);
+
+
+ g_assert (E_IS_BOOK (book));
+
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox),
+ contact_editor, TRUE, TRUE, 0);
+
+ gtk_widget_show (contact_editor);
+ gtk_widget_show (dlg);
+
+ gnome_dialog_close_hides (GNOME_DIALOG (dlg), TRUE);
+ result = gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
+
+
+ /* If the user clicks "okay"...*/
+ if (result == 0) {
+ ECard *card;
+ g_assert (contact_editor);
+ g_assert (GTK_IS_OBJECT (contact_editor));
+ gtk_object_get(GTK_OBJECT(contact_editor),
+ "card", &card,
+ NULL);
+
+ /* Add the card in the contact editor to our ebook */
+ e_book_add_card (
+ book,
+ card,
+ card_added_cb,
+ NULL);
+ }
+ }
+ return FALSE;
+ default:
+ return TRUE;
+ break;
+ }
+}
+
+static void
disconnect_signals(EMinicardView *view)
{
if (view->book_view && view->create_card_id)
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c
index 7831b3152d..834bd3a0b0 100644
--- a/addressbook/gui/widgets/e-minicard.c
+++ b/addressbook/gui/widgets/e-minicard.c
@@ -674,7 +674,7 @@ e_minicard_compare (EMinicard *minicard1, EMinicard *minicard2)
"file_as", &file_as2,
NULL);
if (file_as1 && file_as2)
- return strcmp(file_as1, file_as2);
+ return strcasecmp(file_as1, file_as2);
if (file_as1)
return -1;
if (file_as2)
diff --git a/addressbook/printing/e-contact-print.c b/addressbook/printing/e-contact-print.c
index f03f1389b4..aeb9cfee58 100644
--- a/addressbook/printing/e-contact-print.c
+++ b/addressbook/printing/e-contact-print.c
@@ -575,7 +575,7 @@ card_compare (ECard *card1, ECard *card2) {
"file_as", &file_as2,
NULL);
if (file_as1 && file_as2)
- return strcmp(file_as1, file_as2);
+ return strcasecmp(file_as1, file_as2);
if (file_as1)
return -1;
if (file_as2)
@@ -876,7 +876,7 @@ e_contact_build_style(EContactPrintStyle *style)
style->center_footer = g_strdup("");
style->right_footer = g_strdup("");
style->reverse_on_even_pages = FALSE;
- filename = g_concat_dir_and_file(EVOLUTION_ECPSDIR, "smallbook.ecps");
+ filename = g_concat_dir_and_file(EVOLUTION_ECPSDIR, "medbook.ecps");
styledoc = xmlParseFile(filename);
g_free(filename);
if (styledoc) {
diff --git a/addressbook/printing/medbook.ecps b/addressbook/printing/medbook.ecps
index 2031f39b92..72cca146dd 100644
--- a/addressbook/printing/medbook.ecps
+++ b/addressbook/printing/medbook.ecps
@@ -2,11 +2,11 @@
<title/>
<type>cards</type>
<sections_start_new_page>FALSE</sections_start_new_page>
-<num_columns>1</num_columns>
+<num_columns>2</num_columns>
<blank_forms>2</blank_forms>
<letter_tabs>TRUE</letter_tabs>
<letter_headings>TRUE</letter_headings>
-<headings_font>Helvetica-Bold 10</headings_font>
+<headings_font>Helvetica-Bold 12</headings_font>
<body_font>Helvetica 8</body_font>
<print_using_grey>TRUE</print_using_grey>
<paper_width>8.5</paper_width>
@@ -15,8 +15,8 @@
<left_margin>0.5</left_margin>
<bottom_margin>0.5</bottom_margin>
<right_margin>0.5</right_margin>
-<page_width>4.25</page_width>
-<page_height>5.5</page_height>
+<page_width>8.5</page_width>
+<page_height>11</page_height>
<orientation>portrait</orientation>
<header_font>Helvetica 8</header_font>
<left_header/>
diff --git a/widgets/e-reflow/e-reflow-sorted.c b/widgets/e-reflow/e-reflow-sorted.c
index 415537825b..7205785c6c 100644
--- a/widgets/e-reflow/e-reflow-sorted.c
+++ b/widgets/e-reflow/e-reflow-sorted.c
@@ -171,6 +171,7 @@ e_reflow_sorted_remove_item(EReflowSorted *e_reflow_sorted, const gchar *id)
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);
}
}
}
@@ -231,4 +232,5 @@ e_reflow_sorted_add_item(EReflow *reflow, GnomeCanvasItem *item)
e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(e_reflow_sorted));
}
}
+ e_reflow_post_add_item(reflow, item);
}
diff --git a/widgets/e-reflow/e-reflow.c b/widgets/e-reflow/e-reflow.c
index eee8e695c7..ba7bf36c4d 100644
--- a/widgets/e-reflow/e-reflow.c
+++ b/widgets/e-reflow/e-reflow.c
@@ -24,6 +24,7 @@
#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>
@@ -42,6 +43,7 @@ static void e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *cl
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);
@@ -56,7 +58,8 @@ enum {
ARG_0,
ARG_MINIMUM_WIDTH,
ARG_WIDTH,
- ARG_HEIGHT
+ ARG_HEIGHT,
+ ARG_EMPTY_MESSAGE,
};
GtkType
@@ -87,58 +90,63 @@ e_reflow_get_type (void)
static void
e_reflow_class_init (EReflowClass *klass)
{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
+ GtkObjectClass *object_class;
+ GnomeCanvasItemClass *item_class;
- object_class = (GtkObjectClass*) klass;
- item_class = (GnomeCanvasItemClass *) klass;
+ object_class = (GtkObjectClass*) klass;
+ item_class = (GnomeCanvasItemClass *) klass;
- parent_class = gtk_type_class (gnome_canvas_group_get_type ());
+ 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);
-
- klass->add_item = e_reflow_real_add_item;
+ 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;
+ 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;
+ /* 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->items = NULL;
+ reflow->columns = NULL;
+ reflow->column_width = 150;
+
+ reflow->minimum_width = 10;
+ reflow->width = 10;
+ reflow->height = 10;
+ reflow->idle = 0;
- 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->column_drag = FALSE;
- reflow->need_height_update = FALSE;
- reflow->need_column_resize = FALSE;
+ reflow->need_height_update = FALSE;
+ reflow->need_column_resize = FALSE;
- reflow->default_cursor_shown = TRUE;
- reflow->arrow_cursor = NULL;
- reflow->default_cursor = NULL;
+ 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);
+ e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(reflow), e_reflow_reflow);
}
static void
@@ -152,13 +160,20 @@ e_reflow_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
switch (arg_id){
case ARG_HEIGHT:
- e_reflow->height = GTK_VALUE_DOUBLE (*arg);
- e_canvas_item_request_reflow(item);
- break;
+ 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);
}
}
@@ -171,17 +186,20 @@ e_reflow_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
switch (arg_id) {
case ARG_MINIMUM_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = e_reflow->minimum_width;
- break;
+ GTK_VALUE_DOUBLE (*arg) = e_reflow->minimum_width;
+ break;
case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = e_reflow->width;
- break;
+ GTK_VALUE_DOUBLE (*arg) = e_reflow->width;
+ break;
case ARG_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = e_reflow->height;
- break;
+ 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;
+ arg->type = GTK_TYPE_INVALID;
+ break;
}
}
@@ -193,6 +211,8 @@ e_reflow_destroy (GtkObject *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);
}
@@ -221,6 +241,8 @@ e_reflow_realize (GnomeCanvasItem *item)
NULL);
}
+ set_empty(e_reflow);
+
e_canvas_item_request_reflow(item);
adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
@@ -456,6 +478,7 @@ e_reflow_real_add_item(EReflow *e_reflow, GnomeCanvasItem *item)
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);
}
@@ -678,7 +701,7 @@ _reflow( EReflow *e_reflow )
if (e_reflow->items == NULL) {
e_reflow->columns = NULL;
- e_reflow->column_count = 1;
+ e_reflow->column_count = 0;
return;
}
@@ -708,6 +731,49 @@ _reflow( EReflow *e_reflow )
}
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);
@@ -774,3 +840,9 @@ 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/widgets/e-reflow/e-reflow.h b/widgets/e-reflow/e-reflow.h
index 54de59ba55..eb66b094a5 100644
--- a/widgets/e-reflow/e-reflow.h
+++ b/widgets/e-reflow/e-reflow.h
@@ -57,6 +57,9 @@ struct _EReflow
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;
@@ -98,6 +101,9 @@ struct _EReflowClass
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 */
diff --git a/widgets/misc/e-reflow.c b/widgets/misc/e-reflow.c
index eee8e695c7..ba7bf36c4d 100644
--- a/widgets/misc/e-reflow.c
+++ b/widgets/misc/e-reflow.c
@@ -24,6 +24,7 @@
#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>
@@ -42,6 +43,7 @@ static void e_reflow_update (GnomeCanvasItem *item, double affine[6], ArtSVP *cl
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);
@@ -56,7 +58,8 @@ enum {
ARG_0,
ARG_MINIMUM_WIDTH,
ARG_WIDTH,
- ARG_HEIGHT
+ ARG_HEIGHT,
+ ARG_EMPTY_MESSAGE,
};
GtkType
@@ -87,58 +90,63 @@ e_reflow_get_type (void)
static void
e_reflow_class_init (EReflowClass *klass)
{
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
+ GtkObjectClass *object_class;
+ GnomeCanvasItemClass *item_class;
- object_class = (GtkObjectClass*) klass;
- item_class = (GnomeCanvasItemClass *) klass;
+ object_class = (GtkObjectClass*) klass;
+ item_class = (GnomeCanvasItemClass *) klass;
- parent_class = gtk_type_class (gnome_canvas_group_get_type ());
+ 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);
-
- klass->add_item = e_reflow_real_add_item;
+ 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;
+ 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;
+ /* 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->items = NULL;
+ reflow->columns = NULL;
+ reflow->column_width = 150;
+
+ reflow->minimum_width = 10;
+ reflow->width = 10;
+ reflow->height = 10;
+ reflow->idle = 0;
- 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->column_drag = FALSE;
- reflow->need_height_update = FALSE;
- reflow->need_column_resize = FALSE;
+ reflow->need_height_update = FALSE;
+ reflow->need_column_resize = FALSE;
- reflow->default_cursor_shown = TRUE;
- reflow->arrow_cursor = NULL;
- reflow->default_cursor = NULL;
+ 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);
+ e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(reflow), e_reflow_reflow);
}
static void
@@ -152,13 +160,20 @@ e_reflow_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
switch (arg_id){
case ARG_HEIGHT:
- e_reflow->height = GTK_VALUE_DOUBLE (*arg);
- e_canvas_item_request_reflow(item);
- break;
+ 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);
}
}
@@ -171,17 +186,20 @@ e_reflow_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
switch (arg_id) {
case ARG_MINIMUM_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = e_reflow->minimum_width;
- break;
+ GTK_VALUE_DOUBLE (*arg) = e_reflow->minimum_width;
+ break;
case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = e_reflow->width;
- break;
+ GTK_VALUE_DOUBLE (*arg) = e_reflow->width;
+ break;
case ARG_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = e_reflow->height;
- break;
+ 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;
+ arg->type = GTK_TYPE_INVALID;
+ break;
}
}
@@ -193,6 +211,8 @@ e_reflow_destroy (GtkObject *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);
}
@@ -221,6 +241,8 @@ e_reflow_realize (GnomeCanvasItem *item)
NULL);
}
+ set_empty(e_reflow);
+
e_canvas_item_request_reflow(item);
adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
@@ -456,6 +478,7 @@ e_reflow_real_add_item(EReflow *e_reflow, GnomeCanvasItem *item)
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);
}
@@ -678,7 +701,7 @@ _reflow( EReflow *e_reflow )
if (e_reflow->items == NULL) {
e_reflow->columns = NULL;
- e_reflow->column_count = 1;
+ e_reflow->column_count = 0;
return;
}
@@ -708,6 +731,49 @@ _reflow( EReflow *e_reflow )
}
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);
@@ -774,3 +840,9 @@ 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/widgets/misc/e-reflow.h b/widgets/misc/e-reflow.h
index 54de59ba55..eb66b094a5 100644
--- a/widgets/misc/e-reflow.h
+++ b/widgets/misc/e-reflow.h
@@ -57,6 +57,9 @@ struct _EReflow
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;
@@ -98,6 +101,9 @@ struct _EReflowClass
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 */