MCPcopy Index your code
hub / github.com/Audio4Linux/JDSP4Linux / onPortalBackgroundRequest

Function onPortalBackgroundRequest

src/utils/AutoStartManager.cpp:22–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20
21#ifdef USE_PORTALS
22static void onPortalBackgroundRequest(GObject *source_object, GAsyncResult *res, gpointer data) {
23 Q_UNUSED(source_object)
24 Q_UNUSED(data)
25
26 g_autoptr(GError) error = nullptr;
27
28 if (xdp_portal_request_background_finish(XdpQt::globalPortalObject(), res, &error) == 0) {
29 QString reason;
30 QString explanation;
31
32 if (error != nullptr && error->code == 19) {
33 reason = QObject::tr("Auto-start permission has been denied");
34 explanation = QObject::tr("Please run 'flatpak permission-set background background %1 yes' and reenable auto-start.").arg(FLATPAK_APP_ID);
35 } else {
36 reason = QObject::tr("Unknown error");
37 explanation = QObject::tr("Please make sure a XDG Background Portal implementation is available and active to use auto-start. %1").arg((error) != nullptr ? error->message : "");
38 }
39
40 Log::error(reason);
41 Log::error(explanation);
42 // QMessageBox::critical(nullptr, reason, explanation);
43
44 Log::error("Auto-start disabled");
45 AppConfig::instance().set(AppConfig::AutoStartEnabled, false);
46 }
47
48 Log::information("Background request granted");
49}
50#endif
51
52void AutostartManager::setEnabled(bool enabled)

Callers

nothing calls this directly

Calls 1

setMethod · 0.45

Tested by

no test coverage detected