radiant/build menu: reword Commandline as Command line
[xonotic/netradiant.git] / contrib / brushexport / support.cpp
1 #include <gtk/gtk.h>
2 #include <uilib/uilib.h>
3
4 #include "support.h"
5
6 ui::Widget
7 lookup_widget(ui::Widget       widget,
8                            const gchar     *widget_name ){
9     ui::Widget parent{ui::null};
10
11         for (;; )
12         {
13                 if ( GTK_IS_MENU( widget ) ) {
14                         parent = ui::Widget::from(gtk_menu_get_attach_widget( GTK_MENU( widget ) ));
15                 }
16                 else{
17                         parent = ui::Widget::from(gtk_widget_get_parent(widget));
18                 }
19                 if ( !parent ) {
20                         parent = ui::Widget::from(g_object_get_data( G_OBJECT( widget ), "GladeParentKey" ));
21                 }
22                 if ( parent == NULL ) {
23                         break;
24                 }
25                 widget = parent;
26         }
27
28         auto found_widget = ui::Widget::from(g_object_get_data( G_OBJECT( widget ), widget_name ));
29         if ( !found_widget ) {
30                 g_warning( "Widget not found: %s", widget_name );
31         }
32         return found_widget;
33 }