diff --git a/cl-todo.lisp b/cl-todo.lisp index 0f2a425..550f9bc 100644 --- a/cl-todo.lisp +++ b/cl-todo.lisp @@ -14,6 +14,7 @@ (defun launch () (setf *task-list* (load-task-file)) + (make-gui *task-list*) ;;TODO ) diff --git a/cl-todo.lisp b/cl-todo.lisp index 0f2a425..550f9bc 100644 --- a/cl-todo.lisp +++ b/cl-todo.lisp @@ -14,6 +14,7 @@ (defun launch () (setf *task-list* (load-task-file)) + (make-gui *task-list*) ;;TODO ) diff --git a/gtk-ui.lisp b/gtk-ui.lisp index a91f3d9..ba95544 100644 --- a/gtk-ui.lisp +++ b/gtk-ui.lisp @@ -6,6 +6,44 @@ ;;;; Licensed under the terms of the MIT license ;;;; -(defun launch-gui () - ;;TODO - ) +(in-package :cl-todo) + +(defvar *widget-list*) + +(defun make-gui (task-list) + (within-main-loop + (let ((window (make-instance 'gtk-window + :type :toplevel + :title "cl-todo" ;;remove when undecorating + :default-width 300 + :default-height 200)) + (box (make-instance 'gtk-box + :orientation :vertical + :spacing 10)) + ;;TODO input pane and scratchpad + (input-pane NIL) ;(make-instance 'gtk-text-field)) + (scratch-pad NIL) + (task-buttons (create-widget-list task-list))) + ;;(gtk-box-pack-start input-pane) + (dolist (tb task-buttons) + (gtk-box-pack-start tb)) + (gtk-container-add window box) + ;;TODO undecorate + (gtk-widget-show-all window)))) + + +(defun create-widget-list (task-list) + "Create a check button widget for each task" + ;;XXX This would probably be neater with LOOP + (do* ((tl task-list (cdr tl)) + (task-button + (gtk-check-button-new-with-label (car tl)) + (gtk-check-button-new-with-label (car tl))) + (task-button-list nil)) + ((null task) task-button-list) + (g-signal-connect task-button "clicked" + #'(lambda (button) + ;;TODO also remove the button from the UI + (remove-task! (gtk-check-button-label button)))) + (setf task-button-list + (append task-button-list (list task-button))))) diff --git a/cl-todo.lisp b/cl-todo.lisp index 0f2a425..550f9bc 100644 --- a/cl-todo.lisp +++ b/cl-todo.lisp @@ -14,6 +14,7 @@ (defun launch () (setf *task-list* (load-task-file)) + (make-gui *task-list*) ;;TODO ) diff --git a/gtk-ui.lisp b/gtk-ui.lisp index a91f3d9..ba95544 100644 --- a/gtk-ui.lisp +++ b/gtk-ui.lisp @@ -6,6 +6,44 @@ ;;;; Licensed under the terms of the MIT license ;;;; -(defun launch-gui () - ;;TODO - ) +(in-package :cl-todo) + +(defvar *widget-list*) + +(defun make-gui (task-list) + (within-main-loop + (let ((window (make-instance 'gtk-window + :type :toplevel + :title "cl-todo" ;;remove when undecorating + :default-width 300 + :default-height 200)) + (box (make-instance 'gtk-box + :orientation :vertical + :spacing 10)) + ;;TODO input pane and scratchpad + (input-pane NIL) ;(make-instance 'gtk-text-field)) + (scratch-pad NIL) + (task-buttons (create-widget-list task-list))) + ;;(gtk-box-pack-start input-pane) + (dolist (tb task-buttons) + (gtk-box-pack-start tb)) + (gtk-container-add window box) + ;;TODO undecorate + (gtk-widget-show-all window)))) + + +(defun create-widget-list (task-list) + "Create a check button widget for each task" + ;;XXX This would probably be neater with LOOP + (do* ((tl task-list (cdr tl)) + (task-button + (gtk-check-button-new-with-label (car tl)) + (gtk-check-button-new-with-label (car tl))) + (task-button-list nil)) + ((null task) task-button-list) + (g-signal-connect task-button "clicked" + #'(lambda (button) + ;;TODO also remove the button from the UI + (remove-task! (gtk-check-button-label button)))) + (setf task-button-list + (append task-button-list (list task-button))))) diff --git a/package.lisp b/package.lisp index f217cc1..1c48a26 100644 --- a/package.lisp +++ b/package.lisp @@ -9,5 +9,5 @@ (defpackage :cl-todo (:documentation "A simple TODO widget for the GNOME desktop") (:nicknames :todo) - (:use :common-lisp) + (:use :common-lisp :gtk :gdk :gobject :glib) ;;XXX pare down (:export launch +runfile+))