[glade3] * gladeui/glade-utils.[ch], gladeui/glade-widget.c, gladeui/glade-builtins.c, gladeui/glade-widget



commit 6737be898cadd1e26f54e9888df5b17ba62cae8a
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sat Jan 8 16:17:45 2011 +0900

    	* gladeui/glade-utils.[ch], gladeui/glade-widget.c, gladeui/glade-builtins.c,
    	gladeui/glade-widget-adaptor.c, gladeui/glade-editor-property.c:
    	Removed glade_util_class_implements_interface() in favor of g_type_is_a() (closes bug 455734).

 ChangeLog                       |    8 +++++++-
 gladeui/glade-builtins.c        |   10 ++--------
 gladeui/glade-editor-property.c |    8 +++-----
 gladeui/glade-utils.c           |   27 ---------------------------
 gladeui/glade-utils.h           |    4 ----
 gladeui/glade-widget-adaptor.c  |    2 +-
 gladeui/glade-widget.c          |    8 ++------
 7 files changed, 15 insertions(+), 52 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ac972bf..79ce51c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-01-08  Tristan Van Berkom <tristanvb openismus com>
+
+	* gladeui/glade-utils.[ch], gladeui/glade-widget.c, gladeui/glade-builtins.c,
+	gladeui/glade-widget-adaptor.c, gladeui/glade-editor-property.c:
+	Removed glade_util_class_implements_interface() in favor of g_type_is_a() (closes bug 455734).
+
 2011-01-07  Emilio Pozuelo Monfort <pochu27 gmail com>
 
 	* configure.ac: Bump the minimum GTK+ version to 2.99.0.
@@ -12,7 +18,7 @@
 	* data/glade.desktop.in.in: Execute 'glade' since that's the name
 	of the binary now.
 
-2011-01-06  Tristan Van Berkom <tristanvb openismus com>
+2011-01-07  Tristan Van Berkom <tristanvb openismus com>
 
 	* gladeui/glade-inspector.c: Updated to use GtkStyleContext to set the italic &
 	insensitive color for the < search widgets > entry.
diff --git a/gladeui/glade-builtins.c b/gladeui/glade-builtins.c
index 62f8b5b..48a5a2b 100644
--- a/gladeui/glade-builtins.c
+++ b/gladeui/glade-builtins.c
@@ -395,15 +395,9 @@ param_objects_validate (GParamSpec * pspec, GValue * value)
     {
       object = list->data;
 
-      if (G_TYPE_IS_INTERFACE (ospec->type) &&
-          glade_util_class_implements_interface
-          (G_OBJECT_TYPE (object), ospec->type) == FALSE)
+      if (!(G_OBJECT_TYPE (object) == ospec->type ||
+	    g_type_is_a (G_OBJECT_TYPE (object), ospec->type)))
         toremove = g_list_prepend (toremove, object);
-      else if (G_TYPE_IS_INTERFACE (ospec->type) == FALSE &&
-               g_type_is_a (G_OBJECT_TYPE (object), ospec->type) == FALSE)
-        toremove = g_list_prepend (toremove, object);
-
-
     }
 
   for (list = toremove; list; list = list->next)
diff --git a/gladeui/glade-editor-property.c b/gladeui/glade-editor-property.c
index de04ced..c37c634 100644
--- a/gladeui/glade-editor-property.c
+++ b/gladeui/glade-editor-property.c
@@ -2480,13 +2480,11 @@ glade_eprop_object_populate_view_real (GtkTreeStore * model,
         {
 	  adaptor = glade_widget_get_adaptor (widget);
 
-          has_decendant = !parentless && glade_widget_has_decendant
-              (widget, object_type);
+          has_decendant = 
+	    !parentless && glade_widget_has_decendant (widget, object_type);
 
           good_type = (glade_widget_adaptor_get_object_type (adaptor) == object_type ||
-                       g_type_is_a (glade_widget_adaptor_get_object_type (adaptor), object_type) ||
-                       glade_util_class_implements_interface (glade_widget_adaptor_get_object_type (adaptor),
-                                                              object_type));
+                       g_type_is_a (glade_widget_adaptor_get_object_type (adaptor), object_type));
 
           if (parentless)
             good_type = good_type && !GWA_IS_TOPLEVEL (adaptor);
diff --git a/gladeui/glade-utils.c b/gladeui/glade-utils.c
index b217517..afe0324 100644
--- a/gladeui/glade-utils.c
+++ b/gladeui/glade-utils.c
@@ -1179,33 +1179,6 @@ glade_util_copy_file (const gchar * src_path, const gchar * dest_path)
   return success;
 }
 
-/**
- * glade_util_class_implements_interface:
- * @class_type: A #GType
- * @iface_type: A #GType
- *
- * Returns: whether @class_type implements the @iface_type interface
- */
-gboolean
-glade_util_class_implements_interface (GType class_type, GType iface_type)
-{
-  GType *ifaces;
-  guint n_ifaces, i;
-  gboolean implemented = FALSE;
-
-  if ((ifaces = g_type_interfaces (class_type, &n_ifaces)) != NULL)
-    {
-      for (i = 0; i < n_ifaces; i++)
-        if (ifaces[i] == iface_type)
-          {
-            implemented = TRUE;
-            break;
-          }
-      g_free (ifaces);
-    }
-  return implemented;
-}
-
 static GModule *
 try_load_library (const gchar * library_path, const gchar * library_name)
 {
diff --git a/gladeui/glade-utils.h b/gladeui/glade-utils.h
index 17a0c13..357100a 100644
--- a/gladeui/glade-utils.h
+++ b/gladeui/glade-utils.h
@@ -98,10 +98,6 @@ gchar            *glade_util_canonical_path        (const gchar  *path);
 gboolean          glade_util_copy_file             (const gchar  *src_path,
 						    const gchar  *dest_path);
 
-gboolean          glade_util_class_implements_interface (GType class_type, 
-							 GType iface_type);
-
-
 GModule          *glade_util_load_library          (const gchar  *library_name);
 
 
diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c
index 3872c21..1e33631 100644
--- a/gladeui/glade-widget-adaptor.c
+++ b/gladeui/glade-widget-adaptor.c
@@ -337,7 +337,7 @@ gwa_list_signals (GladeWidgetAdaptor * adaptor, GType real_type)
 
       /* Add class interfaces signals */
       for (i = p = g_type_interfaces (type, NULL); *i; i++)
-        if (!glade_util_class_implements_interface (parent, *i))
+        if (!g_type_is_a (parent, *i))
           gwa_add_signals (adaptor, &signals, *i);
 
       g_free (p);
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index 4fd181d..927ea4e 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -3680,12 +3680,8 @@ glade_widget_has_decendant (GladeWidget * widget, GType type)
   GList *children, *l;
   gboolean found = FALSE;
 
-  if (G_TYPE_IS_INTERFACE (type) &&
-      glade_util_class_implements_interface 
-      (glade_widget_adaptor_get_object_type (widget->priv->adaptor), type))
-    return TRUE;
-  else if (G_TYPE_IS_INTERFACE (type) == FALSE &&
-           g_type_is_a (glade_widget_adaptor_get_object_type (widget->priv->adaptor), type))
+  if (glade_widget_adaptor_get_object_type (widget->priv->adaptor) == type ||
+      g_type_is_a (glade_widget_adaptor_get_object_type (widget->priv->adaptor), type))
     return TRUE;
 
   if ((children = glade_widget_adaptor_get_children



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