Adding new window for adding password stores
This commit is contained in:
@@ -7,11 +7,11 @@ public class MainWindow
|
||||
{
|
||||
public Window Window { get; }
|
||||
private PreferencesGroup shortcutsGroup;
|
||||
private PasswordStoreShortcutCollection shortcuts;
|
||||
private PasswordStoreShortcutCollection shortcuts;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
var builder = new Gtk.Builder("Keychain.UI.MainWindow.MainWindow.xml");
|
||||
public MainWindow()
|
||||
{
|
||||
var builder = new Gtk.Builder("Keychain.UI.MainWindow.MainWindow.xml");
|
||||
|
||||
var window = builder.GetObject("main_window") as Window;
|
||||
if (window == null)
|
||||
@@ -19,30 +19,32 @@ public class MainWindow
|
||||
throw new Exception("Failed to load embedded resource MainWindow.xml");
|
||||
}
|
||||
Window = window;
|
||||
|
||||
|
||||
var group = builder.GetObject("shortcuts_group") as PreferencesGroup;
|
||||
if (group == null)
|
||||
{
|
||||
throw new Exception("Failed to load UI element with ID: shortcuts_group");
|
||||
}
|
||||
shortcutsGroup = group;
|
||||
|
||||
var addButton = builder.GetObject("add_shortcut_button") as Gtk.Button;
|
||||
if (addButton == null)
|
||||
|
||||
var addButton = builder.GetObject("add_shortcut_button") as Gtk.Button;
|
||||
if (addButton == null)
|
||||
{
|
||||
throw new Exception("Failed to load UI element with ID: add_shortcut_button");
|
||||
}
|
||||
addButton.OnClicked += OnAddShortcutClicked;
|
||||
}
|
||||
addButton.OnClicked += OnAddShortcutClicked;
|
||||
|
||||
// Initialize the observable collection with property binding
|
||||
shortcuts = new PasswordStoreShortcutCollection(shortcutsGroup);
|
||||
|
||||
LoadDefaultShortcuts();
|
||||
shortcuts = new PasswordStoreShortcutCollection(shortcutsGroup);
|
||||
|
||||
LoadDefaultShortcuts();
|
||||
}
|
||||
|
||||
private void OnAddShortcutClicked(object sender, EventArgs e)
|
||||
{
|
||||
AddShortcut("/path/to/location");
|
||||
var window = new AddShortcutWindow().Window;
|
||||
window.Application = Window.Application;
|
||||
window.Show();
|
||||
}
|
||||
|
||||
public void AddShortcut(string path)
|
||||
|
||||
Reference in New Issue
Block a user