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

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

g-io-add-watch, GIOFunc?


From: Jan Nieuwenhuizen
Subject: g-io-add-watch, GIOFunc?
Date: Thu, 21 Oct 2004 11:28:18 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

Hi,

What is a GIOFunc?  I can't seem to satisfy g-io-add-watch's function
parameter

    (define-function g_io_add_watch
      (c-name "g_io_add_watch")
      (return-type "guint")
      (parameters
        '("GIOChannel*" "channel")
        '("GIOCondition" "condition")
        '("GIOFunc" "func")
        '("gpointer" "user_data")
      )
    )

whatever lambda I use, gets me something like

    $ echo hallo > ~/.keywise/bindings
    Backtrace:
    In unknown file:
       ?: 0* [init-ipc]
       ?: 1  (let ((channel #)) (g-io-add-watch channel (quote in) ...))
       ?: 2  [#<gw:dynproc g-io-add-watch (4)> #<gw:wcp <gio-channel*> 
0x81a9970> in ...]

    <unnamed port>: In procedure g-io-add-watch in expression (g-io-add-watch 
channel (quote in) ...):
    <unnamed port>: Wrong type argument in position 3: #<procedure 
bindings-callback (source condition data)>
    [1]+  Exit 2                  guile -s ./usr/src/scm/ugh.scm

Jan.


#! /usr/bin/guile -s
!#

(debug-enable 'debug)
(debug-enable 'backtrace)

(define RUNDIR (string-append (getenv "HOME") "/.keywise"))
(define BINDINGS-FIFO (string-append RUNDIR "/bindings"))

(use-modules (ice-9 format)
             (srfi srfi-1)
             (srfi srfi-2)
             (srfi srfi-13))

;; Hmm
(define list-remove remove)

(use-modules (gnome gtk)
             (gnome gtk gdk-event)
             (gnome gw wnck))


(define (bindings-callback source condition data)
  (stderr "FIFO\n")
  (stderr (g-io-channel-read-line source))
  #t)

(define (init-ipc)
  (if (not (access? BINDINGS-FIFO F_OK))
      (begin
        (if (not (access? RUNDIR F_OK))
            (mkdir RUNDIR #o700))
        (mknod BINDINGS-FIFO 'fifo #o600 0)))
  (let (;;(xchannel (make <g-io-channel>))
        ;;(channel (g-io-channel-new-file BINDINGS-FIFO "r" #f)))
        (channel (g-io-channel-new-file BINDINGS-FIFO)))
    (g-io-add-watch channel 'in bindings-callback #f)
    ;;(g-io-add-watch channel 'in (lambda (x y z) (bindings-callback x y z)) #f)
    ;;(g-io-add-watch channel 'in (lambda (x y) (bindings-callback x y #f)) #f)
    ;;(g-io-add-watch channel 'in (lambda (x) (bindings-callback x #f #f)) #f)
    ))
(init-ipc)
(gtk-main)


-- 
Jan Nieuwenhuizen <address@hidden> | GNU LilyPond - The music typesetter
http://www.xs4all.nl/~jantien       | http://www.lilypond.org




reply via email to

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