Debian Codegraph @

src/DetailsList.vala

raw
1 /* DetailsWindow.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 [GtkTemplate (ui = "/io/github/diegoivan/pdf_metadata_editor/gtk/details-list.ui")]
22 public class PaperClip.DetailsList : Adw.Bin {
23 [GtkChild]
24 private unowned Adw.ActionRow format_row;
25 [GtkChild]
26 private unowned Adw.ActionRow layout_row;
27 [GtkChild]
28 private unowned Adw.ActionRow duplex_row;
29 [GtkChild]
30 private unowned Adw.ActionRow subtype_row;
31 [GtkChild]
32 private unowned Adw.ActionRow javascript_row;
33 [GtkChild]
34 private unowned Adw.ActionRow attachments_row;
35 [GtkChild]
36 private unowned Adw.ActionRow pages_row;
37 [GtkChild]
38 private unowned StringArrayRow preferences_row;
39 [GtkChild]
40 private unowned StringArrayRow permissions_row;
41
42 private unowned Document _document;
43 public unowned Document document {
44 get {
45 return _document;
46 }
47 set {
48 _document = value;
49
50 format_row.subtitle = document.format;
51 layout_row.subtitle = document.layout;
52 duplex_row.subtitle = document.print_duplex;
53 subtype_row.subtitle = document.subtype;
54 preferences_row.string_array = document.viewer_preferences;
55 permissions_row.string_array = document.permissions;
56 attachments_row.subtitle = document.contains_attachments ?
57 _("Yes") : _("No");
58 javascript_row.subtitle = document.contains_javascript ?
59 _("Yes") : _("No");
60
61 if (document.n_pages > 0) {
62 pages_row.visible = true;
63 pages_row.subtitle = document.n_pages.to_string ();
64 } else {
65 pages_row.visible = false;
66 }
67 }
68 }
69 }