messenger-gtk

Gtk+3 graphical user interfaces for GNUnet Messenger
Log | Files | Refs | Submodules | README | LICENSE

commit df68f8a8d72be64f0e82398ea4c5e15384aae31e
parent 541496e9f0264ade1cce2c0aae6730aaa43afc74
Author: Jacki <jacki@thejackimonster.de>
Date:   Sat,  9 Mar 2024 01:19:41 +0100

Allow silent fail of pipewire connection

Signed-off-by: Jacki <jacki@thejackimonster.de>

Diffstat:
Msrc/application.c | 27+++++++++++++++------------
Msrc/application.h | 9+++++++++
Msrc/ui/new_contact.c | 3+--
3 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/src/application.c b/src/application.c @@ -302,13 +302,9 @@ application_init(MESSENGER_Application *app, ), 0 ); - else - g_printerr("ERROR: PW-Loop not created!\n"); if (app->pw.context) pw_context_load_module(app->pw.context, "libpipewire-module-link-factory", NULL, NULL); - else - g_printerr("ERROR: PW-Context not created!\n"); app->pw.core = app->pw.context? pw_context_connect(app->pw.context, NULL, 0) : NULL; app->pw.registry = app->pw.core? @@ -323,8 +319,6 @@ application_init(MESSENGER_Application *app, &remote_core_events, app ); - else - g_printerr("ERROR: PW-Core not created!\n"); if (app->pw.registry) pw_registry_add_listener( @@ -333,13 +327,8 @@ application_init(MESSENGER_Application *app, &registry_events, app ); - else - g_printerr("ERROR: PW-Registry not created!\n"); - - app->pw.pending = app->pw.core? pw_core_sync(app->pw.core, 0, 0) : 0; - if ((app->pw.main_loop) && (app->pw.core)) - pw_main_loop_run(app->pw.main_loop); + application_pw_main_loop_run(app); g_application_add_main_option( G_APPLICATION(app->application), @@ -499,6 +488,20 @@ application_run(MESSENGER_Application *app) g_object_unref(app->application); } +void +application_pw_main_loop_run(MESSENGER_Application *app) +{ + g_assert(app); + + if ((! app->pw.core) || (! app->pw.main_loop)) + return; + + app->pw.pending = app->pw.core? pw_core_sync(app->pw.core, 0, 0) : 0; + + if ((app->pw.main_loop) && (app->pw.core)) + pw_main_loop_run(app->pw.main_loop); +} + static void _request_background_callback(MESSENGER_Application *app, gboolean success, diff --git a/src/application.h b/src/application.h @@ -195,6 +195,15 @@ void application_run(MESSENGER_Application *app); /** + * Run the pipewire main loop of the messenger + * application if available. + * + * @param app Messenger application + */ +void +application_pw_main_loop_run(MESSENGER_Application *app); + +/** * Shows the messenger application main window. * * @param app Messenger application diff --git a/src/ui/new_contact.c b/src/ui/new_contact.c @@ -388,9 +388,8 @@ _init_camera_pipeline(MESSENGER_Application *app, if (access) #endif { - app->pw.pending = pw_core_sync(app->pw.core, 0, 0); + application_pw_main_loop_run(app); - pw_main_loop_run(app->pw.main_loop); pw_map_for_each(&(app->pw.globals), iterate_global, handle); if (handle->camera_count)