Skip to content

Commit e62a105

Browse files
authored
details-list: Improve property coverage (#90)
2 parents ac2f95e + f85956f commit e62a105

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

src/DetailsList.vala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ public class PaperClip.DetailsList : Adw.Bin {
2929
[GtkChild]
3030
private unowned Adw.ActionRow subtype_row;
3131
[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]
3238
private unowned StringArrayRow preferences_row;
3339
[GtkChild]
3440
private unowned StringArrayRow permissions_row;
@@ -47,6 +53,17 @@ public class PaperClip.DetailsList : Adw.Bin {
4753
subtype_row.subtitle = document.subtype;
4854
preferences_row.string_array = document.viewer_preferences;
4955
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+
}
5067
}
5168
}
5269
}

src/Document.vala

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,27 @@ public class PaperClip.Document : Object {
153153
}
154154
}
155155

156+
[CCode (notify = false)]
157+
public bool contains_attachments {
158+
get {
159+
return document.has_attachments ();
160+
}
161+
}
162+
163+
[CCode (notify = false)]
164+
public bool contains_javascript {
165+
get {
166+
return document.has_javascript ();
167+
}
168+
}
169+
170+
[CCode (notify = false)]
171+
public int n_pages {
172+
get {
173+
return document.get_n_pages ();
174+
}
175+
}
176+
156177
public signal void keyword_changed ();
157178

158179
public async Document (File original_file, string? password = null) throws Error {

src/gtk/details-list.ui

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,36 @@
5050
</object>
5151
</child>
5252

53+
<child>
54+
<object class="AdwActionRow" id="javascript_row">
55+
<property name="title" translatable="yes">Contains JavaScript</property>
56+
<property name="selectable">false</property>
57+
<style>
58+
<class name="property"/>
59+
</style>
60+
</object>
61+
</child>
62+
63+
<child>
64+
<object class="AdwActionRow" id="attachments_row">
65+
<property name="title" translatable="yes">Contains Attachments</property>
66+
<property name="selectable">false</property>
67+
<style>
68+
<class name="property"/>
69+
</style>
70+
</object>
71+
</child>
72+
73+
<child>
74+
<object class="AdwActionRow" id="pages_row">
75+
<property name="title" translatable="yes">Number of Pages</property>
76+
<property name="selectable">false</property>
77+
<style>
78+
<class name="property"/>
79+
</style>
80+
</object>
81+
</child>
82+
5383
<child>
5484
<object class="PaperClipStringArrayRow" id="preferences_row">
5585
<property name="title" translatable="yes">Viewer Preferences</property>

0 commit comments

Comments
 (0)