diff options
author | Christopher James Lahey <clahey@ximian.com> | 2002-01-18 23:37:09 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2002-01-18 23:37:09 +0800 |
commit | a30eed771c00ccde2cd7a32c3f0a28057f247f84 (patch) | |
tree | 8349ad2f4b5f13af1cc188ee7d9771374a17d5cf /addressbook/gui/widgets/e-addressbook-util.c | |
parent | 9380c68a1a8f6232a1faa0c169eee6b6c4ae889f (diff) | |
download | gsoc2013-evolution-a30eed771c00ccde2cd7a32c3f0a28057f247f84.tar.gz gsoc2013-evolution-a30eed771c00ccde2cd7a32c3f0a28057f247f84.tar.zst gsoc2013-evolution-a30eed771c00ccde2cd7a32c3f0a28057f247f84.zip |
From addressbook/ChangeLog:
2002-01-18 Christopher James Lahey <clahey@ximian.com>
* gui/component/addressbook.c (view_contact_cb): New verb to open
a bunch of cards.
* gui/widgets/e-addressbook-reflow-adapter.c (open_card): Call
e_addressbook_show_multiple_cards instead of doing this ourselves.
* gui/widgets/e-addressbook-util.c,
gui/widgets/e-addressbook-util.h
(e_addressbook_show_multiple_cards): Added this function to show a
bunch of cards, including a dialog if lots of windows are going to
appear.
* gui/widgets/e-addressbook-view.c (e_addressbook_view_view,
e_addressbook_view_can_view): e_addressbook_view_view calls
e_addressbook_show_multiple_cards on the appropriate list of
cards.
From ui/ChangeLog:
2002-01-18 Christopher James Lahey <clahey@ximian.com>
* evolution-addressbook.xml: Added File->Open which calls the
ContactsView command.
svn path=/trunk/; revision=15355
Diffstat (limited to 'addressbook/gui/widgets/e-addressbook-util.c')
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-util.c | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-util.c b/addressbook/gui/widgets/e-addressbook-util.c index fa29b61bba..c53e16a45c 100644 --- a/addressbook/gui/widgets/e-addressbook-util.c +++ b/addressbook/gui/widgets/e-addressbook-util.c @@ -146,3 +146,79 @@ e_addressbook_show_contact_list_editor (EBook *book, ECard *card, return ce; } + +typedef struct { + EBook *book; + GList *list; + gboolean editable; +} BookAndList; + +static void +view_cards (EBook *book, GList *list, gboolean editable) +{ + for (; list; list = list->next) { + ECard *card = list->data; + if (e_card_evolution_list (card)) + e_addressbook_show_contact_list_editor (book, card, FALSE, editable); + else + e_addressbook_show_contact_editor (book, card, FALSE, editable); + } +} + +static void +view_question_clicked (GtkObject *object, int button, BookAndList *bnl) +{ + GnomeDialog *dialog = GNOME_DIALOG (object); + switch (button) { + case 0: + view_cards (bnl->book, bnl->list, bnl->editable); + break; + } + gnome_dialog_close(dialog); +} + +static void +view_question_destroyed (GtkObject *object, GList *list) +{ + gtk_main_quit(); +} + +void +e_addressbook_show_multiple_cards (EBook *book, + GList *list, + gboolean editable) +{ + if (list) { + int length = g_list_length (list); + if (length > 5) { + char *string; + GtkWidget *dialog; + BookAndList bnl; + + bnl.book = book; + bnl.list = list; + bnl.editable = editable; + + dialog = gnome_dialog_new (_("Display Cards?"), + _("Display Cards"), + GNOME_STOCK_BUTTON_CANCEL, + NULL); + + string = g_strdup_printf (_("You have requested that %d cards be cards. This will cause %d new windows to be\n" + "displayed on your screen. Do you really want to display all of these cards?"), length, length); + gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), gtk_label_new (string), FALSE, FALSE, 0); + g_free (string); + + gtk_signal_connect (GTK_OBJECT (dialog), "destroy", + GTK_SIGNAL_FUNC (view_question_destroyed), &bnl); + gtk_signal_connect (GTK_OBJECT (dialog), "clicked", + GTK_SIGNAL_FUNC (view_question_clicked), &bnl); + + gtk_widget_show_all (dialog); + + gtk_main(); + } else { + view_cards (book, list, editable); + } + } +} |