From bfdf1acff01f093907d88325149ddb2a7baaf83b Mon Sep 17 00:00:00 2001 From: Dmitry Kalyanov Date: Sun, 13 Sep 2009 16:05:13 +0400 Subject: [PATCH] Add GtkLinkbutton's set-uri-hook --- gtk/cl-gtk2-gtk.asd | 1 + gtk/gtk.link-button.lisp | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 gtk/gtk.link-button.lisp diff --git a/gtk/cl-gtk2-gtk.asd b/gtk/cl-gtk2-gtk.asd index 124c9e0..98e72a1 100644 --- a/gtk/cl-gtk2-gtk.asd +++ b/gtk/cl-gtk2-gtk.asd @@ -47,6 +47,7 @@ (:file "gtk.widget") (:file "gtk.builder") (:file "gtk.assistant") + (:file "gtk.link-button") (:file "gtk.main-loop-events") diff --git a/gtk/gtk.link-button.lisp b/gtk/gtk.link-button.lisp new file mode 100644 index 0000000..3c98331 --- /dev/null +++ b/gtk/gtk.link-button.lisp @@ -0,0 +1,30 @@ +(in-package :gtk) + +(defvar *link-button-uri-func* nil) + +(defcallback link-button-uri-func-cb :void + ((button (g-object link-button)) (link (:string :free-from-foreign nil)) (user-data :pointer)) + (declare (ignore user-data)) + (funcall *link-button-uri-func* button link)) + +(defcallback link-button-uri-func-destroy-cb :void + ((data :pointer)) + (declare (ignore data)) + (setf *link-button-uri-func* nil)) + +(defcfun gtk-link-button-set-uri-hook :void + (func :pointer) + (data :pointer) + (destroy-notify :pointer)) + +(defun (setf link-button-global-uri-hook) (new-value) + (if new-value + (gtk-link-button-set-uri-hook (callback link-button-uri-func-cb) + (null-pointer) + (callback link-button-uri-func-destroy-cb)) + (gtk-link-button-set-uri-hook (null-pointer) + (null-pointer) + (null-pointer))) + (setf *link-button-uri-func* new-value)) + +(export 'link-button-global-uri-hook) -- 1.7.10.4