aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addressbook/ChangeLog88
-rw-r--r--addressbook/gui/component/addressbook-component.c7
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c380
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.h21
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c211
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.h17
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c2
-rw-r--r--addressbook/gui/widgets/e-minicard.c9
-rw-r--r--addressbook/gui/widgets/e-minicard.h4
-rw-r--r--addressbook/gui/widgets/eab-gui-util.c9
-rw-r--r--addressbook/gui/widgets/eab-popup-control.c3
11 files changed, 316 insertions, 435 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 84297f9eb6..816a83d2e7 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,5 +1,93 @@
2004-03-24 Chris Toshok <toshok@ximian.com>
+ * gui/contact-list-editor/e-contact-list-editor.c
+ (e_contact_list_editor_get_type): parent_type == EAB_TYPE_EDITOR.
+ (e_contact_list_editor_class_init): fill in editor_class virtual
+ functions, and remove all the signals.
+ (list_added_cb): call eab_editor_contact_* instead of emitting a
+ signal here. also call eab_editor_close
+ (list_modified_cb): same.
+ (e_contact_list_editor_is_valid): new function.
+ (e_contact_list_editor_is_changed): same.
+ (e_contact_list_editor_get_window): same.
+ (file_close_cb): call eab_editor_ functions.
+ (list_deleted_cb): call eab_editor_contact_* instead of emitting a
+ signal here. also call eab_editor_close
+ (delete_cb): call eab_editor_* functions.
+ (contact_list_editor_destroy_notify): call eab_editor_remove.
+ (e_contact_list_editor_new): call eab_editor_add, and remove the
+ g_object_ref/gtk_object_sink two-step.
+ (e_contact_list_editor_show): make static, and make arg EABEditor.
+ (e_contact_list_editor_raise): same.
+ (e_contact_list_editor_close): same.
+ (app_delete_event_cb): call eab_editor_ functions.
+ (command_state_changed): use eab_editor_is_valid instead of
+ is_named.
+ (e_contact_list_editor_request_close_all): nuke.
+
+ * gui/contact-list-editor/e-contact-list-editor.h: nuke a bunch of
+ prototypes for functions that are now either virtual functions
+ from EABEditor or eab_editor_* functions.
+ (struct _EContactListEditor): we subclass from EABEditor.
+ (struct _EContactListEditorClass): same, and nuke all the signals.
+
+ * gui/contact-editor/e-contact-editor.c
+ (e_contact_editor_get_type): parent_type == EAB_TYPE_EDITOR.
+ (e_contact_editor_class_init): fill in editor_class virtual
+ functions, and remove all the signals.
+ (contact_moved_cb): call eab_editor_contact_* instead of emitting
+ a signal here. also call eab_editor_close
+ (contact_added_cb): same.
+ (contact_modified_cb): same.
+ (e_contact_editor_close): rename from close_dialog.
+ (e_contact_editor_is_valid): new function.
+ (e_contact_editor_is_changed): new function.
+ (e_contact_editor_get_window): new function.
+ (file_close_cb): use eab_editor_ calls here.
+ (e_contact_editor_confirm_delete): nuke.
+ (contact_deleted_cb): call eab_editor_contact_* instead of
+ emitting a signal here. also call eab_editor_close
+ (delete_cb): use eab_editor_ functions.
+ (e_contact_editor_dispose): chain up to our parent's ::dispose.
+ (contact_editor_destroy_notify): use eab_editor_remove.
+ (e_contact_editor_new): use eab_editor_add, and remove the
+ g_object_ref/gtk_object_sink two-step.
+ (_popup_position): nuke dead function.
+ (set_fields): i is an index, not a field_id.
+ (e_contact_editor_raise): make this static, and it takes an
+ EABEditor arg now, not a EContactEditor.
+ (e_contact_editor_show): same.
+ (e_contact_editor_request_close_all): nuke.
+
+ * gui/contact-editor/e-contact-editor.h: nuke a bunch of
+ prototypes for functions that are now either virtual functions
+ from EABEditor or eab_editor_* functions.
+ (struct _EContactEditor): we subclass from EABEditor.
+ (struct _EContactEditorClass): same, and remove the signals.
+
+ * gui/widgets/e-addressbook-view.c (delete): call
+ eab_editor_confirm_delete.
+
+ * gui/widgets/eab-popup-control.c (contact_editor_cb): don't
+ bother calling e_contact_editor_raise since this is a new contact
+ editor anyway.
+
+ * gui/widgets/eab-gui-util.c (eab_show_contact_list_editor): use
+ EABEditor signals, and eab_editor_show.
+
+ * gui/widgets/e-minicard.h: "editor" is now of type EABEditor, not
+ GObject.
+
+ * gui/widgets/e-minicard.c (e_minicard_event): just use
+ eab_editor_raise instead of
+ e_contact_editor_raise/e_contact_list_editor_raise.
+
+ * gui/component/addressbook-component.c (impl_requestQuit):
+ implement this again, calling eab_editor_request_close_all.
+ (addressbook_component_class_init): fill in epv->requestQuit.
+
+2004-03-24 Chris Toshok <toshok@ximian.com>
+
* gui/contact-editor/eab-editor.[ch]: superclass for both
EContactEditor and EContactListEditor. A start toward simplifying
the interface to both of them, and a place to abstract code.
diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c
index 1acba3fcec..48aef349b3 100644
--- a/addressbook/gui/component/addressbook-component.c
+++ b/addressbook/gui/component/addressbook-component.c
@@ -624,6 +624,12 @@ impl_upgradeFromVersion (PortableServer_Servant servant, short major, short mino
return addressbook_migrate (addressbook_component_peek (), major, minor, revision);
}
+static CORBA_boolean
+impl_requestQuit (PortableServer_Servant servant, CORBA_Environment *ev)
+{
+ return eab_editor_request_close_all ();
+}
+
/* GObject methods. */
static void
@@ -677,6 +683,7 @@ addressbook_component_class_init (AddressbookComponentClass *class)
epv->_get_userCreatableItems = impl__get_userCreatableItems;
epv->requestCreateItem = impl_requestCreateItem;
epv->upgradeFromVersion = impl_upgradeFromVersion;
+ epv->requestQuit = impl_requestQuit;
object_class->dispose = impl_dispose;
object_class->finalize = impl_finalize;
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index dd781a0db8..c9833815ac 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -21,6 +21,7 @@
#include <config.h>
+#include "eab-editor.h"
#include "e-contact-editor.h"
#include <string.h>
@@ -70,15 +71,6 @@
#include "e-contact-editor-fullname.h"
#include "e-contact-editor-marshal.h"
-/* Signal IDs */
-enum {
- CONTACT_ADDED,
- CONTACT_MODIFIED,
- CONTACT_DELETED,
- EDITOR_CLOSED,
- LAST_SIGNAL
-};
-
/* IM columns */
enum {
COLUMN_IM_ICON,
@@ -97,6 +89,13 @@ static void e_contact_editor_set_property (GObject *object, guint prop_id, const
static void e_contact_editor_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
static void e_contact_editor_dispose (GObject *object);
+static void e_contact_editor_raise (EABEditor *editor);
+static void e_contact_editor_show (EABEditor *editor);
+static void e_contact_editor_close (EABEditor *editor);
+static gboolean e_contact_editor_is_valid (EABEditor *editor);
+static gboolean e_contact_editor_is_changed (EABEditor *editor);
+static GtkWindow* e_contact_editor_get_window (EABEditor *editor);
+
static void _email_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor);
static void _phone_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor);
static void _address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor);
@@ -114,12 +113,9 @@ static void set_phone_field(EContactEditor *editor, GtkWidget *entry, const char
static void set_fields(EContactEditor *editor);
static void command_state_changed (EContactEditor *ce);
static void widget_changed (GtkWidget *widget, EContactEditor *editor);
-static void close_dialog (EContactEditor *ce);
static void enable_widget (GtkWidget *widget, gboolean enabled);
-static GtkObjectClass *parent_class = NULL;
-
-static guint contact_editor_signals[LAST_SIGNAL];
+static EABEditorClass *parent_class = NULL;
/* The arguments we take */
enum {
@@ -173,8 +169,6 @@ static EContactField addresses[] = {
E_CONTACT_ADDRESS_OTHER
};
-static GSList *all_contact_editors = NULL;
-
GType
e_contact_editor_get_type (void)
{
@@ -193,7 +187,7 @@ e_contact_editor_get_type (void)
(GInstanceInitFunc) e_contact_editor_init,
};
- contact_editor_type = g_type_register_static (GTK_TYPE_OBJECT, "EContactEditor", &contact_editor_info, 0);
+ contact_editor_type = g_type_register_static (EAB_TYPE_EDITOR, "EContactEditor", &contact_editor_info, 0);
}
return contact_editor_type;
@@ -202,101 +196,70 @@ e_contact_editor_get_type (void)
static void
e_contact_editor_class_init (EContactEditorClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_ref (GTK_TYPE_OBJECT);
-
- object_class->set_property = e_contact_editor_set_property;
- object_class->get_property = e_contact_editor_get_property;
- object_class->dispose = e_contact_editor_dispose;
-
- g_object_class_install_property (object_class, PROP_SOURCE_BOOK,
- g_param_spec_object ("source_book",
- _("Source Book"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_BOOK,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_TARGET_BOOK,
- g_param_spec_object ("target_book",
- _("Target Book"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_BOOK,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_CONTACT,
- g_param_spec_object ("contact",
- _("Contact"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_CONTACT,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_IS_NEW_CONTACT,
- g_param_spec_boolean ("is_new_contact",
- _("Is New Contact"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_WRITABLE_FIELDS,
- g_param_spec_object ("writable_fields",
- _("Writable Fields"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_LIST,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_EDITABLE,
- g_param_spec_boolean ("editable",
- _("Editable"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_CHANGED,
- g_param_spec_boolean ("changed",
- _("Changed"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- contact_editor_signals[CONTACT_ADDED] =
- g_signal_new ("contact_added",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EContactEditorClass, contact_added),
- NULL, NULL,
- e_contact_editor_marshal_NONE__INT_OBJECT,
- G_TYPE_NONE, 2,
- G_TYPE_INT, G_TYPE_OBJECT);
-
- contact_editor_signals[CONTACT_MODIFIED] =
- g_signal_new ("contact_modified",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EContactEditorClass, contact_modified),
- NULL, NULL,
- e_contact_editor_marshal_NONE__INT_OBJECT,
- G_TYPE_NONE, 2,
- G_TYPE_INT, G_TYPE_OBJECT);
-
- contact_editor_signals[CONTACT_DELETED] =
- g_signal_new ("contact_deleted",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EContactEditorClass, contact_deleted),
- NULL, NULL,
- e_contact_editor_marshal_NONE__INT_OBJECT,
- G_TYPE_NONE, 2,
- G_TYPE_INT, G_TYPE_OBJECT);
-
- contact_editor_signals[EDITOR_CLOSED] =
- g_signal_new ("editor_closed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EContactEditorClass, editor_closed),
- NULL, NULL,
- e_contact_editor_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ EABEditorClass *editor_class = EAB_EDITOR_CLASS (klass);
+
+ parent_class = g_type_class_ref (EAB_TYPE_EDITOR);
+
+ object_class->set_property = e_contact_editor_set_property;
+ object_class->get_property = e_contact_editor_get_property;
+ object_class->dispose = e_contact_editor_dispose;
+
+ editor_class->raise = e_contact_editor_raise;
+ editor_class->show = e_contact_editor_show;
+ editor_class->close = e_contact_editor_close;
+ editor_class->is_valid = e_contact_editor_is_valid;
+ editor_class->is_changed = e_contact_editor_is_changed;
+ editor_class->get_window = e_contact_editor_get_window;
+
+ g_object_class_install_property (object_class, PROP_SOURCE_BOOK,
+ g_param_spec_object ("source_book",
+ _("Source Book"),
+ /*_( */"XXX blurb" /*)*/,
+ E_TYPE_BOOK,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_TARGET_BOOK,
+ g_param_spec_object ("target_book",
+ _("Target Book"),
+ /*_( */"XXX blurb" /*)*/,
+ E_TYPE_BOOK,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_CONTACT,
+ g_param_spec_object ("contact",
+ _("Contact"),
+ /*_( */"XXX blurb" /*)*/,
+ E_TYPE_CONTACT,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_IS_NEW_CONTACT,
+ g_param_spec_boolean ("is_new_contact",
+ _("Is New Contact"),
+ /*_( */"XXX blurb" /*)*/,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_WRITABLE_FIELDS,
+ g_param_spec_object ("writable_fields",
+ _("Writable Fields"),
+ /*_( */"XXX blurb" /*)*/,
+ E_TYPE_LIST,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_EDITABLE,
+ g_param_spec_boolean ("editable",
+ _("Editable"),
+ /*_( */"XXX blurb" /*)*/,
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_CHANGED,
+ g_param_spec_boolean ("changed",
+ _("Changed"),
+ /*_( */"XXX blurb" /*)*/,
+ FALSE,
+ G_PARAM_READWRITE));
}
static void
@@ -1544,13 +1507,12 @@ contact_moved_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs)
e_contact_set (ce->contact, E_CONTACT_UID, ecs->new_id);
- g_signal_emit (ce, contact_editor_signals[CONTACT_DELETED], 0,
- status, ce->contact);
+ eab_editor_contact_deleted (EAB_EDITOR (ce), status, ce->contact);
ce->is_new_contact = FALSE;
if (should_close) {
- close_dialog (ce);
+ eab_editor_close (EAB_EDITOR (ce));
}
else {
ce->changed = FALSE;
@@ -1586,14 +1548,13 @@ contact_added_cb (EBook *book, EBookStatus status, const char *id, EditorCloseSt
e_contact_set (ce->contact, E_CONTACT_UID, (char *) id);
- g_signal_emit (ce, contact_editor_signals[CONTACT_ADDED], 0,
- status, ce->contact);
+ eab_editor_contact_added (EAB_EDITOR (ce), status, ce->contact);
if (status == E_BOOK_ERROR_OK) {
ce->is_new_contact = FALSE;
if (should_close) {
- close_dialog (ce);
+ eab_editor_close (EAB_EDITOR (ce));
}
else {
ce->changed = FALSE;
@@ -1614,12 +1575,11 @@ contact_modified_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs)
gtk_widget_set_sensitive (ce->app, TRUE);
ce->in_async_call = FALSE;
- g_signal_emit (ce, contact_editor_signals[CONTACT_MODIFIED], 0,
- status, ce->contact);
+ eab_editor_contact_modified (EAB_EDITOR (ce), status, ce->contact);
if (status == E_BOOK_ERROR_OK) {
if (should_close) {
- close_dialog (ce);
+ eab_editor_close (EAB_EDITOR (ce));
}
else {
ce->changed = FALSE;
@@ -1665,33 +1625,37 @@ save_contact (EContactEditor *ce, gboolean should_close)
/* Closes the dialog box and emits the appropriate signals */
static void
-close_dialog (EContactEditor *ce)
+e_contact_editor_close (EABEditor *editor)
{
+ EContactEditor *ce = E_CONTACT_EDITOR (editor);
+
if (ce->app != NULL) {
gtk_widget_destroy (ce->app);
ce->app = NULL;
- g_signal_emit (ce, contact_editor_signals[EDITOR_CLOSED], 0);
+ eab_editor_closed (editor);
}
}
static gboolean
-prompt_to_save_changes (EContactEditor *editor)
+e_contact_editor_is_valid (EABEditor *editor)
{
- if (!editor->changed)
- return TRUE;
+ /* insert checks here (date format, for instance, etc.) */
+ return TRUE;
+}
- switch (eab_prompt_save_dialog (GTK_WINDOW(editor->app))) {
- case GTK_RESPONSE_YES:
- save_contact (editor, FALSE);
- return TRUE;
- case GTK_RESPONSE_NO:
- return TRUE;
- case GTK_RESPONSE_CANCEL:
- default:
- return FALSE;
- }
+static gboolean
+e_contact_editor_is_changed (EABEditor *editor)
+{
+ return E_CONTACT_EDITOR (editor)->changed;
+}
+
+static GtkWindow*
+e_contact_editor_get_window (EABEditor *editor)
+{
+ return GTK_WINDOW (E_CONTACT_EDITOR (editor)->app);
}
+
/* Menu callbacks */
/* File/Save callback */
@@ -1711,10 +1675,10 @@ file_close_cb (GtkWidget *widget, gpointer data)
EContactEditor *ce;
ce = E_CONTACT_EDITOR (data);
- if (!prompt_to_save_changes (ce))
+ if (!eab_editor_prompt_to_save_changes (EAB_EDITOR (ce), GTK_WINDOW (ce->app)))
return;
- close_dialog (ce);
+ eab_editor_close (EAB_EDITOR (ce));
}
static void
@@ -1755,49 +1719,17 @@ file_send_to_cb (GtkWidget *widget, gpointer data)
eab_send_contact(ce->contact, EAB_DISPOSITION_AS_TO);
}
-gboolean
-e_contact_editor_confirm_delete (GtkWindow *parent)
-{
- GtkWidget *dialog;
- gint result;
-
- dialog = gtk_message_dialog_new (parent,
- 0,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_NONE,
-#if notyet
- /* XXX we really need to handle the plural case here.. */
- (plural
- ? _("Are you sure you want\n"
- "to delete these contacts?"))
-#endif
- _("Are you sure you want\n"
- "to delete this contact?"));
-
- 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);
-}
-
static void
contact_deleted_cb (EBook *book, EBookStatus status, EContactEditor *ce)
{
gtk_widget_set_sensitive (ce->app, TRUE);
ce->in_async_call = FALSE;
- g_signal_emit (ce, contact_editor_signals[CONTACT_DELETED], 0,
- status, ce->contact);
+ eab_editor_contact_deleted (EAB_EDITOR (ce), status, ce->contact);
/* always close the dialog after we successfully delete a card */
if (status == E_BOOK_ERROR_OK)
- close_dialog (ce);
+ eab_editor_close (EAB_EDITOR (ce));
}
static void
@@ -1808,7 +1740,7 @@ delete_cb (GtkWidget *widget, gpointer data)
g_object_ref(contact);
- if (e_contact_editor_confirm_delete(GTK_WINDOW(ce->app))) {
+ if (eab_editor_confirm_delete(GTK_WINDOW(ce->app))) {
extract_info (ce);
@@ -1920,10 +1852,10 @@ app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
if (ce->in_async_call)
return TRUE;
- if (!prompt_to_save_changes (ce))
+ if (!eab_editor_prompt_to_save_changes (EAB_EDITOR (ce), GTK_WINDOW (ce->app)))
return TRUE;
- close_dialog (ce);
+ eab_editor_close (EAB_EDITOR (ce));
return TRUE;
}
@@ -2111,7 +2043,8 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
}
void
-e_contact_editor_dispose (GObject *object) {
+e_contact_editor_dispose (GObject *object)
+{
EContactEditor *e_contact_editor = E_CONTACT_EDITOR(object);
if (e_contact_editor->writable_fields) {
@@ -2191,6 +2124,9 @@ e_contact_editor_dispose (GObject *object) {
}
cancel_load (e_contact_editor);
+
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ (* G_OBJECT_CLASS (parent_class)->dispose) (object);
}
static void
@@ -2214,16 +2150,16 @@ static void
supported_fields_cb (EBook *book, EBookStatus status,
EList *fields, EContactEditor *ce)
{
- if (!g_slist_find (all_contact_editors, ce)) {
+ if (!g_slist_find ((GSList*)eab_editor_get_all_editors (), ce)) {
g_warning ("supported_fields_cb called for book that's still around, but contact editor that's been destroyed.");
return;
}
g_object_set (ce,
- "writable_fields", fields,
- NULL);
+ "writable_fields", fields,
+ NULL);
- e_contact_editor_show (ce);
+ eab_editor_show (EAB_EDITOR (ce));
command_state_changed (ce);
}
@@ -2232,9 +2168,7 @@ static void
contact_editor_destroy_notify (void *data,
GObject *where_the_object_was)
{
- EContactEditor *ce = E_CONTACT_EDITOR (data);
-
- all_contact_editors = g_slist_remove (all_contact_editors, ce);
+ eab_editor_remove (EAB_EDITOR (data));
}
EContactEditor *
@@ -2250,12 +2184,9 @@ e_contact_editor_new (EBook *book,
ce = g_object_new (E_TYPE_CONTACT_EDITOR, NULL);
- all_contact_editors = g_slist_prepend (all_contact_editors, ce);
+ eab_editor_add (EAB_EDITOR (ce));
g_object_weak_ref (G_OBJECT (ce), contact_editor_destroy_notify, ce);
- g_object_ref (ce);
- gtk_object_sink (GTK_OBJECT (ce));
-
g_object_set (ce,
"source_book", book,
"contact", contact,
@@ -2445,41 +2376,6 @@ e_contact_editor_get_property (GObject *object, guint prop_id, GValue *value, GP
}
}
-static void
-_popup_position(GtkMenu *menu,
- gint *x,
- gint *y,
- gboolean *push_in,
- gpointer data)
-{
- GtkWidget *button = GTK_WIDGET(data);
- GtkRequisition request;
- int mh, mw;
- gdk_window_get_origin (button->window, x, y);
- *x += button->allocation.x;
- *y += button->allocation.y;
-
- gtk_widget_size_request(GTK_WIDGET(menu), &request);
-
- mh = request.height;
- mw = request.width;
-
- *x -= mw;
- if (*x < 0)
- *x = 0;
-
- if (*y < 0)
- *y = 0;
-
- if ((*x + mw) > gdk_screen_width ())
- *x = gdk_screen_width () - mw;
-
- if ((*y + mh) > gdk_screen_height ())
- *y = gdk_screen_height () - mh;
-
- *push_in = FALSE;
-}
-
static gint
_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor, GtkWidget *popup, GList **list, GnomeUIInfo **info, gchar *label)
{
@@ -2827,7 +2723,7 @@ set_fields(EContactEditor *editor)
}
}
if (i == G_N_ELEMENTS (addresses))
- i = addresses[0];
+ i = 0;
label_widget = glade_xml_get_widget(editor->gui, "label-address");
if (label_widget && GTK_IS_LABEL(label_widget)) {
@@ -3471,12 +3367,13 @@ extract_info(EContactEditor *editor)
*
* Raises the dialog associated with this %EContactEditor object.
*/
-void
-e_contact_editor_raise (EContactEditor *editor)
+static void
+e_contact_editor_raise (EABEditor *editor)
{
- /* FIXME: perhaps we should raise at realize time */
- if (GTK_WIDGET (editor->app)->window)
- gdk_window_raise (GTK_WIDGET (editor->app)->window);
+ EContactEditor *ce = E_CONTACT_EDITOR (editor);
+
+ if (GTK_WIDGET (ce->app)->window)
+ gdk_window_raise (GTK_WIDGET (ce->app)->window);
}
/**
@@ -3485,9 +3382,10 @@ e_contact_editor_raise (EContactEditor *editor)
*
* Shows the dialog associated with this %EContactEditor object.
*/
-void
-e_contact_editor_show (EContactEditor *ce)
+static void
+e_contact_editor_show (EABEditor *editor)
{
+ EContactEditor *ce = E_CONTACT_EDITOR (editor);
gtk_widget_show (ce->app);
}
@@ -3576,27 +3474,3 @@ enable_widget (GtkWidget *widget, gboolean enabled)
else
gtk_widget_set_sensitive (widget, enabled);
}
-
-
-gboolean
-e_contact_editor_request_close_all (void)
-{
- GSList *p;
- GSList *pnext;
- gboolean retval;
-
- retval = TRUE;
- for (p = all_contact_editors; p != NULL; p = pnext) {
- pnext = p->next;
-
- e_contact_editor_raise (E_CONTACT_EDITOR (p->data));
- if (! prompt_to_save_changes (E_CONTACT_EDITOR (p->data))) {
- retval = FALSE;
- break;
- }
-
- close_dialog (E_CONTACT_EDITOR (p->data));
- }
-
- return retval;
-}
diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h
index 220e2cf421..10d2567cba 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.h
+++ b/addressbook/gui/contact-editor/e-contact-editor.h
@@ -25,6 +25,8 @@
#include <bonobo/bonobo-ui-component.h>
#include <glade/glade.h>
+#include "addressbook/gui/contact-editor/eab-editor.h"
+
#include <libebook/e-book-async.h>
#include <libebook/e-contact.h>
@@ -54,7 +56,7 @@ typedef struct _EContactEditorClass EContactEditorClass;
struct _EContactEditor
{
- GtkObject object;
+ EABEditor object;
/* item specific fields */
EBook *source_book;
@@ -119,14 +121,7 @@ struct _EContactEditor
struct _EContactEditorClass
{
- GtkObjectClass parent_class;
-
- /* Notification signals */
-
- void (* contact_added) (EContactEditor *ce, EBookStatus status, EContact *contact);
- void (* contact_modified) (EContactEditor *ce, EBookStatus status, EContact *contact);
- void (* contact_deleted) (EContactEditor *ce, EBookStatus status, EContact *contact);
- void (* editor_closed) (EContactEditor *ce);
+ EABEditorClass parent_class;
};
EContactEditor *e_contact_editor_new (EBook *book,
@@ -135,14 +130,6 @@ EContactEditor *e_contact_editor_new (EBook *book,
gboolean editable);
GType e_contact_editor_get_type (void);
-void e_contact_editor_show (EContactEditor *editor);
-void e_contact_editor_close (EContactEditor *editor);
-void e_contact_editor_raise (EContactEditor *editor);
-
-gboolean e_contact_editor_confirm_delete (GtkWindow *parent);
-
-gboolean e_contact_editor_request_close_all (void);
-
G_END_DECLS
#endif /* __E_CONTACT_EDITOR_H__ */
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index 84b6a769ea..3b37240b5b 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -9,7 +9,7 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
@@ -38,29 +38,27 @@
#include "addressbook/gui/widgets/eab-gui-util.h"
#include "addressbook/util/eab-book-util.h"
+#include "eab-editor.h"
#include "e-contact-editor.h"
#include "e-contact-list-model.h"
#include "e-contact-list-editor-marshal.h"
-/* Signal IDs */
-enum {
- LIST_ADDED,
- LIST_MODIFIED,
- LIST_DELETED,
- EDITOR_CLOSED,
- LAST_SIGNAL
-};
-
static void e_contact_list_editor_init (EContactListEditor *editor);
static void e_contact_list_editor_class_init (EContactListEditorClass *klass);
static void e_contact_list_editor_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void e_contact_list_editor_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
static void e_contact_list_editor_dispose (GObject *object);
+static void e_contact_list_editor_show (EABEditor *editor);
+static void e_contact_list_editor_raise (EABEditor *editor);
+static void e_contact_list_editor_close (EABEditor *editor);
+static gboolean e_contact_list_editor_is_valid (EABEditor *editor);
+static gboolean e_contact_list_editor_is_changed (EABEditor *editor);
+static GtkWindow* e_contact_list_editor_get_window (EABEditor *editor);
+
static void create_ui (EContactListEditor *ce);
static void set_editable (EContactListEditor *editor);
static void command_state_changed (EContactListEditor *editor);
-static void close_dialog (EContactListEditor *cle);
static void extract_info(EContactListEditor *editor);
static void fill_in_info(EContactListEditor *editor);
@@ -81,9 +79,7 @@ static void table_drag_data_received_cb (ETable *table, int row, int col,
GtkSelectionData *selection_data, guint info, guint time,
EContactListEditor *editor);
-static GtkObjectClass *parent_class = NULL;
-
-static guint contact_list_editor_signals[LAST_SIGNAL];
+static EABEditorClass *parent_class = NULL;
enum DndTargetType {
DND_TARGET_TYPE_VCARD,
@@ -104,8 +100,6 @@ enum {
PROP_EDITABLE
};
-static GSList *all_contact_list_editors = NULL;
-
GType
e_contact_list_editor_get_type (void)
{
@@ -124,7 +118,7 @@ e_contact_list_editor_get_type (void)
(GInstanceInitFunc) e_contact_list_editor_init,
};
- cle_type = g_type_register_static (GTK_TYPE_OBJECT, "EContactListEditor", &cle_info, 0);
+ cle_type = g_type_register_static (EAB_TYPE_EDITOR, "EContactListEditor", &cle_info, 0);
}
return cle_type;
@@ -135,12 +129,20 @@ static void
e_contact_list_editor_class_init (EContactListEditorClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ EABEditorClass *editor_class = EAB_EDITOR_CLASS (klass);
+
+ parent_class = g_type_class_ref (EAB_TYPE_EDITOR);
- parent_class = g_type_class_ref (GTK_TYPE_OBJECT);
+ editor_class->show = e_contact_list_editor_show;
+ editor_class->raise = e_contact_list_editor_raise;
+ editor_class->close = e_contact_list_editor_close;
+ editor_class->is_valid = e_contact_list_editor_is_valid;
+ editor_class->is_changed = e_contact_list_editor_is_changed;
+ editor_class->get_window = e_contact_list_editor_get_window;
object_class->set_property = e_contact_list_editor_set_property;
object_class->get_property = e_contact_list_editor_get_property;
- /* object_class->dispose = e_contact_list_editor_dispose;*/
+ object_class->dispose = e_contact_list_editor_dispose;
g_object_class_install_property (object_class, PROP_BOOK,
g_param_spec_object ("book",
@@ -169,45 +171,6 @@ e_contact_list_editor_class_init (EContactListEditorClass *klass)
/*_( */"XXX blurb" /*)*/,
FALSE,
G_PARAM_READWRITE));
-
- contact_list_editor_signals[LIST_ADDED] =
- g_signal_new ("list_added",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EContactListEditorClass, list_added),
- NULL, NULL,
- e_contact_list_editor_marshal_NONE__INT_OBJECT,
- G_TYPE_NONE, 2,
- G_TYPE_INT, G_TYPE_OBJECT);
-
- contact_list_editor_signals[LIST_MODIFIED] =
- g_signal_new ("list_modified",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EContactListEditorClass, list_modified),
- NULL, NULL,
- e_contact_list_editor_marshal_NONE__INT_OBJECT,
- G_TYPE_NONE, 2,
- G_TYPE_INT, G_TYPE_OBJECT);
-
- contact_list_editor_signals[LIST_DELETED] =
- g_signal_new ("list_deleted",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EContactListEditorClass, list_deleted),
- NULL, NULL,
- e_contact_list_editor_marshal_NONE__INT_OBJECT,
- G_TYPE_NONE, 2,
- G_TYPE_INT, G_TYPE_OBJECT);
-
- contact_list_editor_signals[EDITOR_CLOSED] =
- g_signal_new ("editor_closed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EContactListEditorClass, editor_closed),
- NULL, NULL,
- e_contact_list_editor_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
}
static void
@@ -341,14 +304,13 @@ list_added_cb (EBook *book, EBookStatus status, const char *id, EditorCloseStruc
e_contact_set (cle->contact, E_CONTACT_UID, (char*)id);
- g_signal_emit (cle, contact_list_editor_signals[LIST_ADDED], 0,
- status, cle->contact);
+ eab_editor_contact_added (EAB_EDITOR (cle), status, cle->contact);
if (status == E_BOOK_ERROR_OK) {
cle->is_new_list = FALSE;
if (should_close)
- close_dialog (cle);
+ eab_editor_close (EAB_EDITOR (cle));
else
command_state_changed (cle);
}
@@ -367,12 +329,11 @@ list_modified_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs)
gtk_widget_set_sensitive (cle->app, TRUE);
cle->in_async_call = FALSE;
- g_signal_emit (cle, contact_list_editor_signals[LIST_MODIFIED], 0,
- status, cle->contact);
+ eab_editor_contact_modified (EAB_EDITOR (cle), status, cle->contact);
if (status == E_BOOK_ERROR_OK) {
if (should_close)
- close_dialog (cle);
+ eab_editor_close (EAB_EDITOR (cle));
}
g_object_unref (cle); /* release ref held for ebook callback */
@@ -420,21 +381,25 @@ is_named (EContactListEditor *editor)
}
static gboolean
-prompt_to_save_changes (EContactListEditor *editor)
+e_contact_list_editor_is_valid (EABEditor *editor)
{
- if (!editor->changed || !is_named (editor))
- return TRUE;
+ EContactListEditor *cle = E_CONTACT_LIST_EDITOR (editor);
- switch (eab_prompt_save_dialog (GTK_WINDOW(editor->app))) {
- case GTK_RESPONSE_YES:
- save_contact (editor, FALSE);
- return TRUE;
- case GTK_RESPONSE_NO:
- return TRUE;
- case GTK_RESPONSE_CANCEL:
- default:
- return FALSE;
- }
+ return is_named (cle);
+}
+
+static gboolean
+e_contact_list_editor_is_changed (EABEditor *editor)
+{
+ EContactListEditor *cle = E_CONTACT_LIST_EDITOR (editor);
+
+ return cle->changed;
+}
+
+static GtkWindow*
+e_contact_list_editor_get_window (EABEditor *editor)
+{
+ return GTK_WINDOW (E_CONTACT_LIST_EDITOR (editor)->app);
}
static void
@@ -442,10 +407,10 @@ file_close_cb (GtkWidget *widget, gpointer data)
{
EContactListEditor *cle = E_CONTACT_LIST_EDITOR (data);
- if (!prompt_to_save_changes (cle))
+ if (!eab_editor_prompt_to_save_changes (EAB_EDITOR (cle), GTK_WINDOW (cle->app)))
return;
- close_dialog (cle);
+ eab_editor_close (EAB_EDITOR (cle));
}
static void
@@ -500,12 +465,11 @@ list_deleted_cb (EBook *book, EBookStatus status, EContactListEditor *cle)
gtk_widget_set_sensitive (cle->app, TRUE);
cle->in_async_call = FALSE;
- g_signal_emit (cle, contact_list_editor_signals[LIST_DELETED], 0,
- status, cle->contact);
+ eab_editor_contact_deleted (EAB_EDITOR (cle), status, cle->contact);
/* always close the dialog after we successfully delete a list */
if (status == E_BOOK_ERROR_OK)
- close_dialog (cle);
+ eab_editor_close (EAB_EDITOR (cle));
g_object_unref (cle); /* release reference held for callback */
}
@@ -518,7 +482,7 @@ delete_cb (GtkWidget *widget, gpointer data)
g_object_ref (contact);
- if (e_contact_editor_confirm_delete(GTK_WINDOW(cle->app))) {
+ if (eab_editor_confirm_delete (GTK_WINDOW(cle->app))) {
extract_info (cle);
@@ -580,9 +544,7 @@ static void
contact_list_editor_destroy_notify (gpointer data,
GObject *where_the_object_was)
{
- EContactListEditor *ce = E_CONTACT_LIST_EDITOR (data);
-
- all_contact_list_editors = g_slist_remove (all_contact_list_editors, ce);
+ eab_editor_remove (EAB_EDITOR (data));
}
EContactListEditor *
@@ -593,12 +555,9 @@ e_contact_list_editor_new (EBook *book,
{
EContactListEditor *ce = g_object_new (E_TYPE_CONTACT_LIST_EDITOR, NULL);
- all_contact_list_editors = g_slist_prepend (all_contact_list_editors, ce);
+ eab_editor_add (EAB_EDITOR (ce));
g_object_weak_ref (G_OBJECT (ce), contact_list_editor_destroy_notify, ce);
- g_object_ref (ce);
- gtk_object_sink (GTK_OBJECT (ce));
-
g_object_set (ce,
"book", book,
"contact", list_contact,
@@ -692,16 +651,30 @@ e_contact_list_editor_get_property (GObject *object, guint prop_id,
}
}
-void
-e_contact_list_editor_show (EContactListEditor *editor)
+static void
+e_contact_list_editor_show (EABEditor *editor)
+{
+ EContactListEditor *cle = E_CONTACT_LIST_EDITOR (editor);
+ gtk_widget_show (cle->app);
+}
+
+static void
+e_contact_list_editor_raise (EABEditor *editor)
{
- gtk_widget_show (editor->app);
+ EContactListEditor *cle = E_CONTACT_LIST_EDITOR (editor);
+ gdk_window_raise (GTK_WIDGET (cle->app)->window);
}
-void
-e_contact_list_editor_raise (EContactListEditor *editor)
+static void
+e_contact_list_editor_close (EABEditor *editor)
{
- gdk_window_raise (GTK_WIDGET (editor->app)->window);
+ EContactListEditor *cle = E_CONTACT_LIST_EDITOR (editor);
+ g_assert (cle->app != NULL);
+
+ gtk_widget_destroy (cle->app);
+ cle->app = NULL;
+
+ eab_editor_closed (EAB_EDITOR (cle));
}
GtkWidget *
@@ -798,18 +771,6 @@ set_editable (EContactListEditor *editor)
gtk_widget_set_sensitive (editor->table, editor->editable);
}
-/* Closes the dialog box and emits the appropriate signals */
-static void
-close_dialog (EContactListEditor *cle)
-{
- g_assert (cle->app != NULL);
-
- gtk_widget_destroy (cle->app);
- cle->app = NULL;
-
- g_signal_emit (cle, contact_list_editor_signals[EDITOR_CLOSED], 0);
-}
-
/* Callback used when the editor is destroyed */
static gint
app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
@@ -822,10 +783,10 @@ app_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
if (ce->in_async_call)
return TRUE;
- if (!prompt_to_save_changes (ce))
+ if (!eab_editor_prompt_to_save_changes (EAB_EDITOR (ce), GTK_WINDOW (ce->app)))
return TRUE;
- close_dialog (ce);
+ eab_editor_close (EAB_EDITOR (ce));
return TRUE;
}
@@ -918,17 +879,17 @@ table_drag_data_received_cb (ETable *table, int row, int col,
static void
command_state_changed (EContactListEditor *editor)
{
- gboolean named = is_named (editor);
+ gboolean valid = eab_editor_is_valid (EAB_EDITOR (editor));
bonobo_ui_component_set_prop (editor->uic,
"/commands/ContactListEditorSaveClose",
"sensitive",
- editor->changed && named && editor->editable ? "1" : "0", NULL);
+ editor->changed && valid && editor->editable ? "1" : "0", NULL);
bonobo_ui_component_set_prop (editor->uic,
"/commands/ContactListEditorSave",
"sensitive",
- editor->changed && named && editor->editable ? "1" : "0", NULL);
+ editor->changed && valid && editor->editable ? "1" : "0", NULL);
bonobo_ui_component_set_prop (editor->uic,
"/commands/ContactListEditorDelete",
@@ -1039,27 +1000,3 @@ fill_in_info(EContactListEditor *editor)
}
}
}
-
-
-gboolean
-e_contact_list_editor_request_close_all (void)
-{
- GSList *p;
- GSList *pnext;
- gboolean retval;
-
- retval = TRUE;
- for (p = all_contact_list_editors; p != NULL; p = pnext) {
- pnext = p->next;
-
- e_contact_list_editor_raise (E_CONTACT_LIST_EDITOR (p->data));
- if (! prompt_to_save_changes (E_CONTACT_LIST_EDITOR (p->data))) {
- retval = FALSE;
- break;
- }
-
- close_dialog (E_CONTACT_LIST_EDITOR (p->data));
- }
-
- return retval;
-}
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.h b/addressbook/gui/contact-list-editor/e-contact-list-editor.h
index 574f9a5b55..3272cf39f0 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.h
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.h
@@ -26,6 +26,8 @@
#include <glade/glade.h>
#include <gal/e-table/e-table-model.h>
+#include "addressbook/gui/contact-editor/eab-editor.h"
+
#include <libebook/e-book-async.h>
#include <libebook/e-contact.h>
@@ -43,7 +45,7 @@ typedef struct _EContactListEditorClass EContactListEditorClass;
struct _EContactListEditor
{
- GtkObject object;
+ EABEditor parent;
/* item specific fields */
EBook *book;
@@ -83,14 +85,7 @@ struct _EContactListEditor
struct _EContactListEditorClass
{
- GtkObjectClass parent_class;
-
- /* Notification signals */
-
- void (* list_added) (EContactListEditor *cle, EBookStatus status, EContact *contact);
- void (* list_modified) (EContactListEditor *cle, EBookStatus status, EContact *contact);
- void (* list_deleted) (EContactListEditor *cle, EBookStatus status, EContact *contact);
- void (* editor_closed) (EContactListEditor *cle);
+ EABEditorClass parent_class;
};
EContactListEditor *e_contact_list_editor_new (EBook *book,
@@ -98,10 +93,6 @@ EContactListEditor *e_contact_list_editor_new (EBook *book,
gboolean is_new_list,
gboolean editable);
GType e_contact_list_editor_get_type (void);
-void e_contact_list_editor_show (EContactListEditor *editor);
-void e_contact_list_editor_raise (EContactListEditor *editor);
-
-gboolean e_contact_list_editor_confirm_delete (GtkWindow *parent);
gboolean e_contact_list_editor_request_close_all (void);
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 2521638cca..963f1389b1 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -911,7 +911,7 @@ cut (GtkWidget *widget, ContactAndBook *contact_and_book)
static void
delete (GtkWidget *widget, ContactAndBook *contact_and_book)
{
- if (e_contact_editor_confirm_delete(GTK_WINDOW(gtk_widget_get_toplevel(contact_and_book->view->widget)))) {
+ if (eab_editor_confirm_delete(GTK_WINDOW(gtk_widget_get_toplevel(contact_and_book->view->widget)))) {
EBook *book;
GList *list = get_contact_list(contact_and_book);
GList *iterator;
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c
index 7e831090a6..c587d9764e 100644
--- a/addressbook/gui/widgets/e-minicard.c
+++ b/addressbook/gui/widgets/e-minicard.c
@@ -602,10 +602,7 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event)
case GDK_2BUTTON_PRESS:
if (event->button.button == 1 && E_IS_MINICARD_VIEW(item->parent)) {
if (e_minicard->editor) {
- if (GPOINTER_TO_INT (e_contact_get (e_minicard->contact, E_CONTACT_IS_LIST)))
- e_contact_list_editor_raise (E_CONTACT_LIST_EDITOR(e_minicard->editor));
- else
- e_contact_editor_raise(E_CONTACT_EDITOR(e_minicard->editor));
+ eab_editor_raise (e_minicard->editor);
} else {
EBook *book = NULL;
if (E_IS_MINICARD_VIEW(item->parent)) {
@@ -618,12 +615,12 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event)
if (e_contact_get (e_minicard->contact, E_CONTACT_IS_LIST)) {
EContactListEditor *editor = eab_show_contact_list_editor (book, e_minicard->contact,
FALSE, e_minicard->editable);
- e_minicard->editor = G_OBJECT (editor);
+ e_minicard->editor = EAB_EDITOR (editor);
}
else {
EContactEditor *editor = eab_show_contact_editor (book, e_minicard->contact,
FALSE, e_minicard->editable);
- e_minicard->editor = G_OBJECT (editor);
+ e_minicard->editor = EAB_EDITOR (editor);
}
g_object_ref (e_minicard->editor);
diff --git a/addressbook/gui/widgets/e-minicard.h b/addressbook/gui/widgets/e-minicard.h
index 8fbb2b7a01..dd6ab33199 100644
--- a/addressbook/gui/widgets/e-minicard.h
+++ b/addressbook/gui/widgets/e-minicard.h
@@ -21,7 +21,7 @@
#define __E_MINICARD_H__
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include "addressbook/gui/contact-editor/e-contact-editor.h"
+#include "addressbook/gui/contact-editor/eab-editor.h"
#include <libgnomecanvas/gnome-canvas.h>
#include <libebook/e-contact.h>
@@ -72,7 +72,7 @@ struct _EMinicard
GdkPixbuf *list_icon_pixbuf;
double list_icon_size;
- GObject *editor;
+ EABEditor *editor;
GList *fields; /* Of type EMinicardField */
guint needs_remodeling : 1;
diff --git a/addressbook/gui/widgets/eab-gui-util.c b/addressbook/gui/widgets/eab-gui-util.c
index 7c9e540cbe..6dd72d9325 100644
--- a/addressbook/gui/widgets/eab-gui-util.c
+++ b/addressbook/gui/widgets/eab-gui-util.c
@@ -35,6 +35,7 @@
#include <gnome.h>
+#include "addressbook/gui/contact-editor/eab-editor.h"
#include "addressbook/gui/contact-editor/e-contact-editor.h"
#include "addressbook/gui/contact-list-editor/e-contact-list-editor.h"
#include "addressbook/gui/component/addressbook-component.h"
@@ -163,16 +164,16 @@ eab_show_contact_list_editor (EBook *book, EContact *contact,
ce = e_contact_list_editor_new (book, contact, is_new_contact, editable);
- g_signal_connect (ce, "list_added",
+ g_signal_connect (ce, "contact_added",
G_CALLBACK (added_cb), GINT_TO_POINTER (TRUE));
- g_signal_connect (ce, "list_modified",
+ g_signal_connect (ce, "contact_modified",
G_CALLBACK (modified_cb), GINT_TO_POINTER (TRUE));
- g_signal_connect (ce, "list_deleted",
+ g_signal_connect (ce, "contact_deleted",
G_CALLBACK (deleted_cb), GINT_TO_POINTER (TRUE));
g_signal_connect (ce, "editor_closed",
G_CALLBACK (editor_closed_cb), GINT_TO_POINTER (TRUE));
- e_contact_list_editor_show (ce);
+ eab_editor_show (EAB_EDITOR (ce));
return ce;
}
diff --git a/addressbook/gui/widgets/eab-popup-control.c b/addressbook/gui/widgets/eab-popup-control.c
index b7c635b089..943803ef47 100644
--- a/addressbook/gui/widgets/eab-popup-control.c
+++ b/addressbook/gui/widgets/eab-popup-control.c
@@ -933,10 +933,9 @@ contact_editor_cb (EBook *book, EBookStatus status, gpointer closure)
{
if (status == E_BOOK_ERROR_OK) {
EABPopupControl *pop = EAB_POPUP_CONTROL (closure);
- EContactEditor *ce = eab_show_contact_editor (book, pop->contact, FALSE, TRUE);
+ eab_show_contact_editor (book, pop->contact, FALSE, TRUE);
eab_popup_control_cleanup (pop);
emit_event (pop, "Destroy");
- e_contact_editor_raise (ce);
}
if (book)