diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-07-14 03:22:42 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-07-14 03:22:42 +0800 |
commit | a5fc85f2f49c04d8b0344c8e967c2bf18856a46a (patch) | |
tree | 6fc8f6893ebefb2fbc5433bac058356860363d38 /addressbook/gui/contact-editor | |
parent | 906c46112c18cab409eeb06aaaf4616c24e026b5 (diff) | |
download | gsoc2013-evolution-a5fc85f2f49c04d8b0344c8e967c2bf18856a46a.tar gsoc2013-evolution-a5fc85f2f49c04d8b0344c8e967c2bf18856a46a.tar.gz gsoc2013-evolution-a5fc85f2f49c04d8b0344c8e967c2bf18856a46a.tar.bz2 gsoc2013-evolution-a5fc85f2f49c04d8b0344c8e967c2bf18856a46a.tar.lz gsoc2013-evolution-a5fc85f2f49c04d8b0344c8e967c2bf18856a46a.tar.xz gsoc2013-evolution-a5fc85f2f49c04d8b0344c8e967c2bf18856a46a.tar.zst gsoc2013-evolution-a5fc85f2f49c04d8b0344c8e967c2bf18856a46a.zip |
Switched the order of compilation of printing and contact-editor.
2000-07-13 Christopher James Lahey <clahey@helixcode.com>
* Makefile.am: Switched the order of compilation of printing and
contact-editor.
* contact-editor/Makefile.am: Added printing libraries and a
confirm delete dialog glade file.
* contact-editor/e-contact-editor.c,
contact-editor/e-contact-editor.h: Enabled the delete and print
functions as well as providing a confirm delete dialog to the
outside world.
* gui/component/addressbook.c: Made the delete button on new cards
active.
* gui/minicard/Makefile.am: Added printing libraries to a number
of test programs.
* gui/minicard/e-minicard.c: Added print and delete to the right
click menu. Made the delete button on the card editor active.
* printing/e-contact-print.c, printing/e-contact-print.h: Added a
function to print a single card.
svn path=/trunk/; revision=4151
Diffstat (limited to 'addressbook/gui/contact-editor')
-rw-r--r-- | addressbook/gui/contact-editor/Makefile.am | 7 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.c | 76 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.h | 4 |
3 files changed, 79 insertions, 8 deletions
diff --git a/addressbook/gui/contact-editor/Makefile.am b/addressbook/gui/contact-editor/Makefile.am index b487f96fe2..f51a0109ac 100644 --- a/addressbook/gui/contact-editor/Makefile.am +++ b/addressbook/gui/contact-editor/Makefile.am @@ -33,6 +33,7 @@ contact_editor_test_SOURCES = \ contact_editor_test_LDADD = \ libecontacteditor.a \ $(top_builddir)/e-util/libeutil.la \ + $(top_builddir)/addressbook/printing/libecontactprint.a \ $(top_builddir)/addressbook/backend/ebook/libebook.la \ $(top_builddir)/addressbook/ename/libename.la \ $(top_builddir)/libversit/libversit.la \ @@ -53,10 +54,12 @@ gladedir = $(datadir)/evolution/glade glade_DATA = \ contact-editor.glade \ fullname.glade \ - categories.glade + categories.glade \ + e-contact-editor-confirm-delete.glade EXTRA_DIST = $(evolution_DATA) \ $(glade_DATA) \ e-contact-editor-strings.h \ fullname-strings.h \ - categories-strings.h + categories-strings.h \ + e-contact-editor-confirm-delete.glade.h diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index c318dc7605..6793713f65 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -29,11 +29,13 @@ #include <gdk-pixbuf/gnome-canvas-pixbuf.h> #include <e-util/e-gui-utils.h> #include <e-contact-save-as.h> +#include "addressbook/printing/e-contact-print.h" /* Signal IDs */ enum { ADD_CARD, COMMIT_CARD, + DELETE_CARD, EDITOR_CLOSED, LAST_SIGNAL }; @@ -130,6 +132,15 @@ e_contact_editor_class_init (EContactEditorClass *klass) GTK_TYPE_NONE, 1, GTK_TYPE_OBJECT); + contact_editor_signals[DELETE_CARD] = + gtk_signal_new ("delete_card", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (EContactEditorClass, delete_card), + gtk_marshal_NONE__OBJECT, + GTK_TYPE_NONE, 1, + GTK_TYPE_OBJECT); + contact_editor_signals[EDITOR_CLOSED] = gtk_signal_new ("editor_closed", GTK_RUN_FIRST, @@ -573,6 +584,59 @@ file_save_as_cb (GtkWidget *widget, gpointer data) e_contact_save_as("Save as VCard", card); } +gboolean +e_contact_editor_confirm_delete(void) +{ + GnomeDialog *dialog; + GladeXML *gui; + int result; + + gui = glade_xml_new (EVOLUTION_GLADEDIR "/e-contact-editor-confirm-delete.glade", NULL); + + dialog = GNOME_DIALOG(glade_xml_get_widget(gui, "confirm-dialog")); + + result = gnome_dialog_run_and_close(dialog); + + gtk_object_unref(GTK_OBJECT(gui)); + + return !result; +} + +static void +delete_cb (GtkWidget *widget, gpointer data) +{ + EContactEditor *ce; + + if (e_contact_editor_confirm_delete()) { + + ce = E_CONTACT_EDITOR (data); + + extract_info (ce); + e_card_simple_sync_card (ce->simple); + + if (!ce->is_new_card) + gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[DELETE_CARD], + ce->card); + + file_close_cb(widget, data); + } +} + +/* Emits the signal to request printing a card */ +static void +print_cb (GtkWidget *widget, gpointer data) +{ + EContactEditor *ce; + + ce = E_CONTACT_EDITOR (data); + + extract_info (ce); + e_card_simple_sync_card (ce->simple); + + gtk_widget_show(e_contact_print_card_dialog_new(ce->card)); +} + + /* Menu bar */ static GnomeUIInfo file_new_menu[] = { @@ -606,13 +670,13 @@ static GnomeUIInfo file_menu[] = { GNOMEUIINFO_MENU_SAVE_AS_ITEM (file_save_as_cb, NULL), GNOMEUIINFO_ITEM_NONE (N_("FIXME: Save Attac_hments..."), NULL, NULL), GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Delete"), NULL, NULL), + GNOMEUIINFO_ITEM_NONE (N_("_Delete"), NULL, delete_cb), GNOMEUIINFO_ITEM_NONE (N_("FIXME: _Move to Folder..."), NULL, NULL), GNOMEUIINFO_ITEM_NONE (N_("FIXME: Cop_y to Folder..."), NULL, NULL), GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_SUBTREE (N_("Page Set_up"), file_page_setup_menu), GNOMEUIINFO_ITEM_NONE (N_("FIXME: Print Pre_view"), NULL, NULL), - GNOMEUIINFO_MENU_PRINT_ITEM (NULL, NULL), + GNOMEUIINFO_MENU_PRINT_ITEM (print_cb, NULL), GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_MENU_PROPERTIES_ITEM (NULL, NULL), GNOMEUIINFO_SEPARATOR, @@ -777,16 +841,16 @@ static GnomeUIInfo toolbar[] = { tb_save_and_close_cb, GNOME_STOCK_PIXMAP_SAVE), GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Print..."), - N_("Print this item"), NULL, + GNOMEUIINFO_ITEM_STOCK (N_("Print..."), + N_("Print this item"), print_cb, GNOME_STOCK_PIXMAP_PRINT), #if 0 GNOMEUIINFO_ITEM_NONE (N_("FIXME: Insert File..."), N_("Insert a file as an attachment"), NULL), #endif GNOMEUIINFO_SEPARATOR, - GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Delete"), - N_("Delete this item"), NULL, + GNOMEUIINFO_ITEM_STOCK (N_("Delete"), + N_("Delete this item"), delete_cb, GNOME_STOCK_PIXMAP_TRASH), GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_ITEM_STOCK (N_("FIXME: Previous"), diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h index 8eae2bf1b5..de14b84ca3 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.h +++ b/addressbook/gui/contact-editor/e-contact-editor.h @@ -95,6 +95,7 @@ struct _EContactEditorClass void (* add_card) (EContactEditor *ce, ECard *card); void (* commit_card) (EContactEditor *ce, ECard *card); + void (* delete_card) (EContactEditor *ce, ECard *card); void (* editor_closed) (EContactEditor *ce); }; @@ -102,6 +103,9 @@ struct _EContactEditorClass EContactEditor *e_contact_editor_new (ECard *card, gboolean is_new_card); GtkType e_contact_editor_get_type (void); + +gboolean e_contact_editor_confirm_delete(void); + #ifdef __cplusplus } #endif /* __cplusplus */ |