Re: [GtkGLExt] GtkGLExt in a Mozilla plug-in



On Thu, 2004-12-02 at 21:36 +1300, Alif Wahid wrote:

[snip]

> Now we're just dynamically determining whether a given typename has
> already been registered or not. The call to g_type_from_name(...)
> function will return a 0 if the type has not been registered yet. It
> will also work across dynamic module load --> unload --> reload cycles
> since it is a query to the central GObject dynamic module, which is
> separate from GtkGLExt module.

It would need to be something like this (assuming the basic approach is
valid):

        GType
        user_defined_class_get_type (void)
        {
          static GType type = 0;
        
          if (!type)
            {
              type = g_type_from_name("UserDefinedClass");
            }
        
          if (!type)
            {
              /** fill in a GTypeInfo structure and register it with the type system **/
              static const GTypeInfo type_info = {
                sizeof (user_defined_class),
                (GBaseInitFunc) NULL,
                (GBaseFinalizeFunc) NULL,
                (GClassInitFunc) user_defined_class_init,
                (GClassFinalizeFunc) NULL,
                NULL,                   /* class_data */
                sizeof (user_defined_class),
                0,                      /* n_preallocs */
                (GInstanceInitFunc) NULL
              };
        
              type = g_type_register_static (G_TYPE_OBJECT,
                                             "UserDefinedClass",
                                             &type_info, 0);
            }
        
          return type;
        }

In the event that you do get the type via g_type_from_name, you want to
set the static variable and return a valid GType pointer.

I've tried checking GtkGLExt out of CVS and making this modification.
However, po/Makefile.in.in doesn't like my version of autotools. (What
$(mkinstalldirs) resolves to has changed in a way that is incompatible
with how it is used here.) What do I need to do to update this file? I
tried gettextize; but that added a rather large number of files that
didn't exist previously.

-- 
Braden McDaniel                           e-mail: <braden endoframe com>
<http://endoframe.com>                    Jabber: <braden jabber org>




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