right-click menus and "reverse" menu merging




Darin Adler writes:
 > In Nautilus, I think there may be some cases where we want application-wide
 > menu items to appear in the right-click "context menu". Is there any way to
 > do this kind of "reverse" menu merging with Bonobo?

    I guess the idea is that you right-click on a component, and you
want the main application to have a chance to merge items in, right?

    This is doable.  There's no facility in-place specifically for
this, but you want to do it something like this:

Component
---------

    uih = bonobo_ui_handler_new ();

    Nautilus_Toplevel_merge_global_context_menus (
        my_toplevel, bonobo_object_corba_objref (BONOBO_OBJECT (uih)), 
        &ev);

    ... then add your local menu items to the uih ...

    bonobo_ui_handler_do_popup_menu (uih); 


Container
---------

static void
impl_Nautilus_Toplevel_merge_global_context_menus
       (PortableServer_Servant  servant,
        Bonobo_UIHandler        context_uih,
        CORBA_Environment      *ev)
{
        BonoboUIHandler *uih;


        uih = bonobo_ui_handler_new ();
        bonobo_ui_handler_set_container (uih, context_uih);

        ... merge the global menus ...
}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]