save is_attention session state

This commit is contained in:
yggverse 2024-11-11 16:53:06 +02:00
parent 8917d14908
commit 57cdc4cee9
4 changed files with 21 additions and 13 deletions

View file

@ -5,6 +5,7 @@ pub struct Table {
// pub app_browser_window_tab_id: i64, not in use
pub is_pinned: bool,
pub is_selected: bool,
pub is_attention: bool,
}
pub struct Database {
@ -20,7 +21,8 @@ impl Database {
`app_browser_window_tab_id` INTEGER NOT NULL,
`page_position` INTEGER NOT NULL,
`is_pinned` INTEGER NOT NULL,
`is_selected` INTEGER NOT NULL
`is_selected` INTEGER NOT NULL,
`is_attention` INTEGER NOT NULL
)",
[],
)
@ -32,19 +34,22 @@ impl Database {
page_position: &i32,
is_pinned: &bool,
is_selected: &bool,
is_attention: &bool,
) -> Result<usize, Error> {
tx.execute(
"INSERT INTO `app_browser_window_tab_item` (
`app_browser_window_tab_id`,
`page_position`,
`is_pinned`,
`is_selected`
) VALUES (?, ?, ?, ?)",
`is_selected`,
`is_attention`
) VALUES (?, ?, ?, ?, ?)",
[
app_browser_window_tab_id,
&(*page_position as i64),
&(*is_pinned as i64),
&(*is_selected as i64),
&(*is_attention as i64),
],
)
}
@ -54,7 +59,8 @@ impl Database {
"SELECT `id`,
`app_browser_window_tab_id`,
`is_pinned`,
`is_selected`
`is_selected`,
`is_attention`
FROM `app_browser_window_tab_item`
WHERE `app_browser_window_tab_id` = ?
ORDER BY `page_position` ASC", // just order by, no store in struct wanted
@ -66,6 +72,7 @@ impl Database {
// app_browser_window_tab_id: row.get(1)?, not in use
is_pinned: row.get(2)?,
is_selected: row.get(3)?,
is_attention: row.get(4)?,
})
})?;