sawfish r4368 - in trunk: . lisp/sawfish/gtk
- From: chrisb svn gnome org
- To: svn-commits-list gnome org
- Subject: sawfish r4368 - in trunk: . lisp/sawfish/gtk
- Date: Wed, 14 Jan 2009 18:43:32 +0000 (UTC)
Author: chrisb
Date: Wed Jan 14 18:43:32 2009
New Revision: 4368
URL: http://svn.gnome.org/viewvc/sawfish?rev=4368&view=rev
Log:
stock.jl: added (why was it missing?)
Added:
trunk/lisp/sawfish/gtk/stock.jl
Modified:
trunk/ChangeLog
Added: trunk/lisp/sawfish/gtk/stock.jl
==============================================================================
--- (empty file)
+++ trunk/lisp/sawfish/gtk/stock.jl Wed Jan 14 18:43:32 2009
@@ -0,0 +1,113 @@
+#| nokogiri-no-gnome.jl -- workaround lack of GNOME widgets -*- lisp -*-
+
+ $Id: stock.jl.gtk,v 1.9 2003/01/12 20:30:43 jsh Exp $
+
+ Copyright (C) 2000 John Harper <john dcs warwick ac uk>
+
+ This file is part of sawfish.
+
+ sawfish is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ sawfish is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with sawfish; see the file COPYING. If not, write to
+ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+|#
+
+(define-structure sawfish.gtk.stock
+
+ (export stock-button
+ simple-dialog
+ about-dialog
+ make-url-widget)
+
+ (open rep
+ gui.gtk-2.gtk
+ sawfish.gtk.widget)
+
+ ;; same as in gnome now
+ (define (stock-button type)
+ (gtk-button-new-from-stock
+ (case type
+ ((ok) "gtk-ok")
+ ((cancel) "gtk-cancel")
+ ((revert) "gtk-revert-to-saved")
+ ((apply) "gtk-apply")
+ ((yes) "gtk-yes")
+ ((no) "gtk-no")
+ ((close) "gtk-close")
+ ((help) "gtk-help"))))
+
+ (define (simple-dialog title widget #!optional ok-callback main-window)
+
+ (let ((window (gtk-window-new 'toplevel))
+ (vbox (gtk-vbox-new nil box-spacing))
+ (hbbox (gtk-hbutton-box-new))
+ (ok (stock-button 'ok))
+ (cancel (and ok-callback (stock-button 'cancel))))
+
+ (define (on-cancel)
+ (gtk-widget-destroy window))
+
+ (define (on-ok)
+ (ok-callback)
+ (gtk-widget-destroy window))
+
+ (gtk-window-set-title window title)
+ (gtk-window-set-wmclass window "ok_cancel_dialog" "Nokogiri")
+ (gtk-container-set-border-width window box-border)
+ (when main-window
+ (gtk-window-set-transient-for window main-window))
+
+ (gtk-box-set-spacing hbbox button-box-spacing)
+ (gtk-button-box-set-layout hbbox 'end)
+ (when cancel
+ (gtk-box-pack-end hbbox cancel))
+ (gtk-box-pack-end hbbox ok)
+ (gtk-box-pack-end vbox hbbox)
+ (gtk-container-add window vbox)
+ (gtk-widget-show-all vbox)
+
+ (gtk-container-add vbox widget)
+
+ (when cancel
+ (g-signal-connect cancel "clicked" on-cancel))
+ (g-signal-connect ok "clicked" (if ok-callback on-ok on-cancel))
+ (g-signal-connect window "delete_event" on-cancel)
+
+ (gtk-widget-show window)
+ (gtk-window-set-modal window t)
+ (gtk-widget-grab-focus widget)
+
+ window))
+
+ (define (about-dialog title version copyright
+ authors comments #!key logo extra)
+ (declare (unused logo))
+ (let* ((box (gtk-vbox-new nil 4))
+ (text-view (gtk-text-view-new))
+ (text-buffer (gtk-text-view-get-buffer text-view)))
+ (define (insert s)
+ (gtk-text-buffer-insert-at-cursor text-buffer s (length s)))
+ (insert (format nil "%s %s\n" title version))
+ (insert (format nil "%s\n\n" copyright))
+ (when authors
+ (insert "Authors:\n")
+ (mapc (lambda (x) (insert (format nil " %s\n" x))) authors))
+ (insert (format nil "\n%s\n" comments))
+ (gtk-text-view-set-editable text-view nil)
+ (gtk-container-add box text-view)
+ (when extra
+ (gtk-box-pack-end box extra))
+ (gtk-widget-show-all box)
+ (simple-dialog "About" box)))
+
+ (define (make-url-widget url label)
+ (gtk-label-new (format nil "%s <%s>" label url))))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]