From bfaace723bb0199325f79ac52c32260df9e524fb Mon Sep 17 00:00:00 2001 From: Not Zed Date: Thu, 7 Oct 2004 01:33:10 +0000 Subject: fix for e-popup api changes. Moved all mask specifiers to visible rather 2004-10-06 Not Zed * gui/component/addressbook-view.c (popup_event_callback): * gui/component/select-names/e-select-names.c (section_right_click_cb): * gui/widgets/e-addressbook-view.c (do_popup_menu): fix for e-popup api changes. Moved all mask specifiers to visible rather than enable in the menu table. 2004-10-06 Not Zed * gui/contact-editor/e-contact-editor.c: removed gnome-popup-menu.h (unused). * gui/widgets/e-addressbook-reflow-adapter.c: * gui/widgets/eab-popup-control.c: remove e-popup-menu.h (unused). * gui/component/select-names/e-select-names.c (section_right_click_cb): use e-popup. Somewhat overengineered for this use ... (remove_cb): api changes. * gui/widgets/eab-popup.c (eab_popup_target_new_select_names): added pretty useless wrapper for the select names popup. Added to hook maps. svn path=/trunk/; revision=27488 --- .../gui/component/select-names/e-select-names.c | 48 +++++++++++++--------- 1 file changed, 28 insertions(+), 20 deletions(-) (limited to 'addressbook/gui/component/select-names/e-select-names.c') diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c index 3cdf807ef4..6b13637299 100644 --- a/addressbook/gui/component/select-names/e-select-names.c +++ b/addressbook/gui/component/select-names/e-select-names.c @@ -29,7 +29,6 @@ #include #include -#include #include #include @@ -38,6 +37,7 @@ #include #include #include +#include #include "e-select-names-config.h" #include "e-select-names.h" @@ -678,36 +678,44 @@ remove_address(ETable *table, int row, int col, GdkEvent *event, ESelectNamesChi e_select_names_model_delete (child->source, row); } -struct _RightClickData { - ESelectNamesChild *child; - int row; -}; -typedef struct _RightClickData RightClickData; - static void -remove_cb (GtkWidget *widget, void *data) +remove_cb (EPopup *ep, EPopupItem *pitem, void *data) { - RightClickData *rcdata = (RightClickData *)data; + EABPopupTargetSelectNames *t = (EABPopupTargetSelectNames *)ep->target; - e_select_names_model_delete (rcdata->child->source, rcdata->row); + e_select_names_model_delete (t->model, t->row); +} + +static EPopupItem esn_select_popups[] = { + { E_POPUP_ITEM, "20.delete", N_("Remove"), remove_cb, NULL, NULL, 0, 0 }, +}; - /* Free everything we've created */ - g_free (rcdata); +static void +esn_select_popup_free (EPopup *ep, GSList *list, void *data) +{ + g_slist_free (list); } static void section_right_click_cb (ETable *et, int row, int col, GdkEvent *ev, ESelectNamesChild *child) { - static EPopupMenu right_click_menu[] = { - E_POPUP_ITEM (N_("Remove"), G_CALLBACK (remove_cb), 0), - E_POPUP_TERMINATOR - }; - RightClickData *rcdata = g_new0 (RightClickData, 1); + EABPopup *ep; + EABPopupTargetSelectNames *t; + GSList *menus = NULL; + int i; + GtkMenu *menu; + + ep = eab_popup_new("com.novell.evolution.addressbook.selectNames.popup"); + t = eab_popup_target_new_select_names(ep, child->source, row); + t->target.widget = (GtkWidget *)et; + + for (i=0;irow = row; - rcdata->child = child; + e_popup_add_items((EPopup *)ep, menus, esn_select_popup_free, NULL); - e_popup_menu_run (right_click_menu, (GdkEvent *)ev, 0, 0, rcdata); + menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0); + gtk_menu_popup(menu, NULL, NULL, NULL, NULL, ev->button.button, ev->button.time); } void -- cgit v1.2.3