Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GtkSearchBar instead of GtkSearchEntry for Apps and Processes #437

Merged
merged 7 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions data/net.nokyan.Resources.gschema.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
<default>&quot;Normal&quot;</default>
<summary>Refresh Speed</summary>
</key>
<key name="show-search-on-start" type="b">
<default>false</default>
<summary>Show search field for Processes and Applications on launch</summary>
</key>
<key name="show-virtual-drives" type="b">
<default>false</default>
<summary>Show virtual block devices such as LVM containers</summary>
Expand Down
5 changes: 0 additions & 5 deletions data/resources/ui/dialogs/settings_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@
</property>
</object>
</child>
<child>
<object class="AdwSwitchRow" id="show_search_on_start_row">
<property name="title" translatable="yes">Show Search Fields on Launch</property>
</object>
</child>
<child>
<object class="AdwSwitchRow" id="sidebar_details_row">
<property name="title" translatable="yes">Show Usage Details in Sidebar</property>
Expand Down
103 changes: 35 additions & 68 deletions data/resources/ui/pages/applications.ui
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@
</object>
<property name="child">
<object class="AdwToolbarView">
<child type="top">
<object class="GtkSearchBar" id="search_bar">
<property name="child">
<object class="GtkSearchEntry" id="search_entry">
<accessibility>
<property name="label" translatable="yes">Search applications</property>
</accessibility>
</object>
</property>
</object>
</child>
<property name="content">
<object class="AdwToastOverlay" id="toast_overlay">
<child>
Expand All @@ -62,78 +73,34 @@
</property>
<child type="bottom">
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="margin-top">16</property>
<property name="margin-bottom">16</property>
<property name="margin-start">16</property>
<property name="margin-end">16</property>
<property name="hexpand">true</property>
<property name="spacing">16</property>
<property name="halign">end</property>
<child>
<object class="GtkRevealer" id="search_revealer">
<property name="transition_type">slide-up</property>
<child>
<object class="AdwClamp">
<property name="margin-top">16</property>
<property name="margin-bottom">0</property>
<property name="margin-start">16</property>
<property name="margin-end">16</property>
<property name="tightening-threshold">300</property>
<property name="maximum-size">400</property>
<child>
<object class="GtkSearchEntry" id="search_entry">
<accessibility>
<property name="label" translatable="yes">Search applications</property>
</accessibility>
</object>
</child>
</object>
</child>
<object class="GtkButton" id="information_button">
<property name="icon-name">info-symbolic</property>
<property name="sensitive">false</property>
<property name="tooltip-text" translatable="yes">Show App Information</property>
<accessibility>
<property name="label" translatable="yes">Show App Information</property>
</accessibility>
<style>
<class name="circular"/>
</style>
</object>
</child>
<child>
<object class="GtkBox">
<property name="margin-top">16</property>
<property name="margin-bottom">16</property>
<property name="margin-start">16</property>
<property name="margin-end">16</property>
<property name="spacing">16</property>
<child>
<object class="GtkToggleButton" id="search_button">
<property name="icon-name">search-symbolic</property>
<property name="tooltip-text" translatable="yes">Search</property>
<accessibility>
<property name="label" translatable="yes">Toggle search field</property>
</accessibility>
<style>
<class name="circular"/>
</style>
</object>
</child>
<child>
<object class="GtkBox">
<property name="hexpand">true</property>
<property name="spacing">16</property>
<property name="halign">end</property>
<child>
<object class="GtkButton" id="information_button">
<property name="icon-name">info-symbolic</property>
<property name="sensitive">false</property>
<property name="tooltip-text" translatable="yes">Show App Information</property>
<accessibility>
<property name="label" translatable="yes">Show App Information</property>
</accessibility>
<style>
<class name="circular"/>
</style>
</object>
</child>
<child>
<object class="AdwSplitButton" id="end_application_button">
<property name="label" translatable="yes">End App</property>
<property name="menu-model">end_app_menu</property>
<property name="sensitive">false</property>
<style>
<class name="destructive-action"/>
</style>
</object>
</child>
</object>
</child>
<object class="AdwSplitButton" id="end_application_button">
<property name="label" translatable="yes">End App</property>
<property name="menu-model">end_app_menu</property>
<property name="sensitive">false</property>
<style>
<class name="destructive-action"/>
</style>
</object>
</child>
</object>
Expand Down
129 changes: 48 additions & 81 deletions data/resources/ui/pages/processes.ui
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@
</object>
<property name="child">
<object class="AdwToolbarView">
<child type="top">
<object class="GtkSearchBar" id="search_bar">
<property name="child">
<object class="GtkSearchEntry" id="search_entry">
<accessibility>
<property name="label" translatable="yes">Search processes</property>
</accessibility>
</object>
</property>
</object>
</child>
<property name="content">
<object class="AdwToastOverlay" id="toast_overlay">
<child>
Expand All @@ -108,91 +119,47 @@
</property>
<child type="bottom">
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="margin-top">16</property>
<property name="margin-bottom">16</property>
<property name="margin-start">16</property>
<property name="margin-end">16</property>
<property name="hexpand">true</property>
<property name="spacing">16</property>
<property name="halign">end</property>
<child>
<object class="GtkButton" id="options_button">
<property name="icon-name">options-symbolic</property>
<property name="sensitive">false</property>
<property name="tooltip-text" translatable="yes">Show Process Options</property>
<accessibility>
<property name="label" translatable="yes">Show Process Options</property>
</accessibility>
<style>
<class name="circular"/>
</style>
</object>
</child>
<child>
<object class="GtkRevealer" id="search_revealer">
<property name="transition_type">slide-up</property>
<child>
<object class="AdwClamp">
<property name="margin-top">16</property>
<property name="margin-bottom">0</property>
<property name="margin-start">16</property>
<property name="margin-end">16</property>
<property name="tightening-threshold">300</property>
<property name="maximum-size">400</property>
<child>
<object class="GtkSearchEntry" id="search_entry">
<accessibility>
<property name="label" translatable="yes">Search processes</property>
</accessibility>
</object>
</child>
</object>
</child>
<object class="GtkButton" id="information_button">
<property name="icon-name">info-symbolic</property>
<property name="sensitive">false</property>
<property name="tooltip-text" translatable="yes">Show Process Information</property>
<accessibility>
<property name="label" translatable="yes">Show Process Information</property>
</accessibility>
<style>
<class name="circular"/>
</style>
</object>
</child>
<child>
<object class="GtkBox">
<property name="margin-top">16</property>
<property name="margin-bottom">16</property>
<property name="margin-start">16</property>
<property name="margin-end">16</property>
<property name="spacing">16</property>
<child>
<object class="GtkToggleButton" id="search_button">
<property name="icon-name">search-symbolic</property>
<property name="tooltip-text" translatable="yes">Search</property>
<accessibility>
<property name="label" translatable="yes">Toggle search field</property>
</accessibility>
<style>
<class name="circular"/>
</style>
</object>
</child>
<child>
<object class="GtkBox">
<property name="hexpand">true</property>
<property name="spacing">16</property>
<property name="halign">end</property>
<child>
<object class="GtkButton" id="options_button">
<property name="icon-name">options-symbolic</property>
<property name="sensitive">false</property>
<property name="tooltip-text" translatable="yes">Show Process Options</property>
<accessibility>
<property name="label" translatable="yes">Show Process Options</property>
</accessibility>
<style>
<class name="circular"/>
</style>
</object>
</child>
<child>
<object class="GtkButton" id="information_button">
<property name="icon-name">info-symbolic</property>
<property name="sensitive">false</property>
<property name="tooltip-text" translatable="yes">Show Process Information</property>
<accessibility>
<property name="label" translatable="yes">Show Process Information</property>
</accessibility>
<style>
<class name="circular"/>
</style>
</object>
</child>
<child>
<object class="AdwSplitButton" id="end_process_button">
<property name="label" translatable="yes">End Process</property>
<property name="menu-model">end_process_menu</property>
<property name="sensitive">false</property>
<style>
<class name="destructive-action"/>
</style>
</object>
</child>
</object>
</child>
<object class="AdwSplitButton" id="end_process_button">
<property name="label" translatable="yes">End Process</property>
<property name="menu-model">end_process_menu</property>
<property name="sensitive">false</property>
<style>
<class name="destructive-action"/>
</style>
</object>
</child>
</object>
Expand Down
22 changes: 20 additions & 2 deletions data/resources/ui/window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<property name="vexpand">True</property>
<property name="vhomogeneous">False</property>
<child>
<object class="GtkStackPage" id="applications_page">
<object class="GtkStackPage" id="apps_page">
<property name="title" translatable="yes">Apps</property>
<property name="child">
<object class="AdwToolbarView">
Expand All @@ -82,10 +82,19 @@
<property name="active" bind-source="split_view" bind-property="show-sidebar" bind-flags="sync-create|bidirectional"/>
</object>
</child>
<child>
<object class="GtkToggleButton" id="apps_search_button">
<property name="icon-name">search-symbolic</property>
<property name="tooltip-text" translatable="yes">Search</property>
<accessibility>
<property name="label" translatable="yes">Toggle search field</property>
</accessibility>
</object>
</child>
</object>
</child>
<property name="content">
<object class="ResApplications" id="applications"/>
<object class="ResApplications" id="apps"/>
</property>
</object>
</property>
Expand Down Expand Up @@ -113,6 +122,15 @@
<property name="active" bind-source="split_view" bind-property="show-sidebar" bind-flags="sync-create|bidirectional"/>
</object>
</child>
<child>
<object class="GtkToggleButton" id="processes_search_button">
<property name="icon-name">search-symbolic</property>
<property name="tooltip-text" translatable="yes">Search</property>
<accessibility>
<property name="label" translatable="yes">Toggle search field</property>
</accessibility>
</object>
</child>
</object>
</child>
<property name="content">
Expand Down
9 changes: 0 additions & 9 deletions src/ui/dialogs/settings_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ mod imp {
#[template_child]
pub graph_data_points_row: TemplateChild<adw::SpinRow>,
#[template_child]
pub show_search_on_start_row: TemplateChild<adw::SwitchRow>,
#[template_child]
pub sidebar_details_row: TemplateChild<adw::SwitchRow>,
#[template_child]
pub sidebar_description_row: TemplateChild<adw::SwitchRow>,
Expand Down Expand Up @@ -188,8 +186,6 @@ impl ResSettingsDialog {
.set_active(SETTINGS.sidebar_description());
imp.sidebar_meter_type_row
.set_selected((SETTINGS.sidebar_meter_type() as u8) as u32);
imp.show_search_on_start_row
.set_active(SETTINGS.show_search_on_start());
imp.normalize_cpu_usage_row
.set_active(SETTINGS.normalize_cpu_usage());

Expand Down Expand Up @@ -313,11 +309,6 @@ impl ResSettingsDialog {
}
});

imp.show_search_on_start_row
.connect_active_notify(|switch_row| {
let _ = SETTINGS.set_show_search_on_start(switch_row.is_active());
});

imp.normalize_cpu_usage_row
.connect_active_notify(|switch_row| {
let _ = SETTINGS.set_normalize_cpu_usage(switch_row.is_active());
Expand Down
Loading