diff options
This commit was manufactured by cvs2svn to create tagEVOLUTION_1_2_4
'EVOLUTION_1_2_4'.
svn path=/tags/EVOLUTION_1_2_4/; revision=20614
Diffstat (limited to 'addressbook/gui/widgets/e-minicard.c')
-rw-r--r-- | addressbook/gui/widgets/e-minicard.c | 475 |
1 files changed, 219 insertions, 256 deletions
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index 8bebb4cdb0..98fe4c4e05 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -20,34 +20,32 @@ */ #include <config.h> -#include <string.h> #include <glib.h> #include <gtk/gtkdnd.h> -#include <gtk/gtkmain.h> #include <gdk/gdkkeysyms.h> +#include <libgnome/gnome-defs.h> #include <libgnome/gnome-i18n.h> -#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> -#include <libgnomecanvas/gnome-canvas-pixbuf.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> #include <gal/widgets/e-canvas.h> +#include <gal/unicode/gunicode.h> #include "addressbook/backend/ebook/e-book.h" -#include "e-addressbook-marshal.h" #include "e-addressbook-util.h" #include "e-minicard.h" #include "e-minicard-label.h" #include "e-minicard-view.h" #include "e-contact-editor.h" #include "e-card-merging.h" -#include "ebook/e-destination.h" static void e_minicard_init (EMinicard *card); static void e_minicard_class_init (EMinicardClass *klass); -static void e_minicard_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void e_minicard_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); -static void e_minicard_dispose (GObject *object); -static void e_minicard_finalize (GObject *object); +static void e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); +static void e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); +static void e_minicard_destroy (GtkObject *object); +static void e_minicard_finalize (GtkObject *object); static gboolean e_minicard_event (GnomeCanvasItem *item, GdkEvent *event); static void e_minicard_realize (GnomeCanvasItem *item); static void e_minicard_unrealize (GnomeCanvasItem *item); @@ -82,14 +80,14 @@ e_minicard_field_destroy(EMinicardField *field) /* The arguments we take */ enum { - PROP_0, - PROP_WIDTH, - PROP_HEIGHT, - PROP_HAS_FOCUS, - PROP_SELECTED, - PROP_HAS_CURSOR, - PROP_EDITABLE, - PROP_CARD + ARG_0, + ARG_WIDTH, + ARG_HEIGHT, + ARG_HAS_FOCUS, + ARG_SELECTED, + ARG_HAS_CURSOR, + ARG_EDITABLE, + ARG_CARD }; enum { @@ -100,112 +98,80 @@ enum { static guint e_minicard_signals [LAST_SIGNAL] = {0, }; -GType +GtkType e_minicard_get_type (void) { - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (EMinicardClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) e_minicard_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (EMinicard), - 0, /* n_preallocs */ - (GInstanceInitFunc) e_minicard_init, - }; - - type = g_type_register_static (gnome_canvas_group_get_type (), "EMinicard", &info, 0); - } + static GtkType minicard_type = 0; + + if (!minicard_type) + { + static const GtkTypeInfo minicard_info = + { + "EMinicard", + sizeof (EMinicard), + sizeof (EMinicardClass), + (GtkClassInitFunc) e_minicard_class_init, + (GtkObjectInitFunc) e_minicard_init, + /* reserved_1 */ NULL, + /* reserved_2 */ NULL, + (GtkClassInitFunc) NULL, + }; + + minicard_type = gtk_type_unique (gnome_canvas_group_get_type (), &minicard_info); + } - return type; + return minicard_type; } static void e_minicard_class_init (EMinicardClass *klass) { - GObjectClass *object_class = (GObjectClass*) klass; - GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) klass; + GtkObjectClass *object_class; + GnomeCanvasItemClass *item_class; - object_class->set_property = e_minicard_set_property; - object_class->get_property = e_minicard_get_property; - object_class->dispose = e_minicard_dispose; - object_class->finalize = e_minicard_finalize; + object_class = (GtkObjectClass*) klass; + item_class = (GnomeCanvasItemClass *) klass; parent_class = gtk_type_class (gnome_canvas_group_get_type ()); - - g_object_class_install_property (object_class, PROP_WIDTH, - g_param_spec_double ("width", - _("Width"), - /*_( */"XXX blurb" /*)*/, - 0.0, G_MAXDOUBLE, 10.0, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_HEIGHT, - g_param_spec_double ("height", - _("Height"), - /*_( */"XXX blurb" /*)*/, - 0.0, G_MAXDOUBLE, 10.0, - G_PARAM_READABLE)); - - g_object_class_install_property (object_class, PROP_HAS_FOCUS, - /* XXX should be _enum */ - g_param_spec_int ("has_focus", - _("Has Focus"), - /*_( */"XXX blurb" /*)*/, - E_MINICARD_FOCUS_TYPE_START, E_MINICARD_FOCUS_TYPE_END, - E_MINICARD_FOCUS_TYPE_START, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_SELECTED, - g_param_spec_boolean ("selected", - _("Selected"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_HAS_CURSOR, - g_param_spec_boolean ("has_cursor", - _("Has Cursor"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_EDITABLE, - g_param_spec_boolean ("editable", - _("Editable"), - /*_( */"XXX blurb" /*)*/, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_CARD, - g_param_spec_object ("card", - _("Card"), - /*_( */"XXX blurb" /*)*/, - E_TYPE_CARD, - G_PARAM_READWRITE)); + gtk_object_add_arg_type ("EMinicard::width", GTK_TYPE_DOUBLE, + GTK_ARG_READWRITE, ARG_WIDTH); + gtk_object_add_arg_type ("EMinicard::height", GTK_TYPE_DOUBLE, + GTK_ARG_READABLE, ARG_HEIGHT); + gtk_object_add_arg_type ("EMinicard::has_focus", GTK_TYPE_ENUM, + GTK_ARG_READWRITE, ARG_HAS_FOCUS); + gtk_object_add_arg_type ("EMinicard::selected", GTK_TYPE_BOOL, + GTK_ARG_READWRITE, ARG_SELECTED); + gtk_object_add_arg_type ("EMinicard::has_cursor", GTK_TYPE_BOOL, + GTK_ARG_READWRITE, ARG_HAS_CURSOR); + gtk_object_add_arg_type ("EMinicard::editable", GTK_TYPE_BOOL, + GTK_ARG_READWRITE, ARG_EDITABLE); + gtk_object_add_arg_type ("EMinicard::card", GTK_TYPE_OBJECT, + GTK_ARG_READWRITE, ARG_CARD); + e_minicard_signals [SELECTED] = - g_signal_new ("selected", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMinicardClass, selected), - NULL, NULL, - e_addressbook_marshal_INT__POINTER, - G_TYPE_INT, 1, G_TYPE_POINTER); + gtk_signal_new ("selected", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (EMinicardClass, selected), + gtk_marshal_INT__POINTER, + GTK_TYPE_INT, 1, GTK_TYPE_POINTER); e_minicard_signals [DRAG_BEGIN] = - g_signal_new ("drag_begin", - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMinicardClass, drag_begin), - NULL, NULL, - e_addressbook_marshal_INT__POINTER, - G_TYPE_INT, 1, G_TYPE_POINTER); - + gtk_signal_new ("drag_begin", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (EMinicardClass, drag_begin), + gtk_marshal_INT__POINTER, + GTK_TYPE_INT, 1, GTK_TYPE_POINTER); + + gtk_object_class_add_signals (object_class, e_minicard_signals, LAST_SIGNAL); + + object_class->set_arg = e_minicard_set_arg; + object_class->get_arg = e_minicard_get_arg; + object_class->destroy = e_minicard_destroy; + object_class->finalize = e_minicard_finalize; + /* GnomeCanvasItem method overrides */ item_class->realize = e_minicard_realize; item_class->unrealize = e_minicard_unrealize; @@ -230,7 +196,7 @@ 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, 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; @@ -278,34 +244,34 @@ set_has_cursor (EMinicard *minicard, gboolean has_cursor) static void -e_minicard_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) +e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) { GnomeCanvasItem *item; EMinicard *e_minicard; GList *l; - item = GNOME_CANVAS_ITEM (object); - e_minicard = E_MINICARD (object); + item = GNOME_CANVAS_ITEM (o); + e_minicard = E_MINICARD (o); - switch (prop_id){ - case PROP_WIDTH: - if (e_minicard->width != g_value_get_double (value)) { - e_minicard->width = g_value_get_double (value); + switch (arg_id){ + case ARG_WIDTH: + if (e_minicard->width != GTK_VALUE_DOUBLE (*arg)) { + e_minicard->width = GTK_VALUE_DOUBLE (*arg); e_minicard_resize_children(e_minicard); if ( GTK_OBJECT_FLAGS( e_minicard ) & GNOME_CANVAS_ITEM_REALIZED ) e_canvas_item_request_reflow(item); } break; - case PROP_HAS_FOCUS: + case ARG_HAS_FOCUS: if (e_minicard->fields) { - if ( g_value_get_int(value) == E_FOCUS_START || - g_value_get_int(value) == E_FOCUS_CURRENT) { + if ( GTK_VALUE_ENUM(*arg) == E_FOCUS_START || + GTK_VALUE_ENUM(*arg) == E_FOCUS_CURRENT) { gnome_canvas_item_set(E_MINICARD_FIELD(e_minicard->fields->data)->label, - "has_focus", g_value_get_int (value), + "has_focus", GTK_VALUE_ENUM(*arg), NULL); - } else if ( g_value_get_int (value) == E_FOCUS_END ) { + } else if ( GTK_VALUE_ENUM(*arg) == E_FOCUS_END ) { gnome_canvas_item_set(E_MINICARD_FIELD(g_list_last(e_minicard->fields)->data)->label, - "has_focus", g_value_get_int (value), + "has_focus", GTK_VALUE_ENUM(*arg), NULL); } } @@ -314,79 +280,76 @@ e_minicard_set_property (GObject *object, guint prop_id, const GValue *value, G e_canvas_item_grab_focus(item, FALSE); } break; - case PROP_SELECTED: - if (e_minicard->selected != g_value_get_boolean (value)) - set_selected (e_minicard, g_value_get_boolean (value)); + case ARG_SELECTED: + if (e_minicard->selected != GTK_VALUE_BOOL(*arg)) + set_selected (e_minicard, GTK_VALUE_BOOL(*arg)); break; - case PROP_EDITABLE: - e_minicard->editable = g_value_get_boolean (value); + case ARG_EDITABLE: + e_minicard->editable = GTK_VALUE_BOOL(*arg); for (l = e_minicard->fields; l; l = l->next) - g_object_set (E_MINICARD_FIELD (l->data)->label, - "editable", e_minicard->editable, - NULL); + gtk_object_set (GTK_OBJECT (E_MINICARD_FIELD (l->data)->label), + "editable", e_minicard->editable, + NULL); break; - case PROP_HAS_CURSOR: - d(g_print("%s: PROP_HAS_CURSOR\n", G_GNUC_FUNCTION)); - if (e_minicard->has_cursor != g_value_get_boolean (value)) - set_has_cursor (e_minicard, g_value_get_boolean (value)); + case ARG_HAS_CURSOR: + d(g_print("%s: ARG_HAS_CURSOR\n", __FUNCTION__)); + if (e_minicard->has_cursor != GTK_VALUE_BOOL(*arg)) + set_has_cursor (e_minicard, GTK_VALUE_BOOL(*arg)); break; - case PROP_CARD: + case ARG_CARD: if (e_minicard->card) - g_object_unref (e_minicard->card); - e_minicard->card = E_CARD(g_value_get_object (value)); + gtk_object_unref (GTK_OBJECT(e_minicard->card)); + e_minicard->card = E_CARD(GTK_VALUE_OBJECT (*arg)); if (e_minicard->card) - g_object_ref (e_minicard->card); - g_object_set(e_minicard->simple, - "card", e_minicard->card, - NULL); + gtk_object_ref (GTK_OBJECT(e_minicard->card)); + gtk_object_set(GTK_OBJECT(e_minicard->simple), + "card", e_minicard->card, + NULL); remodel(e_minicard); e_canvas_item_request_reflow(item); e_minicard->changed = FALSE; break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; } } static void -e_minicard_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) +e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) { EMinicard *e_minicard; e_minicard = E_MINICARD (object); - switch (prop_id) { - case PROP_WIDTH: - g_value_set_double (value, e_minicard->width); - break; - case PROP_HEIGHT: - g_value_set_double (value, e_minicard->height); - break; - case PROP_HAS_FOCUS: - g_value_set_int (value, e_minicard->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE); + switch (arg_id) { + case ARG_WIDTH: + GTK_VALUE_DOUBLE (*arg) = e_minicard->width; + break; + case ARG_HEIGHT: + GTK_VALUE_DOUBLE (*arg) = e_minicard->height; + break; + case ARG_HAS_FOCUS: + GTK_VALUE_ENUM (*arg) = e_minicard->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE; break; - case PROP_SELECTED: - g_value_set_boolean (value, e_minicard->selected); + case ARG_SELECTED: + GTK_VALUE_BOOL (*arg) = e_minicard->selected; break; - case PROP_HAS_CURSOR: - g_value_set_boolean (value, e_minicard->has_cursor); + case ARG_HAS_CURSOR: + GTK_VALUE_BOOL (*arg) = e_minicard->has_cursor; break; - case PROP_EDITABLE: - g_value_set_boolean (value, e_minicard->editable); + case ARG_EDITABLE: + GTK_VALUE_BOOL (*arg) = e_minicard->editable; break; - case PROP_CARD: + case ARG_CARD: e_card_simple_sync_card(e_minicard->simple); - g_value_set_object (value, e_minicard->card); + GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_minicard->card); break; default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; + arg->type = GTK_TYPE_INVALID; + break; } } static void -e_minicard_dispose (GObject *object) +e_minicard_destroy (GtkObject *object) { EMinicard *e_minicard; @@ -395,25 +358,19 @@ e_minicard_dispose (GObject *object) e_minicard = E_MINICARD (object); - if (e_minicard->fields) { - g_list_foreach(e_minicard->fields, (GFunc) e_minicard_field_destroy, NULL); - g_list_free(e_minicard->fields); - e_minicard->fields = NULL; - } + g_list_foreach(e_minicard->fields, (GFunc) e_minicard_field_destroy, NULL); + g_list_free(e_minicard->fields); - if (e_minicard->list_icon_pixbuf) { - gdk_pixbuf_unref (e_minicard->list_icon_pixbuf); - e_minicard->list_icon_pixbuf = NULL; - } + gdk_pixbuf_unref (e_minicard->list_icon_pixbuf); - if (G_OBJECT_CLASS (parent_class)->dispose) - (* G_OBJECT_CLASS (parent_class)->dispose) (object); + if (GTK_OBJECT_CLASS (parent_class)->destroy) + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } static void -e_minicard_finalize (GObject *object) +e_minicard_finalize (GtkObject *object) { EMinicard *e_minicard; @@ -423,12 +380,12 @@ e_minicard_finalize (GObject *object) e_minicard = E_MINICARD (object); if (e_minicard->card) - g_object_unref (e_minicard->card); + gtk_object_unref (GTK_OBJECT(e_minicard->card)); if (e_minicard->simple) - g_object_unref (e_minicard->simple); + gtk_object_unref (GTK_OBJECT(e_minicard->simple)); - if (G_OBJECT_CLASS (parent_class)->finalize) - (* G_OBJECT_CLASS (parent_class)->finalize) (object); + if (GTK_OBJECT_CLASS (parent_class)->finalize) + (* GTK_OBJECT_CLASS (parent_class)->finalize) (object); } static void @@ -450,8 +407,8 @@ e_minicard_realize (GnomeCanvasItem *item) gnome_canvas_rect_get_type(), "x1", (double) 0, "y1", (double) 0, - "x2", (double) MAX (e_minicard->width - 1, 0), - "y2", (double) MAX (e_minicard->height - 1, 0), + "x2", (double) e_minicard->width - 1, + "y2", (double) e_minicard->height - 1, "outline_color", NULL, NULL ); @@ -460,8 +417,8 @@ e_minicard_realize (GnomeCanvasItem *item) gnome_canvas_rect_get_type(), "x1", (double) 2, "y1", (double) 2, - "x2", (double) MAX (e_minicard->width - 3, 0), - "y2", (double) MAX (e_minicard->height - 3, 0), + "x2", (double) e_minicard->width - 3, + "y2", (double) e_minicard->height - 3, "fill_color_gdk", &canvas->style->bg[GTK_STATE_NORMAL], NULL ); @@ -469,9 +426,12 @@ e_minicard_realize (GnomeCanvasItem *item) gnome_canvas_item_new( group, e_text_get_type(), "anchor", GTK_ANCHOR_NW, - "width", (double) MAX( e_minicard->width - 12, 0 ), + "width", (double) ( e_minicard->width - 12 ), "clip", TRUE, "use_ellipsis", TRUE, +#if 0 + "font", "fixed-bold-10", +#endif "fill_color_gdk", &canvas->style->fg[GTK_STATE_NORMAL], "text", "", "draw_background", FALSE, @@ -510,7 +470,7 @@ e_minicard_unrealize (GnomeCanvasItem *item) static void card_modified_cb (EBook* book, EBookStatus status, gpointer user_data) { - d(g_print ("%s: %s(): a card was modified\n", __FILE__, G_GNUC_FUNCTION)); + d(g_print ("%s: %s(): a card was modified\n", __FILE__, __FUNCTION__)); if (status != E_BOOK_STATUS_SUCCESS) e_addressbook_error_dialog (_("Error modifying card"), status); } @@ -520,7 +480,7 @@ static void editor_closed_cb (GtkObject *editor, gpointer data) { EMinicard *minicard = data; - g_object_unref (editor); + gtk_object_unref (GTK_OBJECT (editor)); minicard->editor = NULL; } @@ -532,12 +492,12 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) e_minicard = E_MINICARD (item); canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (item)->canvas); - + switch( event->type ) { case GDK_FOCUS_CHANGE: { GdkEventFocus *focus_event = (GdkEventFocus *) event; - d(g_print("%s: GDK_FOCUS_CHANGE: %s\n", G_GNUC_FUNCTION, focus_event->in?"in":"out")); + d(g_print("%s: GDK_FOCUS_CHANGE: %s\n", __FUNCTION__, focus_event->in?"in":"out")); if (focus_event->in) { /* Chris: When EMinicard gets the cursor, if it doesn't have the focus, it should take it. */ e_minicard->has_focus = TRUE; @@ -553,9 +513,9 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) if (E_IS_MINICARD_VIEW(GNOME_CANVAS_ITEM(e_minicard)->parent)) { - g_object_get(GNOME_CANVAS_ITEM(e_minicard)->parent, - "book", &book, - NULL); + gtk_object_get(GTK_OBJECT(GNOME_CANVAS_ITEM(e_minicard)->parent), + "book", &book, + NULL); } @@ -641,26 +601,26 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) } else { EBook *book = NULL; if (E_IS_MINICARD_VIEW(item->parent)) { - g_object_get(item->parent, - "book", &book, - NULL); + gtk_object_get(GTK_OBJECT(item->parent), + "book", &book, + NULL); } if (book != NULL) { if (e_card_evolution_list (e_minicard->card)) { EContactListEditor *editor = e_addressbook_show_contact_list_editor (book, e_minicard->card, FALSE, e_minicard->editable); - e_minicard->editor = G_OBJECT (editor); + e_minicard->editor = GTK_OBJECT (editor); } else { EContactEditor *editor = e_addressbook_show_contact_editor (book, e_minicard->card, FALSE, e_minicard->editable); - e_minicard->editor = G_OBJECT (editor); + e_minicard->editor = GTK_OBJECT (editor); } - g_object_ref (e_minicard->editor); + gtk_object_ref (e_minicard->editor); - g_signal_connect (e_minicard->editor, "editor_closed", - G_CALLBACK (editor_closed_cb), e_minicard); + gtk_signal_connect (e_minicard->editor, "editor_closed", + GTK_SIGNAL_FUNC (editor_closed_cb), e_minicard); } } @@ -676,9 +636,9 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) EMinicardField *field = E_MINICARD_FIELD(list->data); GnomeCanvasItem *item = field->label; EFocus has_focus; - g_object_get(item, - "has_focus", &has_focus, - NULL); + gtk_object_get(GTK_OBJECT(item), + "has_focus", &has_focus, + NULL); if (has_focus != E_FOCUS_NONE) { if (event->key.state & GDK_SHIFT_MASK) list = list->prev; @@ -739,11 +699,11 @@ field_changed (EText *text, EMinicard *e_minicard) gboolean is_list = FALSE; type = GPOINTER_TO_INT - (g_object_get_data(G_OBJECT(text), - "EMinicard:field")); - g_object_get(text, - "text", &string, - NULL); + (gtk_object_get_data(GTK_OBJECT(text), + "EMinicard:field")); + gtk_object_get(GTK_OBJECT(text), + "text", &string, + NULL); /* * If the card is coresponding with a contact list and the field be @@ -764,7 +724,7 @@ field_changed (EText *text, EMinicard *e_minicard) new_string = e_destination_export(dest); g_free(string); string=new_string; - g_object_unref (dest); + gtk_object_unref (GTK_OBJECT (dest)); } } } @@ -803,10 +763,10 @@ add_field (EMinicard *e_minicard, ECardSimpleField field, gdouble left_width) if (!strncmp (string, "<?xml", 5)) { EDestination *dest = e_destination_import (string); if (dest != NULL) { - gchar *new_string = g_strdup (e_destination_get_textrep (dest, TRUE)); + gchar *new_string = g_strdup (e_destination_get_address (dest)); g_free (string); string = new_string; - g_object_unref (dest); + gtk_object_unref (GTK_OBJECT (dest)); } } @@ -818,16 +778,16 @@ add_field (EMinicard *e_minicard, ECardSimpleField field, gdouble left_width) "max_field_name_length", left_width, "editable", e_minicard->editable, NULL ); - g_signal_connect(E_MINICARD_LABEL(new_item)->field, - "changed", G_CALLBACK (field_changed), e_minicard); - g_signal_connect(E_MINICARD_LABEL(new_item)->field, - "activate", G_CALLBACK (field_activated), e_minicard); - g_object_set(E_MINICARD_LABEL(new_item)->field, - "allow_newlines", e_card_simple_get_allow_newlines (e_minicard->simple, field), - NULL); - g_object_set_data(G_OBJECT (E_MINICARD_LABEL(new_item)->field), - "EMinicard:field", - GINT_TO_POINTER(field)); + gtk_signal_connect(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field), + "changed", GTK_SIGNAL_FUNC(field_changed), e_minicard); + gtk_signal_connect(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field), + "activate", GTK_SIGNAL_FUNC(field_activated), e_minicard); + gtk_object_set(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field), + "allow_newlines", e_card_simple_get_allow_newlines (e_minicard->simple, field), + NULL); + gtk_object_set_data(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field), + "EMinicard:field", + GINT_TO_POINTER(field)); minicard_field = g_new(EMinicardField, 1); minicard_field->field = field; @@ -839,25 +799,24 @@ add_field (EMinicard *e_minicard, ECardSimpleField field, gdouble left_width) g_free(string); } -static int +static gdouble get_left_width(EMinicard *e_minicard) { gchar *name; ECardSimpleField field; - int width = -1; - PangoLayout *layout; + gdouble width = -1; + GdkFont *font; + + font = ((GtkWidget *) ((GnomeCanvasItem *) e_minicard)->canvas)->style->font; - layout = gtk_widget_create_pango_layout (GTK_WIDGET (GNOME_CANVAS_ITEM (e_minicard)->canvas), ""); for(field = E_CARD_SIMPLE_FIELD_FULL_NAME; field != E_CARD_SIMPLE_FIELD_LAST; field++) { - int this_width; + gdouble this_width; name = g_strdup_printf("%s:", e_card_simple_get_name(e_minicard->simple, field)); - pango_layout_set_text (layout, name, -1); - pango_layout_get_pixel_size (layout, &this_width, NULL); + this_width = gdk_text_width(font, name, strlen(name)); if (width < this_width) width = this_width; g_free(name); } - g_object_unref (layout); return width; } @@ -871,7 +830,7 @@ remodel( EMinicard *e_minicard ) ECardSimpleField field; GList *list; char *file_as; - int left_width = -1; + gdouble left_width = -1; if (e_minicard->header_text) { file_as = e_card_simple_get(e_minicard->simple, E_CARD_SIMPLE_FIELD_FILE_AS); @@ -906,17 +865,17 @@ remodel( EMinicard *e_minicard ) if (!strncmp (string, "<?xml", 4)) { EDestination *dest = e_destination_import (string); if (dest != NULL) { - gchar *new_string = g_strdup (e_destination_get_textrep (dest, TRUE)); + gchar *new_string = g_strdup (e_destination_get_address (dest)); g_free (string); string = new_string; - g_object_unref (dest); + gtk_object_unref (GTK_OBJECT (dest)); } } e_minicard->fields = g_list_append(e_minicard->fields, minicard_field); - g_object_set(minicard_field->label, - "field", string, - NULL); + gtk_object_set(GTK_OBJECT(minicard_field->label), + "field", string, + NULL); count ++; } else { e_minicard_field_destroy(minicard_field); @@ -955,9 +914,9 @@ e_minicard_reflow( GnomeCanvasItem *item, int flags ) old_height = e_minicard->height; - g_object_get( e_minicard->header_text, - "text_height", &text_height, - NULL ); + gtk_object_get( GTK_OBJECT( e_minicard->header_text ), + "text_height", &text_height, + NULL ); e_minicard->height = text_height + 10.0; @@ -968,15 +927,19 @@ e_minicard_reflow( GnomeCanvasItem *item, int flags ) for(list = e_minicard->fields; list; list = g_list_next(list)) { EMinicardField *field = E_MINICARD_FIELD(list->data); GnomeCanvasItem *item = field->label; - g_object_get (item, - "height", &text_height, - NULL); + gtk_object_get (GTK_OBJECT(item), + "height", &text_height, + NULL); e_canvas_item_move_absolute(item, 2, e_minicard->height); e_minicard->height += text_height; } e_minicard->height += 2; gnome_canvas_item_set( e_minicard->rect, + "y2", (double) e_minicard->height - 1, + NULL ); + + gnome_canvas_item_set( e_minicard->rect, "x2", (double) e_minicard->width - 1.0, "y2", (double) e_minicard->height - 1.0, NULL ); @@ -1012,12 +975,12 @@ e_minicard_compare (EMinicard *minicard1, EMinicard *minicard2) if (minicard1->card && minicard2->card) { char *file_as1, *file_as2; - g_object_get(minicard1->card, - "file_as", &file_as1, - NULL); - g_object_get(minicard2->card, - "file_as", &file_as2, - NULL); + gtk_object_get(GTK_OBJECT(minicard1->card), + "file_as", &file_as1, + NULL); + gtk_object_get(GTK_OBJECT(minicard2->card), + "file_as", &file_as2, + NULL); if (file_as1 && file_as2) return g_utf8_collate(file_as1, file_as2); if (file_as1) @@ -1036,15 +999,15 @@ e_minicard_selected (EMinicard *minicard, GdkEvent *event) gint ret_val = 0; GnomeCanvasItem *item = GNOME_CANVAS_ITEM (minicard); if (item->parent) { - guint signal_id = g_signal_lookup ("selection_event", G_OBJECT_TYPE (item->parent)); + guint signal_id = gtk_signal_lookup ("selection_event", GTK_OBJECT_TYPE (item->parent)); /* We should probably check the signature here, but I * don't think it's worth the time required to code * it. */ if (signal_id != 0) { - g_signal_emit(item->parent, - signal_id, 0, - item, event, &ret_val); + gtk_signal_emit(GTK_OBJECT(item->parent), + signal_id, + item, event, &ret_val); } } return ret_val; @@ -1055,9 +1018,9 @@ e_minicard_drag_begin (EMinicard *minicard, GdkEvent *event) { gint ret_val = 0; GnomeCanvasItem *parent; - g_signal_emit (minicard, - e_minicard_signals[DRAG_BEGIN], 0, - event, &ret_val); + gtk_signal_emit (GTK_OBJECT(minicard), + e_minicard_signals[DRAG_BEGIN], + event, &ret_val); parent = GNOME_CANVAS_ITEM (minicard)->parent; if (parent && E_IS_REFLOW (parent)) { |