1
0
Fork 0
mirror of https://github.com/Xetibo/ReSet.git synced 2025-04-11 08:02:01 +02:00

fix: Show selected tab at startup

This commit is contained in:
Fabio Lenherr / DashieTM 2023-12-17 22:28:33 +01:00
parent e0a672935e
commit 9c85bf6705
4 changed files with 23 additions and 11 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "reset"
version = "0.1.3"
version = "0.1.4"
edition = "2021"
description = "A wip universal Linux settings application."
repository = "https://github.com/Xetibo/ReSet"

View file

@ -3,7 +3,7 @@ use adw::subclass::prelude::ObjectSubclassIsExt;
use adw::BreakpointCondition;
use glib::Object;
use gtk::gio::ActionEntry;
use gtk::{gio, glib, AccessibleRole, Application, ListBoxRow, Orientation};
use gtk::{gio, glib, AccessibleRole, Application, ListBoxRow, Orientation, StateFlags};
use gtk::{prelude::*, DirectionType};
use crate::components::window::handle_sidebar_click::*;
@ -242,14 +242,16 @@ impl ReSetWindow {
connectivity_list,
));
let output = SidebarEntry::new(
"Output",
"audio-volume-high-symbolic",
Categories::Audio,
true,
HANDLE_VOLUME_CLICK,
);
output.set_receives_default(true);
let audio_list = vec![
SidebarEntry::new(
"Output",
"audio-volume-high-symbolic",
Categories::Audio,
true,
HANDLE_VOLUME_CLICK,
),
output,
SidebarEntry::new(
"Input",
"audio-input-microphone-symbolic",
@ -320,7 +322,15 @@ impl ReSetWindow {
for (main_entry, sub_entries) in sidebar_entries.iter() {
self_imp.reset_sidebar_list.append(main_entry);
for sub_entry in sub_entries {
self_imp.reset_sidebar_list.append(sub_entry);
// TODO change this to home when home offers dynamic selection
// this is just a placeholder for now, hence hardcoded
if &*sub_entry.imp().name.borrow() == "Output" {
self_imp.reset_sidebar_list.append(sub_entry);
sub_entry.grab_focus();
sub_entry.set_state_flags(StateFlags::SELECTED, true);
} else {
self_imp.reset_sidebar_list.append(sub_entry);
}
}
let separator = gtk::Separator::builder()
.margin_bottom(3)
@ -334,7 +344,7 @@ impl ReSetWindow {
.selectable(false)
.activatable(false)
.can_target(false)
.focusable(false)
// .focusable(false)
.accessible_role(AccessibleRole::Separator)
.build();
// TODO how to simply skip this ?

View file

@ -91,6 +91,7 @@
<property name="valign">start</property>
<child>
<object class="GtkSearchEntry" id="reset_search_entry">
<property name="height-request">39</property>
<property name="placeholder-text">Search (Ctrl + F)</property>
<property name="valign">start</property>
</object>

View file

@ -323,6 +323,7 @@
(3,18,"GtkWidget","margin-top","5",None,None,None,None,None,None,None,None,None),
(3,19,"GtkWidget","valign","start",None,None,None,None,None,None,None,None,None),
(3,20,"GtkSearchEntry","placeholder-text","Search (Ctrl + F)",None,None,None,None,None,None,None,None,None),
(3,20,"GtkWidget","height-request","39",None,None,None,None,None,None,None,None,None),
(3,20,"GtkWidget","valign","start",None,None,None,None,None,None,None,None,None),
(3,25,"GtkWidget","valign","start",None,None,None,None,None,None,None,None,None),
(3,26,"GtkButton","icon-name","sidebar-show-symbolic",None,None,None,None,None,None,None,None,None),