diff options
Diffstat (limited to 'addressbook/gui')
-rw-r--r-- | addressbook/gui/widgets/Makefile.am | 1 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-minicard.c | 30 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-minicard.h | 5 |
3 files changed, 35 insertions, 1 deletions
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 <libgnome/gnome-defs.h> #include <libgnome/gnome-i18n.h> #include <libgnomeui/gnome-canvas-rect-ellipse.h> +#include <gdk-pixbuf/gnome-canvas-pixbuf.h> #include <gal/e-text/e-text.h> #include <gal/util/e-util.h> #include <gal/widgets/e-canvas-utils.h> @@ -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 <libgnomeui/gnome-canvas.h> +#include <gdk-pixbuf/gdk-pixbuf.h> #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; |