[seahorse/wip/nielsdg/gkr-item-icon: 3/7] gkr: Item: Add a field `icon`



commit dbc51c16e541923ca535396ee8639e15ef0dce8f
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Sun Feb 17 19:54:32 2019 +0100

    gkr: Item: Add a field `icon`
    
    We can use this to set custom icons for certain types of secrets, such
    as wireless network passwords and app-specific secrets.

 gkr/gkr-item.vala | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/gkr/gkr-item.vala b/gkr/gkr-item.vala
index f68a0d18..512b47fe 100644
--- a/gkr/gkr-item.vala
+++ b/gkr/gkr-item.vala
@@ -33,6 +33,7 @@ private struct DisplayInfo {
        string? label;
        string? details;
        string? description;
+    GLib.Icon? icon;
 }
 
 [CCode (has_target = false)]
@@ -76,9 +77,12 @@ public class Item : Secret.Item, Deletable, Viewable {
                get { return Flags.DELETABLE | Flags.PERSONAL; }
        }
 
-       public GLib.Icon icon {
-               owned get { return new GLib.ThemedIcon (ICON_PASSWORD); }
-       }
+    public GLib.Icon icon {
+        owned get {
+            ensure_display_info();
+            return this._info.icon ?? new GLib.ThemedIcon (ICON_PASSWORD);
+        }
+    }
 
        public new string label {
                owned get {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]