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