Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permissions view creates empty files in home folder #124

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Permissions/Backend/App.vala
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public class Permissions.Backend.App : GLib.Object {
private string get_overrides_path () {
var overrides_folder_path = GLib.Path.build_path (
GLib.Path.DIR_SEPARATOR_S,
AppManager.get_default ().user_installation_path,
FlatpakManager.get_default ().user_installation_path,
"overrides"
);

Expand Down
2 changes: 0 additions & 2 deletions src/Permissions/Backend/AppManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

public class Permissions.Backend.AppManager : GLib.Object {
public HashTable<string, Backend.App> apps { get; private set; }
public string user_installation_path { get; private set; }

private static AppManager? instance;
public static AppManager get_default () {
Expand All @@ -37,7 +36,6 @@ public class Permissions.Backend.AppManager : GLib.Object {

try {
var installation = new Flatpak.Installation.user ();
user_installation_path = installation.get_path ().get_path ();
get_apps_for_installation (installation);
} catch (Error e) {
critical ("Unable to get flatpak user installation : %s", e.message);
Expand Down
42 changes: 42 additions & 0 deletions src/Permissions/Backend/FlatpakManager.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2020 elementary, Inc. (https://elementary.io)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* Authored by: Marius Meisenzahl <mariusmeisenzahl@gmail.com>
*/

public class Permissions.Backend.FlatpakManager : GLib.Object {
public string user_installation_path { get; private set; }

private static FlatpakManager? instance;
public static FlatpakManager get_default () {
if (instance == null) {
instance = new FlatpakManager ();
}

return instance;
}

construct {
try {
var installation = new Flatpak.Installation.user ();
user_installation_path = installation.get_path ().get_path ();
} catch (Error e) {
critical ("Unable to get flatpak user installation : %s", e.message);
}
}
}
1 change: 1 addition & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ plug_files = files(
'Defaults/DefaultPlug.vala',
'Permissions/Backend/App.vala',
'Permissions/Backend/AppManager.vala',
'Permissions/Backend/FlatpakManager.vala',
'Permissions/Backend/PermissionSettings.vala',
'Permissions/Widgets/AppSettingsView.vala',
'Permissions/Widgets/PermissionSettingsWidget.vala',
Expand Down