added GtkAboutDialog hooks
authorAndrey Kutejko <andy128k@gmail.com>
Sun, 15 Aug 2010 11:08:33 +0000 (14:08 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Sun, 15 Aug 2010 11:08:33 +0000 (14:08 +0300)
gtk/cl-gtk2-gtk.asd
gtk/gtk.about-dialog.lisp [new file with mode: 0644]

index c825c29..3d09695 100644 (file)
@@ -24,6 +24,7 @@
                (:file "gtk.functions")
                (:file "gtk.base-classes")
                (:file "gtk.dialog")
+               (:file "gtk.about-dialog")
                (:file "gtk.window")
                (:file "gtk.window-group")
                (:file "gtk.icon-factory")
diff --git a/gtk/gtk.about-dialog.lisp b/gtk/gtk.about-dialog.lisp
new file mode 100644 (file)
index 0000000..2d36cdc
--- /dev/null
@@ -0,0 +1,60 @@
+(in-package :gtk)
+
+(defvar *about-dialog-url-func* nil)
+
+(defcallback about-dialog-url-func-cb :void
+  ((dialog (g-object about-dialog)) (link (:string :free-from-foreign nil)) (user-data :pointer))
+  (declare (ignore user-data))
+  (funcall *about-dialog-url-func* dialog link))
+
+(defcallback about-dialog-url-func-destroy-cb :void
+  ((data :pointer))
+  (declare (ignore data))
+  (setf *about-dialog-url-func* nil))
+
+(defcfun gtk-about-dialog-set-url-hook :void
+  (func :pointer)
+  (data :pointer)
+  (destroy-notify :pointer))
+
+(defun (setf about-dialog-global-url-hook) (new-value)
+  (if new-value
+      (gtk-about-dialog-set-url-hook (callback about-dialog-url-func-cb)
+                                    (null-pointer)
+                                    (callback about-dialog-url-func-destroy-cb))
+      (gtk-about-dialog-set-url-hook (null-pointer)
+                                    (null-pointer)
+                                    (null-pointer)))
+  (setf *about-dialog-url-func* new-value))
+
+(export 'about-dialog-global-url-hook)
+
+(defvar *about-dialog-email-func* nil)
+
+(defcallback about-dialog-email-func-cb :void
+  ((dialog (g-object about-dialog)) (link (:string :free-from-foreign nil)) (user-data :pointer))
+  (declare (ignore user-data))
+  (funcall *about-dialog-email-func* dialog link))
+
+(defcallback about-dialog-email-func-destroy-cb :void
+  ((data :pointer))
+  (declare (ignore data))
+  (setf *about-dialog-email-func* nil))
+
+(defcfun gtk-about-dialog-set-email-hook :void
+  (func :pointer)
+  (data :pointer)
+  (destroy-notify :pointer))
+
+(defun (setf about-dialog-global-email-hook) (new-value)
+  (if new-value
+      (gtk-about-dialog-set-email-hook (callback about-dialog-email-func-cb)
+                                      (null-pointer)
+                                      (callback about-dialog-email-func-destroy-cb))
+      (gtk-about-dialog-set-email-hook (null-pointer)
+                                      (null-pointer)
+                                      (null-pointer)))
+  (setf *about-dialog-email-func* new-value))
+
+(export 'about-dialog-global-email-hook)
+