mirror of
https://github.com/Xetibo/ReSet.git
synced 2025-04-12 08:28:32 +02:00
Add poopover menu functionality
This commit is contained in:
parent
1e10929818
commit
0695f4eb9a
|
@ -7,7 +7,6 @@ use glib::Object;
|
|||
use gtk::{Application, FlowBox, gio, glib};
|
||||
use gtk::prelude::*;
|
||||
|
||||
use crate::components::wifi::WifiBox;
|
||||
use crate::components::window::handleSidebarClick::{
|
||||
HANDLE_AUDIO_CLICK, HANDLE_BLUETOOTH_CLICK, HANDLE_CONNECTIVITY_CLICK, HANDLE_MICROPHONE_CLICK,
|
||||
HANDLE_VOLUME_CLICK, HANDLE_VPN_CLICK, HANDLE_WIFI_CLICK,
|
||||
|
@ -41,15 +40,14 @@ impl Window {
|
|||
let selfImp = self.imp();
|
||||
|
||||
selfImp.resetSearchEntry.connect_search_changed(clone!(@ weak self as window => move |_| {
|
||||
window.filterList();
|
||||
window.filterList();
|
||||
}));
|
||||
|
||||
selfImp.resetSideBarToggle.connect_clicked(clone!(@ weak self as window => move |_| {
|
||||
window.toggleSidebar();
|
||||
window.toggleSidebar();
|
||||
}));
|
||||
|
||||
selfImp.resetSidebarList
|
||||
.connect_row_activated(clone!(@ weak selfImp as flowbox => move |_, y| {
|
||||
selfImp.resetSidebarList.connect_row_activated(clone!(@ weak selfImp as flowbox => move |_, y| {
|
||||
let result = y.downcast_ref::<SidebarEntry>().unwrap();
|
||||
let clickEvent = result.imp().onClickEvent.borrow().onClickEvent;
|
||||
(clickEvent)(flowbox.resetMain.get());
|
||||
|
@ -59,15 +57,15 @@ impl Window {
|
|||
window.close();
|
||||
}));
|
||||
|
||||
selfImp.resetMenu.connect_clicked(|_| {
|
||||
WifiBox::donotdisturb();
|
||||
});
|
||||
// selfImp.resetMenu.connect_clicked(|_| {
|
||||
// WifiBox::donotdisturb();
|
||||
//
|
||||
// });
|
||||
}
|
||||
|
||||
fn handleDynamicSidebar(&self) {
|
||||
let selfImp = self.imp();
|
||||
selfImp.resetSidebarBreakpoint
|
||||
.set_condition(BreakpointCondition::parse("max-width: 500sp").as_ref().ok());
|
||||
selfImp.resetSidebarBreakpoint.set_condition(BreakpointCondition::parse("max-width: 500sp").as_ref().ok());
|
||||
selfImp.resetSidebarBreakpoint.add_setter(
|
||||
&Object::from(selfImp.resetOverlaySplitView.get()),
|
||||
"collapsed",
|
||||
|
|
|
@ -3,7 +3,7 @@ use adw::subclass::prelude::AdwApplicationWindowImpl;
|
|||
use adw::{Breakpoint, OverlaySplitView};
|
||||
use glib::subclass::InitializingObject;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::{glib, Box, Button, CompositeTemplate, FlowBox, ListBox, SearchEntry};
|
||||
use gtk::{glib, Box, Button, CompositeTemplate, FlowBox, ListBox, SearchEntry, PopoverMenu};
|
||||
use std::cell::RefCell;
|
||||
|
||||
use crate::components::wifi::WifiBox;
|
||||
|
@ -28,7 +28,7 @@ pub struct Window {
|
|||
#[template_child]
|
||||
pub resetPath: TemplateChild<Box>,
|
||||
#[template_child]
|
||||
pub resetMenu: TemplateChild<Button>,
|
||||
pub resetPopoverMenu: TemplateChild<PopoverMenu>,
|
||||
#[template_child]
|
||||
pub resetClose: TemplateChild<Button>,
|
||||
pub sidebarEntries: RefCell<Vec<(SidebarEntry, Vec<SidebarEntry>)>>,
|
||||
|
|
|
@ -28,33 +28,67 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="resetBack">
|
||||
<property name="has-frame">False</property>
|
||||
<property name="icon-name">go-previous-symbolic</property>
|
||||
<property name="valign">start</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="resetForward">
|
||||
<property name="has-frame">False</property>
|
||||
<property name="icon-name">go-previous-symbolic-rtl</property>
|
||||
<property name="valign">start</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="resetPath">
|
||||
<property name="hexpand">True</property>
|
||||
<property name="hexpand-set">True</property>
|
||||
<property name="valign">start</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="resetMenu">
|
||||
<object class="GtkMenuButton">
|
||||
<property name="can-shrink">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="hexpand-set">True</property>
|
||||
<property name="icon-name">open-menu-symbolic</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="popover">
|
||||
<object class="GtkPopoverMenu" id="resetPopoverMenu">
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="has-frame">False</property>
|
||||
<property name="label">Help</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="has-frame">False</property>
|
||||
<property name="label">Preferences</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="has-frame">False</property>
|
||||
<property name="label">About</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="vexpand">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="resetClose">
|
||||
<property name="halign">start</property>
|
||||
<property name="icon-name">window-close-symbolic</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="margin-start">5</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -93,6 +127,7 @@
|
|||
</child>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<property name="margin-top">5</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
|
|
Loading…
Reference in a new issue