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 | |
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')
-rw-r--r-- | addressbook/gui/component/addressbook.c | 12 | ||||
-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 | ||||
-rw-r--r-- | addressbook/gui/minicard/Makefile.am | 3 | ||||
-rw-r--r-- | addressbook/gui/minicard/e-minicard.c | 46 | ||||
-rw-r--r-- | addressbook/gui/widgets/Makefile.am | 3 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-minicard.c | 46 |
8 files changed, 187 insertions, 10 deletions
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index 7295682bf7..477f4b6f40 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -125,6 +125,16 @@ commit_card_cb (EContactEditor *ce, ECard *card, gpointer data) e_book_commit_card (book, card, card_modified_cb, NULL); } +/* Callback for the delete_card signal from the contact editor */ +static void +delete_card_cb (EContactEditor *ce, ECard *card, gpointer data) +{ + EBook *book; + + book = E_BOOK (data); + e_book_remove_card (book, card, card_modified_cb, NULL); +} + /* Callback used when the contact editor is closed */ static void editor_closed_cb (EContactEditor *ce, gpointer data) @@ -157,6 +167,8 @@ new_contact_cb (BonoboUIHandler *uih, void *user_data, const char *path) GTK_SIGNAL_FUNC (add_card_cb), book); gtk_signal_connect (GTK_OBJECT (ce), "commit_card", GTK_SIGNAL_FUNC (commit_card_cb), book); + gtk_signal_connect (GTK_OBJECT (ce), "delete_card", + GTK_SIGNAL_FUNC (delete_card_cb), book); gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", GTK_SIGNAL_FUNC (editor_closed_cb), NULL); 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 */ diff --git a/addressbook/gui/minicard/Makefile.am b/addressbook/gui/minicard/Makefile.am index a20edc1c08..d09d66fe31 100644 --- a/addressbook/gui/minicard/Makefile.am +++ b/addressbook/gui/minicard/Makefile.am @@ -53,6 +53,7 @@ minicard_test_LDADD = \ $(top_builddir)/libversit/libversit.la \ $(top_builddir)/addressbook/ename/libename.la \ $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \ + $(top_builddir)/addressbook/printing/libecontactprint.a \ $(top_builddir)/widgets/e-table/libetable.a \ $(top_builddir)/widgets/misc/libemiscwidgets.a \ $(top_builddir)/e-util/libeutil.la \ @@ -71,6 +72,7 @@ reflow_test_LDADD = \ $(top_builddir)/libversit/libversit.la \ $(top_builddir)/addressbook/ename/libename.la \ $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \ + $(top_builddir)/addressbook/printing/libecontactprint.a \ $(top_builddir)/widgets/e-table/libetable.a \ $(top_builddir)/widgets/misc/libemiscwidgets.a \ $(top_builddir)/e-util/libeutil.la \ @@ -89,6 +91,7 @@ minicard_view_test_LDADD = \ $(top_builddir)/libversit/libversit.la \ $(top_builddir)/addressbook/ename/libename.la \ $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \ + $(top_builddir)/addressbook/printing/libecontactprint.a \ $(top_builddir)/widgets/e-table/libetable.a \ $(top_builddir)/widgets/misc/libemiscwidgets.a \ $(top_builddir)/e-util/libeutil.la \ diff --git a/addressbook/gui/minicard/e-minicard.c b/addressbook/gui/minicard/e-minicard.c index cdc809f6e4..68f6ccfc05 100644 --- a/addressbook/gui/minicard/e-minicard.c +++ b/addressbook/gui/minicard/e-minicard.c @@ -30,6 +30,7 @@ #include <e-util/e-util.h> #include <e-util/e-canvas-utils.h> #include <e-util/e-popup-menu.h> +#include "addressbook/printing/e-contact-print.h" #include "e-contact-editor.h" #include "e-contact-save-as.h" #include "e-minicard-view.h" @@ -329,6 +330,34 @@ save_as (GtkWidget *widget, EMinicard *minicard) e_contact_save_as(_("Save as VCard"), minicard->card); } +static void +delete (GtkWidget *widget, EMinicard *minicard) +{ + EBook *book; + + if (e_contact_editor_confirm_delete()) { + e_card_simple_sync_card(minicard->simple); + + gtk_object_get(GTK_OBJECT(GNOME_CANVAS_ITEM(minicard)->parent), + "book", &book, + NULL); + + /* Add the card in the contact editor to our ebook */ + e_book_remove_card (book, + minicard->card, + card_changed_cb, + NULL); + } +} + +static void +print (GtkWidget *widget, EMinicard *minicard) +{ + e_card_simple_sync_card(minicard->simple); + + gtk_widget_show(e_contact_print_card_dialog_new(minicard->card)); +} + /* Callback for the add_card signal from the contact editor */ static void add_card_cb (EContactEditor *ce, ECard *card, gpointer data) @@ -349,6 +378,16 @@ commit_card_cb (EContactEditor *ce, ECard *card, gpointer data) e_book_commit_card (book, card, card_changed_cb, NULL); } +/* Callback for the commit_card signal from the contact editor */ +static void +delete_card_cb (EContactEditor *ce, ECard *card, gpointer data) +{ + EBook *book; + + book = E_BOOK (data); + e_book_remove_card (book, card, card_changed_cb, NULL); +} + /* Callback used when the contact editor is closed */ static void editor_closed_cb (EContactEditor *ce, gpointer data) @@ -410,7 +449,10 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) if (event->button.button == 1) { e_canvas_item_grab_focus(item); } else if (event->button.button == 3) { - EPopupMenu menu[] = { {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), 0}, {NULL, NULL, NULL, 0} }; + EPopupMenu menu[] = { {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), 0}, + {"Print", NULL, GTK_SIGNAL_FUNC(print), 0}, + {"Delete", NULL, GTK_SIGNAL_FUNC(delete), 0}, + {NULL, NULL, NULL, 0}}; e_popup_menu_run (menu, (GdkEventButton *)event, 0, e_minicard); } break; @@ -431,6 +473,8 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) GTK_SIGNAL_FUNC (add_card_cb), book); gtk_signal_connect (GTK_OBJECT (ce), "commit_card", GTK_SIGNAL_FUNC (commit_card_cb), book); + gtk_signal_connect (GTK_OBJECT (ce), "delete_card", + GTK_SIGNAL_FUNC (delete_card_cb), book); gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", GTK_SIGNAL_FUNC (editor_closed_cb), NULL); diff --git a/addressbook/gui/widgets/Makefile.am b/addressbook/gui/widgets/Makefile.am index a20edc1c08..d09d66fe31 100644 --- a/addressbook/gui/widgets/Makefile.am +++ b/addressbook/gui/widgets/Makefile.am @@ -53,6 +53,7 @@ minicard_test_LDADD = \ $(top_builddir)/libversit/libversit.la \ $(top_builddir)/addressbook/ename/libename.la \ $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \ + $(top_builddir)/addressbook/printing/libecontactprint.a \ $(top_builddir)/widgets/e-table/libetable.a \ $(top_builddir)/widgets/misc/libemiscwidgets.a \ $(top_builddir)/e-util/libeutil.la \ @@ -71,6 +72,7 @@ reflow_test_LDADD = \ $(top_builddir)/libversit/libversit.la \ $(top_builddir)/addressbook/ename/libename.la \ $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \ + $(top_builddir)/addressbook/printing/libecontactprint.a \ $(top_builddir)/widgets/e-table/libetable.a \ $(top_builddir)/widgets/misc/libemiscwidgets.a \ $(top_builddir)/e-util/libeutil.la \ @@ -89,6 +91,7 @@ minicard_view_test_LDADD = \ $(top_builddir)/libversit/libversit.la \ $(top_builddir)/addressbook/ename/libename.la \ $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \ + $(top_builddir)/addressbook/printing/libecontactprint.a \ $(top_builddir)/widgets/e-table/libetable.a \ $(top_builddir)/widgets/misc/libemiscwidgets.a \ $(top_builddir)/e-util/libeutil.la \ diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index cdc809f6e4..68f6ccfc05 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -30,6 +30,7 @@ #include <e-util/e-util.h> #include <e-util/e-canvas-utils.h> #include <e-util/e-popup-menu.h> +#include "addressbook/printing/e-contact-print.h" #include "e-contact-editor.h" #include "e-contact-save-as.h" #include "e-minicard-view.h" @@ -329,6 +330,34 @@ save_as (GtkWidget *widget, EMinicard *minicard) e_contact_save_as(_("Save as VCard"), minicard->card); } +static void +delete (GtkWidget *widget, EMinicard *minicard) +{ + EBook *book; + + if (e_contact_editor_confirm_delete()) { + e_card_simple_sync_card(minicard->simple); + + gtk_object_get(GTK_OBJECT(GNOME_CANVAS_ITEM(minicard)->parent), + "book", &book, + NULL); + + /* Add the card in the contact editor to our ebook */ + e_book_remove_card (book, + minicard->card, + card_changed_cb, + NULL); + } +} + +static void +print (GtkWidget *widget, EMinicard *minicard) +{ + e_card_simple_sync_card(minicard->simple); + + gtk_widget_show(e_contact_print_card_dialog_new(minicard->card)); +} + /* Callback for the add_card signal from the contact editor */ static void add_card_cb (EContactEditor *ce, ECard *card, gpointer data) @@ -349,6 +378,16 @@ commit_card_cb (EContactEditor *ce, ECard *card, gpointer data) e_book_commit_card (book, card, card_changed_cb, NULL); } +/* Callback for the commit_card signal from the contact editor */ +static void +delete_card_cb (EContactEditor *ce, ECard *card, gpointer data) +{ + EBook *book; + + book = E_BOOK (data); + e_book_remove_card (book, card, card_changed_cb, NULL); +} + /* Callback used when the contact editor is closed */ static void editor_closed_cb (EContactEditor *ce, gpointer data) @@ -410,7 +449,10 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) if (event->button.button == 1) { e_canvas_item_grab_focus(item); } else if (event->button.button == 3) { - EPopupMenu menu[] = { {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), 0}, {NULL, NULL, NULL, 0} }; + EPopupMenu menu[] = { {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), 0}, + {"Print", NULL, GTK_SIGNAL_FUNC(print), 0}, + {"Delete", NULL, GTK_SIGNAL_FUNC(delete), 0}, + {NULL, NULL, NULL, 0}}; e_popup_menu_run (menu, (GdkEventButton *)event, 0, e_minicard); } break; @@ -431,6 +473,8 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) GTK_SIGNAL_FUNC (add_card_cb), book); gtk_signal_connect (GTK_OBJECT (ce), "commit_card", GTK_SIGNAL_FUNC (commit_card_cb), book); + gtk_signal_connect (GTK_OBJECT (ce), "delete_card", + GTK_SIGNAL_FUNC (delete_card_cb), book); gtk_signal_connect (GTK_OBJECT (ce), "editor_closed", GTK_SIGNAL_FUNC (editor_closed_cb), NULL); |