Add GtkLinkbutton's set-uri-hook
authorDmitry Kalyanov <Kalyanov.Dmitry@gmail.com>
Sun, 13 Sep 2009 12:05:13 +0000 (16:05 +0400)
committerDmitry Kalyanov <Kalyanov.Dmitry@gmail.com>
Sun, 13 Sep 2009 12:05:13 +0000 (16:05 +0400)
gtk/cl-gtk2-gtk.asd
gtk/gtk.link-button.lisp [new file with mode: 0644]

index 124c9e0..98e72a1 100644 (file)
@@ -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 (file)
index 0000000..3c98331
--- /dev/null
@@ -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)