Browse Source

allow any kind of widget

master
yggverse 1 month ago
parent
commit
b2237879be
  1. 7
      src/app/browser/window/tab/item/page/navigation/history/widget.rs
  2. 15
      src/app/browser/window/tab/item/page/navigation/widget.rs
  3. 9
      src/app/browser/window/tab/item/page/widget.rs

7
src/app/browser/window/tab/item/page/navigation/history/widget.rs

@ -1,4 +1,7 @@
use gtk::{prelude::BoxExt, Box, Button, Orientation}; use gtk::{
prelude::{BoxExt, IsA},
Box, Orientation,
};
use std::sync::Arc; use std::sync::Arc;
pub struct Widget { pub struct Widget {
@ -7,7 +10,7 @@ pub struct Widget {
impl Widget { impl Widget {
// Construct // Construct
pub fn new_arc(back: &Button, forward: &Button) -> Arc<Self> { pub fn new_arc(back: &impl IsA<gtk::Widget>, forward: &impl IsA<gtk::Widget>) -> Arc<Self> {
// Init widget // Init widget
let gobject = Box::builder() let gobject = Box::builder()
.orientation(Orientation::Horizontal) .orientation(Orientation::Horizontal)

15
src/app/browser/window/tab/item/page/navigation/widget.rs

@ -1,4 +1,7 @@
use gtk::{prelude::BoxExt, Box, Button, Entry, Orientation}; use gtk::{
prelude::{BoxExt, IsA},
Box, Orientation,
};
use std::sync::Arc; use std::sync::Arc;
const MARGIN: i32 = 6; const MARGIN: i32 = 6;
@ -11,11 +14,11 @@ pub struct Widget {
impl Widget { impl Widget {
// Construct // Construct
pub fn new_arc( pub fn new_arc(
base: &Button, base: &impl IsA<gtk::Widget>,
history: &Box, history: &impl IsA<gtk::Widget>,
reload: &Button, reload: &impl IsA<gtk::Widget>,
request: &Entry, request: &impl IsA<gtk::Widget>,
bookmark: &Button, bookmark: &impl IsA<gtk::Widget>,
) -> Arc<Self> { ) -> Arc<Self> {
let gobject = Box::builder() let gobject = Box::builder()
.orientation(Orientation::Horizontal) .orientation(Orientation::Horizontal)

9
src/app/browser/window/tab/item/page/widget.rs

@ -1,8 +1,7 @@
use adw::Clamp;
use gtk::{ use gtk::{
gio::{SimpleAction, SimpleActionGroup}, gio::{SimpleAction, SimpleActionGroup},
glib::uuid_string_random, glib::uuid_string_random,
prelude::{ActionMapExt, BoxExt, WidgetExt}, prelude::{ActionMapExt, BoxExt, IsA, WidgetExt},
Box, Orientation, Box, Orientation,
}; };
use std::sync::Arc; use std::sync::Arc;
@ -18,9 +17,9 @@ impl Widget {
// Actions // Actions
action_page_open: SimpleAction, action_page_open: SimpleAction,
// Components // Components
navigation: &Box, navigation: &impl IsA<gtk::Widget>,
content: &Box, content: &impl IsA<gtk::Widget>,
input: &Clamp, input: &impl IsA<gtk::Widget>,
) -> Arc<Self> { ) -> Arc<Self> {
// Init additional action group // Init additional action group
let action_group = SimpleActionGroup::new(); let action_group = SimpleActionGroup::new();

Loading…
Cancel
Save