]> granicus.if.org Git - handbrake/commitdiff
LinGui: Simplify some code in the hud compositor
authorjstebbins <jstebbins.hb@gmail.com>
Thu, 21 Apr 2011 16:01:54 +0000 (16:01 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Thu, 21 Apr 2011 16:01:54 +0000 (16:01 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3948 b64f7644-9d1e-0410-96f1-a4d463321fa5

gtk/src/ghbcompositor.c

index 7a05e58cd29ac54f1c847e5d3f4f39ea94b2ec49..b4054055f3462cedf8f9e2b59a92d64f43e5d1a8 100644 (file)
@@ -307,35 +307,26 @@ showtype(const gchar *msg, GtkWidget *widget)
 }
 #endif
 
-static GList*
-find_drawables(GList *drawables, GtkWidget *widget)
+static void
+find_drawables(GtkWidget *widget, gpointer data)
 {
+    GList *drawables, **pdrawables;
+    pdrawables = (GList**)data;
+    drawables = *pdrawables;
+
     if (gtk_widget_get_has_window(widget))
     {
         drawables = g_list_append(drawables, widget);
-        return drawables;
+        *pdrawables = drawables;
+        return;
     }
     if (GTK_IS_CONTAINER(widget))
     {
-        GList *children, *link;
-
-        children = gtk_container_get_children(GTK_CONTAINER(widget));
-        // Look for a child with a window
-        for (link = children; link != NULL; link = link->next)
-        {
-            if (gtk_widget_get_has_window(GTK_WIDGET(link->data)))
-            {
-                drawables = g_list_append(drawables, link->data);
-            }
-            else
-            {
-                drawables = find_drawables(drawables, GTK_WIDGET(link->data));
-            }
-        }
+        gtk_container_forall(GTK_CONTAINER(widget), find_drawables, data);
     }
-    return drawables;
 }
 
+
 /**
  * ghb_compositor_zlist_insert:
  * @compositor: a #GhbCompositor
@@ -378,7 +369,8 @@ ghb_compositor_zlist_insert (
     {
         GList *link;
 
-        cc->drawables = find_drawables(NULL, cc->widget);
+        cc->drawables = NULL;
+        find_drawables(cc->widget, &cc->drawables);
 
         for (link = cc->drawables; link != NULL; link = link->next)
         {