mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
drop options not in use
This commit is contained in:
parent
6684b09ae2
commit
4370d1d971
8 changed files with 14 additions and 69 deletions
|
|
@ -3,7 +3,6 @@ use sqlite::{Error, Transaction};
|
|||
pub struct Table {
|
||||
pub id: i64,
|
||||
// pub app_browser_window_tab_id: i64, not in use
|
||||
pub is_initially_current: bool,
|
||||
}
|
||||
|
||||
pub struct Database {
|
||||
|
|
@ -17,8 +16,7 @@ impl Database {
|
|||
(
|
||||
`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||
`app_browser_window_tab_id` INTEGER NOT NULL,
|
||||
`page_number` INTEGER NOT NULL,
|
||||
`is_initially_current` INTEGER NOT NULL
|
||||
`page_number` INTEGER NOT NULL
|
||||
)",
|
||||
[],
|
||||
)
|
||||
|
|
@ -28,36 +26,28 @@ impl Database {
|
|||
tx: &Transaction,
|
||||
app_browser_window_tab_id: &i64,
|
||||
page_number: &u32,
|
||||
is_initially_current: &bool,
|
||||
) -> Result<usize, Error> {
|
||||
tx.execute(
|
||||
"INSERT INTO `app_browser_window_tab_item` (
|
||||
`app_browser_window_tab_id`,
|
||||
`page_number`,
|
||||
`is_initially_current`
|
||||
) VALUES (?, ?, ?)",
|
||||
[
|
||||
app_browser_window_tab_id,
|
||||
&(*page_number as i64),
|
||||
&(*is_initially_current as i64),
|
||||
],
|
||||
`page_number`
|
||||
) VALUES (?, ?)",
|
||||
[app_browser_window_tab_id, &(*page_number as i64)],
|
||||
)
|
||||
}
|
||||
|
||||
pub fn records(tx: &Transaction, app_browser_window_tab_id: &i64) -> Result<Vec<Table>, Error> {
|
||||
let mut stmt = tx.prepare(
|
||||
"SELECT `id`,
|
||||
`app_browser_window_tab_id`,
|
||||
`is_initially_current` FROM `app_browser_window_tab_item`
|
||||
WHERE `app_browser_window_tab_id` = ?
|
||||
ORDER BY `page_number` ASC", // just order by, no store in struct wanted
|
||||
`app_browser_window_tab_id` FROM `app_browser_window_tab_item`
|
||||
WHERE `app_browser_window_tab_id` = ?
|
||||
ORDER BY `page_number` ASC", // just order by, no store in struct wanted
|
||||
)?;
|
||||
|
||||
let result = stmt.query_map([app_browser_window_tab_id], |row| {
|
||||
Ok(Table {
|
||||
id: row.get(0)?,
|
||||
// app_browser_window_tab_id: row.get(1)?, not in use
|
||||
is_initially_current: row.get(2)?,
|
||||
})
|
||||
})?;
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ impl Page {
|
|||
// Construct
|
||||
pub fn new_arc(
|
||||
name: GString,
|
||||
navigation_request_text: Option<GString>,
|
||||
action_tab_page_navigation_base: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_back: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_forward: Arc<SimpleAction>,
|
||||
|
|
@ -56,7 +55,6 @@ impl Page {
|
|||
// Init components
|
||||
let content = Arc::new(Content::new(action_page_open.clone()));
|
||||
let navigation = Arc::new(Navigation::new(
|
||||
navigation_request_text,
|
||||
action_tab_page_navigation_base.clone(),
|
||||
action_tab_page_navigation_history_back.clone(),
|
||||
action_tab_page_navigation_history_forward.clone(),
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ pub struct Navigation {
|
|||
|
||||
impl Navigation {
|
||||
pub fn new(
|
||||
request_text: Option<GString>,
|
||||
action_tab_page_navigation_base: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_back: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_history_forward: Arc<SimpleAction>,
|
||||
|
|
@ -47,7 +46,6 @@ impl Navigation {
|
|||
);
|
||||
let reload = Reload::new(action_tab_page_navigation_reload.clone());
|
||||
let request = Request::new(
|
||||
request_text,
|
||||
action_update.clone(),
|
||||
action_tab_page_navigation_reload.clone(),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ pub struct Request {
|
|||
impl Request {
|
||||
// Construct
|
||||
pub fn new(
|
||||
text: Option<GString>,
|
||||
// Actions
|
||||
action_update: Arc<SimpleAction>,
|
||||
action_tab_page_navigation_reload: Arc<SimpleAction>, // @TODO local `action_page_open`?
|
||||
|
|
@ -34,10 +33,6 @@ impl Request {
|
|||
let widget = Entry::builder()
|
||||
.placeholder_text("URL or search term...")
|
||||
.hexpand(true)
|
||||
.text(match text {
|
||||
Some(text) => text,
|
||||
None => GString::new(),
|
||||
})
|
||||
.build();
|
||||
|
||||
// Connect events
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue