From ec7b287514d9577597e69e78e5b8611eea34e37f Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Wed, 8 Aug 2001 16:32:36 +0000 Subject: new function, used by the context menu. 2001-08-08 Chris Toshok * gui/widgets/e-addressbook-reflow-adapter.c (open_card): new function, used by the context menu. (e_addressbook_reflow_adapter_right_click): put "Open" at the top of the menu. also, disable "Delete" if the addressbook isn't writable. svn path=/trunk/; revision=11794 --- addressbook/ChangeLog | 8 +++++ .../gui/widgets/e-addressbook-reflow-adapter.c | 40 ++++++++++++++++++++-- 2 files changed, 45 insertions(+), 3 deletions(-) (limited to 'addressbook') diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 42114f1a0b..f218211573 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,11 @@ +2001-08-08 Chris Toshok + + * gui/widgets/e-addressbook-reflow-adapter.c (open_card): new + function, used by the context menu. + (e_addressbook_reflow_adapter_right_click): put "Open" at the top + of the menu. also, disable "Delete" if the addressbook isn't + writable. + 2001-08-08 Chris Toshok * backend/pas/pas-backend-ldap.c (rfc2254_escape): escape *, \, (, diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c index 47f81db581..8c4468d736 100644 --- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c +++ b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c @@ -5,6 +5,7 @@ #include "e-addressbook-reflow-adapter.h" #include "e-addressbook-model.h" +#include "e-addressbook-util.h" #include @@ -16,6 +17,7 @@ #include "addressbook/printing/e-contact-print.h" #include "addressbook/printing/e-contact-print-envelope.h" + struct _EAddressbookReflowAdapterPrivate { EAddressbookModel *model; @@ -225,25 +227,57 @@ delete (GtkWidget *widget, ModelAndSelection *mns) model_and_selection_free (mns); } +static void +open_card (GtkWidget *widget, ModelAndSelection *mns) +{ + EAddressbookReflowAdapterPrivate *priv = mns->adapter->priv; + GList *list; + + list = get_card_list (mns); + if (list) { + GList *iterator; + EBook *book = e_addressbook_model_get_ebook(priv->model); + + for (iterator = list; iterator; iterator = iterator->next) { + ECard *card = iterator->data; + + if (e_card_evolution_list (card)) { + e_addressbook_show_contact_list_editor (book, card, + FALSE, e_addressbook_model_editable (priv->model)); + } + else { + e_addressbook_show_contact_editor (book, card, + FALSE, e_addressbook_model_editable (priv->model)); + } + } + } + + g_list_free (list); + model_and_selection_free (mns); +} + +#define POPUP_READONLY_MASK 0x01 gint e_addressbook_reflow_adapter_right_click (EAddressbookReflowAdapter *adapter, GdkEvent *event, ESelectionModel *selection) { + EAddressbookReflowAdapterPrivate *priv = adapter->priv; ModelAndSelection *mns = g_new(ModelAndSelection, 1); - EPopupMenu menu[] = { {N_("Save as VCard"), NULL, GTK_SIGNAL_FUNC(save_as), NULL, 0}, + EPopupMenu menu[] = { {N_("Open"), NULL, GTK_SIGNAL_FUNC(open_card), NULL, 0}, + {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}, #if 0 /* Envelope printing is disabled for Evolution 1.0. */ {N_("Print Envelope"), NULL, GTK_SIGNAL_FUNC(print_envelope), NULL, 0}, #endif - {N_("Delete"), NULL, GTK_SIGNAL_FUNC(delete), NULL, 0}, + {N_("Delete"), NULL, GTK_SIGNAL_FUNC(delete), NULL, POPUP_READONLY_MASK}, {NULL, NULL, NULL, 0}}; mns->adapter = adapter; mns->selection = selection; gtk_object_ref(GTK_OBJECT(mns->adapter)); gtk_object_ref(GTK_OBJECT(mns->selection)); - e_popup_menu_run (menu, event, 0, 0, mns); + e_popup_menu_run (menu, event, e_addressbook_model_editable(priv->model) ? 0 : POPUP_READONLY_MASK, 0, mns); return TRUE; } -- cgit v1.2.3