diff options
author | Christopher James Lahey <clahey@ximian.com> | 2001-06-11 18:13:04 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-06-11 18:13:04 +0800 |
commit | 8b080c2358ad689f8a2d3fc2b0e98f966c4cccfb (patch) | |
tree | ab4598c70d3006cba0d895c205a45cae87d3ed67 /addressbook/gui/merging/e-card-merging.c | |
parent | 4b58038f453d5d84169611269e57160e65e9f569 (diff) | |
download | gsoc2013-evolution-8b080c2358ad689f8a2d3fc2b0e98f966c4cccfb.tar gsoc2013-evolution-8b080c2358ad689f8a2d3fc2b0e98f966c4cccfb.tar.gz gsoc2013-evolution-8b080c2358ad689f8a2d3fc2b0e98f966c4cccfb.tar.bz2 gsoc2013-evolution-8b080c2358ad689f8a2d3fc2b0e98f966c4cccfb.tar.lz gsoc2013-evolution-8b080c2358ad689f8a2d3fc2b0e98f966c4cccfb.tar.xz gsoc2013-evolution-8b080c2358ad689f8a2d3fc2b0e98f966c4cccfb.tar.zst gsoc2013-evolution-8b080c2358ad689f8a2d3fc2b0e98f966c4cccfb.zip |
Added e-card-merging-book-commit-duplicate-detected.glade here.
2001-06-11 Christopher James Lahey <clahey@ximian.com>
* gui/merging/Makefile.am (glade_DATA): Added
e-card-merging-book-commit-duplicate-detected.glade here.
* gui/merging/e-card-merging-book-commit-duplicate-detected.glade:
Added this file. The GUI for asking whether to commit a modified
card.
* gui/merging/e-card-merging.c, gui/merging/e-card-merging.h
(e_card_merging_book_commit_card): Added this function.
* gui/widgets/e-addressbook-table-adapter.c
(addressbook_set_value_at), gui/widgets/e-addressbook-util.c
(commit_card_cb), gui/widgets/e-minicard.c (e_minicard_event): Use
e_card_merging_book_commit_card instead of e_book_commit_card here.
svn path=/trunk/; revision=10184
Diffstat (limited to 'addressbook/gui/merging/e-card-merging.c')
-rw-r--r-- | addressbook/gui/merging/e-card-merging.c | 78 |
1 files changed, 71 insertions, 7 deletions
diff --git a/addressbook/gui/merging/e-card-merging.c b/addressbook/gui/merging/e-card-merging.c index c367a60271..dd8c317990 100644 --- a/addressbook/gui/merging/e-card-merging.c +++ b/addressbook/gui/merging/e-card-merging.c @@ -17,23 +17,50 @@ #include <gtk/gtksignal.h> #include "addressbook/gui/widgets/e-minicard-widget.h" +typedef enum { + E_CARD_MERGING_ADD, + E_CARD_MERGING_COMMIT +} ECardMergingOpType; + typedef struct { + ECardMergingOpType op; EBook *book; ECard *card; - EBookIdCallback cb; + EBookIdCallback id_cb; + EBookCallback cb; gpointer closure; } ECardMergingLookup; static void +doit (ECardMergingLookup *lookup) +{ + if (lookup->op == E_CARD_MERGING_ADD) + e_book_add_card (lookup->book, lookup->card, lookup->id_cb, lookup->closure); + else if (lookup->op == E_CARD_MERGING_COMMIT) + e_book_commit_card (lookup->book, lookup->card, lookup->cb, lookup->closure); +} + +static void +cancelit (ECardMergingLookup *lookup) +{ + if (lookup->op == E_CARD_MERGING_ADD) { + if (lookup->id_cb) + lookup->id_cb (lookup->book, E_BOOK_STATUS_CANCELLED, NULL, lookup->closure); + } else if (lookup->op == E_CARD_MERGING_COMMIT) { + if (lookup->cb) + lookup->cb (lookup->book, E_BOOK_STATUS_CANCELLED, lookup->closure); + } +} + +static void clicked (GnomeDialog *dialog, int button, ECardMergingLookup *lookup) { switch (button) { case 0: - e_book_add_card (lookup->book, lookup->card, lookup->cb, lookup->closure); + doit (lookup); break; case 1: - if (lookup->cb) - lookup->cb (lookup->book, E_BOOK_STATUS_CANCELLED, NULL, lookup->closure); + cancelit (lookup); break; } g_free (lookup); @@ -45,12 +72,23 @@ match_query_callback (ECard *card, ECard *match, ECardMatchType type, gpointer c { ECardMergingLookup *lookup = closure; if (type == E_CARD_MATCH_NONE) { - e_book_add_card (lookup->book, card, lookup->cb, lookup->closure); + doit (lookup); g_free (lookup); } else { - GladeXML *ui = glade_xml_new (EVOLUTION_GLADEDIR "/e-card-duplicate-detected.glade", NULL); + GladeXML *ui; + GtkWidget *widget; + if (lookup->op == E_CARD_MERGING_ADD) + ui = glade_xml_new (EVOLUTION_GLADEDIR "/e-card-duplicate-detected.glade", NULL); + else if (lookup->op == E_CARD_MERGING_COMMIT) + ui = glade_xml_new (EVOLUTION_GLADEDIR "/e-card-merging-book-commit-duplicate-detected.glade", NULL); + else { + doit (lookup); + g_free (lookup); + return; + } + widget = glade_xml_get_widget (ui, "custom-old-card"); gtk_object_set (GTK_OBJECT (widget), "card", match, @@ -77,15 +115,41 @@ e_card_merging_book_add_card (EBook *book, ECardMergingLookup *lookup; lookup = g_new (ECardMergingLookup, 1); + lookup->op = E_CARD_MERGING_ADD; lookup->book = book; lookup->card = card; - lookup->cb = cb; + lookup->id_cb = cb; lookup->closure = closure; e_card_locate_match_full (book, card, NULL, match_query_callback, lookup); return TRUE; } +gboolean +e_card_merging_book_commit_card (EBook *book, + ECard *card, + EBookCallback cb, + gpointer closure) +{ + ECardMergingLookup *lookup; + GList *avoid; + lookup = g_new (ECardMergingLookup, 1); + + lookup->op = E_CARD_MERGING_COMMIT; + lookup->book = book; + lookup->card = card; + lookup->cb = cb; + lookup->closure = closure; + + avoid = g_list_append (NULL, card); + + e_card_locate_match_full (book, card, avoid, match_query_callback, lookup); + + g_list_free (avoid); + + return TRUE; +} + GtkWidget * e_card_merging_create_old_card(gchar *name, gchar *string1, gchar *string2, |