Adding new window for adding password stores

This commit is contained in:
2025-09-18 14:46:25 +02:00
parent e65f6c94af
commit a2f19dc189
4 changed files with 145 additions and 14 deletions

View File

@@ -0,0 +1,41 @@
using Adw;
namespace Keychain.UI;
public class AddShortcutWindow
{
public Window Window { get; }
private EntryRow? pathEntry;
private Gtk.Button? browseButton;
public AddShortcutWindow()
{
var builder = new Gtk.Builder("Keychain.UI.AddShortcutWindow.AddShortcutWindow.xml");
var window = builder.GetObject("add_shortcut_window") as Window;
if (window == null)
{
throw new Exception("Failed to load embedded resource AddShortcutWindow.xml");
}
Window = window;
browseButton = builder.GetObject("folder_browse_button") as Gtk.Button;
if (browseButton == null)
{
throw new Exception("Failed to load UI element with ID: folder_browse_button");
}
browseButton.OnClicked += BrowseFolder;
}
private async void BrowseFolder(object sender, EventArgs e)
{
var fileDialog = new Gtk.FileDialog();
var selectedFolder = await fileDialog.SelectFolderAsync(Window);
if (selectedFolder != null)
{
var buttonContent = (ButtonContent)browseButton.Child;
buttonContent.Label = selectedFolder.GetPath();
}
}
}