[gnome-usage] primary-menu: Merge performance filter button and primary menu into one
- From: Petr Štětka <pstetka src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-usage] primary-menu: Merge performance filter button and primary menu into one
- Date: Wed, 19 Dec 2018 12:50:05 +0000 (UTC)
commit 4feaaae9aa8df3b84956a79874a2dcbac2c525fa
Author: Petr Štětka <pstetka redhat com>
Date: Wed Dec 19 13:44:47 2018 +0100
primary-menu: Merge performance filter button and primary menu into one
data/ui/header-bar.ui | 28 ----------------------------
data/ui/primary-menu.ui | 31 +++++++++++++++++++++++++++++++
src/header-bar.vala | 6 +-----
src/primary-menu.vala | 16 +++++++++++++++-
4 files changed, 47 insertions(+), 34 deletions(-)
---
diff --git a/data/ui/header-bar.ui b/data/ui/header-bar.ui
index 843cf71..b086595 100644
--- a/data/ui/header-bar.ui
+++ b/data/ui/header-bar.ui
@@ -63,19 +63,6 @@
</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>
@@ -123,20 +110,5 @@
</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/data/ui/primary-menu.ui b/data/ui/primary-menu.ui
index 751c45b..6a66451 100644
--- a/data/ui/primary-menu.ui
+++ b/data/ui/primary-menu.ui
@@ -6,12 +6,43 @@
<object class="GtkBox" id="primary_menu_container">
<property name="visible">True</property>
<property name="margin">6</property>
+ <property name="orientation">vertical</property>
<child>
<object class="GtkModelButton" id="about_usage_button">
<property name="visible">True</property>
<property name="action-name">app.about</property>
<property name="text" translatable="yes">_About Usage</property>
</object>
+ <packing>
+ <property name="pack_type">end</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="performance_container">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkModelButton">
+ <property name="visible">True</property>
+ <property name="action_name">app.filter-processes</property>
+ <property name="action_target">'group-system'</property>
+ <property name="text" translatable="yes">Group system processes</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkModelButton">
+ <property name="visible">True</property>
+ <property name="action_name">app.filter-processes</property>
+ <property name="action_target">'show-all'</property>
+ <property name="text" translatable="yes">Show all processes</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparator">
+ <property name="visible">True</property>
+ </object>
+ </child>
+ </object>
</child>
</object>
</child>
diff --git a/src/header-bar.vala b/src/header-bar.vala
index 15da81b..d23cb7d 100644
--- a/src/header-bar.vala
+++ b/src/header-bar.vala
@@ -34,9 +34,6 @@ namespace Usage
[GtkChild]
private Gtk.StackSwitcher stack_switcher;
- [GtkChild]
- private Gtk.MenuButton performance_filter_button;
-
[GtkChild]
private Gtk.ToggleButton performance_search_button;
@@ -80,7 +77,6 @@ namespace Usage
switch(this.mode)
{
case HeaderBarMode.PERFORMANCE:
- performance_filter_button.hide ();
performance_search_button.hide ();
break;
case HeaderBarMode.STORAGE:
@@ -95,7 +91,6 @@ namespace Usage
{
case HeaderBarMode.PERFORMANCE:
show_stack_switcher();
- performance_filter_button.show();
performance_search_button.show();
break;
case HeaderBarMode.STORAGE:
@@ -109,6 +104,7 @@ namespace Usage
break;
}
+ menu.mode = mode;
this.mode = mode;
}
diff --git a/src/primary-menu.vala b/src/primary-menu.vala
index f18f250..e39668d 100644
--- a/src/primary-menu.vala
+++ b/src/primary-menu.vala
@@ -26,8 +26,22 @@ namespace Usage {
[GtkChild]
private Gtk.ModelButton about_usage_button;
- public PrimaryMenu() {
+ [GtkChild]
+ private Gtk.Box performance_container;
+ public HeaderBarMode mode { get; set; }
+
+ public PrimaryMenu() {
+ notify["mode"].connect ((sender, property) => {
+ switch(mode) {
+ case HeaderBarMode.PERFORMANCE:
+ performance_container.show();
+ break;
+ case HeaderBarMode.STORAGE:
+ performance_container.hide();
+ break;
+ }
+ });
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]