Re: Pluggable widgets II



On Wed, 2006-12-20 at 15:34 +0100, Tim Janik wrote:
> > 	My point is that Foo would prefer if PanelMenu could automatically
> > sub-class FooGtkMenu rather than GtkMenu.
> 
> with Gtk+ and its object system, that is simply not technically possible.
> 

custom_menu_item_type = 
    g_type_register_static 
            (g_factory_get_appointed (GTK_TYPE_MENU_ITEM),
             "CustomMenuItem",
             &custom_menuitem_info, 0);

I've done some experimenting with subclassing of dynamic types
(or "types that may vary" for lack of better words).

In Glade, I use a GladeWidgetAdaptorClass to interface with the plugin,
the core proceeds to load C functions from the backend modules for each
supported class and then the core uses this to programaticly derive
the base adaptor class with dynamicly created subclasses - 
it been working fine.

At first thought, assuming that:
   g_type_is_a (g_factory_get_appointed (TYPE_FOO), TYPE_FOO);
(which Tim reassured me of in another email), then I believe
there should be no problems if the PanelMenuItem went ahead
and subclassed an appointed type directly - since that appointed
type must conform to the original type.

The remaining obvious problem however, is to ensure that the vendor did
in fact appoint its chosen type to the menu item *before* the
panelmenuitem goes ahead and registers its type. 

Cheers,
                        -Tristan





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