]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - contrib/brushexport/support.cpp
Merge branch 'master' into divVerent/farplanedist-sky-fix
[xonotic/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         GtkWidget *parent, *found_widget;
9
10         for (;; )
11         {
12                 if ( GTK_IS_MENU( widget ) ) {
13                         parent = gtk_menu_get_attach_widget( GTK_MENU( widget ) );
14                 }
15                 else{
16                         parent = widget->parent;
17                 }
18                 if ( !parent ) {
19                         parent = (GtkWidget*) g_object_get_data( G_OBJECT( widget ), "GladeParentKey" );
20                 }
21                 if ( parent == NULL ) {
22                         break;
23                 }
24                 widget = parent;
25         }
26
27         found_widget = (GtkWidget*) g_object_get_data( G_OBJECT( widget ),
28                                                                                                    widget_name );
29         if ( !found_widget ) {
30                 g_warning( "Widget not found: %s", widget_name );
31         }
32         return found_widget;
33 }