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

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

Re: guile-gnome0 - unexplained GTK crashes since +- 10 days


From: Andy Wingo
Subject: Re: guile-gnome0 - unexplained GTK crashes since +- 10 days
Date: Wed, 31 Jan 2007 15:13:21 +0100

Hi David,

On Wed, 2007-01-31 at 11:49 +0100, David Pirotte wrote:
>       (if parent
>           (gtk-window-set-transient-for <the-dialog> parent))
>       (set-modal <the-dialog> #t)
>         ...
>       (show-all <the-dialog>)
>       (gtk-widget-map <the-dialog>)

This is incorrect; as the gtk docs mention, gtk_widget_map is only for
use within widget implementations. gtk-widget-show is sufficient. If you
want a modal "pick-a-file" behavior you will want to use gtk-dialog-run.

To destroy a window, you should use gtk-object-destroy (bound to the
`destroy' generic iirc).

An example of the usage of the file chooser can be found here:
http://developer.gnome.org/doc/API/2.0/gtk/GtkFileChooserDialog.html

Also,

;; throws the 'cancel exception if the user deletes the window or
;; presses cancel
(define (prompt-for-file-name parent-window window-title mode default-file-name)
  "Asks the user for a file name. Might throw @code{cancel}."
  (let ((w (make <gtk-file-chooser-dialog>
             :action mode :title window-title :destroy-with-parent #t)))
    (if parent-window
        (set-transient-for w parent-window))
    (if default-file-name
        (set-filename w default-file-name))
    (for-each
     (lambda (id)
       (add-button w (gtk-stock-id id)
                   (genum->value (make <gtk-response-type> :value id))))
     '(cancel ok))
    (show w)
    (let* ((response (genum->symbol
                     (make <gtk-response-type> :value (run w))))
           (filename (get-filename w)))
      (hide w)
      (destroy w)
      (case response
        ((ok) filename)
        ((cancel delete-event) (throw 'cancel))
        (else #f)))))

Cheers,

Andy
-- 
http://wingolog.org/





reply via email to

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