Add edit button to shortcut rows
This commit is contained in:
@@ -14,8 +14,8 @@
|
|||||||
</child>
|
</child>
|
||||||
<property name="content">
|
<property name="content">
|
||||||
<object class="AdwOverlaySplitView" id="split_view">
|
<object class="AdwOverlaySplitView" id="split_view">
|
||||||
<property name="min-sidebar-width">250</property>
|
<property name="min-sidebar-width">300</property>
|
||||||
<property name="max-sidebar-width">250</property>
|
<property name="max-sidebar-width">300</property>
|
||||||
<property name="show-sidebar"
|
<property name="show-sidebar"
|
||||||
bind-source="show_sidebar_button"
|
bind-source="show_sidebar_button"
|
||||||
bind-property="active"
|
bind-property="active"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
namespace App.UI.Models;
|
namespace App.UI.Models;
|
||||||
|
|
||||||
using Adw;
|
using Adw;
|
||||||
|
using Gtk;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
|
|
||||||
@@ -57,30 +58,37 @@ public class PasswordStoreShortcutCollection : ObservableCollection<PasswordStor
|
|||||||
var row = new ActionRow();
|
var row = new ActionRow();
|
||||||
UpdateRowFromItem(shortcut, ref row);
|
UpdateRowFromItem(shortcut, ref row);
|
||||||
|
|
||||||
row.SetActivatable(true);
|
row.SetActivatable(true);
|
||||||
row.OnActivated += (sender, args) => {
|
row.OnActivated += (sender, args) => {
|
||||||
Console.WriteLine($"[DEBUG] Opening: {shortcut.Path}");
|
Console.WriteLine($"[DEBUG] Opening: {shortcut.Path}");
|
||||||
};
|
};
|
||||||
|
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateRowFromItem(PasswordStoreShortcut shortcut, ref ActionRow row)
|
private void UpdateRowFromItem(PasswordStoreShortcut shortcut, ref ActionRow row)
|
||||||
{
|
{
|
||||||
row.SetTitle(shortcut.DisplayName);
|
row.SetTitle(shortcut.DisplayName);
|
||||||
row.SetSubtitle(shortcut.Path);
|
row.SetSubtitle(shortcut.Path);
|
||||||
|
|
||||||
//Update icon
|
//Update icon
|
||||||
var existingIcon = row.GetFirstChild() as Gtk.Image;
|
var existingIcon = row.GetFirstChild() as Gtk.Image;
|
||||||
if (existingIcon == null)
|
if (existingIcon == null)
|
||||||
{
|
{
|
||||||
var icon = new Gtk.Image();
|
var icon = new Gtk.Image();
|
||||||
icon.SetFromIconName(shortcut.IconName);
|
icon.SetFromIconName(shortcut.IconName);
|
||||||
row.AddPrefix(icon);
|
row.AddPrefix(icon);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
existingIcon.SetFromIconName(shortcut.IconName);
|
existingIcon.SetFromIconName(shortcut.IconName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Edit button
|
||||||
|
var edit = new Button();
|
||||||
|
edit.AddCssClass("flat");
|
||||||
|
edit.SetValign(Align.Center);
|
||||||
|
edit.IconName = "document-edit-symbolic";
|
||||||
|
row.AddSuffix(edit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user