Gtk FileDialog cannot create D-Bus proxy

Hello! I’m currently trying to make a small app that needs to access the filesystem to manage AppImages files (to make them less annoying).

I am new to Gnome app dev ; Sorry in advance if this isn’t the right place or if I’m not following all community standards

I’m having an error however when I try to open the File Dialog :
Failed to create D-Bus proxy: Could not connect: No such file or directory

Here is the code snippet in question (with debug logging)

  handleAppimageOpen() {
    console.log("OPENING FILE DIALOG!")
    const filters = Gio.ListStore.new(Gtk.FileFilter.$gtype);

    filters.append(new Gtk.FileFilter({
        name: _("AppImages"),
        mime_types: ["application/vnd.appimage"]
      })
    );

    let file_dialog = new Gtk.FileDialog({
      modal: true,
      title: _("Open File"),
      filters
    })

    file_dialog.open_finish = (file) => {
      if(file == null) {
              console.log("I GOT NO FILE! TODO : ERROR MESSAGE PLZ")
              return;
      }
        console.log("I GOT A FILE!")
      console.log(file.peek_path());
      this._path_output.set_label('Path : ' + file.peek_path());
      }

    file_dialog.open(this, new Gio.Cancellable(), null)

  }

I have tried to read the documentation but I haven’t been able to find anything relating to this error on the internet…

Found the issue :
You need to be careful because this message isn’t the actual cause of the error and you might have to look deeper into your code for errors that happen BEFORE you open.
Mine was a misplaced console.log. The code I gave here is wrong and wont work.
Use as example the Decibels app (see window.ts)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.