bohonghuang / cl-gtk4

GTK4/Libadwaita/WebKit2 bindings for Common Lisp.
GNU Lesser General Public License v3.0
215 stars 9 forks source link

Can't create simple application. #50

Open Filipp-Druan opened 1 year ago

Filipp-Druan commented 1 year ago

Hello! I tried to write the most simple application:

(define-application (:name main
                     :id   "qwertyuiop")
  (define-main-window (main-window (make-application-window :application
                                                            *application*))
    (setf (window-title main-window)
          "Share-files")

    (let ((main-box (make-box :orientation +orientation-vertical+
                              :spacing     0)))
      (setf (window-child main-window)
            main-box)

      (window-present main-window))))

When I called main function I got this:

Backtrace:
 0: (GIR::G-SIGNAL-CONNECT-CLOSURE NIL "activate" #.(SB-SYS:INT-SAP #X7FF90EB56AF0) NIL)
 1: (GIR:CONNECT NIL "activate" #<FUNCTION (LAMBDA (&REST GTK4::ARGS) :IN GTK4::ATTACH-RESTARTS) {10074D8B1B}> :AFTER NIL :SWAPPED NIL)
      Locals:
        #:.DEFAULTING-TEMP. = NIL
        #:.DEFAULTING-TEMP.#1 = NIL
        AFTER = NIL
        C-HANDLER = #<FUNCTION (LAMBDA (&REST GTK4::ARGS) :IN GTK4::ATTACH-RESTARTS) {10074D8B1B}>
        C-HANDLER#1 = #<FUNCTION (LAMBDA (&REST GTK4::ARGS) :IN GTK4::ATTACH-RESTARTS) {10074D8B1B}>
        FLAGS = 0
        G-OBJECT = NIL
        #:G0 = #<FUNCTION (LAMBDA (&REST GTK4::ARGS) :IN GTK4::ATTACH-RESTARTS) {10074D8B1B}>
        OBJECT-PTR = NIL
        SIGNAL = "activate"
        STR-SIGNAL = "activate"
        SWAPPED = NIL
 2: (QWERTYUIOP.MAIN NIL)
      Locals:
        GTK4::ARGV = NIL
 3: (SB-INT:SIMPLE-EVAL-IN-LEXENV (MAIN) #<NULL-LEXENV>)
 4: (EVAL (MAIN))
 5: ((LAMBDA NIL :IN SLYNK-MREPL::MREPL-EVAL-1))
 --more--

application = NIL

bohonghuang commented 1 year ago

Your application ID is invalid. For example, you can set it to org.filipp.qwertyuiop.

Filipp-Druan commented 1 year ago

Thanks! Can you write rules of application id naming in documentation?

Filipp-Druan commented 1 year ago

I suggest creating a file of NOTES in which to put such non-obvious points.

bohonghuang commented 1 year ago

In the official documentation of GTK4, it is mentioned in the new constructor of Application:

If application_id is not NULL, then it must be valid. See g_application_id_is_valid().

Please refer to the GIO documentation for the rules regarding application IDs.

Currently I haven't found a good way to embed the official documentation of GTK and related libraries into Lisp's Docstring. Therefore, referring to the official documentation directly is still the preferred method for troubleshooting.