From 1f7ba945b16cd5f8c01641dd864a9671d791a651 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Sun, 12 Mar 2000 07:59:42 +0000 Subject: Rearranged SUBDIRS for dependencies. 2000-03-12 Christopher James Lahey * widgets/Makefile.am: Rearranged SUBDIRS for dependencies. * widgets/e-text/e-text-model.c, widgets/e-text-model.h: New object which stores a piece of text data. All methods are virtual. * widgets/e-text/e-text.c, widgets/e-text/e-text.h: Modified this to use an ETextModel for its data. * widgets/e-text/Makefile.am: Added e-text-model.c and e-text-model.h. * widgets/e-minicard/test-minicard-label.c: Made this work again. * widgets/e-minicard/e-minicard.c, widgets/e-minicard/e-minicard.h: Made this use an ETableModel to get its data. * widgets/e-minicard/e-minicard-label.c, widgets/e-minicard/e-minicard-label.h: Added the ability to set the text model used for the contained text widget. * widgets/e-minicard/Makefile.am: Added e-table since e-minicard is now dependent on an e-table-model for its data. * e-util/e-canvas.c, e-util/e-canvas.h: Fixed some bugs here to speed up reflow and to make it fail less often. * addressbook/demo, addressbook/demo/.cvsignore, addressbook/demo/Makefile.am, addressbook/demo/demo.c, addressbook/demo/spec: A new program to test ETable and EMinicard integration. * configure.in: Added addressbook/demo/Makefile. * addressbook/Makefile.am: Added the demo/ subdirectory. in widgets/e-table/: 2000-03-12 Christopher James Lahey * e-table.c: Made this use an ECanvas. Fixed a bug where e_table_new_from_spec_file was calling e_table_construct instead of e_table_construct_from_spec_file. * e-table-item.c, e-table-header-item.c, e-table-column-item.c: Switched these to use GTK_TYPE_OBJECT and GTK_VALUE_OBJECT instead of GTK_TYPE_POINTER and GTK_TYPE_OBJECT. * e-cell-text.c: Got rid of a crashing bug. * e-table-text-model.c, e-table-text-model.h: A new object which is an e-text-model which uses an e-table-model for its data. * Makefile.am: Added e-table-text-model.c and e-table-text-model.h. * .cvsignore: Added table-example-1 and table-example-2. svn path=/trunk/; revision=2101 --- widgets/e-minicard/Makefile.am | 10 +- widgets/e-minicard/e-minicard-label.c | 162 +++++++++++++++---------------- widgets/e-minicard/e-minicard-label.h | 4 +- widgets/e-minicard/e-minicard.c | 140 ++++++++++++++++++-------- widgets/e-minicard/e-minicard.h | 9 ++ widgets/e-minicard/test-minicard-label.c | 21 ++-- 6 files changed, 207 insertions(+), 139 deletions(-) (limited to 'widgets/e-minicard') diff --git a/widgets/e-minicard/Makefile.am b/widgets/e-minicard/Makefile.am index 65253e06f1..e1b130bc2a 100644 --- a/widgets/e-minicard/Makefile.am +++ b/widgets/e-minicard/Makefile.am @@ -1,6 +1,7 @@ INCLUDES = \ -I$(top_srcdir)/widgets/e-text \ -I$(top_srcdir)/e-util \ + -I$(top_srcdir)/widgets/e-table \ $(GNOME_INCLUDEDIR) noinst_LIBRARIES = \ @@ -26,7 +27,8 @@ minicard_label_test_LDADD = \ $(EXTRA_GNOME_LIBS) \ libeminicard.a \ $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/widgets/e-text/libetext.a + $(top_builddir)/widgets/e-text/libetext.a \ + $(top_builddir)/widgets/e-table/libetable.a minicard_test_SOURCES = \ test-minicard.c @@ -35,7 +37,8 @@ minicard_test_LDADD = \ $(EXTRA_GNOME_LIBS) \ libeminicard.a \ $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/widgets/e-text/libetext.a + $(top_builddir)/widgets/e-text/libetext.a \ + $(top_builddir)/widgets/e-table/libetable.a reflow_test_SOURCES = \ test-reflow.c @@ -44,4 +47,5 @@ reflow_test_LDADD = \ $(EXTRA_GNOME_LIBS) \ libeminicard.a \ $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/widgets/e-text/libetext.a + $(top_builddir)/widgets/e-text/libetext.a \ + $(top_builddir)/widgets/e-table/libetable.a diff --git a/widgets/e-minicard/e-minicard-label.c b/widgets/e-minicard/e-minicard-label.c index 25f7f939fc..799eb87cd1 100644 --- a/widgets/e-minicard/e-minicard-label.c +++ b/widgets/e-minicard/e-minicard-label.c @@ -46,7 +46,8 @@ enum { ARG_HEIGHT, ARG_HAS_FOCUS, ARG_FIELD, - ARG_FIELDNAME + ARG_FIELDNAME, + ARG_TEXT_MODEL }; GtkType @@ -95,6 +96,8 @@ e_minicard_label_class_init (EMinicardLabelClass *klass) GTK_ARG_READWRITE, ARG_FIELD); gtk_object_add_arg_type ("EMinicardLabel::fieldname", GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FIELDNAME); + gtk_object_add_arg_type ("EMinicardLabel::text_model", GTK_TYPE_OBJECT, + GTK_ARG_READWRITE, ARG_TEXT_MODEL); object_class->set_arg = e_minicard_label_set_arg; object_class->get_arg = e_minicard_label_get_arg; @@ -114,8 +117,6 @@ e_minicard_label_init (EMinicardLabel *minicard_label) minicard_label->rect = NULL; minicard_label->fieldname = NULL; minicard_label->field = NULL; - minicard_label->fieldname_text = NULL; - minicard_label->field_text = NULL; e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(minicard_label), e_minicard_label_reflow); } @@ -131,26 +132,23 @@ e_minicard_label_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) switch (arg_id){ case ARG_WIDTH: - e_minicard_label->width = GTK_VALUE_DOUBLE (*arg); - e_minicard_label_resize_children(e_minicard_label); - e_canvas_item_request_reflow (item); - break; + e_minicard_label->width = GTK_VALUE_DOUBLE (*arg); + e_minicard_label_resize_children(e_minicard_label); + e_canvas_item_request_reflow (item); + break; case ARG_HAS_FOCUS: if (e_minicard_label->field && (GTK_VALUE_ENUM(*arg) != E_FOCUS_NONE)) e_canvas_item_grab_focus(e_minicard_label->field); break; case ARG_FIELD: - if ( e_minicard_label->field ) - gnome_canvas_item_set( e_minicard_label->field, "text", GTK_VALUE_STRING (*arg), NULL ); - else - e_minicard_label->field_text = g_strdup( GTK_VALUE_STRING (*arg) ); - break; + gnome_canvas_item_set( e_minicard_label->field, "text", GTK_VALUE_STRING (*arg), NULL ); + break; case ARG_FIELDNAME: - if ( e_minicard_label->fieldname ) - gnome_canvas_item_set( e_minicard_label->fieldname, "text", GTK_VALUE_STRING (*arg), NULL ); - else - e_minicard_label->fieldname_text = g_strdup( GTK_VALUE_STRING (*arg) ); - break; + gnome_canvas_item_set( e_minicard_label->fieldname, "text", GTK_VALUE_STRING (*arg), NULL ); + break; + case ARG_TEXT_MODEL: + gnome_canvas_item_set( e_minicard_label->field, "model", GTK_VALUE_OBJECT (*arg), NULL); + break; } } @@ -159,32 +157,31 @@ e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) { EMinicardLabel *e_minicard_label; char *temp; + ETextModel *tempmodel; e_minicard_label = E_MINICARD_LABEL (object); switch (arg_id) { case ARG_WIDTH: - GTK_VALUE_DOUBLE (*arg) = e_minicard_label->width; - break; + GTK_VALUE_DOUBLE (*arg) = e_minicard_label->width; + break; case ARG_HEIGHT: - GTK_VALUE_DOUBLE (*arg) = e_minicard_label->height; - break; + GTK_VALUE_DOUBLE (*arg) = e_minicard_label->height; + break; case ARG_HAS_FOCUS: GTK_VALUE_ENUM (*arg) = e_minicard_label->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE; break; case ARG_FIELD: - if ( e_minicard_label->field ) { - gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - } else - GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->field_text ); + gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "text", &temp, NULL ); + GTK_VALUE_STRING (*arg) = temp; break; case ARG_FIELDNAME: - if ( e_minicard_label->fieldname ) { - gtk_object_get( GTK_OBJECT( e_minicard_label->fieldname ), "text", &temp, NULL ); - GTK_VALUE_STRING (*arg) = temp; - } else - GTK_VALUE_STRING (*arg) = g_strdup( e_minicard_label->fieldname_text ); + gtk_object_get( GTK_OBJECT( e_minicard_label->fieldname ), "text", &temp, NULL ); + GTK_VALUE_STRING (*arg) = temp; + break; + case ARG_TEXT_MODEL: + gtk_object_get( GTK_OBJECT( e_minicard_label->field ), "model", &tempmodel, NULL ); + GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(tempmodel); break; default: arg->type = GTK_TYPE_INVALID; @@ -194,6 +191,19 @@ e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) static void e_minicard_label_realize (GnomeCanvasItem *item) +{ + if (GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) + (* GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) (item); + + e_canvas_item_request_reflow(item); + + if (!item->canvas->aa) + { + } +} + +void +e_minicard_label_construct (GnomeCanvasItem *item) { EMinicardLabel *e_minicard_label; GnomeCanvasGroup *group; @@ -206,9 +216,6 @@ e_minicard_label_realize (GnomeCanvasItem *item) e_minicard_label = E_MINICARD_LABEL (item); group = GNOME_CANVAS_GROUP( item ); - if (GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) - (* GNOME_CANVAS_ITEM_CLASS( parent_class )->realize) (item); - e_minicard_label->rect = gnome_canvas_item_new( group, gnome_canvas_rect_get_type(), @@ -229,13 +236,6 @@ e_minicard_label_realize (GnomeCanvasItem *item) "fill_color", "black", NULL ); e_canvas_item_move_absolute(e_minicard_label->fieldname, 2, 1); - if ( e_minicard_label->fieldname_text ) - { - gnome_canvas_item_set( e_minicard_label->fieldname, - "text", e_minicard_label->fieldname_text, - NULL ); - g_free( e_minicard_label->fieldname_text ); - } e_minicard_label->field = gnome_canvas_item_new( group, @@ -249,20 +249,8 @@ e_minicard_label_realize (GnomeCanvasItem *item) "editable", TRUE, NULL ); e_canvas_item_move_absolute(e_minicard_label->field, ( e_minicard_label->width / 2 + 2), 1); - if ( e_minicard_label->field_text ) - { - gnome_canvas_item_set( e_minicard_label->field, - "text", e_minicard_label->field_text, - NULL ); - g_free( e_minicard_label->field_text ); - } e_canvas_item_request_reflow(item); - - if (!item->canvas->aa) - { - } - } static void @@ -379,49 +367,53 @@ e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event) static void e_minicard_label_resize_children(EMinicardLabel *e_minicard_label) { - if ( GTK_OBJECT_FLAGS( e_minicard_label ) & GNOME_CANVAS_ITEM_REALIZED ) { - gnome_canvas_item_set( e_minicard_label->fieldname, - "clip_width", (double) ( e_minicard_label->width / 2 - 4 ), - NULL ); - gnome_canvas_item_set( e_minicard_label->field, - "clip_width", (double) ( ( e_minicard_label->width + 1 ) / 2 - 4 ), - NULL ); - } + gnome_canvas_item_set( e_minicard_label->fieldname, + "clip_width", (double) ( e_minicard_label->width / 2 - 4 ), + NULL ); + gnome_canvas_item_set( e_minicard_label->field, + "clip_width", (double) ( ( e_minicard_label->width + 1 ) / 2 - 4 ), + NULL ); } static void e_minicard_label_reflow(GnomeCanvasItem *item, int flags) { EMinicardLabel *e_minicard_label = E_MINICARD_LABEL(item); - if ( GTK_OBJECT_FLAGS( e_minicard_label ) & GNOME_CANVAS_ITEM_REALIZED ) - { - gint old_height; - gdouble text_height; - old_height = e_minicard_label->height; + + gint old_height; + gdouble text_height; + old_height = e_minicard_label->height; - gtk_object_get(GTK_OBJECT(e_minicard_label->fieldname), - "text_height", &text_height, - NULL); + gtk_object_get(GTK_OBJECT(e_minicard_label->fieldname), + "text_height", &text_height, + NULL); - e_minicard_label->height = text_height; + e_minicard_label->height = text_height; - gtk_object_get(GTK_OBJECT(e_minicard_label->field), - "text_height", &text_height, - NULL); + gtk_object_get(GTK_OBJECT(e_minicard_label->field), + "text_height", &text_height, + NULL); - if (e_minicard_label->height < text_height) - e_minicard_label->height = text_height; - e_minicard_label->height += 3; + if (e_minicard_label->height < text_height) + e_minicard_label->height = text_height; + e_minicard_label->height += 3; - gnome_canvas_item_set( e_minicard_label->rect, - "x2", (double) e_minicard_label->width - 1, - "y2", (double) e_minicard_label->height - 1, - NULL ); - e_canvas_item_move_absolute(e_minicard_label->field, ( e_minicard_label->width / 2 + 2), 1); + gnome_canvas_item_set( e_minicard_label->rect, + "x2", (double) e_minicard_label->width - 1, + "y2", (double) e_minicard_label->height - 1, + NULL ); + e_canvas_item_move_absolute(e_minicard_label->field, ( e_minicard_label->width / 2 + 2), 1); - if (old_height != e_minicard_label->height) - e_canvas_item_request_parent_reflow(item); - - } + if (old_height != e_minicard_label->height) + e_canvas_item_request_parent_reflow(item); } + +GnomeCanvasItem * +e_minicard_label_new(GnomeCanvasGroup *parent) +{ + GnomeCanvasItem *item = gnome_canvas_item_new(parent, e_minicard_label_get_type(), NULL); + e_minicard_label_construct(item); + return item; +} + diff --git a/widgets/e-minicard/e-minicard-label.h b/widgets/e-minicard/e-minicard-label.h index b439c53f9d..1790414a54 100644 --- a/widgets/e-minicard/e-minicard-label.h +++ b/widgets/e-minicard/e-minicard-label.h @@ -60,8 +60,6 @@ struct _EMinicardLabel GnomeCanvasItem *fieldname; GnomeCanvasItem *field; GnomeCanvasItem *rect; - char *fieldname_text; - char *field_text; gboolean has_focus; }; @@ -73,6 +71,8 @@ struct _EMinicardLabelClass GtkType e_minicard_label_get_type (void); +GnomeCanvasItem *e_minicard_label_new(GnomeCanvasGroup *parent); +void e_minicard_label_construct (GnomeCanvasItem *item); #ifdef __cplusplus } diff --git a/widgets/e-minicard/e-minicard.c b/widgets/e-minicard/e-minicard.c index 79668b6507..b7b9a4c10e 100644 --- a/widgets/e-minicard/e-minicard.c +++ b/widgets/e-minicard/e-minicard.c @@ -24,6 +24,7 @@ #include "e-minicard.h" #include "e-minicard-label.h" #include "e-text.h" +#include "e-table-text-model.h" #include "e-canvas.h" #include "e-util.h" #include "e-canvas-utils.h" @@ -37,6 +38,7 @@ static void e_minicard_unrealize (GnomeCanvasItem *item); static void e_minicard_reflow ( GnomeCanvasItem *item, int flags ); static void e_minicard_resize_children( EMinicard *e_minicard ); +static void remodel( EMinicard *e_minicard ); static GnomeCanvasGroupClass *parent_class = NULL; @@ -46,7 +48,9 @@ enum { ARG_WIDTH, ARG_HEIGHT, ARG_HAS_FOCUS, - ARG_CARD + ARG_CARD, + ARG_MODEL, + ARG_ROW }; GtkType @@ -93,6 +97,10 @@ 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; @@ -113,6 +121,9 @@ e_minicard_init (EMinicard *minicard) minicard->width = 10; minicard->height = 10; minicard->has_focus = FALSE; + + minicard->model = NULL; + minicard->row = 0; e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(minicard), e_minicard_reflow); } @@ -131,7 +142,8 @@ e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) if (e_minicard->width != GTK_VALUE_DOUBLE (*arg)) { e_minicard->width = GTK_VALUE_DOUBLE (*arg); e_minicard_resize_children(e_minicard); - e_canvas_item_request_reflow(item); + if ( GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED ) + e_canvas_item_request_reflow(item); } break; case ARG_HAS_FOCUS: @@ -148,13 +160,23 @@ e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) } } else - e_canvas_item_grab_focus(GNOME_CANVAS_ITEM(e_minicard)); + e_canvas_item_grab_focus(item); break; case ARG_CARD: - /* e_minicard->card = GTK_VALUE_POINTER (*arg); + /* e_minicard->card = GTK_VALUE_OBJECT (*arg); _update_card(e_minicard); gnome_canvas_item_request_update (item);*/ break; + case ARG_MODEL: + e_minicard->model = E_TABLE_MODEL(GTK_VALUE_OBJECT (*arg)); + remodel(e_minicard); + e_canvas_item_request_reflow(item); + break; + case ARG_ROW: + e_minicard->row = GTK_VALUE_INT (*arg); + remodel(e_minicard); + e_canvas_item_request_reflow(item); + break; } } @@ -176,8 +198,14 @@ 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_POINTER (*arg) = e_minicard->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; + break; default: arg->type = GTK_TYPE_INVALID; break; @@ -229,41 +257,46 @@ e_minicard_realize (GnomeCanvasItem *item) "text", "Chris Lahey", 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); - if ( rand() % 2 ) { - new_item = gnome_canvas_item_new( group, - e_minicard_label_get_type(), - "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); - } - - if (rand() % 2) { - new_item = gnome_canvas_item_new( group, - e_minicard_label_get_type(), - "width", e_minicard->width - 4, - "fieldname", "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); - } - - if (rand() % 2) { - new_item = gnome_canvas_item_new( group, - e_minicard_label_get_type(), - "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", "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); - + if (!item->canvas->aa) { } } @@ -383,6 +416,35 @@ e_minicard_resize_children( EMinicard *e_minicard ) } } +static void +remodel( EMinicard *e_minicard ) +{ + 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)); + } + 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)); + } + + } +} + static void e_minicard_reflow( GnomeCanvasItem *item, int flags ) { @@ -391,7 +453,7 @@ e_minicard_reflow( GnomeCanvasItem *item, int flags ) GList *list; gdouble text_height; gint old_height; - + old_height = e_minicard->height; gtk_object_get( GTK_OBJECT( e_minicard->header_text ), diff --git a/widgets/e-minicard/e-minicard.h b/widgets/e-minicard/e-minicard.h index 3be80c1586..05d95a743e 100644 --- a/widgets/e-minicard/e-minicard.h +++ b/widgets/e-minicard/e-minicard.h @@ -22,6 +22,7 @@ #define __E_MINICARD_H__ #include +#include "e-table-model.h" #ifdef __cplusplus extern "C" { @@ -36,6 +37,10 @@ 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 */ @@ -66,6 +71,10 @@ struct _EMinicard GnomeCanvasItem *header_rect; GnomeCanvasItem *header_text; GList *fields; /* Of type GnomeCanvasItem. */ + + ETableModel *model; + int row; + guint needs_remodeling : 1; gboolean has_focus; diff --git a/widgets/e-minicard/test-minicard-label.c b/widgets/e-minicard/test-minicard-label.c index 8da34e6f22..727d709925 100644 --- a/widgets/e-minicard/test-minicard-label.c +++ b/widgets/e-minicard/test-minicard-label.c @@ -21,6 +21,7 @@ #include #include "e-minicard-label.h" +#include "e-canvas.h" /* This is a horrible thing to do, but it is just a test. */ GnomeCanvasItem *label; @@ -80,7 +81,7 @@ int main( int argc, char *argv[] ) gnome_init( "Minicard Label Test", VERSION, argc, argv); app = gnome_app_new("Minicard Label Test", NULL); - canvas = gnome_canvas_new(); + canvas = e_canvas_new(); rect = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), gnome_canvas_rect_get_type(), "x1", (double) 0, @@ -89,15 +90,15 @@ int main( int argc, char *argv[] ) "y2", (double) 100, "fill_color", "white", NULL ); - label = gnome_canvas_item_new( gnome_canvas_root( GNOME_CANVAS( canvas ) ), - e_minicard_label_get_type(), - "x", (double) 0, - "y", (double) 0, - "width", (double) 100, - "height", (double) 100, - "fieldname", "Full Name:", - "field", "Christopher James Lahey", - NULL ); + label = e_minicard_label_new(gnome_canvas_root( GNOME_CANVAS( canvas ) )); + gnome_canvas_item_set( label, + "x", (double) 0, + "y", (double) 0, + "width", (double) 100, + "height", (double) 100, + "fieldname", "Full Name:", + "field", "Christopher James Lahey", + NULL ); gnome_canvas_set_scroll_region ( GNOME_CANVAS( canvas ), 0, 0, 100, 100 ); -- cgit v1.2.3