From 4b59f2d8609f171a9a875e9f1003fbb50a1d3202 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Dj=C3=A4rv?= Date: Sun, 2 Sep 2007 17:00:06 +0000 Subject: [PATCH] (x-gtk-stock-map, icon-map-list): New variables. (x-gtk-map-stock): New function. --- lisp/ChangeLog | 8 +++++++ lisp/term/x-win.el | 57 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0d92d7a0d02..ccf0fa4f624 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2007-09-02 Jan Dj,Ad(Brv + + * info.el (info-tool-bar-map): Add :rtl keyword to right/left-arrow and + prev/next-node. + + * term/x-win.el (x-gtk-stock-map, icon-map-list): New variables. + (x-gtk-map-stock): New function. + 2007-09-02 Glenn Morris * comint.el (comint-mode): Don't set scroll-conservatively. diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index a3fad5894fa..34fa275b8b5 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el @@ -2556,5 +2556,62 @@ order until succeed.") (and (fboundp 'menu-bar-open) (global-set-key [f10] 'x-menu-bar-open)) +(defcustom x-gtk-stock-map + '( + ("etc/images/new" . "gtk-new") + ("etc/images/open" . "gtk-open") + ("etc/images/diropen" . "n:system-file-manager") + ("etc/images/close" . "gtk-close") + ("etc/images/save" . "gtk-save") + ("etc/images/saveas" . "gtk-save-as") + ("etc/images/undo" . "gtk-undo") + ("etc/images/cut" . "gtk-cut") + ("etc/images/copy" . "gtk-copy") + ("etc/images/paste" . "gtk-paste") + ("etc/images/search" . "gtk-find") + ("etc/images/print" . "gtk-print") + ("etc/images/preferences" . "gtk-preferences") + ("etc/images/help" . "gtk-help") + ("etc/images/left-arrow" . "gtk-go-back") + ("etc/images/right-arrow" . "gtk-go-forward") + ("etc/images/home" . "gtk-home") + ("etc/images/jump-to" . "gtk-jump-to") + ("etc/images/index" . "gtk-index") + ("etc/images/search" . "gtk-find") + ("etc/images/exit" . "gtk-quit")) + "How icons for tool bars are mapped to Gtk+ stock items. +Emacs must be compiled with the Gtk+ toolkit for this to have any effect. +A value that begins with n: denotes a named icon instead of a stock icon." + :version "23.1" + :type 'alist + :group 'x) + +(defvar icon-map-list '(x-gtk-stock-map) + "*A list of alists that maps icon file names to stock/named icons. +The alists are searched in the order they appear. The first match is used. +The keys in the alists are file names without extension and with two directory +components. For example, to map /usr/share/emacs/22.1.1/etc/images/open.xpm +to stock item gtk-open, use: + + (\"etc/images/open\" . \"gtk-open\") + +Themes also have named icons. To map to one of those, use n: before the name: + + (\"etc/images/diropen\" . \"n:system-file-manager\") + +The list elements are either the symbol name for the alist or the alist itself.") + +(defun x-gtk-map-stock (file) + "Map icon with file name FILE to a Gtk+ stock name, using `x-gtk-stock-map'." + (let* ((file-sans (file-name-sans-extension file)) + (key (and (string-match "/\\([^/]+/[^/]+/[^/]+$\\)" file-sans) + (match-string 1 file-sans))) + (value)) + (mapc (lambda (elem) + (let ((assoc (if (symbolp elem) (symbol-value elem) elem))) + (or value (setq value (assoc-string (or key file-sans) assoc))))) + icon-map-list) + (and value (cdr value)))) + ;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78 ;;; x-win.el ends here -- 2.39.2