From 0dc6d8432ac5141905b31a4660f5a8f3792fec75 Mon Sep 17 00:00:00 2001 From: TypoMustakes Date: Tue, 28 Oct 2025 12:05:35 +0100 Subject: [PATCH] Renamed types to more descriptive name --- src/App/Program.cs | 2 +- .../UI/AddShortcutWindow/AddShortcutWindow.cs | 4 ++-- src/App/UI/MainWindow/MainWindow.cs | 2 +- src/App/UI/MainWindow/ShortcutSidebar.cs | 2 +- .../BookmarkCollection.cs} | 18 +++++++++--------- .../BookmarkViewModel.cs} | 6 +++--- .../ViewModels/{ => Password}/PasswordList.cs | 0 .../{ => Password}/PasswordViewModel.cs | 0 src/Logic/PasswordStoreService.cs | 4 ++-- ...sonRepository.cs => BookmarksRepository.cs} | 4 ++-- ...{IRepository.cs => IBookmarksRepository.cs} | 2 +- 11 files changed, 22 insertions(+), 22 deletions(-) rename src/App/ViewModels/{PasswordStoreShortcutCollection.cs => Bookmark/BookmarkCollection.cs} (77%) rename src/App/ViewModels/{PasswordStoreViewModel.cs => Bookmark/BookmarkViewModel.cs} (72%) rename src/App/ViewModels/{ => Password}/PasswordList.cs (100%) rename src/App/ViewModels/{ => Password}/PasswordViewModel.cs (100%) rename src/Repository/{JsonRepository.cs => BookmarksRepository.cs} (96%) rename src/Repository/{IRepository.cs => IBookmarksRepository.cs} (80%) diff --git a/src/App/Program.cs b/src/App/Program.cs index 436c9c6..790832a 100644 --- a/src/App/Program.cs +++ b/src/App/Program.cs @@ -28,7 +28,7 @@ class Program { var services = new ServiceCollection(); services.AddSingleton(); - services.AddSingleton(); + services.AddSingleton(); services.AddSingleton(); return services.BuildServiceProvider(); } diff --git a/src/App/UI/AddShortcutWindow/AddShortcutWindow.cs b/src/App/UI/AddShortcutWindow/AddShortcutWindow.cs index 10f72f2..e8b24ee 100644 --- a/src/App/UI/AddShortcutWindow/AddShortcutWindow.cs +++ b/src/App/UI/AddShortcutWindow/AddShortcutWindow.cs @@ -5,7 +5,7 @@ namespace Keychain.UI; public class AddShortcutWindow { - private readonly PasswordStoreShortcutCollection shortcuts; + private readonly BookmarkCollection shortcuts; public Dialog Dialog { get; } private const string dialogId = "add_shortcut_dialog"; private Gtk.Button? closeButton; @@ -21,7 +21,7 @@ public class AddShortcutWindow private Gtk.Button? saveButton; private const string saveButtonId = "save_button"; - public AddShortcutWindow(PasswordStoreShortcutCollection shortcuts) + public AddShortcutWindow(BookmarkCollection shortcuts) { this.shortcuts = shortcuts; var builder = new Gtk.Builder("Keychain.UI.AddShortcutWindow.AddShortcutWindow.xml"); diff --git a/src/App/UI/MainWindow/MainWindow.cs b/src/App/UI/MainWindow/MainWindow.cs index 3517679..d6b7a9d 100644 --- a/src/App/UI/MainWindow/MainWindow.cs +++ b/src/App/UI/MainWindow/MainWindow.cs @@ -26,7 +26,7 @@ public partial class MainWindow BindUIElements(); // Initialize the observable collection with property binding - shortcuts = new PasswordStoreShortcutCollection(shortcutsGroup, passwordStoreService); + shortcuts = new BookmarkCollection(shortcutsGroup, passwordStoreService); if (shortcuts.Count == 0) { LoadDefaultShortcuts(); diff --git a/src/App/UI/MainWindow/ShortcutSidebar.cs b/src/App/UI/MainWindow/ShortcutSidebar.cs index 836e862..0f54f58 100644 --- a/src/App/UI/MainWindow/ShortcutSidebar.cs +++ b/src/App/UI/MainWindow/ShortcutSidebar.cs @@ -10,7 +10,7 @@ public partial class MainWindow private readonly IPasswordStoreService passwordStoreService; private PreferencesGroup shortcutsGroup; - private PasswordStoreShortcutCollection shortcuts; + private BookmarkCollection shortcuts; private const string shortcutsGroupId = "shortcuts_group"; private const string addShortcutButtonId = "add_shortcut_button"; diff --git a/src/App/ViewModels/PasswordStoreShortcutCollection.cs b/src/App/ViewModels/Bookmark/BookmarkCollection.cs similarity index 77% rename from src/App/ViewModels/PasswordStoreShortcutCollection.cs rename to src/App/ViewModels/Bookmark/BookmarkCollection.cs index 9a52b17..1d85cdb 100644 --- a/src/App/ViewModels/PasswordStoreShortcutCollection.cs +++ b/src/App/ViewModels/Bookmark/BookmarkCollection.cs @@ -6,14 +6,14 @@ using Logic; using System.Collections.ObjectModel; using System.Collections.Specialized; -public class PasswordStoreShortcutCollection : ObservableCollection +public class BookmarkCollection : ObservableCollection { private readonly IPasswordStoreService _passwordStoreService; private readonly PreferencesGroup shortcutsGroup; - private Dictionary itemToRowMap = new(); + private Dictionary itemToRowMap = new(); - public PasswordStoreShortcutCollection(PreferencesGroup shortcutsGroup, IPasswordStoreService passwordStoreService) + public BookmarkCollection(PreferencesGroup shortcutsGroup, IPasswordStoreService passwordStoreService) : base() { this.shortcutsGroup = shortcutsGroup; @@ -23,7 +23,7 @@ public class PasswordStoreShortcutCollection : ObservableCollection _model; } - public PasswordStoreViewModel(PasswordStore item) + public BookmarkViewModel(PasswordStore item) { _model = item; } - public PasswordStoreViewModel(string path, string? displayName = "New Shortcut") + public BookmarkViewModel(string path, string? displayName = "New Shortcut") { _model = new PasswordStore { diff --git a/src/App/ViewModels/PasswordList.cs b/src/App/ViewModels/Password/PasswordList.cs similarity index 100% rename from src/App/ViewModels/PasswordList.cs rename to src/App/ViewModels/Password/PasswordList.cs diff --git a/src/App/ViewModels/PasswordViewModel.cs b/src/App/ViewModels/Password/PasswordViewModel.cs similarity index 100% rename from src/App/ViewModels/PasswordViewModel.cs rename to src/App/ViewModels/Password/PasswordViewModel.cs diff --git a/src/Logic/PasswordStoreService.cs b/src/Logic/PasswordStoreService.cs index 7a832be..1b56e75 100644 --- a/src/Logic/PasswordStoreService.cs +++ b/src/Logic/PasswordStoreService.cs @@ -5,10 +5,10 @@ namespace Logic; public class PasswordStoreService : IPasswordStoreService { - private readonly IRepository repository; + private readonly IBookmarksRepository repository; private readonly ISecretService secretService; - public PasswordStoreService(IRepository repository, ISecretService secretService) + public PasswordStoreService(IBookmarksRepository repository, ISecretService secretService) { this.repository = repository; this.secretService = secretService; diff --git a/src/Repository/JsonRepository.cs b/src/Repository/BookmarksRepository.cs similarity index 96% rename from src/Repository/JsonRepository.cs rename to src/Repository/BookmarksRepository.cs index 418fa39..0d82258 100644 --- a/src/Repository/JsonRepository.cs +++ b/src/Repository/BookmarksRepository.cs @@ -3,7 +3,7 @@ using Models; namespace Repository; -public class JsonRepository : IRepository, IDisposable +public class BookmarksRepository : IBookmarksRepository, IDisposable { private const string _appName = "Keychain"; private const string fileName = "password_stores.json"; @@ -13,7 +13,7 @@ public class JsonRepository : IRepository, IDisposable private List _cache; private bool _cacheAhead; - public JsonRepository() + public BookmarksRepository() { string? xdgDataHome = Environment.GetEnvironmentVariable("XDG_DATA_HOME"); string dataHome; diff --git a/src/Repository/IRepository.cs b/src/Repository/IBookmarksRepository.cs similarity index 80% rename from src/Repository/IRepository.cs rename to src/Repository/IBookmarksRepository.cs index a638c1b..75c98c9 100644 --- a/src/Repository/IRepository.cs +++ b/src/Repository/IBookmarksRepository.cs @@ -3,7 +3,7 @@ using Models; namespace Repository; -public interface IRepository +public interface IBookmarksRepository { List GetAll(); void Create(PasswordStore item);