summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Kost <alezost@gmail.com>2017-01-22 00:10:29 +0300
committerAlex Kost <alezost@gmail.com>2017-01-22 13:50:18 +0300
commitb323709a96c863a2c7006e0db7975d8bc1530352 (patch)
treee36731ae4df7bae6552846f3852fc27ad129fbae
parentdoc: Add "Graph Configuration" section (diff)
downloadguix-wigust-b323709a96c863a2c7006e0db7975d8bc1530352.tar.gz
elisp/ui-package: Add "Graph" button to Package Info
* elisp/guix-ui-package.el (guix-package-info-insert-graph-button): New procedure. (guix-package-info-button-functions): Add it.
-rw-r--r--elisp/guix-ui-package.el16
1 files changed, 15 insertions, 1 deletions
diff --git a/elisp/guix-ui-package.el b/elisp/guix-ui-package.el
index 8548c1e..a0728dd 100644
--- a/elisp/guix-ui-package.el
+++ b/elisp/guix-ui-package.el
@@ -352,7 +352,8 @@ prompt depending on `guix-operation-confirm' variable)."
(defcustom guix-package-info-button-functions
'(guix-package-info-insert-build-button
- guix-package-info-insert-build-log-button)
+ guix-package-info-insert-build-log-button
+ guix-package-info-insert-graph-button)
"List of functions used to insert package buttons in Info buffer.
Each function is called with 2 arguments: package ID and full name."
:type '(repeat function)
@@ -635,6 +636,19 @@ PACKAGE-ID is an ID of the package which store path to show."
"View build log of the current package"
'id id))
+(declare-function guix-package-graph "guix-graph" t)
+
+(defun guix-package-info-insert-graph-button (id _name)
+ "Insert button to show a graph of a package defined by ID."
+ (bui-insert-action-button
+ "Graph"
+ (lambda (btn)
+ (guix-package-graph (button-get btn 'id)
+ (guix-read-graph-backend)
+ (guix-read-graph-node-type)))
+ "View graph of the current package"
+ 'id id))
+
(defun guix-package-info-show-source (entry-id package-id)
"Show file name of a package source in the current info buffer.
Find the file if needed (see `guix-package-info-auto-find-source').