diff options
Diffstat (limited to 'addressbook/gui/contact-editor')
-rw-r--r-- | addressbook/gui/contact-editor/Makefile.am | 12 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.c | 67 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.h | 14 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-quick-add.c | 4 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/eab-editor.c | 47 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/eab-editor.h | 2 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/test-editor.c | 4 |
7 files changed, 78 insertions, 72 deletions
diff --git a/addressbook/gui/contact-editor/Makefile.am b/addressbook/gui/contact-editor/Makefile.am index 0b2ec028f5..8dd4cd9180 100644 --- a/addressbook/gui/contact-editor/Makefile.am +++ b/addressbook/gui/contact-editor/Makefile.am @@ -29,10 +29,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 c3a73fbcd5..e4447b9075 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,18 +40,17 @@ #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" -#include "e-util/e-gui-utils.h" #include "e-util/e-error.h" #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" @@ -200,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) { @@ -243,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", @@ -3330,6 +3380,7 @@ static void e_contact_editor_init (EContactEditor *e_contact_editor) { GladeXML *gui; + EShell *shell; GtkWidget *widget, *label; GtkEntryCompletion *completion; char *gladefile; @@ -3407,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 @@ -3502,7 +3557,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, @@ -3528,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 diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h index 02b837fb46..d216fe0435 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.h +++ b/addressbook/gui/contact-editor/e-contact-editor.h @@ -23,7 +23,6 @@ #ifndef __E_CONTACT_EDITOR_H__ #define __E_CONTACT_EDITOR_H__ -#include <bonobo/bonobo-ui-component.h> #include <glade/glade.h> #include "addressbook/gui/contact-editor/eab-editor.h" @@ -63,9 +62,6 @@ struct _EContactEditor EBook *target_book; EContact *contact; - /* UI handler */ - BonoboUIComponent *uic; - GladeXML *gui; GtkWidget *app; @@ -111,11 +107,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 418bdbc1ae..d30559e34f 100644 --- a/addressbook/gui/contact-editor/e-contact-quick-add.c +++ b/addressbook/gui/contact-editor/e-contact-quick-add.c @@ -28,7 +28,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" @@ -194,7 +194,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 b94dff2953..d45fb688ea 100644 --- a/addressbook/gui/contact-editor/eab-editor.c +++ b/addressbook/gui/contact-editor/eab-editor.c @@ -28,8 +28,8 @@ #include <glib/gi18n.h> #include "eab-editor.h" -#include "addressbook/gui/widgets/eab-gui-util.h" #include "e-util/e-util.h" +#include "addressbook/gui/widgets/eab-gui-util.h" static void eab_editor_default_show (EABEditor *editor); static void eab_editor_default_raise (EABEditor *editor); @@ -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 ae13270fe0..4f108f509f 100644 --- a/addressbook/gui/contact-editor/eab-editor.h +++ b/addressbook/gui/contact-editor/eab-editor.h @@ -24,7 +24,6 @@ #ifndef __EAB_EDITOR_H__ #define __EAB_EDITOR_H__ -#include <bonobo/bonobo-ui-component.h> #include <glade/glade.h> #include <libebook/e-book.h> @@ -91,7 +90,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); diff --git a/addressbook/gui/contact-editor/test-editor.c b/addressbook/gui/contact-editor/test-editor.c index 44703c9e57..2f55e4777c 100644 --- a/addressbook/gui/contact-editor/test-editor.c +++ b/addressbook/gui/contact-editor/test-editor.c @@ -24,8 +24,6 @@ #include <stdlib.h> #include <gtk/gtk.h> -#include <libgnomeui/gnome-app.h> -#include <libgnomeui/gnome-ui-init.h> #include <glade/glade.h> #include "e-contact-editor.h" #include "ebook/e-card.h" @@ -97,7 +95,7 @@ int main( int argc, char *argv[] ) char *cardstr; EContactEditor *ce; - gnome_program_init("Contact Editor Test", VERSION, LIBGNOMEUI_MODULE, argc, argv, NULL); + gtk_init (&argc, &argv); glade_init (); |