Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4d41f82
Satisfy linter
meisenzahl Sep 19, 2020
a96ed4a
Add view to install third party software
meisenzahl Sep 19, 2020
6fa525d
Add packages for additional media formats to list
meisenzahl Sep 19, 2020
2f0d8cb
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Sep 19, 2020
d690122
Update src/Views/ThirdPartySoftwareView.vala
meisenzahl Sep 19, 2020
d625297
Rename to software
meisenzahl Sep 19, 2020
61dba02
Remove unused class
meisenzahl Sep 21, 2020
6da68e8
Rearrange views
meisenzahl Sep 21, 2020
67de351
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Sep 21, 2020
2b8233a
Add packagekit as dependency
meisenzahl Sep 21, 2020
2d0dbaa
Install libpackagekit-glib2-dev for CI job
meisenzahl Sep 21, 2020
a021056
Install additional packages
meisenzahl Sep 21, 2020
da6e15e
Satisfy linter
meisenzahl Sep 21, 2020
df0f281
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Oct 21, 2020
01f0a07
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Oct 25, 2020
6a4ef57
Merge branch 'master' into option-to-install-proprietary-codecs
cassidyjames Nov 5, 2020
deef4ef
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Nov 14, 2020
c28b625
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Dec 15, 2020
41183fa
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Dec 28, 2020
1375424
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Jan 30, 2021
81b29c1
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Feb 11, 2021
bdadb7e
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Feb 17, 2021
f2b74d5
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Feb 24, 2021
aa41dcd
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Mar 2, 2021
7ac87fc
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Mar 8, 2021
f65354e
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Mar 14, 2021
834f17f
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Mar 30, 2021
bbdf337
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Apr 6, 2021
f599d59
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl May 2, 2021
93b28c4
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl May 28, 2021
b0957c8
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Jun 1, 2021
6f9d14e
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Jul 17, 2021
9a89167
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Aug 11, 2021
b164ed1
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Oct 17, 2021
776112f
Fix merge errors
meisenzahl Oct 17, 2021
f980bd1
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Jan 6, 2023
c42e7f4
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Jan 6, 2023
fc75a34
Add logic to install Flatpak runtime
meisenzahl Jan 6, 2023
6ad7ed5
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Jan 6, 2023
0f66e28
Satisfy linter
meisenzahl Jan 6, 2023
1b8b480
GitHub Actions: Install libflatpak-dev
meisenzahl Jan 7, 2023
58529b9
Sync changes
meisenzahl Jan 7, 2023
5c69ca3
Sync changes
meisenzahl Jan 7, 2023
b02f8b1
Merge branch 'master' into option-to-install-proprietary-codecs
meisenzahl Jan 8, 2023
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
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Install Dependencies
run: |
apt update
apt install -y desktop-file-utils gettext meson libaccountsservice-dev libgtk-3-dev libgee-0.8-dev libgranite-dev libhandy-1-dev libxml2-dev libjson-glib-dev libgnomekbd-dev libpolkit-gobject-1-dev libpwquality-dev libxml2-utils valac
apt install -y desktop-file-utils gettext meson libaccountsservice-dev libflatpak-dev libgtk-3-dev libgee-0.8-dev libgranite-dev libhandy-1-dev libxml2-dev libjson-glib-dev libgnomekbd-dev libpolkit-gobject-1-dev libpwquality-dev libxml2-utils valac
- name: Build
run: |
meson build
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ You'll need the following dependencies:
* gettext
* granite >= 0.5
* libaccountsservice-dev
* libflatpak-dev
* libgnomekbd-dev
* libgtk-3-dev
* libhandy-1-dev
Expand Down
2 changes: 2 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ gnome = import('gnome')
i18n = import('i18n')

accountservice_dep = dependency('accountsservice')
flatpak_dep = dependency ('flatpak')
gee_dep = dependency('gee-0.8')
glib_dep = dependency('glib-2.0')
gobject_dep = dependency('gobject-2.0')
Expand All @@ -26,6 +27,7 @@ xml2_dep = dependency('libxml-2.0')

