mirror of
https://github.com/Xetibo/ReSet.git
synced 2025-04-19 02:58:33 +02:00
clear search bar on clicking on setting
This commit is contained in:
parent
f7c95cd4a1
commit
9b93d22085
|
@ -1,9 +1,9 @@
|
||||||
|
use adw::BreakpointCondition;
|
||||||
use adw::glib::clone;
|
use adw::glib::clone;
|
||||||
use adw::subclass::prelude::ObjectSubclassIsExt;
|
use adw::subclass::prelude::ObjectSubclassIsExt;
|
||||||
use adw::BreakpointCondition;
|
|
||||||
use glib::Object;
|
use glib::Object;
|
||||||
|
use gtk::{Application, gio, glib, ListBoxRow, Orientation};
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
use gtk::{gio, glib, Application, ListBoxRow, Orientation};
|
|
||||||
|
|
||||||
use crate::components::window::handleSidebarClick::*;
|
use crate::components::window::handleSidebarClick::*;
|
||||||
use crate::components::window::sidebarEntry::SidebarEntry;
|
use crate::components::window::sidebarEntry::SidebarEntry;
|
||||||
|
@ -18,6 +18,7 @@ glib::wrapper! {
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl Send for Window {}
|
unsafe impl Send for Window {}
|
||||||
|
|
||||||
unsafe impl Sync for Window {}
|
unsafe impl Sync for Window {}
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
|
@ -29,15 +30,11 @@ impl Window {
|
||||||
pub fn setupCallback(&self) {
|
pub fn setupCallback(&self) {
|
||||||
let selfImp = self.imp();
|
let selfImp = self.imp();
|
||||||
|
|
||||||
selfImp
|
selfImp.resetSearchEntry.connect_search_changed(clone!(@ weak self as window => move |_| {
|
||||||
.resetSearchEntry
|
|
||||||
.connect_search_changed(clone!(@ weak self as window => move |_| {
|
|
||||||
window.filterList();
|
window.filterList();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
selfImp
|
selfImp.resetSideBarToggle.connect_clicked(clone!(@ weak self as window => move |_| {
|
||||||
.resetSideBarToggle
|
|
||||||
.connect_clicked(clone!(@ weak self as window => move |_| {
|
|
||||||
window.toggleSidebar();
|
window.toggleSidebar();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -49,9 +46,7 @@ impl Window {
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
selfImp
|
selfImp.resetClose.connect_clicked(clone!(@ weak self as window => move |_| {
|
||||||
.resetClose
|
|
||||||
.connect_clicked(clone!(@ weak self as window => move |_| {
|
|
||||||
window.close();
|
window.close();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -63,9 +58,7 @@ impl Window {
|
||||||
|
|
||||||
pub fn handleDynamicSidebar(&self) {
|
pub fn handleDynamicSidebar(&self) {
|
||||||
let selfImp = self.imp();
|
let selfImp = self.imp();
|
||||||
selfImp
|
selfImp.resetSidebarBreakpoint.set_condition(BreakpointCondition::parse("max-width: 700sp").as_ref().ok());
|
||||||
.resetSidebarBreakpoint
|
|
||||||
.set_condition(BreakpointCondition::parse("max-width: 700sp").as_ref().ok());
|
|
||||||
selfImp.resetSidebarBreakpoint.add_setter(
|
selfImp.resetSidebarBreakpoint.add_setter(
|
||||||
&Object::from(selfImp.resetOverlaySplitView.get()),
|
&Object::from(selfImp.resetOverlaySplitView.get()),
|
||||||
"collapsed",
|
"collapsed",
|
||||||
|
@ -88,25 +81,13 @@ impl Window {
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if mainEntry
|
if mainEntry.imp().name.borrow().to_lowercase().contains(&text.to_lowercase()) {
|
||||||
.imp()
|
|
||||||
.name
|
|
||||||
.borrow()
|
|
||||||
.to_lowercase()
|
|
||||||
.contains(&text.to_lowercase())
|
|
||||||
{
|
|
||||||
mainEntry.set_visible(true);
|
mainEntry.set_visible(true);
|
||||||
} else {
|
} else {
|
||||||
mainEntry.set_visible(false);
|
mainEntry.set_visible(false);
|
||||||
}
|
}
|
||||||
for subEntry in subEntries {
|
for subEntry in subEntries {
|
||||||
if subEntry
|
if subEntry.imp().name.borrow().to_lowercase().contains(&text.to_lowercase()) {
|
||||||
.imp()
|
|
||||||
.name
|
|
||||||
.borrow()
|
|
||||||
.to_lowercase()
|
|
||||||
.contains(&text.to_lowercase())
|
|
||||||
{
|
|
||||||
subEntry.set_visible(true);
|
subEntry.set_visible(true);
|
||||||
mainEntry.set_visible(true);
|
mainEntry.set_visible(true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -226,6 +207,10 @@ impl Window {
|
||||||
peripheralsList,
|
peripheralsList,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
selfImp.resetSidebarList.connect_row_activated(clone!(@ weak selfImp => move |_, _| {
|
||||||
|
selfImp.resetSearchEntry.set_text("");
|
||||||
|
}));
|
||||||
|
|
||||||
for (mainEntry, subEntries) in sidebarEntries.iter() {
|
for (mainEntry, subEntries) in sidebarEntries.iter() {
|
||||||
selfImp.resetSidebarList.append(mainEntry);
|
selfImp.resetSidebarList.append(mainEntry);
|
||||||
for subEntry in subEntries {
|
for subEntry in subEntries {
|
||||||
|
@ -241,9 +226,7 @@ impl Window {
|
||||||
|
|
||||||
pub fn setupPopoverButtons(&self) {
|
pub fn setupPopoverButtons(&self) {
|
||||||
let selfImp = self.imp();
|
let selfImp = self.imp();
|
||||||
selfImp
|
selfImp.resetAboutButton.connect_clicked(clone!(@ weak self as window => move |_| {
|
||||||
.resetAboutButton
|
|
||||||
.connect_clicked(clone!(@ weak self as window => move |_| {
|
|
||||||
let dialog = adw::AboutWindow::builder()
|
let dialog = adw::AboutWindow::builder()
|
||||||
.application_name("ReSet")
|
.application_name("ReSet")
|
||||||
.application_icon("ReSet")
|
.application_icon("ReSet")
|
||||||
|
@ -262,16 +245,12 @@ impl Window {
|
||||||
window.imp().resetPopoverMenu.popdown();
|
window.imp().resetPopoverMenu.popdown();
|
||||||
dialog.present();
|
dialog.present();
|
||||||
}));
|
}));
|
||||||
selfImp
|
selfImp.resetPreferenceButton.connect_clicked(clone!(@weak self as window => move |_| {
|
||||||
.resetPreferenceButton
|
|
||||||
.connect_clicked(clone!(@weak self as window => move |_| {
|
|
||||||
let preferences = adw::PreferencesWindow::builder().build();
|
let preferences = adw::PreferencesWindow::builder().build();
|
||||||
window.imp().resetPopoverMenu.popdown();
|
window.imp().resetPopoverMenu.popdown();
|
||||||
preferences.present();
|
preferences.present();
|
||||||
}));
|
}));
|
||||||
selfImp
|
selfImp.resetShortcutsButton.connect_clicked(clone!(@weak self as window => move |_| {
|
||||||
.resetShortcutsButton
|
|
||||||
.connect_clicked(clone!(@weak self as window => move |_| {
|
|
||||||
let shortcuts = gtk::ShortcutsWindow::builder().build();
|
let shortcuts = gtk::ShortcutsWindow::builder().build();
|
||||||
window.imp().resetPopoverMenu.popdown();
|
window.imp().resetPopoverMenu.popdown();
|
||||||
shortcuts.present();
|
shortcuts.present();
|
||||||
|
|
Loading…
Reference in a new issue