X-Git-Url: https://git.draconx.ca/gitweb/gob-dx.git/blobdiff_plain/486240dc4c5d57b0afaddba60d87fe375112bed5..c9914e54f16c3315d47040f4cca2d3788228c504:/examples/gtk-button-count.gob diff --git a/examples/gtk-button-count.gob b/examples/gtk-button-count.gob index d0bf595..9061c5c 100644 --- a/examples/gtk-button-count.gob +++ b/examples/gtk-button-count.gob @@ -32,7 +32,9 @@ class Gtk:Button:Count from Gtk:Button { GtkWidget * new(void) { - return GTK_WIDGET(GET_NEW); + /* It's ok to use a normal cast here, as we are sure that we + * have gotten the right type */ + return (GtkWidget *)GET_NEW; } /** @@ -47,7 +49,13 @@ class Gtk:Button:Count from Gtk:Button { GtkWidget * new_with_label(char *label (check null)) onerror NULL { - return GTK_WIDGET(GET_NEW); + /* It's ok to use a normal cast here, as we are sure that we + * have gotten the right type */ + GtkWidget *widget = (GtkWidget *)GET_NEW; + GtkWidget *label_widget = gtk_label_new(label); + gtk_container_add(GTK_CONTAINER(widget), label_widget); + gtk_widget_show(label_widget); + return widget; } override (Gtk:Button)