elementary / calendar

Desktop calendar app designed for elementary OS
https://elementary.io
GNU General Public License v3.0
130 stars 39 forks source link

Application: Force use of portals #717

Closed danirabbit closed 1 year ago

danirabbit commented 3 years ago

Since Calendar currently can't be sandboxed due to online accounts, this forces the use of portals even outside of flatpak. What this means practically is that Calendar uses the native filechooser instead of the one from Gtk

I didn't notice any issues with reading system gsettings like the show weeks setting and location services seem to work as normal

davidmhewitt commented 3 years ago

Have you checked notifications?

See: https://github.com/elementary/default-settings/pull/215

danirabbit commented 3 years ago

@davidmhewitt I had not! thank you. It looks like I am getting notifications okay here with this branch. I think since we reworked things in https://github.com/elementary/calendar/pull/702 that probably fixed it

davidmhewitt commented 3 years ago

And they're correctly being appended to the wingpanel indicator and you can configure them via switchboard?

I can't see how we wouldn't be hitting the same issues that we saw when this environment variable was set globally. That PR moved the notifications code into the same binary that now has the environment variable set.

danirabbit commented 3 years ago

@davidmhewitt Yup it's working in the indicator and I've verified that it works with switchboard settings as well

I think because previously the notifications were being sent with a different ID than the main application so they were being blocked

davidmhewitt commented 3 years ago

That's a different issue though. By forcing the use of portals with the environment variable, GLib was previously sending all notifications via the portal even from outside the sandbox. The portal then didn't send the app ID onto the notification server, because it couldn't verify it as it's a non sandboxed app.

I don't see how setting the environment variable in the application instead of in a shell script in the user's profile would change that.

But if it works, it works, I guess.

jeremypw commented 2 years ago

Code is already setting GTK_USE_PORTAL, but proper notification behaviour is going to be much more important in Calendar than in Code.

Marukesu commented 1 year ago

About the notification working when it wasn't before, that's because GLib/Gio store the environment value during the library ctor, while Gtk only do it after calling Gtk.init(). so GLib code isn't affected by this.