Switching to dialog approach
This commit is contained in:
@@ -4,7 +4,7 @@ namespace Keychain.UI;
|
||||
|
||||
public class AddShortcutWindow
|
||||
{
|
||||
public Window Window { get; }
|
||||
public Dialog Dialog { get; }
|
||||
private EntryRow? pathEntry;
|
||||
private Gtk.Button? browseButton;
|
||||
|
||||
@@ -12,12 +12,12 @@ public class AddShortcutWindow
|
||||
{
|
||||
var builder = new Gtk.Builder("Keychain.UI.AddShortcutWindow.AddShortcutWindow.xml");
|
||||
|
||||
var window = builder.GetObject("add_shortcut_window") as Window;
|
||||
if (window == null)
|
||||
var dialog = builder.GetObject("add_shortcut_dialog") as Dialog;
|
||||
if (dialog == null)
|
||||
{
|
||||
throw new Exception("Failed to load embedded resource AddShortcutWindow.xml");
|
||||
}
|
||||
Window = window;
|
||||
Dialog = dialog;
|
||||
|
||||
browseButton = builder.GetObject("folder_browse_button") as Gtk.Button;
|
||||
if (browseButton == null)
|
||||
@@ -29,9 +29,8 @@ public class AddShortcutWindow
|
||||
|
||||
private async void BrowseFolder(object sender, EventArgs e)
|
||||
{
|
||||
var fileDialog = new Gtk.FileDialog();
|
||||
var selectedFolder = await fileDialog.SelectFolderAsync(Window);
|
||||
|
||||
var fileDialog = new Gtk.FileDialog();
|
||||
var selectedFolder = await fileDialog.SelectFolderAsync((Window)Dialog.Parent.Parent);
|
||||
if (selectedFolder != null)
|
||||
{
|
||||
var buttonContent = (ButtonContent)browseButton.Child;
|
||||
|
||||
Reference in New Issue
Block a user