applications: Rename functions as portal permssions are not Flatpak specific

This commit is contained in:
Robert Ancell 2019-02-19 14:34:46 +01:00 committed by Georges Basile Stavracas Neto
parent a856740dfa
commit a3db60a24b

View file

@ -156,13 +156,13 @@ open_software_cb (GtkButton *button,
g_spawn_async (NULL, (char **)argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL); g_spawn_async (NULL, (char **)argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
} }
/* --- flatpak permissions and utilities --- */ /* --- portal permissions and utilities --- */
static gchar ** static gchar **
get_flatpak_permissions (CcApplicationsPanel *self, get_portal_permissions (CcApplicationsPanel *self,
const gchar *table, const gchar *table,
const gchar *id, const gchar *id,
const gchar *app_id) const gchar *app_id)
{ {
g_autoptr(GVariant) ret = NULL; g_autoptr(GVariant) ret = NULL;
g_autoptr(GVariantIter) iter = NULL; g_autoptr(GVariantIter) iter = NULL;
@ -191,11 +191,11 @@ get_flatpak_permissions (CcApplicationsPanel *self,
} }
static void static void
set_flatpak_permissions (CcApplicationsPanel *self, set_portal_permissions (CcApplicationsPanel *self,
const gchar *table, const gchar *table,
const gchar *id, const gchar *id,
const gchar *app_id, const gchar *app_id,
const gchar * const *permissions) const gchar * const *permissions)
{ {
g_autoptr(GError) error = NULL; g_autoptr(GError) error = NULL;
@ -207,7 +207,7 @@ set_flatpak_permissions (CcApplicationsPanel *self,
NULL, NULL,
&error); &error);
if (error) if (error)
g_warning ("Error setting Flatpak permissions: %s", error->message); g_warning ("Error setting portal permissions: %s", error->message);
} }
static char * static char *
@ -359,7 +359,7 @@ get_notification_allowed (CcApplicationsPanel *self,
} }
else else
{ {
g_auto(GStrv) perms = get_flatpak_permissions (self, "notifications", "notification", app_id); g_auto(GStrv) perms = get_portal_permissions (self, "notifications", "notification", app_id);
*set = perms != NULL; *set = perms != NULL;
/* FIXME: needs unreleased xdg-desktop-portals to write permissions on use */ /* FIXME: needs unreleased xdg-desktop-portals to write permissions on use */
*set = TRUE; *set = TRUE;
@ -380,7 +380,7 @@ set_notification_allowed (CcApplicationsPanel *self,
const gchar *perms[2] = { NULL, NULL }; const gchar *perms[2] = { NULL, NULL };
perms[0] = allowed ? "yes" : "no"; perms[0] = allowed ? "yes" : "no";
set_flatpak_permissions (self, "notifications", "notification", self->current_flatpak_id, perms); set_portal_permissions (self, "notifications", "notification", self->current_flatpak_id, perms);
} }
} }
@ -428,7 +428,7 @@ get_device_allowed (CcApplicationsPanel *self,
{ {
g_auto(GStrv) perms = NULL; g_auto(GStrv) perms = NULL;
perms = get_flatpak_permissions (self, "devices", device, app_id); perms = get_portal_permissions (self, "devices", device, app_id);
*set = perms != NULL; *set = perms != NULL;
*allowed = perms == NULL || strcmp (perms[0], "no") != 0; *allowed = perms == NULL || strcmp (perms[0], "no") != 0;
@ -444,7 +444,7 @@ set_device_allowed (CcApplicationsPanel *self,
perms[0] = allowed ? "yes" : "no"; perms[0] = allowed ? "yes" : "no";
perms[1] = NULL; perms[1] = NULL;
set_flatpak_permissions (self, "devices", device, self->current_flatpak_id, perms); set_portal_permissions (self, "devices", device, self->current_flatpak_id, perms);
} }
static void static void
@ -478,7 +478,7 @@ get_location_allowed (CcApplicationsPanel *self,
{ {
g_auto(GStrv) perms = NULL; g_auto(GStrv) perms = NULL;
perms = get_flatpak_permissions (self, "location", "location", app_id); perms = get_portal_permissions (self, "location", "location", app_id);
*set = perms != NULL; *set = perms != NULL;
*allowed = perms == NULL || strcmp (perms[0], "NONE") != 0; *allowed = perms == NULL || strcmp (perms[0], "NONE") != 0;
@ -495,7 +495,7 @@ set_location_allowed (CcApplicationsPanel *self,
perms[1] = "0"; perms[1] = "0";
perms[2] = NULL; perms[2] = NULL;
set_flatpak_permissions (self, "location", "location", self->current_flatpak_id, perms); set_portal_permissions (self, "location", "location", self->current_flatpak_id, perms);
} }
static void static void
@ -1442,7 +1442,7 @@ on_perm_store_ready (GObject *source_object,
if (proxy == NULL) if (proxy == NULL)
{ {
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
g_warning ("Failed to connect to flatpak permission store: %s", g_warning ("Failed to connect to portal permission store: %s",
error->message); error->message);
return; return;
} }