After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 768498 - portal support for glib
portal support for glib
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2016-07-07 04:16 UTC by Matthias Clasen
Modified: 2016-07-13 03:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gproxyresolverportal.c: Init portal proxy resolver backend after checking for portal availability (1.30 KB, patch)
2016-07-11 09:43 UTC, Fan, Chun-wei
none Details | Review
gio: Build portal items only on *NIX (5.36 KB, patch)
2016-07-11 15:16 UTC, Fan, Chun-wei
accepted-commit_now Details | Review
gio: Build portal items only on *NIX (take ii) (7.80 KB, patch)
2016-07-12 02:20 UTC, Fan, Chun-wei
committed Details | Review

Description Matthias Clasen 2016-07-07 04:16:09 UTC
I've pushed a portal2 branch that supports a number of the portal interfaces from https://github.com/flatpak/xdg-desktop-portal: application launching, network monitoring, proxy resolving and notifications.
Comment 1 Cosimo Cecchi 2016-07-07 17:45:34 UTC
I've reviewed the branch, and it looks good to me.
Comment 2 Fan, Chun-wei 2016-07-11 09:35:46 UTC
Hi,

One issue I saw with the commits on gproxyresolverportal.c is the unconditional call to the following (sorry for the formatting as I copied and pasted) in g_proxy_resolver_portal_init():

resolver->resolver = gxdp_proxy_resolver_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
                                                                   G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
                                                                   "org.freedesktop.portal.Desktop",
                                                                   "/org/freedesktop/portal/desktop",
                                                                   NULL,
                                                                   NULL);

On systems that don't have flatpak/xdg-desktop-portal support (such as Windows) this is going to cause the system to wait infinitely for this gdbus op, so I guess we want to check for glib_should_use_portal () beforehand?

With blessings, thank you!
Comment 3 Fan, Chun-wei 2016-07-11 09:43:11 UTC
Created attachment 331195 [details] [review]
gproxyresolverportal.c: Init portal proxy resolver backend after checking for portal availability

Hi,

My stab at the patch for this.

With blessings, thank you!
Comment 4 Emmanuele Bassi (:ebassi) 2016-07-11 10:01:31 UTC
Review of attachment 331195 [details] [review]:

The glib_should_use_portal() function is really glib_is_the_application_running_inside_a_flatpak().

I think portal-related classes should not be built on platforms that are not targeted by Flatpak.
Comment 5 Fan, Chun-wei 2016-07-11 15:16:21 UTC
Created attachment 331232 [details] [review]
gio: Build portal items only on *NIX

Hi Emmanuele,

I agree with you on this regard, so here comes the new patch to exclude it on non-*NIX.  I didn't go for checking for flatpak and xdg-desktop-portal in configure.ac as that seems to introduce a circular dependency, that can be resolved, but seems to be confusing and bothersome as that would involve building GLib twice if starting from scratch.

With blessings, thank you!
Comment 6 Matthias Clasen 2016-07-11 18:19:34 UTC
Review of attachment 331232 [details] [review]:

::: gio/gappinfo.c
@@ +37,1 @@
 

This part looks fine

::: gio/giomodule.c
@@ +1120,3 @@
       g_type_ensure (g_portal_notification_backend_get_type ());
+      g_type_ensure (g_network_monitor_portal_get_type ());
+      g_type_ensure (g_proxy_resolver_portal_get_type ());

This doesn't look quite right to me; the portal code has nothing to do with either netlink or cocoa.
Comment 7 Fan, Chun-wei 2016-07-12 01:32:55 UTC
Review of attachment 331232 [details] [review]:

::: gio/giomodule.c
@@ +1120,3 @@
       g_type_ensure (g_portal_notification_backend_get_type ());
+      g_type_ensure (g_network_monitor_portal_get_type ());
+      g_type_ensure (g_proxy_resolver_portal_get_type ());

Hi Matthias,

Hmm, I thought I had it in the right places for those, guarded by G_OS_UNIX, no?  The line numbers can be deceiving though...  I will do a new patch though quite soon, as there are newer portal code that is being added at this time, and I think I want to rearrange gio/Makefile.am?

With blessings, thank you!
Comment 8 Fan, Chun-wei 2016-07-12 02:20:31 UTC
Created attachment 331291 [details] [review]
gio: Build portal items only on *NIX (take ii)

Hi,

This is the updated patch which:
-Was rebased, due to Cosimo's work
-gio/Makefile.am is cleaned up a bit
-Checked that the changes in giomodule.c is correct

With blessings, thank you!
Comment 9 Matthias Clasen 2016-07-13 01:39:59 UTC
Review of attachment 331232 [details] [review]:

::: gio/giomodule.c
@@ +1120,3 @@
       g_type_ensure (g_portal_notification_backend_get_type ());
+      g_type_ensure (g_network_monitor_portal_get_type ());
+      g_type_ensure (g_proxy_resolver_portal_get_type ());

Hmm, looking at the source file, it appears you are right; sorry for the false alarm.
Comment 10 Fan, Chun-wei 2016-07-13 03:33:39 UTC
Comment on attachment 331291 [details] [review]
gio: Build portal items only on *NIX (take ii)

Hi Matthias,

I pushed the patch as b5258d9, thanks for the review and ack.

With blessings, thank you!