diff options
author | Not Zed <NotZed@Ximian.com> | 2004-10-07 09:33:10 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-10-07 09:33:10 +0800 |
commit | bfaace723bb0199325f79ac52c32260df9e524fb (patch) | |
tree | c172660f225d74570af10532c7de75554c7ae8b6 /addressbook/gui | |
parent | 3a6b8953fef7c05efd694b922dcb3cbf1f466b16 (diff) | |
download | gsoc2013-evolution-bfaace723bb0199325f79ac52c32260df9e524fb.tar gsoc2013-evolution-bfaace723bb0199325f79ac52c32260df9e524fb.tar.gz gsoc2013-evolution-bfaace723bb0199325f79ac52c32260df9e524fb.tar.bz2 gsoc2013-evolution-bfaace723bb0199325f79ac52c32260df9e524fb.tar.lz gsoc2013-evolution-bfaace723bb0199325f79ac52c32260df9e524fb.tar.xz gsoc2013-evolution-bfaace723bb0199325f79ac52c32260df9e524fb.tar.zst gsoc2013-evolution-bfaace723bb0199325f79ac52c32260df9e524fb.zip |
fix for e-popup api changes. Moved all mask specifiers to visible rather
2004-10-06 Not Zed <NotZed@Ximian.com>
* 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 <NotZed@Ximian.com>
* 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
Diffstat (limited to 'addressbook/gui')
-rw-r--r-- | addressbook/gui/component/addressbook-view.c | 9 | ||||
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names.c | 48 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.c | 1 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-reflow-adapter.c | 1 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-view.c | 28 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-popup-control.c | 1 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-popup.c | 22 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-popup.h | 20 |
8 files changed, 87 insertions, 43 deletions
diff --git a/addressbook/gui/component/addressbook-view.c b/addressbook/gui/component/addressbook-view.c index 48d8499a32..61a219f62e 100644 --- a/addressbook/gui/component/addressbook-view.c +++ b/addressbook/gui/component/addressbook-view.c @@ -741,9 +741,9 @@ primary_source_selection_changed_callback (ESourceSelector *selector, } static EPopupItem abv_source_popups[] = { - { E_POPUP_ITEM, "10.new", N_("New Address Book"), new_addressbook_cb, NULL, NULL, 0 }, - { E_POPUP_ITEM, "20.delete", N_("Delete"), delete_addressbook_cb, NULL, "stock_delete", EAB_POPUP_SOURCE_USER|EAB_POPUP_SOURCE_PRIMARY }, - { E_POPUP_ITEM, "30.properties", N_("Properties..."), edit_addressbook_cb, NULL, NULL, EAB_POPUP_SOURCE_PRIMARY }, + { E_POPUP_ITEM, "10.new", N_("New Address Book"), new_addressbook_cb, NULL, NULL, 0, 0 }, + { E_POPUP_ITEM, "20.delete", N_("Delete"), delete_addressbook_cb, NULL, "stock_delete", 0, EAB_POPUP_SOURCE_USER|EAB_POPUP_SOURCE_PRIMARY }, + { E_POPUP_ITEM, "30.properties", N_("Properties..."), edit_addressbook_cb, NULL, NULL, 0, EAB_POPUP_SOURCE_PRIMARY }, }; static void @@ -770,8 +770,7 @@ popup_event_callback(ESourceSelector *selector, ESource *source, GdkEventButton e_popup_add_items((EPopup *)ep, menus, abv_source_popup_free, view); - /* visibility is disabled, we only disable menu items */ - menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0, t->target.mask); + menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0); gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event?event->button:0, event?event->time:gtk_get_current_event_time()); return TRUE; 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 <gal/e-table/e-table-simple.h> #include <gal/e-table/e-table-without.h> -#include <gal/widgets/e-popup-menu.h> #include <libebook/e-book.h> #include <libebook/e-contact.h> @@ -38,6 +37,7 @@ #include <addressbook/util/eab-book-util.h> #include <addressbook/gui/component/addressbook-component.h> #include <addressbook/gui/component/addressbook.h> +#include <addressbook/gui/widgets/eab-popup.h> #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;i<sizeof(esn_select_popups)/sizeof(esn_select_popups[0]);i++) + menus = g_slist_prepend(menus, &esn_select_popups[i]); - rcdata->row = 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 diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index 5b447b7b99..e3731cfbc6 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -34,7 +34,6 @@ #include <gtk/gtkstock.h> #include <gtk/gtkentry.h> #include <gtk/gtklabel.h> -#include <libgnomeui/gnome-popup-menu.h> #include <libgnomeui/gnome-window-icon.h> #include <libgnome/gnome-util.h> #include <libgnome/gnome-i18n.h> diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c index cf1667fec5..4d935198d1 100644 --- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c +++ b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c @@ -12,7 +12,6 @@ #include "eab-gui-util.h" #include "e-minicard.h" -#include <gal/widgets/e-popup-menu.h> #include <gal/widgets/e-gui-utils.h> #include "addressbook/printing/e-contact-print.h" #include "addressbook/printing/e-contact-print-envelope.h" diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index f716ea8624..ed55f42a89 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -913,24 +913,24 @@ new_list (EPopup *ep, EPopupItem *pitem, void *data) } static EPopupItem eabv_popup_items[] = { - { E_POPUP_ITEM, "10.new", N_("New Contact..."), new_card, NULL, "stock_contact", EAB_POPUP_SELECT_EDITABLE}, - { E_POPUP_ITEM, "15.newlist", N_("New Contact List..."), new_list, NULL, "stock_contact-list", EAB_POPUP_SELECT_EDITABLE }, + { E_POPUP_ITEM, "10.new", N_("New Contact..."), new_card, NULL, "stock_contact", 0, EAB_POPUP_SELECT_EDITABLE}, + { E_POPUP_ITEM, "15.newlist", N_("New Contact List..."), new_list, NULL, "stock_contact-list", 0, EAB_POPUP_SELECT_EDITABLE }, { E_POPUP_BAR, "20.bar" }, - { E_POPUP_ITEM, "30.saveas", N_("Save as VCard..."), save_as, NULL, "stock_save-as", EAB_POPUP_SELECT_MANY }, - { E_POPUP_ITEM, "40.forward", N_("Forward Contact"), send_as, NULL, "stock_mail-forward", EAB_POPUP_SELECT_MANY }, - { E_POPUP_ITEM, "50.mailto", N_("Send Message to Contact"), send_to, NULL, "stock_mail-send", EAB_POPUP_SELECT_MANY|EAB_POPUP_SELECT_EMAIL }, - { E_POPUP_ITEM, "60.print", N_("Print"), print, NULL, "stock_print", EAB_POPUP_SELECT_MANY }, + { E_POPUP_ITEM, "30.saveas", N_("Save as VCard..."), save_as, NULL, "stock_save-as", 0, EAB_POPUP_SELECT_MANY }, + { E_POPUP_ITEM, "40.forward", N_("Forward Contact"), send_as, NULL, "stock_mail-forward", 0, EAB_POPUP_SELECT_MANY }, + { E_POPUP_ITEM, "50.mailto", N_("Send Message to Contact"), send_to, NULL, "stock_mail-send", 0, EAB_POPUP_SELECT_MANY|EAB_POPUP_SELECT_EMAIL }, + { E_POPUP_ITEM, "60.print", N_("Print"), print, NULL, "stock_print", 0, EAB_POPUP_SELECT_MANY }, { E_POPUP_BAR, "70.bar" }, - { E_POPUP_ITEM, "80.copyto", N_("Copy to Address Book..."), copy_to_folder, NULL, NULL, EAB_POPUP_SELECT_MANY }, - { E_POPUP_ITEM, "90.moveto", N_("Move to Address Book..."), move_to_folder, NULL, NULL, EAB_POPUP_SELECT_MANY|EAB_POPUP_SELECT_EDITABLE }, + { E_POPUP_ITEM, "80.copyto", N_("Copy to Address Book..."), copy_to_folder, NULL, NULL, 0, EAB_POPUP_SELECT_MANY }, + { E_POPUP_ITEM, "90.moveto", N_("Move to Address Book..."), move_to_folder, NULL, NULL, 0, EAB_POPUP_SELECT_MANY|EAB_POPUP_SELECT_EDITABLE }, { E_POPUP_BAR, "a0.bar" }, - { E_POPUP_BAR, "b0.cut", N_("Cut"), cut, NULL, "stock_cut", EAB_POPUP_SELECT_MANY|EAB_POPUP_SELECT_EDITABLE }, - { E_POPUP_ITEM, "c0.copy", N_("Copy"), copy, NULL, "stock_copy", EAB_POPUP_SELECT_MANY }, - { E_POPUP_ITEM, "d0.paste", N_("Paste"), paste, NULL, "stock_paste", EAB_POPUP_SELECT_EDITABLE }, - { E_POPUP_ITEM, "e0.delete", N_("Delete"), delete, NULL, "stock_delete", EAB_POPUP_SELECT_EDITABLE|EAB_POPUP_SELECT_MANY }, + { E_POPUP_BAR, "b0.cut", N_("Cut"), cut, NULL, "stock_cut", 0, EAB_POPUP_SELECT_MANY|EAB_POPUP_SELECT_EDITABLE }, + { E_POPUP_ITEM, "c0.copy", N_("Copy"), copy, NULL, "stock_copy", 0, EAB_POPUP_SELECT_MANY }, + { E_POPUP_ITEM, "d0.paste", N_("Paste"), paste, NULL, "stock_paste", 0, EAB_POPUP_SELECT_EDITABLE }, + { E_POPUP_ITEM, "e0.delete", N_("Delete"), delete, NULL, "stock_delete", 0, EAB_POPUP_SELECT_EDITABLE|EAB_POPUP_SELECT_MANY }, }; static void @@ -991,9 +991,7 @@ do_popup_menu(EABView *view, GdkEvent *event) e_popup_add_items((EPopup *)ep, menus, eabv_popup_free, contact_and_book); - /* visibility is disabled, we only disable menu items */ - /* FIXME: when enable is implemented in e-popup */ - menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0, t->target.mask); + menu = e_popup_create_menu_once((EPopup *)ep, (EPopupTarget *)t, 0); gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event?event->button.button:0, event?event->button.time:gtk_get_current_event_time()); } diff --git a/addressbook/gui/widgets/eab-popup-control.c b/addressbook/gui/widgets/eab-popup-control.c index 1e34cf4a18..10ef769632 100644 --- a/addressbook/gui/widgets/eab-popup-control.c +++ b/addressbook/gui/widgets/eab-popup-control.c @@ -48,7 +48,6 @@ #include <bonobo/bonobo-control.h> #include <bonobo/bonobo-property-bag.h> #include <bonobo/bonobo-generic-factory.h> -#include <gal/widgets/e-popup-menu.h> #include <addressbook/util/eab-book-util.h> #include <addressbook/gui/contact-editor/e-contact-editor.h> #include <addressbook/gui/contact-editor/e-contact-quick-add.h> diff --git a/addressbook/gui/widgets/eab-popup.c b/addressbook/gui/widgets/eab-popup.c index d2faa40fc5..92624cb4cd 100644 --- a/addressbook/gui/widgets/eab-popup.c +++ b/addressbook/gui/widgets/eab-popup.c @@ -65,6 +65,11 @@ eabp_target_free(EPopup *ep, EPopupTarget *t) g_object_unref(s->selector); break; } + case EAB_POPUP_TARGET_SELECT_NAMES: { + EABPopupTargetSelectNames *s = (EABPopupTargetSelectNames *)t; + + g_object_unref(s->model); + break; } } ((EPopupClass *)eabp_parent)->target_free(ep, t); @@ -189,6 +194,18 @@ eab_popup_target_new_source(EABPopup *eabp, ESourceSelector *selector) return t; } +EABPopupTargetSelectNames * +eab_popup_target_new_select_names(EABPopup *eabp, struct _ESelectNamesModel *model, int row) +{ + EABPopupTargetSelectNames *t = e_popup_target_new(&eabp->popup, EAB_POPUP_TARGET_SELECT_NAMES, sizeof(*t)); + + t->model = model; + g_object_ref(model); + t->row = row; + + return t; +} + /* ********************************************************************** */ /* Popup menu plugin handler */ @@ -231,9 +248,14 @@ static const EPopupHookTargetMask eabph_source_masks[] = { { 0 } }; +static const EPopupHookTargetMask eabph_select_names_masks[] = { + { 0 } +}; + static const EPopupHookTargetMap eabph_targets[] = { { "select", EAB_POPUP_TARGET_SELECT, eabph_select_masks }, { "source", EAB_POPUP_TARGET_SOURCE, eabph_source_masks }, + { "select-names", EAB_POPUP_TARGET_SELECT_NAMES, eabph_select_names_masks }, { 0 } }; diff --git a/addressbook/gui/widgets/eab-popup.h b/addressbook/gui/widgets/eab-popup.h index 996cf78d6d..39df885de5 100644 --- a/addressbook/gui/widgets/eab-popup.h +++ b/addressbook/gui/widgets/eab-popup.h @@ -45,6 +45,7 @@ typedef struct _EABPopupClass EABPopupClass; enum _eab_popup_target_t { EAB_POPUP_TARGET_SELECT, EAB_POPUP_TARGET_SOURCE, + EAB_POPUP_TARGET_SELECT_NAMES, }; /** @@ -77,6 +78,7 @@ enum _eab_popup_target_source_t { typedef struct _EABPopupTargetSelect EABPopupTargetSelect; typedef struct _EABPopupTargetSource EABPopupTargetSource; +typedef struct _EABPopupTargetSelectNames EABPopupTargetSelectNames; /** * struct _EABPopupTargetSelect - A list of address cards. @@ -109,6 +111,23 @@ struct _EABPopupTargetSource { struct _ESourceSelector *selector; }; +/** + * struct _EABPopupTargetSelectNames - A select names target. + * + * @target: Superclass. + * @model: Select names model. + * @row: Row of item selected. + * + * This target is used to represent an item selected in an + * ESelectNames model. + **/ +struct _EABPopupTargetSelectNames { + EPopupTarget target; + + struct _ESelectNamesModel *model; + int row; +}; + typedef struct _EPopupItem EABPopupItem; /* The object */ @@ -128,6 +147,7 @@ EABPopup *eab_popup_new(const char *menuid); EABPopupTargetSelect *eab_popup_target_new_select(EABPopup *eabp, struct _EBook *book, int readonly, GPtrArray *cards); EABPopupTargetSource *eab_popup_target_new_source(EABPopup *eabp, struct _ESourceSelector *selector); +EABPopupTargetSelectNames *eab_popup_target_new_select_names(EABPopup *eabp, struct _ESelectNamesModel *model, int row); /* ********************************************************************** */ |