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/Makefile.am | 1 + addressbook/gui/widgets/e-minicard.c | 30 +++++++++++++++++++++++++++++- addressbook/gui/widgets/e-minicard.h | 5 +++++ 3 files changed, 35 insertions(+), 1 deletion(-) (limited to 'addressbook/gui') diff --git a/addressbook/gui/widgets/Makefile.am b/addressbook/gui/widgets/Makefile.am index 9619363732..8d86b99109 100644 --- a/addressbook/gui/widgets/Makefile.am +++ b/addressbook/gui/widgets/Makefile.am @@ -2,6 +2,7 @@ INCLUDES = \ -DG_LOG_DOMAIN=\"e-minicard\" \ -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ -DEVOLUTION_DATADIR=\""$(datadir)"\" \ + -DEVOLUTION_IMAGESDIR=\""$(datadir)"/images/evolution\" \ -I$(top_srcdir) \ -I$(top_srcdir)/addressbook/backend/ebook \ -I$(top_srcdir)/addressbook/gui/contact-editor \ 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; diff --git a/addressbook/gui/widgets/e-minicard.h b/addressbook/gui/widgets/e-minicard.h index 6b4ce35013..5a0f590c23 100644 --- a/addressbook/gui/widgets/e-minicard.h +++ b/addressbook/gui/widgets/e-minicard.h @@ -22,6 +22,7 @@ #define __E_MINICARD_H__ #include +#include #include "addressbook/gui/contact-editor/e-contact-editor.h" #include "addressbook/backend/ebook/e-card.h" #include "addressbook/backend/ebook/e-card-simple.h" @@ -69,6 +70,10 @@ struct _EMinicard GnomeCanvasItem *rect; GnomeCanvasItem *header_rect; GnomeCanvasItem *header_text; + GnomeCanvasItem *list_icon; + + GdkPixbuf *list_icon_pixbuf; + double list_icon_size; GtkObject *editor; -- cgit