[gnome-usage] header-bar: Add filter processes button
- From: Petr Štětka <pstetka src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-usage] header-bar: Add filter processes button
- Date: Wed, 19 Dec 2018 12:48:59 +0000 (UTC)
commit 215174681e0adda25c9e1c6910d072f27f0270c6
Author: Petr Štětka <pstetka redhat com>
Date: Fri Apr 27 12:03:00 2018 +0200
header-bar: Add filter processes button
Add MenuButton to headerbar in performance tab for grouping system
processes or showing all processes.
data/ui/header-bar.ui | 28 ++++++++++++++++++++++++++++
src/application.vala | 14 +++++++++++++-
src/header-bar.vala | 6 +++++-
3 files changed, 46 insertions(+), 2 deletions(-)
---
diff --git a/data/ui/header-bar.ui b/data/ui/header-bar.ui
index b086595..843cf71 100644
--- a/data/ui/header-bar.ui
+++ b/data/ui/header-bar.ui
@@ -63,6 +63,19 @@
</packing>
</child>
+ <child>
+ <object class="GtkMenuButton" id="performance_filter_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="use_popover">True</property>
+ <property name="direction">none</property>
+ <property name="menu-model">performance-filter-menu</property>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
+
<child>
<object class="GtkToggleButton" id="performance_search_button">
<property name="visible">True</property>
@@ -110,5 +123,20 @@
</packing>
</child>
</template>
+
+ <menu id="performance-filter-menu">
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Group system processes</attribute>
+ <attribute name="action">app.filter-processes</attribute>
+ <attribute name="target">group-system</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Show all processes</attribute>
+ <attribute name="action">app.filter-processes</attribute>
+ <attribute name="target">show-all</attribute>
+ </item>
+ </section>
+ </menu>
</interface>
diff --git a/src/application.vala b/src/application.vala
index 4afeb35..152b02a 100644
--- a/src/application.vala
+++ b/src/application.vala
@@ -30,7 +30,8 @@ namespace Usage
{
{ "about", on_about },
{ "search", on_search },
- { "quit", on_quit }
+ { "quit", on_quit },
+ { "filter-processes", on_activate_radio, "s", "'group-system'", change_filter_processes_state }
};
public Application ()
@@ -95,5 +96,16 @@ namespace Usage
{
window.get_header_bar().action_on_search();
}
+
+ private void on_activate_radio (GLib.SimpleAction action, GLib.Variant? state)
+ {
+ action.change_state(state);
+ }
+
+ private void change_filter_processes_state(GLib.SimpleAction action, GLib.Variant? state)
+ {
+ action.set_state(state);
+ //TODO here change filtering
+ }
}
}
diff --git a/src/header-bar.vala b/src/header-bar.vala
index 17d8f39..15da81b 100644
--- a/src/header-bar.vala
+++ b/src/header-bar.vala
@@ -34,6 +34,9 @@ namespace Usage
[GtkChild]
private Gtk.StackSwitcher stack_switcher;
+ [GtkChild]
+ private Gtk.MenuButton performance_filter_button;
+
[GtkChild]
private Gtk.ToggleButton performance_search_button;
@@ -77,6 +80,7 @@ namespace Usage
switch(this.mode)
{
case HeaderBarMode.PERFORMANCE:
+ performance_filter_button.hide ();
performance_search_button.hide ();
break;
case HeaderBarMode.STORAGE:
@@ -91,7 +95,7 @@ namespace Usage
{
case HeaderBarMode.PERFORMANCE:
show_stack_switcher();
-
+ performance_filter_button.show();
performance_search_button.show();
break;
case HeaderBarMode.STORAGE:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]