aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/contact-editor/e-contact-editor.c
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui/contact-editor/e-contact-editor.c')
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c66
1 files changed, 61 insertions, 5 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index e2468ee6dd..69d11b0e3c 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -33,7 +33,6 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libedataserverui/e-categories-dialog.h>
-#include <misc/e-gui-utils.h>
#include <libebook/e-address-western.h>
#include <libedataserverui/e-category-completion.h>
@@ -41,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"
@@ -49,9 +48,9 @@
#include "misc/e-dateedit.h"
#include "misc/e-image-chooser.h"
#include "misc/e-url-entry.h"
-#include "shell/evolution-shell-component-utils.h"
#include "e-util/e-icon-factory.h"
#include "e-util/e-util-private.h"
+#include "shell/e-shell.h"
#include "eab-contact-merging.h"
@@ -199,6 +198,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 +289,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",
@@ -3329,6 +3380,7 @@ static void
e_contact_editor_init (EContactEditor *e_contact_editor)
{
GladeXML *gui;
+ EShell *shell;
GtkWidget *widget, *label;
GtkEntryCompletion *completion;
gchar *gladefile;
@@ -3406,6 +3458,10 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
/* show window */
gtk_widget_show (e_contact_editor->app);
+
+ /* FIXME Shell should be passed in. */
+ shell = e_shell_get_default ();
+ e_shell_watch_window (shell, GTK_WINDOW (e_contact_editor->app));
}
static void
@@ -3501,7 +3557,7 @@ contact_editor_destroy_notify (gpointer data,
eab_editor_remove (EAB_EDITOR (data));
}
-EContactEditor *
+GtkWidget *
e_contact_editor_new (EBook *book,
EContact *contact,
gboolean is_new_contact,
@@ -3527,7 +3583,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