Skip to content

Commit

Permalink
background: Allow enabling background apps for partial support in
Browse files Browse the repository at this point in the history
Xfce and MATE.

Only Cinnamon currently supports getting application states,
but being able to enable autostart for flatpaks is still a useful
function.

Ref: #17
  • Loading branch information
mtwebster committed Jun 14, 2024
1 parent 15da6ed commit 024ec3e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
29 changes: 19 additions & 10 deletions src/background.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,15 @@ handle_get_app_state (XdpImplBackground *object,
{
g_debug ("background: handle GetAppState");

if (!CINNAMON_MODE)
{
g_dbus_method_invocation_return_error (invocation,
XDG_DESKTOP_PORTAL_ERROR,
XDG_DESKTOP_PORTAL_ERROR_FAILED,
"GetAppState currently only supported in Cinnamon");
return TRUE;
}

if (app_state == NULL)
app_state = get_app_state ();

Expand Down Expand Up @@ -243,16 +252,16 @@ background_init (GDBusConnection *bus,
error))
return FALSE;

portal_handlers = org_cinnamon_portal_handlers_proxy_new_sync (bus,
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
"org.Cinnamon",
"/org/Cinnamon",
NULL,
error);
g_signal_connect (portal_handlers, "g-signal", G_CALLBACK (on_cinnamon_signal), helper);

if (portal_handlers == NULL)
return FALSE;
if (CINNAMON_MODE)
{
portal_handlers = org_cinnamon_portal_handlers_proxy_new_sync (bus,
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
"org.Cinnamon",
"/org/Cinnamon",
NULL,
error);
g_signal_connect (portal_handlers, "g-signal", G_CALLBACK (on_cinnamon_signal), helper);
}

g_debug ("providing %s", g_dbus_interface_skeleton_get_info (helper)->name);

Expand Down
2 changes: 1 addition & 1 deletion src/xdg-desktop-portal-xapp.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ on_bus_acquired (GDBusConnection *connection,
g_clear_error (&error);
}

if (CINNAMON_MODE && !background_init (connection, &error))
if (!background_init (connection, &error))
{
g_warning ("error: %s\n", error->message);
g_clear_error (&error);
Expand Down

0 comments on commit 024ec3e

Please sign in to comment.