diff options
author | Christopher James Lahey <clahey@ximian.com> | 2001-05-08 12:58:41 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-05-08 12:58:41 +0800 |
commit | 3c0c62e2958b5dccca490908145c534022a85563 (patch) | |
tree | 421d5332f2518c99cfd6ac6dd4aa325f1a0a1a84 /addressbook/gui/widgets/e-minicard.c | |
parent | 5d4895eb431adfbf2c7895d4257fa20a28f474f9 (diff) | |
download | gsoc2013-evolution-3c0c62e2958b5dccca490908145c534022a85563.tar.gz gsoc2013-evolution-3c0c62e2958b5dccca490908145c534022a85563.tar.zst gsoc2013-evolution-3c0c62e2958b5dccca490908145c534022a85563.zip |
Removed e-card-pairs.h since we're not using it.
2001-05-08 Christopher James Lahey <clahey@ximian.com>
* backend/ebook/Makefile.am (libebookinclude_HEADERS): Removed
e-card-pairs.h since we're not using it.
* backend/ebook/e-book-view.c (e_book_view_check_listener_queue):
Added break; to default: case here.
* backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h:
Added changed variable so as to avoid sync_card when possible.
(e_card_simple_destroy): Free all the data here properly.
(e_card_simple_get_arg): Slight simplification here.
(fill_in_info, e_card_simple_arbitrary_foreach,
e_card_simple_get_arbitrary): Call e_card_free_empty_lists here to
save a bit of memory.
* backend/ebook/e-card.c, backend/ebook/e-card.h: Fixed up
includes a bit.
(e_card_list_get_vcard, e_card_list_send): Added these functions
for acting on a group of cards.
(parse_org): Cleaned up this function a bit.
(e_card_free_empty_lists): Added this function to delete
unnecessary ELists and save a bit of memory.
(e_v_object_get_child_value): Made this return NULL if not found
instead of g_strdup("").
* contact-editor/e-contact-save-as.c,
contact-editor/e-contact-save-as.h (e_contact_list_save_as): Added
this function to save multiple contacts.
* gui/widgets/Makefile.am: Commented out reflow test.
(libeminicard_a_SOURCES): Added e-minicard-view-model.c and
e-minicard-view-model.h.
* gui/widgets/e-minicard-view-model.c,
gui/widgets/e-minicard-view-model.h: Model for use in
EMinicardView.
* gui/widgets/e-minicard-view.c, gui/widgets/e-minicard-view.h:
Reworked this to use the new EReflow stuff.
* gui/widgets/e-minicard.c (e_minicard_event): Doesn't handle
right click menus now. Emits a signal on the parent canvas item
instead.
* printing/e-contact-print-envelope.c,
printing/e-contact-print-envelope.h
(e_contact_print_envelope_list_dialog_new): Added this function to
print multiple envelopes (only prints first for now.)
* printing/e-contact-print.c, printing/e-contact-print.h
(e_contact_print_card_list_dialog_new): Added this function to
print multiple cards. Only prints the first for now.
svn path=/trunk/; revision=9711
Diffstat (limited to 'addressbook/gui/widgets/e-minicard.c')
-rw-r--r-- | addressbook/gui/widgets/e-minicard.c | 149 |
1 files changed, 17 insertions, 132 deletions
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index b5c11bd27f..0db903a790 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -31,15 +31,11 @@ #include <gal/util/e-util.h> #include <gal/widgets/e-canvas-utils.h> #include <gal/widgets/e-canvas.h> -#include <gal/widgets/e-popup-menu.h> #include "addressbook/backend/ebook/e-book.h" -#include "addressbook/printing/e-contact-print.h" -#include "addressbook/printing/e-contact-print-envelope.h" #include "e-minicard.h" #include "e-minicard-label.h" #include "e-minicard-view.h" #include "e-contact-editor.h" -#include "e-contact-save-as.h" static void e_minicard_init (EMinicard *card); static void e_minicard_class_init (EMinicardClass *klass); @@ -442,113 +438,6 @@ card_changed_cb (EBook* book, EBookStatus status, gpointer user_data) g_print ("%s: %s(): a card was changed with status %d\n", __FILE__, __FUNCTION__, status); } -typedef struct { - EMinicard *minicard; - GnomeCanvasItem *parent; - GtkWidget *canvas; -} MinicardAndParent; - -static void -e_minicard_and_parent_free (MinicardAndParent *mnp) -{ - gtk_object_unref(GTK_OBJECT(mnp->minicard)); - gtk_object_unref(GTK_OBJECT(mnp->parent)); - gtk_object_unref(GTK_OBJECT(mnp->canvas)); - g_free(mnp); -} - -static void -save_as (GtkWidget *widget, MinicardAndParent *mnp) -{ - EMinicard *minicard = mnp->minicard; - if (!GTK_OBJECT_DESTROYED(minicard)) { - e_card_simple_sync_card(minicard->simple); - e_contact_save_as(_("Save as VCard"), minicard->card); - } - e_minicard_and_parent_free (mnp); -} - -static void -send_as (GtkWidget *widget, MinicardAndParent *mnp) -{ - EMinicard *minicard = mnp->minicard; - if (!GTK_OBJECT_DESTROYED(minicard)) { - e_card_simple_sync_card(minicard->simple); - e_card_send(minicard->card, E_CARD_DISPOSITION_AS_ATTACHMENT); - } - e_minicard_and_parent_free (mnp); -} - -static void -send_to (GtkWidget *widget, MinicardAndParent *mnp) -{ - EMinicard *minicard = mnp->minicard; - if (!GTK_OBJECT_DESTROYED(minicard)) { - e_card_simple_sync_card(minicard->simple); - e_card_send(minicard->card, E_CARD_DISPOSITION_AS_TO); - } - e_minicard_and_parent_free (mnp); -} - -static void -delete (GtkWidget *widget, MinicardAndParent *mnp) -{ - EMinicard *minicard = mnp->minicard; - - if (!GTK_OBJECT_DESTROYED(minicard)) { - EBook *book; - ECard *card = minicard->card; - ECardSimple *simple = minicard->simple; - - gtk_object_get(GTK_OBJECT(mnp->parent), - "book", &book, - NULL); - - gtk_object_ref(GTK_OBJECT(card)); - gtk_object_ref(GTK_OBJECT(simple)); - - if (e_contact_editor_confirm_delete(GTK_WINDOW(gtk_widget_get_toplevel(mnp->canvas)))) { - e_card_simple_sync_card(simple); - - - /* Add the card in the contact editor to our ebook */ - e_book_remove_card (book, - card, - card_changed_cb, - NULL); - } - - gtk_object_unref(GTK_OBJECT(card)); - gtk_object_unref(GTK_OBJECT(simple)); - } - - e_minicard_and_parent_free (mnp); -} - -static void -print (GtkWidget *widget, MinicardAndParent *mnp) -{ - EMinicard *minicard = mnp->minicard; - - if (!GTK_OBJECT_DESTROYED(minicard)) { - e_card_simple_sync_card(minicard->simple); - gtk_widget_show(e_contact_print_card_dialog_new(minicard->card)); - } - e_minicard_and_parent_free (mnp); -} - -static void -print_envelope (GtkWidget *widget, MinicardAndParent *mnp) -{ - EMinicard *minicard = mnp->minicard; - - if (!GTK_OBJECT_DESTROYED(minicard)) { - e_card_simple_sync_card(minicard->simple); - gtk_widget_show(e_contact_print_envelope_dialog_new(minicard->card)); - } - e_minicard_and_parent_free (mnp); -} - /* Callback for the add_card signal from the contact editor */ static void add_card_cb (EContactEditor *ce, ECard *card, gpointer data) @@ -664,21 +553,7 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) e_minicard->drag_button_down = TRUE; return ret_val; } else if (event->button.button == 3) { - MinicardAndParent *mnp = g_new(MinicardAndParent, 1); - EPopupMenu menu[] = { {N_("Save as VCard"), NULL, GTK_SIGNAL_FUNC(save_as), NULL, 0}, - {N_("Send contact to other"), NULL, GTK_SIGNAL_FUNC(send_as), NULL, 0}, - {N_("Send message to contact"), NULL, GTK_SIGNAL_FUNC(send_to), NULL, 0}, - {N_("Print"), NULL, GTK_SIGNAL_FUNC(print), NULL, 0}, - {N_("Print Envelope"), NULL, GTK_SIGNAL_FUNC(print_envelope), NULL, 0}, - {N_("Delete"), NULL, GTK_SIGNAL_FUNC(delete), NULL, 1}, - {NULL, NULL, NULL, 0}}; - mnp->minicard = e_minicard; - mnp->parent = item->parent; - mnp->canvas = GTK_WIDGET(item->canvas); - gtk_object_ref(GTK_OBJECT(mnp->minicard)); - gtk_object_ref(GTK_OBJECT(mnp->parent)); - gtk_object_ref(GTK_OBJECT(mnp->canvas)); - e_popup_menu_run (menu, event, 0, E_IS_MINICARD_VIEW(mnp->parent) ? 0 : 1, mnp); + return e_minicard_selected(e_minicard, event); } break; case GDK_BUTTON_RELEASE: @@ -877,7 +752,7 @@ remodel( EMinicard *e_minicard ) NULL ); g_free(file_as); } - + list = e_minicard->fields; e_minicard->fields = NULL; @@ -889,7 +764,7 @@ remodel( EMinicard *e_minicard ) if (minicard_field && minicard_field->field == field) { GList *this_list = list; char *string; - + string = e_card_simple_get(e_minicard->simple, field); if (string && *string) { e_minicard->fields = g_list_append(e_minicard->fields, minicard_field); @@ -917,7 +792,7 @@ remodel( EMinicard *e_minicard ) g_free(string); } } - + g_list_foreach(list, (GFunc) e_minicard_field_destroy, NULL); g_list_free(list); } @@ -1017,9 +892,19 @@ int e_minicard_selected (EMinicard *minicard, GdkEvent *event) { gint ret_val = 0; - gtk_signal_emit(GTK_OBJECT(minicard), - e_minicard_signals[SELECTED], - event, &ret_val); + GnomeCanvasItem *item = GNOME_CANVAS_ITEM (minicard); + if (item->parent) { + guint signal_id = gtk_signal_lookup ("selection_event", GTK_OBJECT_TYPE (item->parent)); + /* We should probably check the signature here, but I + * don't think it's worth the time required to code + * it. + */ + if (signal_id != 0) { + gtk_signal_emit(GTK_OBJECT(item->parent), + signal_id, + item, event, &ret_val); + } + } return ret_val; } |