dependencies = [
accountservice_dep,
flatpak_dep,
gee_dep,
glib_dep,
gobject_dep,
Expand Down
36 changes: 35 additions & 1 deletion src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public class Installer.MainWindow : Hdy.Window {
private LanguageView language_view;
private KeyboardLayoutView keyboard_layout_view;
private NetworkView network_view;
private ProgressView progress_view;
private SoftwareView software_view;

construct {
language_view = new LanguageView ();
Expand Down Expand Up @@ -71,7 +73,24 @@ public class Installer.MainWindow : Hdy.Window {
deck.add (network_view);
deck.visible_child = network_view;

network_view.next_step.connect (load_account_view);
network_view.next_step.connect (load_software_view);
} else {
load_software_view ();
}
}

private void load_software_view () {
if (software_view != null) {
software_view.destroy ();
}

if (NetworkMonitor.get_default ().get_network_available ()) {
software_view = new SoftwareView ();

deck.add (software_view);
deck.visible_child = software_view;

software_view.next_step.connect (load_account_view);
} else {
load_account_view ();
}
Expand All @@ -86,5 +105,20 @@ public class Installer.MainWindow : Hdy.Window {

deck.add (account_view);
deck.visible_child = account_view;

account_view.next_step.connect (on_finish);
}

private void on_finish () {
if (progress_view != null) {
progress_view.destroy ();
}

progress_view = new ProgressView ();

deck.add (progress_view);
deck.visible_child = progress_view;

progress_view.start_setup ();
}
}
5 changes: 5 additions & 0 deletions src/Objects/Configuration.vala
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,9 @@ public class Configuration : GLib.Object {
public InitialSetup.KeyboardLayout keyboard_layout { get; set; }
public InitialSetup.KeyboardVariant? keyboard_variant { get; set; default = null; }
public bool left_handed { get; set; }
public bool install_additional_media_formats { get; set; default = false; }
public string realname { get; set; }
public string username { get; set; }
public string password { get; set; }
public string hostname { get; set; }
}
170 changes: 11 additions & 159 deletions src/Views/AccountView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,6 @@ public class Installer.AccountView : AbstractInstallerView {
}
}

private Polkit.Permission? _permission = null;
private Polkit.Permission? permission {
get {
if (_permission != null) {
return _permission;
}

try {
_permission = new Polkit.Permission.sync ("org.freedesktop.accounts.user-administration", new Polkit.UnixProcess (Posix.getpid ()));
} catch (Error e) {
critical (e.message);
}

return _permission;
}
}

private Act.User? created_user = null;
private ErrorRevealer confirm_entry_revealer;
private ErrorRevealer pw_error_revealer;
private ErrorRevealer username_error_revealer;
Expand Down Expand Up @@ -191,14 +173,24 @@ public class Installer.AccountView : AbstractInstallerView {
update_finish_button ();
});

finish_button.clicked.connect (create_new_user);
finish_button.clicked.connect (on_finish_button_clicked);

show_all ();

realname_entry.bind_property ("text", avatar, "text");
realname_entry.grab_focus ();
}

private void on_finish_button_clicked () {
unowned var configuration = Configuration.get_default ();
configuration.realname = realname_entry.text;
configuration.username = username_entry.text;
configuration.password = pw_entry.text;
configuration.hostname = hostname_entry.text;

next_step ();
}

