mirror of
https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio.git
synced 2024-11-25 10:30:59 +00:00
logger: display the most recent log on top
The most recent log arrives on top of the list and is always visible.
This commit is contained in:
parent
7762332700
commit
aaaa58072c
1 changed files with 14 additions and 1 deletions
|
@ -42,6 +42,19 @@ pub fn add_to_logger_list(app: &GPSApp, log_entry: &str) {
|
||||||
.dynamic_cast::<ListStore>()
|
.dynamic_cast::<ListStore>()
|
||||||
.expect("Could not cast to ListStore");
|
.expect("Could not cast to ListStore");
|
||||||
let log: Vec<&str> = log_entry.splitn(3, ' ').collect();
|
let log: Vec<&str> = log_entry.splitn(3, ' ').collect();
|
||||||
list_store.insert_with_values(None, &[(0, &log[0]), (1, &log[1]), (2, &log[2])]);
|
list_store.insert_with_values(Some(0), &[(0, &log[0]), (1, &log[1]), (2, &log[2])]);
|
||||||
|
// Scroll to the first element.
|
||||||
|
if let Some(model) = logger_list.model() {
|
||||||
|
if let Some(iter) = model.iter_first() {
|
||||||
|
let path = model.path(&iter);
|
||||||
|
logger_list.scroll_to_cell(
|
||||||
|
Some(&path),
|
||||||
|
None::<>k::TreeViewColumn>,
|
||||||
|
false,
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue