diff options
Diffstat (limited to 'addressbook/gui/widgets/e-minicard.c')
-rw-r--r-- | addressbook/gui/widgets/e-minicard.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index d6fa1a2068..871d8aa446 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -75,6 +75,7 @@ enum { ARG_HEIGHT, ARG_HAS_FOCUS, ARG_SELECTED, + ARG_EDITABLE, ARG_CARD }; @@ -129,6 +130,8 @@ e_minicard_class_init (EMinicardClass *klass) 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::editable", GTK_TYPE_BOOL, + GTK_ARG_READWRITE, ARG_EDITABLE); gtk_object_add_arg_type ("EMinicard::card", GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CARD); @@ -165,7 +168,8 @@ e_minicard_init (EMinicard *minicard) minicard->height = 10; minicard->has_focus = FALSE; minicard->selected = FALSE; - + minicard->editable = FALSE; + minicard->card = NULL; minicard->simple = e_card_simple_new(NULL); @@ -210,6 +214,7 @@ e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) { GnomeCanvasItem *item; EMinicard *e_minicard; + GList *l; item = GNOME_CANVAS_ITEM (o); e_minicard = E_MINICARD (o); @@ -243,6 +248,13 @@ e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) if (e_minicard->selected != GTK_VALUE_BOOL(*arg)) set_selected (e_minicard, GTK_VALUE_BOOL(*arg)); break; + case ARG_EDITABLE: + e_minicard->editable = GTK_VALUE_BOOL(*arg); + for (l = e_minicard->fields; l; l = l->next) + gtk_object_set (GTK_OBJECT (E_MINICARD_FIELD (l->data)->label), + "editable", e_minicard->editable, + NULL); + break; case ARG_CARD: if (e_minicard->card) gtk_object_unref (GTK_OBJECT(e_minicard->card)); @@ -279,6 +291,9 @@ e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) case ARG_SELECTED: GTK_VALUE_BOOL (*arg) = e_minicard->selected; break; + case ARG_EDITABLE: + GTK_VALUE_BOOL (*arg) = e_minicard->editable; + break; case ARG_CARD: e_card_simple_sync_card(e_minicard->simple); GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_minicard->card); @@ -560,7 +575,7 @@ editor_closed_cb (EContactEditor *ce, gpointer data) static void supported_fields_cb (EBook *book, EBookStatus status, EList *fields, EMinicard *e_minicard) { - e_minicard->editor = e_contact_editor_new (e_minicard->card, FALSE, fields, FALSE); + e_minicard->editor = e_contact_editor_new (e_minicard->card, FALSE, fields, !e_minicard->editable); if (book != NULL) { gtk_signal_connect (GTK_OBJECT (e_minicard->editor), "add_card", @@ -767,6 +782,7 @@ add_field (EMinicard *e_minicard, ECardSimpleField field, gdouble left_width) "fieldname", name, "field", string, "max_field_name_length", left_width, + "editable", e_minicard->editable, NULL ); gtk_signal_connect(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field), "changed", GTK_SIGNAL_FUNC(field_changed), e_minicard); |