Skip to content
API Documentation
BastionGuard™
ExcludeMessageWindow.vala
Go to the documentation of this file.
1/*
2 * ExcludeMessageWindow.vala
3 */
4
5using Gtk;
6using Gee;
7
13using TeeJee.System;
14using TeeJee.Misc;
15
16public class ExcludeMessageWindow : Gtk.Dialog{
17
18 private Gtk.Box vbox_main;
19 private Gtk.Box hbox_action;
20 private Gtk.ListBox exclude_list;
21 private ScrolledWindow sw_exclude;
22 private Label lbl_header_exclude;
23 private Label lbl_exclude;
24 private Label lbl_header_home;
25 private Label lbl_home;
26
27 private Button btn_ok;
28
30
31 log_debug("ExcludeMessageWindow: ExcludeMessageWindow()");
32
33 this.title = _("Excluded Directories");
34 this.set_destroy_with_parent (true);
35 this.set_modal (true);
36 this.set_default_size (520, 420);
37
38 string msg;
39
40 vbox_main = get_content_area ();
41 vbox_main.margin_start = 12;
42 vbox_main.margin_end = 12;
43 vbox_main.margin_top = 12;
44 vbox_main.margin_bottom = 12;
45 vbox_main.spacing = 8;
46
47 lbl_header_exclude = new Gtk.Label("<b>" + _("Exclude List") + ":</b>");
48 lbl_header_exclude.xalign = (float) 0.0;
49 lbl_header_exclude.set_use_markup(true);
51
52 lbl_exclude = new Gtk.Label(_("Files matching the following patterns will be excluded") + ":");
53 lbl_exclude.xalign = (float) 0.0;
54 lbl_exclude.wrap = true;
55 vbox_main.append(lbl_exclude);
56
57 exclude_list = new Gtk.ListBox();
58 exclude_list.set_selection_mode(Gtk.SelectionMode.NONE);
59 exclude_list.add_css_class("boxed-list");
60
61 sw_exclude = new ScrolledWindow();
62 sw_exclude.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
63 sw_exclude.set_child(exclude_list);
64 sw_exclude.hexpand = true;
65 sw_exclude.vexpand = true;
66 vbox_main.append(sw_exclude);
67
68 lbl_header_home = new Gtk.Label("<b>" + _("Home Directory") + ":</b>");
69 lbl_header_home.xalign = (float) 0.0;
70 lbl_header_home.set_use_markup(true);
71 lbl_header_home.margin_top = 6;
73
74 lbl_home = new Gtk.Label("");
75 lbl_home.xalign = (float) 0.0;
76 lbl_home.set_use_markup(true);
77 lbl_home.wrap = true;
78 vbox_main.append(lbl_home);
79
80 msg = _("Hidden files and folders are included by default since they contain user-specific configuration files.") + "\n";
81 msg += _("All other files and folders are excluded.") + "\n";
82 lbl_home.label = msg;
83
84 btn_ok = (Gtk.Button) add_button(_("OK"), Gtk.ResponseType.OK);
85 btn_ok.clicked.connect (btn_ok_clicked);
86
87 foreach(string path in App.exclude_list_default){
89 }
90
91 log_debug("ExcludeMessageWindow: ExcludeMessageWindow(): exit");
92 }
93
94 private void exclude_list_add_item(string path){
95 var row = new Gtk.ListBoxRow();
96 var box = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 10);
97 box.margin_top = 8;
98 box.margin_bottom = 8;
99 box.margin_start = 10;
100 box.margin_end = 10;
101
102 string icon_name = path.has_prefix("+ ") ? "list-add-symbolic" : "list-remove-symbolic";
103 string text = path.has_prefix("+ ") ? path.substring(2) : path;
104
105 var icon = IconManager.lookup_image(icon_name, 16);
106 icon.valign = Gtk.Align.START;
107 box.append(icon);
108
109 var label = new Gtk.Label(text);
110 label.xalign = 0.0f;
111 label.wrap = true;
112 label.hexpand = true;
113 box.append(label);
114
115 row.set_child(box);
116 exclude_list.append(row);
117 }
118
119 private void btn_ok_clicked(){
120 this.response(Gtk.ResponseType.OK);
121 }
122}
Main App
#define _(s)
void exclude_list_add_item(string path)
static Gtk.Image lookup_image(string icon_name, int icon_size, bool symbolic=false, bool use_hardcoded=false)
Gee.ArrayList< string > exclude_list_default
Definition Main.vala:62
void log_debug(string message)