aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/widgets/e-minicard.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-07-14 03:22:42 +0800
committerChris Lahey <clahey@src.gnome.org>2000-07-14 03:22:42 +0800
commita5fc85f2f49c04d8b0344c8e967c2bf18856a46a (patch)
tree6fc8f6893ebefb2fbc5433bac058356860363d38 /addressbook/gui/widgets/e-minicard.c
parent906c46112c18cab409eeb06aaaf4616c24e026b5 (diff)
downloadgsoc2013-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/widgets/e-minicard.c')
-rw-r--r--addressbook/gui/widgets/e-minicard.c46
1 files changed, 45 insertions, 1 deletions
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);