Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,9 @@ install_data(
'io.elementary.onboarding.gschema.xml',
install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas')
)

# Stop the default guest session dialog from showing
install_data(
'prefs.sh',
install_dir: get_option('sysconfdir') / 'guest-session'
)
5 changes: 4 additions & 1 deletion data/onboarding.metainfo.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<update_contact>contact_at_elementary.io</update_contact>

<releases>
<release version="7.0.2" date="2023-03-28" urgency="medium">
<release version="7.1.0" date="2023-04-04" urgency="medium">
<description>
<ul>
<li>Generate a main page icon using the default wallpaper and accent color</li>
Expand All @@ -60,6 +60,9 @@
<li>Updated translations</li>
</ul>
</description>
<issues>
<issue url="https://github.com/elementary/onboarding/issues/204">Handle guest account warning</issue>
</issues>
</release>

<release version="7.0.1" date="2022-10-20" urgency="medium">
Expand Down
1 change: 1 addition & 0 deletions data/prefs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
touch $HOME/.skip-guest-warning-dialog
1 change: 1 addition & 0 deletions po/POTFILES
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ src/Views/AbstractOnboardingView.vala
src/Views/AppCenterView.vala
src/Views/EarlyAccessView.vala
src/Views/FinishView.vala
src/Views/GuestView.vala
src/Views/HouseKeepingView.vala
src/Views/NightLightView.vala
src/Views/OnlineAccountsView.vala
Expand Down
2 changes: 1 addition & 1 deletion src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class Onboarding.App : Gtk.Application {
}

public override void activate () {
if (Posix.getuid () < MIN_UID) {
if (Posix.getuid () < MIN_UID && !(Environment.get_user_name ().has_prefix ("guest-"))) {
quit ();
}

Expand Down
12 changes: 9 additions & 3 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ public class Onboarding.MainWindow : Gtk.ApplicationWindow {
critical ("Couldn't read apt sources: %s", e.message);
}

var guest_session = Environment.get_user_name ().has_prefix ("guest-");
if (guest_session || Posix.isatty (Posix.STDIN_FILENO)) {
var guest_view = new GuestView ();
carousel.append (guest_view);
}

if (early_access) {
var early_access_view = new EarlyAccessView ();
carousel.append (early_access_view);
Expand All @@ -82,12 +88,12 @@ public class Onboarding.MainWindow : Gtk.ApplicationWindow {
carousel.append (night_light_view);
}

if (!("housekeeping" in viewed)) {
if (!("housekeeping" in viewed || guest_session)) {
var housekeeping_view = new HouseKeepingView ();
carousel.append (housekeeping_view);
}

if (!("onlineaccounts" in viewed)) {
if (!("onlineaccounts" in viewed || guest_session)) {
var onlineaccounts_view = new OnlineAccountsView ();
carousel.append (onlineaccounts_view);
}
Expand All @@ -98,7 +104,7 @@ public class Onboarding.MainWindow : Gtk.ApplicationWindow {
carousel.append (appcenter_view);
}

if (!("updates" in viewed)) {
if (!("updates" in viewed || guest_session)) {
var updates_view = new UpdatesView ();
carousel.append (updates_view);
}
Expand Down
31 changes: 31 additions & 0 deletions src/Views/AbstractOnboardingView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,35 @@ public abstract class AbstractOnboardingView : Gtk.Box {

bind_property ("description", description_label, "label");
}

public class ListItem : Gtk.Box {
public string color { get; construct; }
public string icon_name { get; construct; }
public string label { get; construct; }

public ListItem (string icon_name, string label, string color) {
Object (
icon_name: icon_name,
label: label,
color: color
);
}

construct {
var image = new Gtk.Image.from_icon_name (icon_name);
image.add_css_class (Granite.STYLE_CLASS_ACCENT);
image.add_css_class (color);

var description_label = new Gtk.Label (label) {
hexpand = true,
max_width_chars = 40,
wrap = true,
xalign = 0
};

spacing = 6;
append (image);
append (description_label);
}
}
}
31 changes: 0 additions & 31 deletions src/Views/EarlyAccessView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -39,35 +39,4 @@ public class Onboarding.EarlyAccessView : AbstractOnboardingView {
custom_bin.append (features_item);
custom_bin.append (bugs_item);
}

private class ListItem : Gtk.Box {
public string color { get; construct; }
public string icon_name { get; construct; }
public string label { get; construct; }

public ListItem (string icon_name, string label, string color) {
Object (
icon_name: icon_name,
label: label,
color: color
);
}

construct {
var image = new Gtk.Image.from_icon_name (icon_name);
image.add_css_class (Granite.STYLE_CLASS_ACCENT);
image.add_css_class (color);

var description_label = new Gtk.Label (label) {
hexpand = true,
max_width_chars = 40,
wrap = true,
xalign = 0
};

spacing = 6;
append (image);
append (description_label);
}
}
}
39 changes: 39 additions & 0 deletions src/Views/GuestView.vala
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* SPDX-License-Identifier: GPL-3.0-or-later
* SPDX-FileCopyrightText: 2023 elementary, Inc. (https://elementary.io)
*/

public class Onboarding.GuestView : AbstractOnboardingView {
public GuestView () {
Object (
view_name: "guest",
description: _("This temporary session will be reset when you log out."),
icon_name: "avatar-default",
title: _("Guest Session")
);
}

construct {
var upgrades_item = new ListItem (
"user-trash-symbolic",
_("All data created during this session will be deleted"),
"orange"
);

var features_item = new ListItem (
"preferences-system-symbolic",
_("Settings will be reset to defaults"),
"yellow"
);

var bugs_item = new ListItem (
"drive-removable-media-symbolic",
_("Save files on an external device to access them later"),
"green"
);

custom_bin.append (upgrades_item);
custom_bin.append (features_item);
custom_bin.append (bugs_item);
}
}
1 change: 1 addition & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ vala_files = [
'Views/AppCenterView.vala',
'Views/EarlyAccessView.vala',
'Views/FinishView.vala',
'Views/GuestView.vala',
'Views/HouseKeepingView.vala',
'Views/NightLightView.vala',
'Views/OnlineAccountsView.vala',
Expand Down