blob: 4e116a19818218290f6431da5d4fca7eba06d11d (
plain)
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
|
#include "DirectoryTableView.h"
DirectoryTableView::DirectoryTableView(GWidget* parent)
: GTableView(parent)
{
set_model(make<DirectoryTableModel>());
}
DirectoryTableView::~DirectoryTableView()
{
}
void DirectoryTableView::open(const String& path)
{
model().open(path);
}
void DirectoryTableView::model_notification(const GModelNotification& notification)
{
if (notification.type() == GModelNotification::Type::ModelUpdated) {
set_status_message(String::format("%d item%s (%u byte%s)",
model().row_count(),
model().row_count() != 1 ? "s" : "",
model().bytes_in_files(),
model().bytes_in_files() != 1 ? "s" : ""));
if (on_path_change)
on_path_change(model().path());
}
}
void DirectoryTableView::set_status_message(const String& message)
{
if (on_status_message)
on_status_message(message);
}
void DirectoryTableView::open_parent_directory()
{
model().open(String::format("%s/..", model().path().characters()));
}
|