aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/contact-editor
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-11-14 11:56:01 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-11-14 11:56:01 +0800
commit8c0bd86d5fdd6d87c3170e2a01423e7c7018a981 (patch)
tree22da2df051cb6f1bc988d15aca08ebb0a5baf7e4 /addressbook/gui/contact-editor
parent6760cc72334346b8654fcd9fe1440890db55ac1b (diff)
downloadgsoc2013-evolution-8c0bd86d5fdd6d87c3170e2a01423e7c7018a981.tar
gsoc2013-evolution-8c0bd86d5fdd6d87c3170e2a01423e7c7018a981.tar.gz
gsoc2013-evolution-8c0bd86d5fdd6d87c3170e2a01423e7c7018a981.tar.bz2
gsoc2013-evolution-8c0bd86d5fdd6d87c3170e2a01423e7c7018a981.tar.lz
gsoc2013-evolution-8c0bd86d5fdd6d87c3170e2a01423e7c7018a981.tar.xz
gsoc2013-evolution-8c0bd86d5fdd6d87c3170e2a01423e7c7018a981.tar.zst
gsoc2013-evolution-8c0bd86d5fdd6d87c3170e2a01423e7c7018a981.zip
Rearranged some of the addressbook code to try and eliminate some circular
dependencies in our libraries. The circular dependency between the composer and the mail module is still causing me headaches. And it doesn't help that the addressbook and calendar also want to link to the composer. svn path=/branches/kill-bonobo/; revision=36782
Diffstat (limited to 'addressbook/gui/contact-editor')
-rw-r--r--addressbook/gui/contact-editor/Makefile.am12
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c58
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.h10
-rw-r--r--addressbook/gui/contact-editor/e-contact-quick-add.c4
-rw-r--r--addressbook/gui/contact-editor/eab-editor.c45
-rw-r--r--addressbook/gui/contact-editor/eab-editor.h1
6 files changed, 70 insertions, 60 deletions
diff --git a/addressbook/gui/contact-editor/Makefile.am b/addressbook/gui/contact-editor/Makefile.am
index bed73df00b..f813db72e8 100644
--- a/addressbook/gui/contact-editor/Makefile.am
+++ b/addressbook/gui/contact-editor/Makefile.am
@@ -33,10 +33,14 @@ libecontacteditor_la_SOURCES = \
libecontacteditor_la_LDFLAGS = $(NO_UNDEFINED)
-libecontacteditor_la_LIBADD = \
- $(WIN32_BOOTSTRAP_LIBS) \
- $(top_builddir)/widgets/misc/libemiscwidgets.la \
- $(top_builddir)/e-util/libeutil.la \
+libecontacteditor_la_LIBADD = \
+ $(WIN32_BOOTSTRAP_LIBS) \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/widgets/misc/libemiscwidgets.la \
+ $(top_builddir)/addressbook/util/libeabutil.la \
+ $(top_builddir)/addressbook/gui/widgets/libeabwidgets.la \
+ $(top_builddir)/addressbook/gui/merging/libeabbookmerging.la \
+ $(top_builddir)/addressbook/printing/libecontactprint.la \
$(EVOLUTION_ADDRESSBOOK_LIBS)
glade_DATA = \
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 07d4a9ec0f..30d672161a 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -40,7 +40,7 @@
#include <camel/camel.h>
-#include "addressbook/gui/component/addressbook.h"
+#include "addressbook/util/addressbook.h"
#include "addressbook/printing/e-contact-print.h"
#include "addressbook/gui/widgets/eab-gui-util.h"
#include "e-util/e-util.h"
@@ -199,6 +199,54 @@ static const gint email_default [] = { 0, 1, 2, 2 };
#define STRING_IS_EMPTY(x) (!(x) || !(*(x)))
#define STRING_MAKE_NON_NULL(x) ((x) ? (x) : "")
+static void
+e_contact_editor_contact_added (EABEditor *editor,
+ EBookStatus status,
+ EContact *contact)
+{
+ if (status == E_BOOK_ERROR_OK)
+ return;
+
+ if (status == E_BOOK_ERROR_CANCELLED)
+ return;
+
+ eab_error_dialog (_("Error adding contact"), status);
+}
+
+static void
+e_contact_editor_contact_modified (EABEditor *editor,
+ EBookStatus status,
+ EContact *contact)
+{
+ if (status == E_BOOK_ERROR_OK)
+ return;
+
+ if (status == E_BOOK_ERROR_CANCELLED)
+ return;
+
+ eab_error_dialog (_("Error modifying contact"), status);
+}
+
+static void
+e_contact_editor_contact_deleted (EABEditor *editor,
+ EBookStatus status,
+ EContact *contact)
+{
+ if (status == E_BOOK_ERROR_OK)
+ return;
+
+ if (status == E_BOOK_ERROR_CANCELLED)
+ return;
+
+ eab_error_dialog (_("Error removing contact"), status);
+}
+
+static void
+e_contact_editor_closed (EABEditor *editor)
+{
+ g_object_unref (editor);
+}
+
GType
e_contact_editor_get_type (void)
{
@@ -242,6 +290,10 @@ e_contact_editor_class_init (EContactEditorClass *klass)
editor_class->save_contact = e_contact_editor_save_contact;
editor_class->is_changed = e_contact_editor_is_changed;
editor_class->get_window = e_contact_editor_get_window;
+ editor_class->contact_added = e_contact_editor_contact_added;
+ editor_class->contact_modified = e_contact_editor_contact_modified;
+ editor_class->contact_deleted = e_contact_editor_contact_deleted;
+ editor_class->editor_closed = e_contact_editor_closed;
g_object_class_install_property (object_class, PROP_SOURCE_BOOK,
g_param_spec_object ("source_book",
@@ -3470,7 +3522,7 @@ contact_editor_destroy_notify (void *data,
eab_editor_remove (EAB_EDITOR (data));
}
-EContactEditor *
+GtkWidget *
e_contact_editor_new (EBook *book,
EContact *contact,
gboolean is_new_contact,
@@ -3496,7 +3548,7 @@ e_contact_editor_new (EBook *book,
if (book)
e_book_async_get_supported_fields (book, (EBookEListCallback)supported_fields_cb, ce);
- return ce;
+ return GTK_WIDGET (ce);
}
static void
diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h
index 7fd94698c8..d4af1495c2 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.h
+++ b/addressbook/gui/contact-editor/e-contact-editor.h
@@ -109,11 +109,11 @@ struct _EContactEditorClass
EABEditorClass parent_class;
};
-EContactEditor *e_contact_editor_new (EBook *book,
- EContact *contact,
- gboolean is_new_contact,
- gboolean editable);
-GType e_contact_editor_get_type (void);
+GType e_contact_editor_get_type (void);
+GtkWidget *e_contact_editor_new (EBook *book,
+ EContact *contact,
+ gboolean is_new_contact,
+ gboolean editable);
G_END_DECLS
diff --git a/addressbook/gui/contact-editor/e-contact-quick-add.c b/addressbook/gui/contact-editor/e-contact-quick-add.c
index 175af68d43..6de903d16f 100644
--- a/addressbook/gui/contact-editor/e-contact-quick-add.c
+++ b/addressbook/gui/contact-editor/e-contact-quick-add.c
@@ -29,7 +29,7 @@
#include <libebook/e-book.h>
#include <libebook/e-contact.h>
#include <libedataserverui/e-source-combo-box.h>
-#include <addressbook/gui/component/addressbook.h>
+#include <addressbook/util/addressbook.h>
#include <addressbook/util/eab-book-util.h>
#include "e-contact-editor.h"
#include "e-contact-quick-add.h"
@@ -195,7 +195,7 @@ ce_have_book (EBook *book, EBookStatus status, gpointer closure)
g_warning ("Couldn't open local address book.");
quick_add_unref (qa);
} else {
- EContactEditor *contact_editor = e_contact_editor_new (book, qa->contact, TRUE, TRUE /* XXX */);
+ GtkWidget *contact_editor = e_contact_editor_new (book, qa->contact, TRUE, TRUE /* XXX */);
/* mark it as changed so the Save buttons are enabled when we bring up the dialog. */
g_object_set (contact_editor,
diff --git a/addressbook/gui/contact-editor/eab-editor.c b/addressbook/gui/contact-editor/eab-editor.c
index 25a6e5d3e5..d45fb688ea 100644
--- a/addressbook/gui/contact-editor/eab-editor.c
+++ b/addressbook/gui/contact-editor/eab-editor.c
@@ -310,51 +310,6 @@ eab_editor_get_all_editors (void)
return all_editors;
}
-gboolean
-eab_editor_confirm_delete (GtkWindow *parent, gboolean plural, gboolean is_list, char *name)
-{
- GtkWidget *dialog;
- gint result;
- char *msg;
-
- if (is_list) {
- /* contact list(s) */
- if (!plural)
- msg = g_strdup_printf (_("Are you sure you want\nto delete contact list (%s)?"),
- name?name:"");
- else
- msg = g_strdup (_("Are you sure you want\nto delete these contact lists?"));
- }
- else {
- /* contact(s) */
- if (!plural)
- msg = g_strdup_printf (_("Are you sure you want\nto delete contact (%s)?"),
- name?name:"");
- else
- msg = g_strdup (_("Are you sure you want\nto delete these contacts?"));
- }
-
- dialog = gtk_message_dialog_new (parent,
- 0,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_NONE,
- "%s",
- msg);
- g_free (msg);
-
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT,
- NULL);
-
- result = gtk_dialog_run(GTK_DIALOG (dialog));
-
- gtk_widget_destroy (dialog);
-
- return (result == GTK_RESPONSE_ACCEPT);
-}
-
-
void
eab_editor_contact_added (EABEditor *editor, EBookStatus status, EContact *contact)
{
diff --git a/addressbook/gui/contact-editor/eab-editor.h b/addressbook/gui/contact-editor/eab-editor.h
index c106ec75a6..cc95e003e1 100644
--- a/addressbook/gui/contact-editor/eab-editor.h
+++ b/addressbook/gui/contact-editor/eab-editor.h
@@ -92,7 +92,6 @@ gboolean eab_editor_is_changed (EABEditor *editor);
GtkWindow* eab_editor_get_window (EABEditor *editor);
gboolean eab_editor_prompt_to_save_changes (EABEditor *editor, GtkWindow *window);
-gboolean eab_editor_confirm_delete (GtkWindow *parent, gboolean plural, gboolean is_list, char *name);
/* these four generate EABEditor signals */
void eab_editor_contact_added (EABEditor *editor, EBookStatus status, EContact *contact);