Skip to content

Commit 55ebac8

Browse files
committed
chore: Cleanup
1 parent b5905e8 commit 55ebac8

5 files changed

Lines changed: 36 additions & 52 deletions

File tree

Nickvision.Application.GNOME/Views/MainWindow.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ private void About(Gio.SimpleAction sender, Gio.SimpleAction.ActivateSignalArgs
197197
dialog.DebugInfo = _controller.GetDebugInformation(extraInfo);
198198
dialog.Comments = _controller.AppInfo.Description;
199199
dialog.LicenseType = Gtk.License.MitX11;
200-
dialog.Copyright = "© Nickvision 2021-2025";
200+
dialog.Copyright = "© Nickvision 2021-2026";
201201
dialog.Website = "https://nickvision.org";
202202
dialog.IssueUrl = _controller.AppInfo.IssueTracker!.ToString();
203203
dialog.SupportUrl = _controller.AppInfo.DiscussionsForum!.ToString();

Nickvision.Application.GNOME/Views/PreferencesDialog.cs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
using Nickvision.Application.Shared.Controllers;
22
using Nickvision.Application.Shared.Models;
3-
using Nickvision.Desktop.Application;
43
using Nickvision.Desktop.GNOME.Helpers;
54
using System;
6-
using System.Collections.Generic;
75

86
namespace Nickvision.Application.GNOME.Views;
97

108
public class PreferencesDialog : Adw.PreferencesDialog
119
{
1210
private readonly PreferencesViewController _controller;
1311
private readonly Gtk.Builder _builder;
14-
private IReadOnlyList<SelectionItem<Theme>> _themes;
15-
private IReadOnlyList<SelectionItem<string>> _languages;
1612

1713
[Gtk.Connect("themeRow")]
1814
private Adw.ComboRow? _themeRow;
@@ -28,29 +24,27 @@ private PreferencesDialog(PreferencesViewController controller, Gtk.Builder buil
2824
{
2925
_controller = controller;
3026
_builder = builder;
31-
_themes = controller.Themes;
32-
_languages = controller.AvailableTranslationLanguages;
3327
_builder.Connect(this);
3428
// Load
35-
_themeRow!.SetModel(_themes);
36-
_languageRow!.SetModel(_languages);
29+
_themeRow!.SetModel(_controller.Themes);
30+
_languageRow!.SetModel(_controller.AvailableTranslationLanguages);
3731
// Events
3832
OnClosed += Dialog_OnClosed;
3933
_themeRow!.OnNotify += ThemeRow_OnNotify;
4034
}
4135

4236
private async void Dialog_OnClosed(Adw.Dialog sender, EventArgs args)
4337
{
44-
_controller.TranslationLanguage = _languages[(int)_languageRow!.Selected];
38+
_controller.TranslationLanguage = _controller.AvailableTranslationLanguages[(int)_languageRow!.Selected];
4539
await _controller.SaveConfigurationAsync();
4640
}
4741

4842
private void ThemeRow_OnNotify(GObject.Object sender, NotifySignalArgs args)
4943
{
5044
if (args.Pspec.GetName() == "selected-item")
5145
{
52-
_controller.Theme = _themes[(int)_themeRow!.Selected];
53-
Adw.StyleManager.GetDefault().ColorScheme = _themes[(int)_themeRow!.Selected].Value switch
46+
_controller.Theme = _controller.Themes[(int)_themeRow!.Selected];
47+
Adw.StyleManager.GetDefault().ColorScheme = _controller.Themes[(int)_themeRow!.Selected].Value switch
5448
{
5549
Theme.Light => Adw.ColorScheme.ForceLight,
5650
Theme.Dark => Adw.ColorScheme.ForceDark,

Nickvision.Application.Shared/Controllers/PreferencesViewController.cs

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Nickvision.Desktop.Application;
33
using Nickvision.Desktop.Filesystem;
44
using Nickvision.Desktop.Globalization;
5+
using System.Collections;
56
using System.Collections.Generic;
67
using System.Threading.Tasks;
78

@@ -13,46 +14,35 @@ public class PreferencesViewController
1314
private readonly Configuration _configuration;
1415

1516
public ITranslationService Translator { get; }
17+
public IReadOnlyList<SelectionItem<string>> AvailableTranslationLanguages { get; }
18+
public IReadOnlyList<SelectionItem<Theme>> Themes { get; }
1619

1720
public PreferencesViewController(IJsonFileService jsonFileService, ITranslationService translationService)
1821
{
1922
_jsonFileService = jsonFileService;
2023
_configuration = _jsonFileService.Load<Configuration>(Configuration.Key);
2124
Translator = translationService;
22-
}
23-
24-
public IReadOnlyList<SelectionItem<Theme>> Themes
25-
{
26-
get => new List<SelectionItem<Theme>>()
25+
AvailableTranslationLanguages = new List<SelectionItem<string>>()
26+
{
27+
new SelectionItem<string>(string.Empty, Translator._("System"), string.IsNullOrEmpty(_configuration.TranslationLanguage)),
28+
new SelectionItem<string>("C", "en_US", _configuration.TranslationLanguage == "C")
29+
};
30+
foreach (var language in Translator.AvailableLanguages)
31+
{
32+
(AvailableTranslationLanguages as IList)!.Add(new SelectionItem<string>(language, language, _configuration.TranslationLanguage == language));
33+
}
34+
Themes = new List<SelectionItem<Theme>>()
2735
{
2836
new SelectionItem<Theme>(Models.Theme.Light, Translator._p("Theme", "Light"), _configuration.Theme == Models.Theme.Light),
2937
new SelectionItem<Theme>(Models.Theme.Dark, Translator._p("Theme", "Dark"), _configuration.Theme == Models.Theme.Dark),
3038
new SelectionItem<Theme>(Models.Theme.System, Translator._p("Theme", "System"), _configuration.Theme == Models.Theme.System),
3139
};
3240
}
33-
3441
public SelectionItem<Theme> Theme
3542
{
3643
set => _configuration.Theme = value.Value;
3744
}
3845

39-
public IReadOnlyList<SelectionItem<string>> AvailableTranslationLanguages
40-
{
41-
get
42-
{
43-
var availableLanguages = new List<SelectionItem<string>>()
44-
{
45-
new SelectionItem<string>(string.Empty, Translator._("System"), string.IsNullOrEmpty(_configuration.TranslationLanguage)),
46-
new SelectionItem<string>("C", "en_US", _configuration.TranslationLanguage == "C")
47-
};
48-
foreach (var language in Translator.AvailableLanguages)
49-
{
50-
availableLanguages.Add(new SelectionItem<string>(language, language, _configuration.TranslationLanguage == language));
51-
}
52-
return availableLanguages;
53-
}
54-
}
55-
5646
public SelectionItem<string> TranslationLanguage
5747
{
5848
set => _configuration.TranslationLanguage = value.Value;

resources/po/application.pot

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2026-01-17 16:36-0500\n"
11+
"POT-Creation-Date: 2026-01-25 12:39-0500\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -183,25 +183,25 @@ msgstr ""
183183
msgid "Unable to download and install the update"
184184
msgstr ""
185185

186-
#: Nickvision.Application.Shared/Controllers/PreferencesViewController.cs:28
186+
#: Nickvision.Application.Shared/Controllers/PreferencesViewController.cs:27
187+
msgid "System"
188+
msgstr ""
189+
190+
#: Nickvision.Application.Shared/Controllers/PreferencesViewController.cs:36
187191
msgctxt "Theme"
188192
msgid "Light"
189193
msgstr ""
190194

191-
#: Nickvision.Application.Shared/Controllers/PreferencesViewController.cs:29
195+
#: Nickvision.Application.Shared/Controllers/PreferencesViewController.cs:37
192196
msgctxt "Theme"
193197
msgid "Dark"
194198
msgstr ""
195199

196-
#: Nickvision.Application.Shared/Controllers/PreferencesViewController.cs:30
200+
#: Nickvision.Application.Shared/Controllers/PreferencesViewController.cs:38
197201
msgctxt "Theme"
198202
msgid "System"
199203
msgstr ""
200204

201-
#: Nickvision.Application.Shared/Controllers/PreferencesViewController.cs:45
202-
msgid "System"
203-
msgstr ""
204-
205205
#: Nickvision.Application.Shared/Services/FolderService.cs:41
206206
#, csharp-format
207207
msgid "Folder opened: {0}"

resources/po/ru.po

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: PACKAGE VERSION\n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2026-01-17 16:36-0500\n"
10+
"POT-Creation-Date: 2026-01-25 12:38-0500\n"
1111
"PO-Revision-Date: 2023-05-23 06:33+0300\n"
1212
"Last-Translator: Fyodor Sobolev\n"
1313
"Language-Team: Russian\n"
@@ -190,26 +190,26 @@ msgstr "Application"
190190
msgid "Unable to download and install the update"
191191
msgstr ""
192192

193-
#: Nickvision.Application.Shared/Controllers/PreferencesViewController.cs:28
193+
#: Nickvision.Application.Shared/Controllers/PreferencesViewController.cs:27
194+
#, fuzzy
195+
msgid "System"
196+
msgstr "Системная"
197+
198+
#: Nickvision.Application.Shared/Controllers/PreferencesViewController.cs:36
194199
msgctxt "Theme"
195200
msgid "Light"
196201
msgstr "Светлая"
197202

198-
#: Nickvision.Application.Shared/Controllers/PreferencesViewController.cs:29
203+
#: Nickvision.Application.Shared/Controllers/PreferencesViewController.cs:37
199204
msgctxt "Theme"
200205
msgid "Dark"
201206
msgstr "Тёмная"
202207

203-
#: Nickvision.Application.Shared/Controllers/PreferencesViewController.cs:30
208+
#: Nickvision.Application.Shared/Controllers/PreferencesViewController.cs:38
204209
msgctxt "Theme"
205210
msgid "System"
206211
msgstr "Системная"
207212

208-
#: Nickvision.Application.Shared/Controllers/PreferencesViewController.cs:45
209-
#, fuzzy
210-
msgid "System"
211-
msgstr "Системная"
212-
213213
#: Nickvision.Application.Shared/Services/FolderService.cs:41
214214
#, fuzzy, csharp-format
215215
msgid "Folder opened: {0}"

0 commit comments

Comments
 (0)