private bool check_password () {
if (pw_entry.text == "") {
confirm_entry.text = "";
Expand Down Expand Up @@ -286,146 +278,6 @@ public class Installer.AccountView : AbstractInstallerView {
}
}

private void create_new_user () {
string? primary_text = null;
string? error_message = null;

if (permission != null && permission.allowed) {
try {
created_user = user_manager.create_user (username_entry.text, realname_entry.text, Act.UserAccountType.ADMINISTRATOR);
set_settings.begin ((obj, res) => {
set_settings.end (res);

Application.get_default ().quit ();
});
} catch (Error e) {
if (created_user != null) {
try {
user_manager.delete_user (created_user, true);
} catch (Error e) {
critical ("Unable to clean up failed user: %s", e.message);
}
}

primary_text = _("Creating an account for “%s” failed").printf (username_entry.text);
error_message = e.message;
}
} else {
primary_text = _("Couldn't get permission to create an account for “%s”").printf (username_entry.text);
}

if (primary_text != null) {
var error_dialog = new Granite.MessageDialog.with_image_from_icon_name (
primary_text,
_("Initial Setup could not create this account. Without it, you will not be able to log in and may need to reinstall the OS."),
"system-users",
Gtk.ButtonsType.CLOSE
) {
badge_icon = new ThemedIcon ("dialog-error"),
modal = true,
transient_for = (Gtk.Window) get_toplevel ()
};

if (error_message != null) {
error_dialog.show_error_details (error_message);
}

error_dialog.present ();
error_dialog.response.connect (error_dialog.destroy);
}
}

private async void set_settings () {
created_user.set_password (pw_entry.text, "");
yield set_accounts_service_settings ();
yield set_locale ();
set_hostname (hostname_entry.text);
}

public bool set_hostname (string hostname) {
string? primary_text = null;
string? error_message = null;

try {
var permission = new Polkit.Permission.sync ("org.freedesktop.hostname1.set-static-hostname", new Polkit.UnixProcess (Posix.getpid ()));

if (permission != null && permission.allowed) {
Utils.get_hostname_interface_instance ();
Utils.hostname_interface_instance.set_pretty_hostname (hostname, false);
Utils.hostname_interface_instance.set_static_hostname (Utils.gen_hostname (hostname), false);
} else {
primary_text = _("Couldn't get permission to name this device “%s”").printf (hostname);
}
} catch (GLib.Error e) {
primary_text = _("Unable to name this device “%s”").printf (hostname);
error_message = e.message;
}

if (primary_text != null) {
var error_dialog = new Granite.MessageDialog.with_image_from_icon_name (
primary_text,
_("Initial Setup could not set your hostname."),
"dialog-error",
Gtk.ButtonsType.CLOSE
) {
modal = true,
transient_for = (Gtk.Window) get_toplevel ()
};

if (error_message != null) {
error_dialog.show_error_details (error_message);
}

error_dialog.present ();
error_dialog.response.connect (error_dialog.destroy);

return false;
}

return true;
}

private async void set_locale () {
string lang = Configuration.get_default ().lang;
string? locale = null;
bool success = yield LocaleHelper.language2locale (lang, out locale);

if (!success || locale == null || locale == "") {
warning ("Falling back to setting unconverted language as user's locale, may result in incorrect language");
created_user.set_language (lang);
} else {
created_user.set_language (locale);
}
}

private async void set_accounts_service_settings () {
AccountsService accounts_service = null;

try {
var act_service = yield GLib.Bus.get_proxy<FDO.Accounts> (GLib.BusType.SYSTEM,
"org.freedesktop.Accounts",
"/org/freedesktop/Accounts");
var user_path = act_service.find_user_by_name (created_user.user_name);

accounts_service = yield GLib.Bus.get_proxy (GLib.BusType.SYSTEM,
"org.freedesktop.Accounts",
user_path,
GLib.DBusProxyFlags.GET_INVALIDATED_PROPERTIES);
} catch (Error e) {
warning ("Unable to get AccountsService proxy, settings on new user may be incorrect: %s", e.message);
}

if (accounts_service != null) {
var layouts = Configuration.get_default ().keyboard_layout.to_accountsservice_array ();
if (Configuration.get_default ().keyboard_variant != null) {
layouts = Configuration.get_default ().keyboard_variant.to_accountsservice_array ();
}

accounts_service.keyboard_layouts = layouts;
accounts_service.left_handed = Configuration.get_default ().left_handed;
}
}

private bool is_taken_username (string username) {
foreach (unowned Act.User user in user_manager.list_users ()) {
if (user.get_user_name () == username) {
Expand Down
Loading