Skip to content
API Documentation
BastionGuard™
ExcludeAppsBox.vala
Go to the documentation of this file.
1/*
2 * ExcludeAppsBox.vala
3 */
4
5using Gtk;
6using Gee;
7
13using TeeJee.System;
14using TeeJee.Misc;
15
16class ExcludeAppsBox : Gtk.Box{
17 private Gtk.ListBox listbox;
18 private Gtk.Window parent_window;
19
20 public ExcludeAppsBox (Gtk.Window _parent_window) {
21 log_debug("ExcludeAppsBox: ExcludeAppsBox()");
22 GLib.Object(orientation: Gtk.Orientation.VERTICAL, spacing: 6);
23 parent_window = _parent_window;
24 margin_top = 12;
25 margin_bottom = 12;
26 margin_start = 12;
27 margin_end = 12;
28
29 var header_box = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 6);
30 append(header_box);
31 add_label_header(header_box, _("Exclude Application Settings"), true);
32
33 var buffer = add_label(header_box, "");
34 buffer.hexpand = true;
35 init_exclude_summary_link(header_box);
36
39 log_debug("ExcludeAppsBox: ExcludeAppsBox(): exit");
40 }
41
42 private void init_listbox(){
43 listbox = new Gtk.ListBox();
44 listbox.selection_mode = Gtk.SelectionMode.NONE;
45 listbox.add_css_class("boxed-list");
46
47 var scrolled = new Gtk.ScrolledWindow();
48 scrolled.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
49 scrolled.set_child(listbox);
50 scrolled.hexpand = true;
51 scrolled.vexpand = true;
52 append(scrolled);
53 }
54
55 private Gtk.Widget create_row(AppExcludeEntry entry){
56 var row = new Gtk.ListBoxRow();
57 var box = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 12);
58 box.margin_start = 8;
59 box.margin_end = 8;
60 box.margin_top = 6;
61 box.margin_bottom = 6;
62 row.set_child(box);
63
64 var toggle = new Gtk.CheckButton();
65 toggle.active = entry.enabled;
66 toggle.valign = Gtk.Align.CENTER;
67 toggle.toggled.connect(()=>{
68 entry.enabled = toggle.active;
69 });
70 box.append(toggle);
71
72 var name = new Gtk.Label(entry.name);
73 name.xalign = 0.0f;
74 name.hexpand = true;
75 name.wrap = true;
76 name.tooltip_text = entry.tooltip_text();
77 box.append(name);
78
79 return row;
80 }
81
82 private void init_exclude_summary_link(Gtk.Box box){
83 var size_group = new Gtk.SizeGroup(SizeGroupMode.HORIZONTAL);
84 var button = add_button(box, _("Summary"), "", size_group, null);
85 button.clicked.connect(()=>{
87 });
88 }
89
90 public void refresh(){
92 }
93
94 public void refresh_treeview(){
95 Gtk.Widget? child = listbox.get_first_child();
96 while (child != null){
97 Gtk.Widget? next = child.get_next_sibling();
98 listbox.remove(child);
99 child = next;
100 }
101
102 foreach(var entry in App.exclude_list_apps){
103 listbox.append(create_row(entry));
104 }
105 }
106}
Main App
#define _(s)
ExcludeAppsBox(Gtk.Window _parent_window)
void init_exclude_summary_link(Gtk.Box box)
Gtk.Window parent_window
Gtk.ListBox listbox
Gtk.Widget create_row(AppExcludeEntry entry)
ExcludeListSummaryWindow(bool _for_restore)
Gee.ArrayList< AppExcludeEntry > exclude_list_apps
Definition Main.vala:66
Gtk.Label add_label(Gtk.Box box, string text, bool bold=false, bool italic=false, bool large=false)
void log_debug(string message)