Skip to content

Commit

Permalink
Add setting for default startup page
Browse files Browse the repository at this point in the history
  • Loading branch information
mrixner committed Nov 9, 2024
1 parent 0d9ca5c commit 83f7541
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/UniGetUI/Pages/MainView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,28 @@ public MainView()

DiscoverNavButton.ForceClick();

string StartupPage = Settings.GetValue("StartupPage");
switch (StartupPage)
{
case "discover":
NavigateToPage(DiscoverPage);
break;
case "updates":
NavigateToPage(UpdatesPage);
break;
case "installed":
NavigateToPage(InstalledPage);
break;
case "bundles":
NavigateToPage(BundlesPage);
break;
case "settings":
NavigateToPage(SettingsPage);
break;
default: // setting not set or setting set to `default` (
break;
}

if (CoreTools.IsAdministrator() && !Settings.Get("AlreadyWarnedAboutAdmin"))
{
Settings.Set("AlreadyWarnedAboutAdmin", true);
Expand Down
5 changes: 5 additions & 0 deletions src/UniGetUI/Pages/SettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@
SettingName="PreferredTheme"
ValueChanged="ThemeSelector_ValueChanged"
/>
<widgets:ComboboxCard
x:Name="StartupPage"
Text="Startup page:"
SettingName="StartupPage"
/>
<widgets:CheckboxCard
Text="Do not remove successful operations from the list automatically"
SettingName="MaintainSuccessfulInstalls"
Expand Down
9 changes: 9 additions & 0 deletions src/UniGetUI/Pages/SettingsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ public SettingsInterface()
ThemeSelector.AddItem(CoreTools.AutoTranslated("Follow system color scheme"), "auto");
ThemeSelector.ShowAddedItems();

StartupPage.AddItem(CoreTools.AutoTranslated("Discover Packages"), "discover");
StartupPage.AddItem(CoreTools.AutoTranslated("Software Updates"), "updates");
StartupPage.AddItem(CoreTools.AutoTranslated("Installed Packages"), "installed");
StartupPage.AddItem(CoreTools.AutoTranslated("Package Bundles"), "bundles");
StartupPage.AddItem(CoreTools.AutoTranslated("Settings"), "settings");
// At the moment this is just discover (`DiscoverNavButton.ForceClick();` in MainView.xaml.cs), but that might change
StartupPage.AddItem(CoreTools.AutoTranslated("Default"), "default");
StartupPage.ShowAddedItems();

// UI Section
// DisableIconsOnPackageLists.Text = "[EXPERIMENTAL] " + CoreTools.Translate("Show package icons on package lists");

Expand Down

0 comments on commit 83f7541

Please sign in to comment.