cropper
diff interface.c @ 15:7dbf3879939a
removed support.*
author | meillo@marmaro.de |
---|---|
date | Thu, 04 Mar 2010 19:16:10 +0100 |
parents | da18f2d4f92f |
children | 88b8856fccf5 |
line diff
1.1 --- a/interface.c Thu Mar 04 18:31:28 2010 +0100 1.2 +++ b/interface.c Thu Mar 04 19:16:10 2010 +0100 1.3 @@ -10,7 +10,6 @@ 1.4 1.5 #include "main.h" 1.6 #include "callbacks.h" 1.7 -#include "support.h" 1.8 1.9 #define GLADE_HOOKUP_OBJECT(component,widget,name) \ 1.10 g_object_set_data_full(G_OBJECT(component), name, \ 1.11 @@ -19,6 +18,43 @@ 1.12 #define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \ 1.13 g_object_set_data(G_OBJECT(component), name, widget) 1.14 1.15 + 1.16 +/* 1.17 + * This function returns a widget in a component created by Glade. 1.18 + * Call it with the toplevel widget in the component (i.e. a window/dialog), 1.19 + * or alternatively any widget in the component, and the name of the widget 1.20 + * you want returned. 1.21 + */ 1.22 +GtkWidget* 1.23 +lookup_widget(GtkWidget* widget, const gchar* widget_name) 1.24 +{ 1.25 + GtkWidget* parent; 1.26 + GtkWidget* found_widget; 1.27 + 1.28 + for (;;) { 1.29 + if (GTK_IS_MENU(widget)) { 1.30 + parent = gtk_menu_get_attach_widget(GTK_MENU(widget)); 1.31 + } else { 1.32 + parent = widget->parent; 1.33 + } 1.34 + if (!parent) { 1.35 + parent = (GtkWidget*) g_object_get_data(G_OBJECT(widget), "GladeParentKey"); 1.36 + } 1.37 + if (parent == NULL) { 1.38 + break; 1.39 + } 1.40 + widget = parent; 1.41 + } 1.42 + 1.43 + found_widget = (GtkWidget*) g_object_get_data(G_OBJECT(widget), widget_name); 1.44 + if (!found_widget) { 1.45 + g_warning("Widget not found: %s", widget_name); 1.46 + } 1.47 + return found_widget; 1.48 +} 1.49 + 1.50 + 1.51 + 1.52 GtkWidget* 1.53 create_cropper_window(void) 1.54 {