[xdg-desktop-portal-gnome] session: emit the Closed signal when we're closing on our own account



commit b33d02e04877bfeeaa43671d3b1b48e0680fc12d
Author: Peter Hutterer <peter hutterer who-t net>
Date:   Mon Aug 22 18:45:46 2022 +1000

    session: emit the Closed signal when we're closing on our own account
    
    If a RemoteDesktop/ScreenCast session is closed by mutter, send out the
    Closed signal on our impl.portal.Session to notify the
    xdg-desktop-portal that we're done.
    
    Related: https://github.com/flatpak/xdg-desktop-portal/issues/508

 src/remotedesktop.c |  2 +-
 src/screencast.c    |  2 +-
 src/session.c       | 11 +++++++++--
 src/session.h       |  2 +-
 4 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/remotedesktop.c b/src/remotedesktop.c
index 5c7eb0e..4b13816 100644
--- a/src/remotedesktop.c
+++ b/src/remotedesktop.c
@@ -267,7 +267,7 @@ static void
 on_mutter_session_closed (OrgGnomeMutterRemoteDesktopSession *mutter_session_proxy,
                           RemoteDesktopSession *remote_desktop_session)
 {
-  session_close ((Session *)remote_desktop_session);
+  session_close ((Session *)remote_desktop_session, TRUE);
 }
 
 static RemoteDesktopSession *
diff --git a/src/screencast.c b/src/screencast.c
index e0329c6..82fcec7 100644
--- a/src/screencast.c
+++ b/src/screencast.c
@@ -251,7 +251,7 @@ static void
 on_gnome_screen_cast_session_closed (GnomeScreenCastSession *gnome_screen_cast_session,
                                      ScreenCastSession      *screen_cast_session)
 {
-  session_close ((Session *)screen_cast_session);
+  session_close ((Session *)screen_cast_session, TRUE);
 }
 
 static gboolean
diff --git a/src/session.c b/src/session.c
index 5ebe13f..b428ef8 100644
--- a/src/session.c
+++ b/src/session.c
@@ -73,8 +73,15 @@ session_unexport (Session *session)
 }
 
 void
-session_close (Session *session)
+session_close (Session *session, gboolean notify)
 {
+  if (notify)
+    {
+      GVariantBuilder details_builder;
+      g_variant_builder_init (&details_builder, G_VARIANT_TYPE_VARDICT);
+      g_signal_emit_by_name (session, "closed", g_variant_builder_end (&details_builder));
+    }
+
   if (session->exported)
     session_unexport (session);
 
@@ -92,7 +99,7 @@ handle_close (XdpImplSession *object,
   Session *session = (Session *)object;
 
   if (!session->closed)
-    session_close (session);
+    session_close (session, FALSE);
 
   xdp_impl_session_complete_close (object, invocation);
 
diff --git a/src/session.h b/src/session.h
index 4a1173a..7594bd8 100644
--- a/src/session.h
+++ b/src/session.h
@@ -47,7 +47,7 @@ Session *lookup_session (const char *id);
 
 Session *session_new (const char *id);
 
-void session_close (Session *session);
+void session_close (Session *session, gboolean notify);
 
 gboolean session_export (Session *session,
                          GDBusConnection *connection,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]