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 @@ @@ -1,4 +1,7 @@
use gtk::{prelude::BoxExt, Box, Button, Orientation};
use gtk::{
prelude::{BoxExt, IsA},
Box, Orientation,
};
use std::sync::Arc;
pub struct Widget {
@ -7,7 +10,7 @@ pub struct Widget { @@ -7,7 +10,7 @@ pub struct Widget {
impl Widget {
// 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
let gobject = Box::builder()
.orientation(Orientation::Horizontal)

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

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

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

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

Loading…
Cancel
Save