static GtkWidget * labeled_image_new (const char *text, const char *icon_name) { GtkWidget *image; GdkPixbuf *pixbuf = NULL; if (icon_name) { float sizes[] = { 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0 }; pixbuf = test_pixbuf_new_named (icon_name, sizes[random () % G_N_ELEMENTS (sizes)]); } image = eel_labeled_image_new (text, pixbuf); eel_gdk_pixbuf_unref_if_not_null (pixbuf); return image; }
int main (int argc, char* argv[]) { GtkWidget *labeled_image_window = NULL; GtkWidget *labeled_image_button_window = NULL; GdkPixbuf *pixbuf = NULL; test_init (&argc, &argv); if (1) pixbuf = test_pixbuf_new_named (pixbuf_name, 1.0); if (1) labeled_image_button_window = labeled_image_button_window_new ("LabeledImage in GtkButton Test", pixbuf); eel_gdk_pixbuf_unref_if_not_null (pixbuf); if (labeled_image_window) gtk_widget_show (labeled_image_window); if (labeled_image_button_window) gtk_widget_show (labeled_image_button_window); gtk_main (); return test_quit (EXIT_SUCCESS); }