guile-gtk-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: inline image


From: Tomas By
Subject: Re: inline image
Date: Thu, 14 Nov 2013 20:33:25 +0100
User-agent: SquirrelMail/1.4.18

Hi again,

I have now discovered, after some experimentation, NOT by reading it in
the documentation, that I need to use "pkg-config guile-gnome-gtk-2"
instead.

It compiles and links fine. I have (t01 is the inline image):

static GdkPixbuf* get_pixmap(char* name) {
  GdkPixbuf* p;
  GError *err = NULL;
  if (strcmp(name,"test") == 0) {
    p = gdk_pixbuf_new_from_inline(-1,t01,FALSE,&err);
    if (p == NULL) {
      printf("NULL\n");
    }
    if (err != NULL) {
      fprintf(stderr,"%s\n",err->message);
      g_error_free(err);
    }
    return p;
  } else {
    return NULL;
  }
}

and then:

SCM pixmap_wrapper(SCM o1) {
  if (scm_is_string(o1)) {
    char* s;
    GdkPixbuf* p;
    SCM pixmap;
    scm_dynwind_begin(0);
    s = scm_to_locale_string(o1);
    scm_dynwind_free(s);
    p = get_pixmap(s);
    scm_dynwind_end();
    if (p == NULL) {
      return SCM_BOOL_F;
    } else {
      return (SCM)scm_c_gvalue_to_scm((GValue*)p);
    }
  } else {
    scm_wrong_type_arg("get-pixmap",1,o1);
  }
}

when trying it this happens:

| guile> (get-pixmap "test")
|
| (process:8408): GLib-CRITICAL **: g_hash_table_lookup: assertion
'hash_table != NULL' failed
|
| (process:8408): GLib-CRITICAL **: g_hash_table_lookup: assertion
'hash_table != NULL' failed
|
| (process:8408): GLib-GObject-CRITICAL **: g_type_get_qdata: assertion
'node != NULL' failed

I assume I need to call some bookkeeping procedure on the GdkPixbuf before
converting to Scheme, or something like that.

Any help appreciated.

/Tomas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]