Commit 8259e90e authored by Ulf Jasper's avatar Ulf Jasper

Newsticker: Show feedicons in treeview. Small fix in opml export.

* etc/images/newsticker/README: Add rss-feed.png, rss-feed.svg.

* etc/images/newsticker/rss-feed.png: New.

* etc/images/newsticker/rss-feed.svg: New.

* lisp/net/newst-backend.el: Require url-parse.
(newsticker--get-news-by-wget): Store feed name as process property.
(newsticker--sentinel): Read feed name from process property.
(newsticker--sentinel-work): Rename argument name to feed-name.
Rename variable imageurl to image-url.  Pick icon url from Atom
1.0 data.  Launch download of feed icon.
(newsticker--get-icon-url-atom-1.0): New.
(newsticker--unxml)
(newsticker--unxml-node)
(newsticker--unxml-attribute): Documentation.
(newsticker--icons-dir): New.
(newsticker--image-get): New arguments FILENAME and DIRECTORY.
Use `url-retrieve' if `newsticker-retrieval-method' is 'intern.
(newsticker--image-download-by-wget): New.  Use process properties
for storing informations.
(newsticker--image-sentinel): Read informations from process properties.
(newsticker--image-save)
(newsticker--image-remove)
(newsticker--image-download-by-url)
(newsticker--image-download-by-url-callback): New.
(newsticker-opml-export): Handle url list entries containing a
function instead of an url string.

* lisp/net/newst-reader.el (newsticker-html-renderer): Whitespace.
(newsticker--print-extra-elements)
(newsticker--do-print-extra-element): Documentation
(newsticker--image-read): Optionally limit image height.  Use
imagemagick if possible.
(newsticker--icon-read): New.

