Skip to content

Commit

Permalink
Don't check for updates in the guest session (#2090)
Browse files Browse the repository at this point in the history
  • Loading branch information
meisenzahl committed Mar 12, 2024
1 parent 9095dfb commit 35ccd8d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions data/styles/MainWindow.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

.titlebar {
min-height: rem(32px);
padding-bottom: rem(3px);
padding-top: rem(3px);
}
Expand Down
1 change: 1 addition & 0 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public class AppCenter.App : Gtk.Application {
client.cache_update_failed.connect (on_cache_update_failed);

refresh_action = new SimpleAction ("refresh", null);
refresh_action.set_enabled (!Utils.is_running_in_guest_session ());
refresh_action.activate.connect (() => {
client.update_cache.begin (true);
});
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Client.vala
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class AppCenterCore.Client : Object {
public async void update_cache (bool force = false, CacheUpdateType cache_update_type = CacheUpdateType.ALL) {
cancellable.reset ();

if (Utils.is_running_in_demo_mode ()) {
if (Utils.is_running_in_demo_mode () || Utils.is_running_in_guest_session ()) {
return;
}

Expand Down
8 changes: 5 additions & 3 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class AppCenter.MainWindow : Gtk.ApplicationWindow {

notify["working"].connect (() => {
Idle.add (() => {
App.refresh_action.set_enabled (!working);
App.refresh_action.set_enabled (!working && !Utils.is_running_in_guest_session ());
App.repair_action.set_enabled (!working);
return GLib.Source.REMOVE;
});
Expand Down Expand Up @@ -188,8 +188,10 @@ public class AppCenter.MainWindow : Gtk.ApplicationWindow {
title_widget = search_clamp
};
headerbar.pack_start (return_button);
headerbar.pack_end (menu_button);
headerbar.pack_end (view_mode_revealer);
if (!Utils.is_running_in_guest_session ()) {
headerbar.pack_end (menu_button);
headerbar.pack_end (view_mode_revealer);
}

var homepage = new Homepage ();
installed_view = new Views.AppListUpdateView ();
Expand Down
4 changes: 4 additions & 0 deletions src/Utils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,8 @@ namespace Utils {

return false;
}

public static bool is_running_in_guest_session () {
return Environment.get_user_name ().has_prefix ("guest-");
}
}

0 comments on commit 35ccd8d

Please sign in to comment.