Open Ambrevar opened 4 years ago
This might be more of a GTK question than a Common Lisp question, but allow me to post here, just in case. I'm trying to create a custom context menu in WebKitGTK (using cl-webkit).
A simple attempt:
; Helper to populate the browser "context-menu-entries" slot: (defun make-context-menu-entries () (let ((foo-action (gio:g-simple-action-new "foo" (glib:g-variant-type-new glib:+g-variant-type-maybe+)))) (gobject:g-signal-connect foo-action "activate" (lambda (action parameter) (declare (ignore action parameter)) (log:info "foo action"))) (gio:g-simple-action-set-enabled foo-action t) (list :foo (webkit:webkit-context-menu-item-new-from-gaction foo-action "Do foo" (cffi:null-pointer))))) ; Initialize the web view: ; ... (gobject:g-signal-connect (gtk-object buffer) "context-menu" (lambda (web-view context-menu event hit-test-result) (declare (ignore web-view event hit-test-result)) (webkit:webkit-context-menu-append context-menu (getf (context-menu-entries *browser*) :foo)) ;; Return nil to show the context menu. nil))
It works and shows "Do foo" in the context menu; sadly, it's greyed out. It seems that g-simple-action-set-enabled does not do what I think it does.
Any clue what I'm missing?
This might be more of a GTK question than a Common Lisp question, but allow me to post here, just in case. I'm trying to create a custom context menu in WebKitGTK (using cl-webkit).
A simple attempt:
It works and shows "Do foo" in the context menu; sadly, it's greyed out. It seems that g-simple-action-set-enabled does not do what I think it does.
Any clue what I'm missing?