Skip to content

Commit

Permalink
Added rudel-make-{node, group} to rudel-infinote-backend
Browse files Browse the repository at this point in the history
* infinote/rudel-infinote.el
  (rudel-infinote-backend::rudel-make-node): new method; create node
  object according to specified type and properties
  (rudel-infinote-backend::rudel-make-group): new method; create group
  object according to specified type and properties
  • Loading branch information
scymtym committed Jun 6, 2010
1 parent dfe3faa commit 4295c32
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions infinote/rudel-infinote.el
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,52 @@ Return the connection object."
(rudel-infinote-text-document name
:session session))

(defmethod rudel-make-node ((this rudel-infinote-backend)
type name id parent)
"Create a node object according to TYPE, NAME, ID and PARENT.
The new node will be named NAME and have id ID. It will be a
child node of PARENT unless PARENT is nil in which case the new
node will be the root node."
(cond
;; Text
((string= type "InfText")
(rudel-infinote-text-document
name
:id id
:parent parent))

;; SubDirectory
((string= type "InfSubdirectory")
(rudel-infinote-node-directory
name
:id id
:parent parent
:group (rudel-get-group this "InfDirectory")))

;; unknown type
(t
(error "No such node type: `%s'" type)))
)

(defmethod rudel-make-group ((this rudel-infinote-backend)
type name method &optional node)
"Create a new group according to TYPE, NAME and METHOD.
The optional argument NODE can specify the node (usually a
document) associated to the new group."
(cond
;; Text document
((string= type "InfText")
(rudel-infinote-group-text-document
name
:publisher "you"
:method method
:document node))

;; unknown type
(t
(error "No such node type: `%s'" type)))
)


;;; Autoloading
;;
Expand Down

0 comments on commit 4295c32

Please sign in to comment.