From 51da89cf510f7fcbe80eecfb6c98beb0ccb4ff9c Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Fri, 29 Jun 2001 03:53:11 +0000 Subject: remove ancient e-table include, and add include for contact-editor so we 2001-06-28 Chris Toshok * gui/contact-list-editor/Makefile.am (INCLUDES): remove ancient e-table include, and add include for contact-editor so we can reuse the confirm_delete dialog. * gui/contact-list-editor/e-contact-list-editor.h (struct _EContactListEditor): remove prototype for e_contact_list_editor_close, since the function no longer exists. * gui/contact-list-editor/e-contact-list-editor.c (list_deleted_cb): new function, emit our "list_deleted" signal. (delete_cb): new function, called from the Delete toolbar item. (e_contact_list_editor_raise): flesh out function. (extract_info): "evolution_list" => "list". (fill_in_info): same. svn path=/trunk/; revision=10587 --- addressbook/ChangeLog | 17 ++++++++ addressbook/gui/contact-list-editor/Makefile.am | 2 +- .../contact-list-editor/e-contact-list-editor.c | 50 +++++++++++++++------- .../contact-list-editor/e-contact-list-editor.h | 1 - 4 files changed, 52 insertions(+), 18 deletions(-) (limited to 'addressbook') diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 5ca176dff7..a3739aecdb 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,20 @@ +2001-06-28 Chris Toshok + + * gui/contact-list-editor/Makefile.am (INCLUDES): remove ancient + e-table include, and add include for contact-editor so we can + reuse the confirm_delete dialog. + + * gui/contact-list-editor/e-contact-list-editor.h (struct + _EContactListEditor): remove prototype for + e_contact_list_editor_close, since the function no longer exists. + + * gui/contact-list-editor/e-contact-list-editor.c + (list_deleted_cb): new function, emit our "list_deleted" signal. + (delete_cb): new function, called from the Delete toolbar item. + (e_contact_list_editor_raise): flesh out function. + (extract_info): "evolution_list" => "list". + (fill_in_info): same. + 2001-06-28 Chris Toshok * backend/ebook/e-card.c (e_card_get_vobject): add support for diff --git a/addressbook/gui/contact-list-editor/Makefile.am b/addressbook/gui/contact-list-editor/Makefile.am index 5e6229a833..fb16b8e6e7 100644 --- a/addressbook/gui/contact-list-editor/Makefile.am +++ b/addressbook/gui/contact-list-editor/Makefile.am @@ -5,7 +5,7 @@ INCLUDES = \ -I$(top_srcdir)/addressbook/ \ -I$(top_srcdir)/addressbook/backend \ -I$(top_srcdir)/addressbook/gui/merging \ - -I$(top_srcdir)/widgets/e-table \ + -I$(top_srcdir)/addressbook/gui/contact-editor \ -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ -DDATADIR=\""$(datadir)"\" \ -DEVOLUTION_DATADIR=\""$(datadir)"\" \ 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 cd2710f022..bff82c2f2b 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c +++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c @@ -25,6 +25,7 @@ #include #include +#include "e-contact-editor.h" #include "e-contact-list-editor.h" #include "e-contact-list-model.h" @@ -350,7 +351,6 @@ save_card (EContactListEditor *cle, gboolean should_close) } } -/* File/Close callback */ static void file_close_cb (GtkWidget *widget, gpointer data) { @@ -374,15 +374,41 @@ tb_save_and_close_cb (GtkWidget *widget, gpointer data) save_card (cle, TRUE); } +static void +list_deleted_cb (EBook *book, EBookStatus status, EContactListEditor *cle) +{ + gtk_signal_emit (GTK_OBJECT (cle), contact_list_editor_signals[LIST_DELETED], + status, cle->card); +} + +static void +delete_cb (GtkWidget *widget, gpointer data) +{ + EContactListEditor *cle = E_CONTACT_LIST_EDITOR (data); + ECard *card = cle->card; + + gtk_object_ref(GTK_OBJECT(card)); + + if (e_contact_editor_confirm_delete(GTK_WINDOW(cle->app))) { + + extract_info (cle); + + if (!cle->is_new_list) + e_book_remove_card (cle->book, card, GTK_SIGNAL_FUNC(list_deleted_cb), cle); + } + + gtk_object_unref(GTK_OBJECT(card)); +} + static BonoboUIVerb verbs [] = { BONOBO_UI_UNSAFE_VERB ("ContactListEditorSave", file_save_cb), BONOBO_UI_UNSAFE_VERB ("ContactListEditorSaveClose", tb_save_and_close_cb), + BONOBO_UI_UNSAFE_VERB ("ContactListEditorDelete", delete_cb), #if 0 BONOBO_UI_UNSAFE_VERB ("ContactEditorSaveAs", file_save_as_cb), BONOBO_UI_UNSAFE_VERB ("ContactEditorSendAs", file_send_as_cb), BONOBO_UI_UNSAFE_VERB ("ContactEditorSendTo", file_send_to_cb), - BONOBO_UI_UNSAFE_VERB ("ContactEditorDelete", delete_cb), #endif BONOBO_UI_UNSAFE_VERB ("ContactListEditorClose", file_close_cb), BONOBO_UI_VERB_END @@ -440,6 +466,7 @@ e_contact_list_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) editor->card = e_card_duplicate(E_CARD(GTK_VALUE_OBJECT (*arg))); fill_in_info(editor); editor->changed = FALSE; + command_state_changed (editor); break; case ARG_IS_NEW_LIST: { @@ -505,14 +532,10 @@ e_contact_list_editor_show (EContactListEditor *editor) gtk_widget_show (editor->app); } -void -e_contact_list_editor_close (EContactListEditor *editor) -{ -} - void e_contact_list_editor_raise (EContactListEditor *editor) { + gdk_window_raise (GTK_WIDGET (editor->app)->window); } #define SPEC " \ @@ -732,8 +755,8 @@ extract_info(EContactListEditor *editor) gtk_object_set (GTK_OBJECT(card), - "evolution_list", GINT_TO_POINTER (TRUE), - "evolution_list_show_addresses", + "list", GINT_TO_POINTER (TRUE), + "list_show_addresses", GINT_TO_POINTER (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(editor->visible_addrs_checkbutton))), NULL); @@ -762,15 +785,10 @@ fill_in_info(EContactListEditor *editor) gtk_object_get (GTK_OBJECT (editor->card), "file_as", &file_as, "email", &email_list, - "evolution_list", &is_evolution_list, - "evolution_list_show_addresses", &show_addresses, + "list", &is_evolution_list, + "list_show_addresses", &show_addresses, NULL); - if (!editor->is_new_list && !is_evolution_list) { - g_warning ("Attempting to edit non-list card in the list editor.\n"); - return; - } - gtk_editable_delete_text (GTK_EDITABLE (editor->list_name_entry), 0, -1); if (file_as) { int position = 0; 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 4aba6668f8..6c67fc6468 100644 --- a/addressbook/gui/contact-list-editor/e-contact-list-editor.h +++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.h @@ -96,7 +96,6 @@ EContactListEditor *e_contact_list_editor_new (EBook *book, gboolean editable); GtkType e_contact_list_editor_get_type (void); void e_contact_list_editor_show (EContactListEditor *editor); -void e_contact_list_editor_close (EContactListEditor *editor); void e_contact_list_editor_raise (EContactListEditor *editor); gboolean e_contact_list_editor_confirm_delete (GtkWindow *parent); -- cgit v1.2.3