Ahh I see where the problem was...

This commit is contained in:
Markus Koch 2016-06-06 20:56:44 +02:00
parent d909c40c13
commit bef6d005ce
3 changed files with 6 additions and 19 deletions

View File

@ -30,7 +30,6 @@ int buildWindow() {
// CUSTOM!!!!!
ki = kona_image_new();
temp = PreviewWidget_new(ki);
g_signal_connect(ki, "notify::previewFile", (GCallback)previewImage_update_preview_from_konaImage, temp);
gtk_flow_box_insert(GTK_FLOW_BOX(previewLayout),temp,0);
gtk_widget_show(temp);
// -------------------
@ -38,7 +37,6 @@ int buildWindow() {
gtk_widget_show(previewLayout);
gtk_container_add(GTK_CONTAINER(previewContainer), previewLayout);

View File

@ -10,14 +10,9 @@ void kona_download_image( GtkWidget *widget, gpointer data )
}
void PreviewWidget_set_image(PreviewWidget *widget, gchar *url) {
//GtkWidget *w;
GList *widgets;
int height, width;
float iheight, iwidth;
widgets = gtk_container_get_children(GTK_CONTAINER(widget));
//w = widgets->data; // Grab GtkImage
GdkPixbuf *p, *ps;
p = gdk_pixbuf_new_from_file(url, NULL);
iheight = (float) gdk_pixbuf_get_height(p);
@ -105,12 +100,10 @@ void PreviewWidget_init(PreviewWidget *klass)
GtkWidget *PreviewWidget_new(KonaImage* ki)
{
PreviewWidget* w = g_object_new (TYPE_PREVIEWWIDGET, "ki", ki, NULL);
printf("c_pv=%p\n", w);
//g_signal_connect(ki, "notify::previewFile", (GCallback)previewImage_update_preview_from_konaImage, w);
return w;
g_signal_connect(ki, "notify::previewFile", (GCallback)previewImage_update_preview_from_konaImage, w);
return GTK_WIDGET(w);
}
// TODO: DESTROY etc.
void debugfoo(GtkButton *widget, GtkImage *img)
@ -122,14 +115,10 @@ void debugfoo(GtkButton *widget, GtkImage *img)
// CALLBACKS FROM KONAIMAGE
void previewImage_update_preview_from_konaImage( KonaImage *ki, PreviewWidget *pv)
void previewImage_update_preview_from_konaImage( KonaImage *ki, guint propId, PreviewWidget *pv)
{
GValue val = G_VALUE_INIT;
g_value_init(&val, G_TYPE_STRING);
g_object_get_property(ki, "previewFile", &val);
printf("SET IMAGE TO: %s\n", g_value_get_string(&val));
printf("h_pv=%p\n", pv);
gtk_widget_set_visible(pv->image, TRUE);
//PreviewWidget_set_image(pv, "hi");
g_object_get_property(G_OBJECT(ki), "previewFile", &val);
PreviewWidget_set_image(pv, g_value_get_string(&val));
}

View File

@ -38,7 +38,7 @@ void debugfoo(GtkButton *widget, GtkImage* img);
// CALLBACKS FROM KONAIMAGE
void previewImage_update_preview_from_konaImage( KonaImage *ki, PreviewWidget *pv);
void previewImage_update_preview_from_konaImage(KonaImage *ki, guint propId, PreviewWidget *pv);
G_END_DECLS