[seahorse/key-manager-item-row-update-on-notify] key-manager-item-row: Bind to properties of the object




commit 98990d7e9bce15cf9112a66d5b0b918338952817
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Mon Feb 15 15:39:51 2021 +0100

    key-manager-item-row: Bind to properties of the object
    
    Thay way, an item that changed after it was already added to the
    ListModel of the KeyManager will trigger an update in the UI
    
    Fixes https://gitlab.gnome.org/GNOME/seahorse/-/issues/306
    Fixes https://gitlab.gnome.org/GNOME/seahorse/-/issues/307

 src/key-manager-item-row.vala | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/src/key-manager-item-row.vala b/src/key-manager-item-row.vala
index 0fdf09ac..12b3f16e 100644
--- a/src/key-manager-item-row.vala
+++ b/src/key-manager-item-row.vala
@@ -41,9 +41,8 @@ public class Seahorse.KeyManagerItemRow : Gtk.ListBoxRow {
             grid.attach(img, 0, 0, 1, 2);
         }
 
-        string markup;
-        object.get("markup", out markup);
-        var markup_label = new Gtk.Label(markup);
+        var markup_label = new Gtk.Label(null);
+        object.bind_property("markup", markup_label, "label", BindingFlags.SYNC_CREATE);
         markup_label.use_markup = true;
         markup_label.halign = Gtk.Align.START;
         markup_label.xalign = 0.0f;
@@ -51,9 +50,8 @@ public class Seahorse.KeyManagerItemRow : Gtk.ListBoxRow {
         markup_label.ellipsize = Pango.EllipsizeMode.END;
         grid.attach(markup_label, 1, 0);
 
-        string description = "";
-        object.get("description", out description);
-        var description_label = new Gtk.Label(description);
+        var description_label = new Gtk.Label(null);
+        object.bind_property("description", description_label, "label", BindingFlags.SYNC_CREATE);
         description_label.xalign = 1.0f;
         description_label.valign = Gtk.Align.START;
         description_label.get_style_context().add_class("seahorse-item-listbox-row-description");


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