[template-glib] eval: resolve GObject Introspection functions from interfaces



commit 1084904acfcd4b52be26e14ba9a8c6152eebc5fa
Author: Christian Hergert <chergert redhat com>
Date:   Sat Aug 6 12:48:30 2016 -0700

    eval: resolve GObject Introspection functions from interfaces
    
    We were only resolving functions found in the classes themselves. When
    resolving, we also need to look at the interfaces for each object type.

 src/tmpl-expr-eval.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/tmpl-expr-eval.c b/src/tmpl-expr-eval.c
index d9f41cd..6a018ff 100644
--- a/src/tmpl-expr-eval.c
+++ b/src/tmpl-expr-eval.c
@@ -569,6 +569,8 @@ tmpl_expr_gi_call_eval (TmplExprGiCall  *node,
 
   while (g_type_is_a (type, G_TYPE_OBJECT))
     {
+      guint n_ifaces;
+
       base_info = g_irepository_find_by_gtype (repository, type);
 
       if (base_info == NULL)
@@ -585,6 +587,19 @@ tmpl_expr_gi_call_eval (TmplExprGiCall  *node,
       if (function != NULL)
         break;
 
+      /* Maybe the function is found in an interface */
+      n_ifaces = g_object_info_get_n_interfaces ((GIObjectInfo *)base_info);
+      for (i = 0; function == NULL && i < n_ifaces; i++)
+        {
+          GIInterfaceInfo *iface_info;
+
+          iface_info = g_object_info_get_interface ((GIObjectInfo *)base_info, i);
+
+          function = g_interface_info_find_method (iface_info, node->name);
+        }
+      if (function != NULL)
+        break;
+
       type = g_type_parent (type);
     }
 


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