aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/merging/e-card-merging.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-06-09 14:31:55 +0800
committerChris Lahey <clahey@src.gnome.org>2001-06-09 14:31:55 +0800
commit5c58686c8ef72be5ed8a2d4469b3556f80d4b81c (patch)
tree0f708cfe4db04dad2e15a4bb44aa58772aaf3b21 /addressbook/gui/merging/e-card-merging.c
parent7343d66ba7149b389b86508d188bab9c4bfe28dc (diff)
downloadgsoc2013-evolution-5c58686c8ef72be5ed8a2d4469b3556f80d4b81c.tar
gsoc2013-evolution-5c58686c8ef72be5ed8a2d4469b3556f80d4b81c.tar.gz
gsoc2013-evolution-5c58686c8ef72be5ed8a2d4469b3556f80d4b81c.tar.bz2
gsoc2013-evolution-5c58686c8ef72be5ed8a2d4469b3556f80d4b81c.tar.lz
gsoc2013-evolution-5c58686c8ef72be5ed8a2d4469b3556f80d4b81c.tar.xz
gsoc2013-evolution-5c58686c8ef72be5ed8a2d4469b3556f80d4b81c.tar.zst
gsoc2013-evolution-5c58686c8ef72be5ed8a2d4469b3556f80d4b81c.zip
Null terminate the strv here. (e_card_locate_match): ref here instead of
2001-06-09 Christopher James Lahey <clahey@ximian.com> * backend/ebook/e-card-compare.c (use_common_book_cb): Null terminate the strv here. (e_card_locate_match): ref here instead of unref. * backend/ebook/e-card-simple.c (e_card_simple_get): Handle a NULL card here. * contact-editor/Makefile.am (INCLUDES), gui/widgets/Makefile.am (INCLUDES): Added addressbook/gui/merging here. * contact-editor/e-contact-quick-add.c (book_ready_cb), gui/component/addressbook-component.c (dnd_drop_book_open_cb), gui/widgets/e-addressbook-table-adapter.c (addressbook_append_row), gui/widgets/e-addressbook-util.c (add_card_cb), gui/widgets/e-addressbook-view.c (selection_received), gui/widgets/e-minicard-control.c (book_open_cb): Use e_card_merging_book_add_card instead of e_book_add_card here. * gui/Makefile.am (SUBDIRS): Added merging. * gui/component/Makefile.am (evolution_addressbook_LDADD), gui/widgets/Makefile.am (minicard_test_LDADD, minicard_widget_test_LDADD): Added libecardmerging.a here. * gui/merging/, gui/merging/.cvsignore, gui/merging/Makefile.am: New addressbook library. * gui/merging/e-card-duplicate-detected.glade: Glade file for duplicate detected dialog. * gui/merging/e-card-merging.c, gui/merging/e-card-merging.h: New files for detecting duplicates before adding and putting up a dialog if duplicates are found. * gui/widgets/e-minicard-view.c: Include e-addressbook-util.h here. svn path=/trunk/; revision=10170
Diffstat (limited to 'addressbook/gui/merging/e-card-merging.c')
-rw-r--r--addressbook/gui/merging/e-card-merging.c100
1 files changed, 100 insertions, 0 deletions
diff --git a/addressbook/gui/merging/e-card-merging.c b/addressbook/gui/merging/e-card-merging.c
new file mode 100644
index 0000000000..701ab69da9
--- /dev/null
+++ b/addressbook/gui/merging/e-card-merging.c
@@ -0,0 +1,100 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Code for checking for duplicates when doing ECard work.
+ *
+ * Author:
+ * Christopher James Lahey <clahey@ximian.com>
+ *
+ * Copyright 2001, Ximian, Inc.
+ */
+
+#include <config.h>
+
+#include "e-card-merging.h"
+#include <libgnomeui/gnome-dialog.h>
+#include "e-card-compare.h"
+#include <glade/glade.h>
+#include <gtk/gtksignal.h>
+#include "addressbook/gui/widgets/e-minicard-widget.h"
+
+typedef struct {
+ EBook *book;
+ ECard *card;
+ EBookIdCallback cb;
+ gpointer closure;
+} ECardMergingLookup;
+
+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);
+ break;
+ case 1:
+ if (lookup->cb)
+ lookup->cb (lookup->book, E_BOOK_STATUS_CANCELLED, NULL, lookup->closure);
+ break;
+ }
+ g_free (lookup);
+ gnome_dialog_close (dialog);
+}
+
+static void
+match_query_callback (ECard *card, ECard *match, ECardMatchType type, gpointer closure)
+{
+ ECardMergingLookup *lookup = closure;
+ if (type == E_CARD_MATCH_NONE) {
+ e_book_add_card (lookup->book, card, lookup->cb, lookup->closure);
+ g_free (lookup);
+ } else {
+ GladeXML *ui = glade_xml_new (EVOLUTION_GLADEDIR "/e-card-duplicate-detected.glade", NULL);
+ GtkWidget *widget;
+
+ widget = glade_xml_get_widget (ui, "custom-old-card");
+ gtk_object_set (GTK_OBJECT (widget),
+ "card", match,
+ NULL);
+
+ widget = glade_xml_get_widget (ui, "custom-new-card");
+ gtk_object_set (GTK_OBJECT (widget),
+ "card", card,
+ NULL);
+
+ widget = glade_xml_get_widget (ui, "dialog-duplicate-contact");
+
+ gtk_signal_connect (GTK_OBJECT (widget), "clicked",
+ GTK_SIGNAL_FUNC (clicked), lookup);
+ }
+}
+
+gboolean
+e_card_merging_book_add_card (EBook *book,
+ ECard *card,
+ EBookIdCallback cb,
+ gpointer closure)
+{
+ ECardMergingLookup *lookup;
+ lookup = g_new (ECardMergingLookup, 1);
+
+ lookup->book = book;
+ lookup->card = card;
+ lookup->cb = cb;
+ lookup->closure = closure;
+
+ e_card_locate_match (card, match_query_callback, lookup);
+ return TRUE;
+}
+
+GtkWidget *
+e_card_merging_create_old_card(gchar *name,
+ gchar *string1, gchar *string2,
+ gint int1, gint int2);
+
+GtkWidget *
+e_card_merging_create_old_card(gchar *name,
+ gchar *string1, gchar *string2,
+ gint int1, gint int2)
+{
+ return e_minicard_widget_new ();
+}