From eb3a1331f1f6a5ac79133176631a83b5bc0dac18 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Mon, 8 May 2000 00:27:11 +0000 Subject: Added saving in minicard view. 2000-05-08 Christopher James Lahey * gui/minicard/e-minicard.c: Added saving in minicard view. svn path=/trunk/; revision=2891 --- addressbook/gui/widgets/e-minicard.c | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'addressbook/gui/widgets') diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index b75d1779d4..6173ee2c9a 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -451,6 +451,47 @@ field_changed (EText *text, EMinicard *e_minicard) g_free(string); } +static void +field_activated (EText *text, EMinicard *e_minicard) +{ + EBook *book; + + e_card_simple_sync_card(e_minicard->simple); + + gtk_object_get(GTK_OBJECT(GNOME_CANVAS_ITEM(e_minicard)->parent), + "book", &book, + NULL); + + /* Add the card in the contact editor to our ebook */ + e_book_commit_card (book, + e_minicard->card, + card_changed_cb, + NULL); +} + +static void +field_event (EText *text, GdkEvent *event, EMinicard *e_minicard) +{ + switch (event->type) { + case GDK_FOCUS_CHANGE: + if (!((GdkEventFocus *)event)->in) { + EBook *book; + + e_card_simple_sync_card(e_minicard->simple); + + gtk_object_get(GTK_OBJECT(GNOME_CANVAS_ITEM(e_minicard)->parent), + "book", &book, + NULL); + + /* Add the card in the contact editor to our ebook */ + e_book_commit_card (book, + e_minicard->card, + card_changed_cb, + NULL); + } + } +} + static void add_field (EMinicard *e_minicard, ECardSimpleField field) { @@ -474,6 +515,10 @@ add_field (EMinicard *e_minicard, ECardSimpleField field) NULL ); 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_signal_connect(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field), + "event", GTK_SIGNAL_FUNC(field_event), e_minicard); gtk_object_set_data(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field), "EMinicard:field", GINT_TO_POINTER(field)); -- cgit