New basic implementation of GTypePlugin interface as a GObject.
authorOwen Taylor <otaylor@redhat.com>
Sat, 11 Nov 2000 00:03:19 +0000 (00:03 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Sat, 11 Nov 2000 00:03:19 +0000 (00:03 +0000)
Sun Nov  5 13:21:28 2000  Owen Taylor  <otaylor@redhat.com>

* Makefile.am gtypemodule.[ch]: New basic implementation of
GTypePlugin interface as a GObject. Dynamically loaded modules can
register any number of types and interface on the module.

gobject/ChangeLog
gobject/Makefile.am
gobject/gtype.c
gobject/gtype.h

index dd8c8aea186be73c66f11816f24075e0e0abb2bf..f8a0f7996a6ff809fab935272f3f3926d64eac2d 100644 (file)
@@ -1,3 +1,9 @@
+Sun Nov  5 13:21:28 2000  Owen Taylor  <otaylor@redhat.com>
+
+       * Makefile.am gtypemodule.[ch]: New basic implementation of
+       GTypePlugin interface as a GObject. Dynamically loaded modules can
+       register any number of types and interface on the module.
+
 Sun Nov  5 10:25:40 2000  Owen Taylor  <otaylor@redhat.com>
 
        * gsignal.c (handlers_find): When appending handlers and
index 4b8e658c2fbcb74ec69d13b9c3b11362f6ad7495..44f7b472071ec496700b89940b3e232670c446b4 100644 (file)
@@ -32,6 +32,7 @@ gobject_public_h_sources = @STRIP_BEGIN@ \
        gparamspecs.h \
        gsignal.h \
        gtype.h \
+       gtypemodule.h \
        gtypeplugin.h \
        gvalue.h \
        gvaluecollector.h \
@@ -52,6 +53,7 @@ gobject_c_sources = @STRIP_BEGIN@ \
        gparamspecs.c \
        gsignal.c \
        gtype.c \
+       gtypemodule.c \
        gtypeplugin.c \
        gvalue.c \
        gvaluetypes.c \
index a288b657bc006ae0fd47d8c2a5173f34b9af9018..7924d878012b09429666087c1bc22cee4431cd13 100644 (file)
@@ -1910,6 +1910,32 @@ g_type_get_plugin (GType type)
   return node ? node->plugin : NULL;
 }
 
+GTypePlugin*
+g_type_interface_get_plugin (GType instance_type,
+                            GType interface_type)
+{
+  TypeNode *node = LOOKUP_TYPE_NODE (instance_type);  
+  TypeNode *iface = LOOKUP_TYPE_NODE (interface_type);
+  IFaceHolder *iholder;
+
+  g_return_val_if_fail (node == NULL, NULL);
+  g_return_val_if_fail (iface == NULL, NULL);
+  g_return_val_if_fail (G_TYPE_IS_INTERFACE (interface_type), NULL);
+  
+  iholder = iface->private.iface_conformants;
+  
+  while (iholder && iholder->instance_type != instance_type)
+    iholder = iholder->next;
+
+  if (!iholder)
+    {
+      g_warning (G_STRLOC ": Attempt to look up plugin for invalid instance/interface type pair.");
+      return NULL;
+    }
+
+  return iholder->plugin;
+}
+
 GType
 g_type_fundamental_last (void)
 {
index bbef767cfc9da9985341fa75783c289597a01ee0..89ecd96a3333999367b333fe6ef5f1480dcbe794 100644 (file)
@@ -295,6 +295,9 @@ void  g_type_add_interface_dynamic (GType                       instance_type,
 
 /* --- protected (for fundamental type implementations) --- */
 GTypePlugin*    g_type_get_plugin              (GType               type);
+GTypePlugin*    g_type_interface_get_plugin    (GType               instance_type,
+                                                GType               implementation_type);
+
 GType           g_type_fundamental_last        (void);
 gboolean         g_type_check_flags             (GType               type,
                                                 guint               flags);