diff options
author | Chris Toshok <toshok@ximian.com> | 2004-03-25 04:18:49 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2004-03-25 04:18:49 +0800 |
commit | 7f5228bdbad17fddedaddc4714a52b5601cb0769 (patch) | |
tree | 036bc242b90ca17ad33a850bb45e009fb4c339f7 /addressbook/gui/contact-editor | |
parent | 5b496f26137ee1d0920a94e7c19926d6584cd624 (diff) | |
download | gsoc2013-evolution-7f5228bdbad17fddedaddc4714a52b5601cb0769.tar gsoc2013-evolution-7f5228bdbad17fddedaddc4714a52b5601cb0769.tar.gz gsoc2013-evolution-7f5228bdbad17fddedaddc4714a52b5601cb0769.tar.bz2 gsoc2013-evolution-7f5228bdbad17fddedaddc4714a52b5601cb0769.tar.lz gsoc2013-evolution-7f5228bdbad17fddedaddc4714a52b5601cb0769.tar.xz gsoc2013-evolution-7f5228bdbad17fddedaddc4714a52b5601cb0769.tar.zst gsoc2013-evolution-7f5228bdbad17fddedaddc4714a52b5601cb0769.zip |
parent_type == EAB_TYPE_EDITOR. (e_contact_list_editor_class_init): fill
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.
svn path=/trunk/; revision=25173
Diffstat (limited to 'addressbook/gui/contact-editor')
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.c | 380 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.h | 21 |
2 files changed, 131 insertions, 270 deletions
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__ */ |