1/* 2 * Seahorse 3 * 4 * Copyright (C) 2008 Stefan Walter 5 * Copyright (C) 2011 Collabora Ltd. 6 * Copyright (C) 2017 Niels De Graef 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU Lesser General Public License as 10 * published by the Free Software Foundation; either version 2.1 of 11 * the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, but 14 * WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this program; if not, see 20 * <http://www.gnu.org/licenses/>. 21 */ 22 23/** 24 * Represents an item in the KeyManager's (i.e. the main window) list of items. 25 */ 26public class Seahorse.KeyManagerItemRow : Gtk.ListBoxRow { 27 28 public GLib.Object object { get; construct set; } 29 30 construct { 31 var grid = new Gtk.Grid(); 32 grid.get_style_context().add_class("seahorse-item-listbox-row"); 33 add(grid); 34 35 GLib.Icon? icon = null; 36 object.get("icon", out icon); 37 if (icon != null) { 38 var img = new Gtk.Image.from_gicon(icon, Gtk.IconSize.DND); 39 img.margin_end = 12; 40 img.pixel_size = 32; 41 grid.attach(img, 0, 0, 1, 2); 42 } 43 44 var markup_label = new Gtk.Label(null); 45 object.bind_property("markup", markup_label, "label", BindingFlags.SYNC_CREATE); 46 markup_label.use_markup = true; 47 markup_label.halign = Gtk.Align.START; 48 markup_label.xalign = 0.0f; 49 markup_label.hexpand = true; 50 markup_label.ellipsize = Pango.EllipsizeMode.END; 51 grid.attach(markup_label, 1, 0); 52 53 var description_label = new Gtk.Label(null); 54 object.bind_property("description", description_label, "label", BindingFlags.SYNC_CREATE); 55 description_label.xalign = 1.0f; 56 description_label.valign = Gtk.Align.START; 57 description_label.get_style_context().add_class("seahorse-item-listbox-row-description"); 58 grid.attach(description_label, 2, 0); 59 60 show_all(); 61 } 62 63 public KeyManagerItemRow(GLib.Object object) { 64 GLib.Object(object: object); 65 } 66} 67