From 084a2d2e3d39e7b25a6101f125a37bb05b9caf81 Mon Sep 17 00:00:00 2001 From: Not Zed Date: Fri, 15 Oct 2004 07:36:53 +0000 Subject: added an any select mask and updated the hook maps. 2004-10-15 Not Zed * gui/widgets/eab-popup.c: added an any select mask and updated the hook maps. * gui/component/addressbook-component.c (addressbook_component_init): register the addressbook hooks. * gui/component/addressbook-view.c (addressbook_view_init): setup the menu manager. (control_activate_cb): activate the menu manager. (update_command_state): and update the menu manager. * gui/widgets/eab-menu.[ch]: Added menu manager class. svn path=/trunk/; revision=27589 --- addressbook/gui/component/addressbook-component.c | 10 ++++++++++ addressbook/gui/component/addressbook-view.c | 15 +++++++++++++++ 2 files changed, 25 insertions(+) (limited to 'addressbook/gui/component') diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c index befd07098d..9e71580d0b 100644 --- a/addressbook/gui/component/addressbook-component.c +++ b/addressbook/gui/component/addressbook-component.c @@ -31,6 +31,9 @@ #include "addressbook-view.h" #include "addressbook/gui/contact-editor/eab-editor.h" #include "addressbook/gui/widgets/eab-gui-util.h" +#include "e-util/e-plugin.h" +#include "addressbook/gui/widgets/eab-popup.h" +#include "addressbook/gui/widgets/eab-menu.h" #include "widgets/misc/e-task-bar.h" #include "widgets/misc/e-info-label.h" @@ -246,6 +249,7 @@ static void addressbook_component_init (AddressbookComponent *component) { AddressbookComponentPrivate *priv; + static int first = TRUE; priv = g_new0 (AddressbookComponentPrivate, 1); @@ -259,6 +263,12 @@ addressbook_component_init (AddressbookComponent *component) #ifdef ENABLE_SMIME smime_component_init (); #endif + + if (first) { + first = FALSE; + e_plugin_hook_register_type(eab_popup_hook_get_type()); + e_plugin_hook_register_type(eab_menu_hook_get_type()); + } } diff --git a/addressbook/gui/component/addressbook-view.c b/addressbook/gui/component/addressbook-view.c index bd5b3b3c1e..ef4a24b5e0 100644 --- a/addressbook/gui/component/addressbook-view.c +++ b/addressbook/gui/component/addressbook-view.c @@ -62,6 +62,7 @@ #include "addressbook/printing/e-contact-print.h" #include "addressbook/util/eab-book-util.h" #include "addressbook/gui/widgets/eab-popup.h" +#include "addressbook/gui/widgets/eab-menu.h" #define PARENT_TYPE G_TYPE_OBJECT static GObjectClass *parent_class = NULL; @@ -93,6 +94,8 @@ struct _AddressbookViewPrivate { ESourceList *source_list; char *passwd; EUserCreatableItemsHandler *creatable_items_handler; + + EABMenu *menu; }; enum DndTargetType { @@ -337,14 +340,20 @@ update_command_state (EABView *eav, AddressbookView *view) { AddressbookViewPrivate *priv = view->priv; BonoboUIComponent *uic; + EABMenuTargetSelect *target; if (eav != get_current_view (view)) return; g_object_ref (view); + target = eab_view_get_menu_target(eav, priv->menu); + e_menu_update_target((EMenu *)priv->menu, target); + uic = bonobo_control_get_ui_component (priv->folder_view_control); + /* TODO: this stuff can mostly be made to use the target bits instead */ + if (bonobo_ui_component_get_container (uic) != CORBA_OBJECT_NIL) { #define SET_SENSITIVE(verb,f) \ bonobo_ui_component_set_prop (uic, (verb), "sensitive", (f)(eav) ? "1" : "0", NULL) @@ -464,9 +473,11 @@ control_activate_cb (BonoboControl *control, if (activate) { control_activate (control, uic, view); + e_menu_activate((EMenu *)view->priv->menu, uic, activate); if (activate && v && v->model) eab_model_force_folder_bar_message (v->model); } else { + e_menu_activate((EMenu *)view->priv->menu, uic, activate); bonobo_ui_component_unset_container (uic, NULL); eab_view_discard_menus (v); } @@ -1087,6 +1098,7 @@ addressbook_view_init (AddressbookView *view) G_CALLBACK (source_list_changed_cb), view); priv->creatable_items_handler = e_user_creatable_items_handler_new ("contacts", NULL, NULL); + priv->menu = eab_menu_new("com.novell.evolution.addressbook.view"); g_signal_connect (priv->folder_view_control, "activate", G_CALLBACK (control_activate_cb), view); @@ -1176,6 +1188,9 @@ addressbook_view_dispose (GObject *object) if (priv->creatable_items_handler) g_object_unref (priv->creatable_items_handler); + if (priv->menu) + g_object_unref (priv->menu); + g_free (view->priv); view->priv = NULL; } -- cgit