From 8093ffc805f49cc117c3a38cc36643ddc7e2ab1a Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Fri, 29 Jun 2001 09:47:11 +0000 Subject: add EVOLUTION_IMAGESDIR define. 2001-06-29 Chris Toshok * gui/widgets/Makefile.am (INCLUDES): add EVOLUTION_IMAGESDIR define. * gui/widgets/e-minicard.h (struct _EMinicard): add our pixbuf and pixbuf size. * gui/widgets/e-minicard.c (e_minicard_init): init the icon pixbuf and its size. (e_minicard_destroy): unref the list_icon_pixbuf. (e_minicard_realize): create the list_icon GnomeCanvasPixbuf. (e_minicard_resize_children): clip the header_text by the list_icon, and place the list_icon in the right spot. (remodel): show the list_icon if we're a list, and hide it otherwise. svn path=/trunk/; revision=10596 --- addressbook/gui/widgets/e-minicard.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'addressbook/gui/widgets/e-minicard.c') diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index 6c06952c6e..2d74280b72 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -64,6 +65,8 @@ struct _EMinicardField { GnomeCanvasItem *label; }; +#define LIST_ICON_FILENAME "contact-is-a-list.png" + #define E_MINICARD_FIELD(field) ((EMinicardField *)(field)) static void @@ -187,6 +190,9 @@ e_minicard_init (EMinicard *minicard) minicard->card = NULL; minicard->simple = e_card_simple_new(NULL); + minicard->list_icon_pixbuf = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" LIST_ICON_FILENAME); + minicard->list_icon_size = gdk_pixbuf_get_height (minicard->list_icon_pixbuf); + minicard->editor = NULL; minicard->changed = FALSE; @@ -331,6 +337,8 @@ e_minicard_destroy (GtkObject *object) g_list_foreach(e_minicard->fields, (GFunc) e_minicard_field_destroy, NULL); g_list_free(e_minicard->fields); + gdk_pixbuf_unref (e_minicard->list_icon_pixbuf); + if (GTK_OBJECT_CLASS (parent_class)->destroy) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } @@ -404,8 +412,15 @@ e_minicard_realize (GnomeCanvasItem *item) "text", "", "draw_background", FALSE, NULL ); + e_canvas_item_move_absolute(e_minicard->header_text, 6, 6); + e_minicard->list_icon = + gnome_canvas_item_new ( group, + gnome_canvas_pixbuf_get_type(), + "pixbuf", e_minicard->list_icon_pixbuf, + NULL); + remodel(e_minicard); e_canvas_item_request_reflow(item); @@ -608,9 +623,15 @@ e_minicard_resize_children( EMinicard *e_minicard ) if (e_minicard->header_text) { gnome_canvas_item_set( e_minicard->header_text, - "width", (double) e_minicard->width - 12, + "width", ((double) e_minicard->width - 12 + - (e_card_evolution_list (e_minicard->card) ? e_minicard->list_icon_size : 0.0)), NULL ); } + if (e_minicard->list_icon) { + e_canvas_item_move_absolute(e_minicard->list_icon, + e_minicard->width - e_minicard->list_icon_size - 3, + 3); + } for ( list = e_minicard->fields; list; list = g_list_next( list ) ) { gnome_canvas_item_set( E_MINICARD_FIELD( list->data )->label, "width", (double) e_minicard->width - 4.0, @@ -718,6 +739,13 @@ remodel( EMinicard *e_minicard ) g_free(file_as); } + if ( e_card_evolution_list (e_minicard->card) ) { + gnome_canvas_item_show (e_minicard->list_icon); + } + else { + gnome_canvas_item_hide (e_minicard->list_icon); + } + list = e_minicard->fields; e_minicard->fields = NULL; -- cgit