* lisp/net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo.
(newsticker--treeview-tree-expand): Use feed icons in treeview.
(newsticker--tree-widget-icon-create): New.  Set the tree widget icon.
(newsticker--tree-widget-leaf-icon): Use feed icon.
parent 58af643d
2014-10-19 Ulf Jasper <ulf.jasper@web.de>
* images/newsticker/rss-feed.png: New.
* images/newsticker/rss-feed.svg: New.
* images/newsticker/README: Add rss-feed.png, rss-feed.svg.
2014-10-18 Michal Nazarewicz <mina86@mina86.com>
* NEWS: Mention new whitespace-mode option: big-indent.
......
......@@ -2,7 +2,7 @@ COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES
Files: browse-url.xpm get-all.xpm mark-immortal.xpm mark-read.xpm
narrow.xpm next-feed.xpm next-item.xpm prev-feed.xpm
prev-item.xpm update.xpm
prev-item.xpm rss-feed.png rss-feed.svg update.xpm
Author: Ulf Jasper
Copyright (C) 2011-2014 Free Software Foundation, Inc.
License: GNU General Public License version 3 or later (see COPYING)
This diff was suppressed by a .gitattributes entry.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="16px"
height="16px"
id="svg3028"
version="1.1"
inkscape:version="0.48.5 r10040"
sodipodi:docname="newst-rss.svg">
<defs
id="defs3030" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="22.197802"
inkscape:cx="-0.87475255"
inkscape:cy="-1.0099011"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:snap-global="true"
inkscape:snap-object-midpoints="false"
inkscape:window-width="1680"
inkscape:window-height="1026"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="0">
<inkscape:grid
type="xygrid"
id="grid3036" />
</sodipodi:namedview>
<metadata
id="metadata3033">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<rect
style="fill:#ff8000;fill-opacity:1;stroke:#0000ff;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3038"
width="16"
height="16"
x="0"
y="0"
ry="2"
rx="2" />
<path
sodipodi:type="arc"
style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3814"
sodipodi:cx="-4.5"
sodipodi:cy="7.5"
sodipodi:rx="2"
sodipodi:ry="2"
d="m -2.5,7.5 a 2,2 0 1 1 -4,0 2,2 0 1 1 4,0 z"
transform="matrix(0,1,-1,0,11.5,16.5)" />
<path
sodipodi:type="arc"
style="fill:none;stroke:#ffffff;stroke-width:1.89999996;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3847"
sodipodi:cx="8.5"
sodipodi:cy="7.5"
sodipodi:rx="9.5"
sodipodi:ry="9.5"
d="m 18,7.5 a 9.5,9.5 0 1 1 -19,0 9.5,9.5 0 1 1 19,0 z"
transform="matrix(1.0526316,0,0,1.0526316,-8.9473684,8.1052632)" />
<path
sodipodi:type="arc"
style="fill:none;stroke:#ffffff;stroke-width:0.96362412;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3849"
sodipodi:cx="2"
sodipodi:cy="14.5"
sodipodi:rx="7"
sodipodi:ry="6.5"
d="m 9,14.5 a 7,6.5 0 1 1 -14,0 7,6.5 0 1 1 14,0 z"
transform="matrix(2,0,0,2.1538461,-3.9999999,-15.230768)" />
<rect
style="fill:none;fill-opacity:1;stroke:#ff8000;stroke-width:0;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect3869"
width="15"
height="15"
x="2"
y="-1"
rx="0"
ry="0" />
<path
style="fill:#ff8000;fill-opacity:1;stroke:none"
d="M 2 0 C 0.892 0 0 0.892 0 2 L 0 14 C 0 15.108 0.892 16 2 16 L 2 0 z "
id="rect3891" />
<path
style="fill:#ff8000;fill-opacity:1;stroke:none"
d="M 0 14 C 0 15.108 0.892 16 2 16 L 14 16 C 15.108 16 16 15.108 16 14 L 0 14 z "
id="rect3913" />
</g>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="Ebene" />
</svg>
2014-10-19 Ulf Jasper <ulf.jasper@web.de>
* net/newst-backend.el: Require url-parse.
(newsticker--get-news-by-wget): Store feed name as process property.
(newsticker--sentinel): Read feed name from process property.
(newsticker--sentinel-work): Rename argument name to feed-name.
Rename variable imageurl to image-url. Pick icon url from Atom
1.0 data. Launch download of feed icon.
(newsticker--get-icon-url-atom-1.0): New.
(newsticker--unxml)
(newsticker--unxml-node)
(newsticker--unxml-attribute): Documentation.
(newsticker--icons-dir): New.
(newsticker--image-get): New arguments FILENAME and DIRECTORY.
Use `url-retrieve' if `newsticker-retrieval-method' is 'intern.
(newsticker--image-download-by-wget): New. Use process properties
for storing informations.
(newsticker--image-sentinel): Read informations from process properties.
(newsticker--image-save)
(newsticker--image-remove)
(newsticker--image-download-by-url)
(newsticker--image-download-by-url-callback): New.
(newsticker-opml-export): Handle url list entries containing a
function instead of an url string.
* net/newst-reader.el (newsticker-html-renderer): Whitespace.
(newsticker--print-extra-elements)
(newsticker--do-print-extra-element): Documentation
(newsticker--image-read): Optionally limit image height. Use
imagemagick if possible.
(newsticker--icon-read): New.
* net/newst-treeview.el (newsticker--treeview-item-show): Limit height of feed logo.
(newsticker--treeview-tree-expand): Use feed icons in treeview.
(newsticker--tree-widget-icon-create): New. Set the tree widget icon.
(newsticker--tree-widget-leaf-icon): Use feed icon.
2014-10-19 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/eieio-opt.el (eieio-lambda-arglist): Remove.
......
This diff is collapsed.
......@@ -110,7 +110,7 @@ window is used when filling. See also `newsticker-justification'."
#'shr-render-region)
"Function for rendering HTML contents.
If non-nil, newsticker.el will call this function whenever it
finds HTML-like tags in item descriptions.
finds HTML-like tags in item descriptions.
Possible functions include `shr-render-region', `w3m-region', `w3-region', and
`newsticker-htmlr-render'.
Newsticker automatically loads the respective package w3m, w3, or
......@@ -193,7 +193,8 @@ KEYMAP will be applied."
(defun newsticker--print-extra-elements (item keymap &optional htmlish)
"Insert extra-elements of ITEM in a pretty form into the current buffer.
KEYMAP is applied."
KEYMAP is applied. If HTMLISH is non-nil then HTML-markup is used
for formatting."
(let ((ignored-elements '(items link title description content
content:encoded encoded
dc:subject subject
......@@ -223,7 +224,8 @@ KEYMAP is applied."
(defun newsticker--do-print-extra-element (extra-element width keymap htmlish)
"Actually print an EXTRA-ELEMENT using the given WIDTH.
KEYMAP is applied."
KEYMAP is applied. If HTMLISH is non-nil then HTML-markup is used
for formatting."
(let ((name (symbol-name (car extra-element))))
(if htmlish
(insert (format "<li>%s: " name))
......@@ -253,10 +255,11 @@ KEYMAP is applied."
(insert "</li>")
(insert "\n"))))
(defun newsticker--image-read (feed-name-symbol disabled)
(defun newsticker--image-read (feed-name-symbol disabled &optional max-height)
"Read the cached image for FEED-NAME-SYMBOL from disk.
If DISABLED is non-nil the image will be converted to a disabled look
\(unless `newsticker-enable-logo-manipulations' is not t\).
Optional argument MAX-HEIGHT specifies the maximal image height.
Return the image."
(let ((image-name (concat (newsticker--images-dir)
(symbol-name feed-name-symbol)))
......@@ -264,18 +267,47 @@ Return the image."
(when (file-exists-p image-name)
(condition-case error-data
(setq img (create-image
image-name nil nil
image-name
(and (fboundp 'imagemagick-types)
(imagemagick-types)
'imagemagick)
nil
:conversion (and newsticker-enable-logo-manipulations
disabled
'disabled)
:mask (and newsticker-enable-logo-manipulations
'heuristic)
:ascent 70))
:ascent 100
:max-height max-height))
(error
(message "Error: cannot create image for %s: %s"
feed-name-symbol error-data))))
img))
(defun newsticker--icon-read (feed-name-symbol)
"Read the cached icon for FEED-NAME-SYMBOL from disk.
Return the image."
(catch 'icon
(when (file-exists-p (newsticker--icons-dir))
(mapc (lambda (file)
(condition-case error-data
(progn (setq img (create-image
file (and (fboundp 'imagemagick-types)
(imagemagick-types)
'imagemagick)
nil
:ascent 'center
:max-width 16
:max-height 16))
(throw 'icon img))
(error
(message "Error: cannot create icon for %s: %s"
feed-name-symbol error-data))))
(directory-files (newsticker--icons-dir) t
(concat (symbol-name feed-name-symbol) "\\..*"))))
;; fallback: default icon
(find-image '((:type png :file "newsticker/rss-feed.png" :ascent center)))))
;; the functions we need for retrieval and display
;;;###autoload
(defun newsticker-show-news ()
......
......@@ -735,7 +735,7 @@ for the button."
(goto-char (point-min))
;; insert logo at top
(let* ((newsticker-enable-logo-manipulations nil)
(img (newsticker--image-read feed-name-symbol nil)))
(img (newsticker--image-read feed-name-symbol nil 40)))
(if (and (display-images-p) img)
(newsticker--insert-image img (car item))
(insert (newsticker--real-feed-name feed-name-symbol))))
......@@ -829,6 +829,7 @@ Callback function for tree widget that adds nodes for feeds and subgroups."
:nt-group ,(cdr g)
:nt-feed ,g-name
:nt-id ,nt-id
:leaf-icon newsticker--tree-widget-leaf-icon
:keep (:nt-feed :num-new :nt-id :open);; :nt-group
:open nil))
(let ((tag (newsticker--treeview-tree-get-tag g nil nt-id)))
......@@ -841,6 +842,23 @@ Callback function for tree widget that adds nodes for feeds and subgroups."
:open t))))
group)))
(defun newsticker--tree-widget-icon-create (icon)
"Create the ICON widget."
(let* ((g (widget-get (widget-get icon :node) :nt-feed))
(ico (and g (newsticker--icon-read (intern g)))))
(if ico
(progn
(widget-put icon :tag-glyph ico)
(widget-default-create icon)
;; Insert space between the icon and the node widget.
(insert-char ? 1)
(put-text-property
(1- (point)) (point)
'display (list 'space :width tree-widget-space-width)))
;; fallback: default icon
(widget-put icon :leaf-icon 'tree-widget-leaf-icon)
(tree-widget-icon-create icon))))
(defun newsticker--treeview-tree-expand-status (tree &optional changed-widget
event)
"Expand the vfeed TREE.
......@@ -875,6 +893,7 @@ Optional arguments CHANGED-WIDGET and EVENT are ignored."
"Icon for a tree-widget leaf node."
:tag "O"
:glyph-name "leaf"
:create 'newsticker--tree-widget-icon-create
:button-face 'default)
(defun newsticker--treeview-tree-update ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment