[gnome-text-editor] app: ignore portal if it fails



commit b4034abb602eeb16c8ee9b3b145df6ada97c7ef6
Author: Christian Hergert <christian hergert me>
Date:   Wed Dec 22 12:52:32 2021 -0800

    app: ignore portal if it fails

 src/editor-application.c | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)
---
diff --git a/src/editor-application.c b/src/editor-application.c
index 0e94c24..3cfe198 100644
--- a/src/editor-application.c
+++ b/src/editor-application.c
@@ -314,20 +314,23 @@ editor_application_startup (GApplication *application)
                                                 PORTAL_SETTINGS_INTERFACE,
                                                 NULL,
                                                 NULL);
-  g_assert_nonnull (self->portal);
-  g_signal_connect_object (self->portal,
-                           "g-signal",
-                           G_CALLBACK (on_portal_settings_changed_cb),
-                           self,
-                           G_CONNECT_SWAPPED);
-  all = g_dbus_proxy_call_sync (self->portal,
-                                "ReadAll",
-                                g_variant_new ("(^as)", patterns),
-                                G_DBUS_CALL_FLAGS_NONE,
-                                G_MAXINT,
-                                NULL,
-                                NULL);
-  parse_portal_settings (self, all);
+
+  if (self->portal != NULL)
+    {
+      g_signal_connect_object (self->portal,
+                               "g-signal",
+                               G_CALLBACK (on_portal_settings_changed_cb),
+                               self,
+                               G_CONNECT_SWAPPED);
+      all = g_dbus_proxy_call_sync (self->portal,
+                                    "ReadAll",
+                                    g_variant_new ("(^as)", patterns),
+                                    G_DBUS_CALL_FLAGS_NONE,
+                                    G_MAXINT,
+                                    NULL,
+                                    NULL);
+      parse_portal_settings (self, all);
+    }
 
   style_manager = adw_style_manager_get_default ();
 


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