Merge branch 'master' of ssh://git.xonotic.org/netradiant
[divverent/netradiant.git] / contrib / brushexport / support.cpp
1 #include <gtk/gtk.h>
2
3 #include "support.h"
4
5 GtkWidget*
6 lookup_widget                          (GtkWidget       *widget,
7                                         const gchar     *widget_name)
8 {
9   GtkWidget *parent, *found_widget;
10
11   for (;;)
12     {
13       if (GTK_IS_MENU (widget))
14         parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
15       else
16         parent = widget->parent;
17       if (!parent)
18         parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey");
19       if (parent == NULL)
20         break;
21       widget = parent;
22     }
23
24   found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
25                                                  widget_name);
26   if (!found_widget)
27     g_warning ("Widget not found: %s", widget_name);
28   return found_widget;
29 }
30
31