mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 17:20:08 +00:00
save is_attention session state
This commit is contained in:
parent
8917d14908
commit
57cdc4cee9
@ -126,9 +126,6 @@ impl Tab {
|
||||
),
|
||||
));
|
||||
|
||||
// Apply tab attention request
|
||||
item.widget().gobject().set_needs_attention(is_attention);
|
||||
|
||||
// Register dynamically created tab components in the HashMap index
|
||||
self.index
|
||||
.borrow_mut()
|
||||
@ -311,6 +308,7 @@ impl Tab {
|
||||
&self.widget.gobject().page_position(item.widget().gobject()),
|
||||
&item.widget().gobject().is_pinned(),
|
||||
&item.widget().gobject().is_selected(),
|
||||
&item.widget().gobject().needs_attention(),
|
||||
)?;
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ impl Item {
|
||||
options: (Option<i32>, Option<String>, bool, bool, bool, bool),
|
||||
) -> Self {
|
||||
// Get item options from tuple
|
||||
let (position, request, is_pinned, is_selected, _is_attention, is_load) = options;
|
||||
let (position, request, is_pinned, is_selected, is_attention, is_load) = options;
|
||||
|
||||
// Generate unique ID for new page components
|
||||
let id = uuid_string_random();
|
||||
@ -59,8 +59,7 @@ impl Item {
|
||||
page.widget().gobject(),
|
||||
None,
|
||||
position,
|
||||
is_pinned,
|
||||
is_selected,
|
||||
(is_pinned, is_selected, is_attention),
|
||||
));
|
||||
|
||||
// Init events
|
||||
@ -155,7 +154,7 @@ impl Item {
|
||||
None,
|
||||
record.is_pinned,
|
||||
record.is_selected,
|
||||
false,
|
||||
record.is_attention,
|
||||
false,
|
||||
),
|
||||
));
|
||||
@ -181,6 +180,7 @@ impl Item {
|
||||
page_position: &i32,
|
||||
is_pinned: &bool,
|
||||
is_selected: &bool,
|
||||
is_attention: &bool,
|
||||
) -> Result<(), String> {
|
||||
match Database::add(
|
||||
transaction,
|
||||
@ -188,6 +188,7 @@ impl Item {
|
||||
page_position,
|
||||
is_pinned,
|
||||
is_selected,
|
||||
is_attention,
|
||||
) {
|
||||
Ok(_) => {
|
||||
let id = Database::last_insert_id(transaction);
|
||||
|
@ -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)?,
|
||||
})
|
||||
})?;
|
||||
|
||||
|
@ -20,8 +20,7 @@ impl Widget {
|
||||
child: &impl IsA<gtk::Widget>,
|
||||
title: Option<&str>,
|
||||
position: Option<i32>,
|
||||
is_pinned: bool,
|
||||
is_selected: bool,
|
||||
state: (bool, bool, bool),
|
||||
) -> Self {
|
||||
let gobject = match position {
|
||||
Some(value) => {
|
||||
@ -37,6 +36,9 @@ impl Widget {
|
||||
None => tab_view.append(child),
|
||||
};
|
||||
|
||||
let (is_pinned, is_selected, is_attention) = state;
|
||||
|
||||
gobject.set_needs_attention(is_attention);
|
||||
gobject.set_keyword(keyword);
|
||||
|
||||
gobject.set_title(match title {
|
||||
|
Loading…
x
Reference in New Issue
Block a user