| 1 |
/* StringArrayRow.vala |
| 2 |
* |
| 3 |
* Copyright 2023 Diego Iván <[email protected]> |
| 4 |
* |
| 5 |
* This program is free software: you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation, either version 3 of the License, or |
| 8 |
* (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
* |
| 18 |
* SPDX-License-Identifier: GPL-3.0-or-later |
| 19 |
*/ |
| 20 |
|
| 21 |
public class PaperClip.StringArrayRow : Adw.ExpanderRow { |
| 22 |
private ContentRow content_row = new ContentRow (); |
| 23 |
public string[] string_array { |
| 24 |
set { |
| 25 |
content_row.contents = ""; |
| 26 |
|
| 27 |
foreach (string item in value) { |
| 28 |
content_row.contents += "• %s\n".printf (item); |
| 29 |
} |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
construct { |
| 34 |
add_row (content_row); |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
public class PaperClip.ContentRow : Gtk.ListBoxRow { |
| 39 |
private Gtk.Label content_label; |
| 40 |
|
| 41 |
public string contents { |
| 42 |
get { |
| 43 |
return content_label.label; |
| 44 |
} |
| 45 |
set { |
| 46 |
content_label.label = value; |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
construct { |
| 51 |
content_label = new Gtk.Label ("") { |
| 52 |
css_classes = { "dim-label" }, |
| 53 |
halign = START, |
| 54 |
margin_start = 12, |
| 55 |
margin_top = 18, |
| 56 |
}; |
| 57 |
content_label.add_css_class ("dim-label"); |
| 58 |
child = content_label; |
| 59 |
} |
| 60 |
} |