/
13-places-siderbar.pl6
executable file
·66 lines (54 loc) · 2.02 KB
/
13-places-siderbar.pl6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env perl6
use v6;
use lib 'lib';
use GTK::Simpler;
my $app = app(:title("Places Sidebar Demo"));
my $places-sidebar = places-sidebar;
$places-sidebar.open-location.tap: {
"open-location event triggered".say;
#TODO get the location parameter
# See https://developer.gnome.org/gtk3/stable/GtkPlacesSidebar.html#GtkPlacesSidebar-open-location)
}
my $show-trash-button = toggle-button( :label("Show Trash") );
$show-trash-button.toggled.tap: {
$places-sidebar.show-trash = not $places-sidebar.show-trash;
};
my $show-recent-button = toggle-button( :label("Show Recent") );
$show-recent-button.toggled.tap: {
$places-sidebar.show-recent = not $places-sidebar.show-recent;
};
my $show-desktop-button = toggle-button( :label("Show Desktop") );
$show-desktop-button.toggled.tap: {
$places-sidebar.show-desktop = not $places-sidebar.show-desktop;
};
my $show-connect-to-server-button = toggle-button(
:label("Show Connect to Server") );
$show-connect-to-server-button.toggled.tap: {
$places-sidebar.show-connect-to-server =
not $places-sidebar.show-connect-to-server;
};
my $show-other-locations-button = toggle-button(
:label("Show Other Locations") );
$show-other-locations-button.toggled.tap: {
$places-sidebar.show-other-locations = not $places-sidebar.show-other-locations;
};
# Update initial toggle button status
$show-trash-button.status = $places-sidebar.show-trash;
$show-recent-button.status = $places-sidebar.show-recent;
$show-desktop-button.status = $places-sidebar.show-desktop;
$show-connect-to-server-button.status = $places-sidebar.show-connect-to-server;
$show-other-locations-button.status = $places-sidebar.show-other-locations;
$app.set-content(
hbox(
$places-sidebar,
vbox(
$show-trash-button,
$show-recent-button,
$show-desktop-button,
$show-connect-to-server-button,
$show-other-locations-button,
)
)
);
$app.border-width = 20;
$app.run;