[gnome-system-monitor] Make Resources sections collapsible
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-system-monitor] Make Resources sections collapsible
- Date: Fri, 6 Nov 2020 00:00:40 +0000 (UTC)
commit d1aacf9c6d2fc569a72e30ae789d12ba8382ca23
Author: Robert Roth <robert roth off gmail com>
Date: Fri Nov 6 00:00:40 2020 +0000
Make Resources sections collapsible
data/interface.ui | 534 ++++++++++++++++++++++--------------------
src/interface.cpp | 7 +
src/legacy/gsm_color_button.c | 3 +-
src/load-graph.cpp | 6 +-
4 files changed, 289 insertions(+), 261 deletions(-)
---
diff --git a/data/interface.ui b/data/interface.ui
index ecabaecf..2c48dc65 100644
--- a/data/interface.ui
+++ b/data/interface.ui
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <!-- interface-requires gtk+ 3.0 -->
+ <!-- interface-requires gtk+ 3.12 -->
<object class="GtkApplicationWindow" id="main_window">
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="title" translatable="yes">System Monitor</property>
- <property name="default_width">440</property>
- <property name="default_height">495</property>
- <property name="icon_name">org.gnome.SystemMonitor</property>
+ <property name="default-width">440</property>
+ <property name="default-height">495</property>
+ <property name="icon-name">org.gnome.SystemMonitor</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="header_bar">
<property name="visible">True</property>
- <property name="show_close_button">True</property>
+ <property name="show-close-button">True</property>
<style>
<class name="titlebar"/>
</style>
@@ -23,8 +23,8 @@
<child>
<object class="GtkMenuButton" id="process_menu_button">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="use_popover">True</property>
+ <property name="can-focus">True</property>
+ <property name="use-popover">True</property>
<property name="valign">center</property>
<property name="halign">end</property>
<property name="direction">none</property>
@@ -34,14 +34,14 @@
</style>
</object>
<packing>
- <property name="pack_type">end</property>
+ <property name="pack-type">end</property>
</packing>
</child>
<child>
<object class="GtkMenuButton" id="window_menu_button">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="use_popover">True</property>
+ <property name="can-focus">True</property>
+ <property name="use-popover">True</property>
<property name="valign">center</property>
<property name="halign">end</property>
<property name="direction">none</property>
@@ -51,7 +51,7 @@
</style>
</object>
<packing>
- <property name="pack_type">end</property>
+ <property name="pack-type">end</property>
</packing>
</child>
<child>
@@ -59,22 +59,22 @@
<property name="visible">True</property>
<property name="active">False</property>
<property name="valign">center</property>
- <property name="margin_start">6</property>
- <property name="action_name">win.search</property>
- <property name="action_target">@b false</property>
+ <property name="margin-start">6</property>
+ <property name="action-name">win.search</property>
+ <property name="action-target">@b false</property>
<style>
<class name="title-button"/>
</style>
<child>
<object class="GtkImage" id="search_image">
<property name="visible">True</property>
- <property name="icon_size">1</property>
- <property name="icon_name">edit-find-symbolic</property>
+ <property name="icon-size">1</property>
+ <property name="icon-name">edit-find-symbolic</property>
</object>
</child>
</object>
<packing>
- <property name="pack_type">end</property>
+ <property name="pack-type">end</property>
</packing>
</child>
</object>
@@ -82,36 +82,36 @@
<child>
<object class="GtkBox" id="main_box">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="orientation">vertical</property>
- <property name="width_request">560</property>
+ <property name="width-request">560</property>
<child>
<object class="GtkStack" id="stack">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<child>
<object class="GtkBox" id="proc_box">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchBar" id="proc_searchbar">
<property name="visible">False</property>
- <property name="can_focus">False</property>
- <property name="vexpand_set">True</property>
+ <property name="can-focus">False</property>
+ <property name="vexpand-set">True</property>
<property name="vexpand">False</property>
<child>
<object class="GtkSearchEntry" id="proc_searchentry">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="halign">fill</property>
- <property name="width_request">300</property>
+ <property name="width-request">300</property>
</object>
</child>
</object>
@@ -124,10 +124,9 @@
<child>
<object class="GtkScrolledWindow" id="processes_scrolled">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="shadow_type">none</property>
<child>
<placeholder/>
</child>
@@ -141,7 +140,7 @@
<child>
<object class="GtkRevealer" id="proc_actionbar_revealer">
<property name="visible">True</property>
- <property name="transition_type">slide-up</property>
+ <property name="transition-type">slide-up</property>
<child>
<object class="GtkActionBar" id="proc_actionbar">
<property name="visible">True</property>
@@ -149,30 +148,30 @@
<object class="GtkButton" id="end_process_button">
<property name="label" translatable="yes">_End Process</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
+ <property name="can-focus">True</property>
+ <property name="receives-default">True</property>
<property name="halign">start</property>
- <property name="use_underline">True</property>
- <property name="action_name">win.send-signal-end</property>
- <property name="action_target">@i 15</property>
+ <property name="use-underline">True</property>
+ <property name="action-name">win.send-signal-end</property>
+ <property name="action-target">@i 15</property>
<accelerator key="Delete" signal="clicked"/>
</object>
</child>
<child>
<object class="GtkButton" id="proc_properties_button">
<property name="visible">True</property>
- <property name="tooltip_text" translatable="yes">Show process
properties</property>
- <property name="action_name">win.process-properties</property>
+ <property name="tooltip-text" translatable="yes">Show process
properties</property>
+ <property name="action-name">win.process-properties</property>
<child>
<object class="GtkImage" id="proc_properties_image">
<property name="visible">True</property>
- <property name="icon_size">1</property>
- <property name="icon_name">document-properties-symbolic</property>
+ <property name="icon-size">1</property>
+ <property name="icon-name">document-properties-symbolic</property>
</object>
</child>
</object>
<packing>
- <property name="pack_type">end</property>
+ <property name="pack-type">end</property>
</packing>
</child>
</object>
@@ -188,73 +187,74 @@
<child>
<object class="GtkScrolledWindow" id="res_scrolled">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="shadow_type">none</property>
<child>
<object class="GtkBox" id="res_box">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="border_width">8</property>
+ <property name="border-width">8</property>
+ <property name="margin-bottom">6</property>
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
- <object class="GtkLabel" id="cpu_label">
+ <object class="GtkExpander" id="cpu_expander">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">CPU History</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="cpu_graph_box">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
+ <property name="can-focus">True</property>
<property name="vexpand">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
+ <property name="expanded">True</property>
<child>
- <object class="GtkGrid" id="cpu_table">
+ <object class="GtkBox" id="cpu_graph_box">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_start">57</property>
+ <property name="can-focus">False</property>
<property name="hexpand">True</property>
- <property name="row_spacing">1</property>
- <property name="column_spacing">6</property>
- <property name="row_homogeneous">True</property>
- <property name="column_homogeneous">True</property>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
+ <property name="vexpand">True</property>
+ <property name="orientation">vertical</property>
+ <property name="margin-top">6</property>
+ <property name="spacing">6</property>
<child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
+ <object class="GtkGrid" id="cpu_table">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="margin-start">57</property>
+ <property name="hexpand">True</property>
+ <property name="row-spacing">1</property>
+ <property name="column-spacing">6</property>
+ <property name="row-homogeneous">True</property>
+ <property name="column-homogeneous">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack-type">end</property>
+ <property name="position">0</property>
+ </packing>
</child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkBox" id="cpu_header">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="margin-start">12</property>
<child>
- <placeholder/>
+ <object class="GtkLabel" id="cpu_label">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">CPU</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
</child>
<child>
<placeholder/>
@@ -263,81 +263,101 @@
<placeholder/>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
<child>
- <object class="GtkLabel" id="mem_label">
+ <object class="GtkExpander" id="mem_expander">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Memory and Swap History</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="mem_graph_box">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
+ <property name="can-focus">True</property>
<property name="vexpand">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
+ <property name="expanded">True</property>
<child>
- <object class="GtkGrid" id="mem_table">
+ <object class="GtkBox" id="mem_graph_box">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_start">54</property>
+ <property name="can-focus">False</property>
<property name="hexpand">True</property>
- <property name="row_spacing">0</property>
- <property name="column_spacing">6</property>
- <property name="row_homogeneous">True</property>
+ <property name="vexpand">True</property>
+ <property name="orientation">vertical</property>
+ <property name="margin-top">6</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkLabel" id="memory_label">
+ <object class="GtkGrid" id="mem_table">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
+ <property name="margin-start">54</property>
<property name="hexpand">True</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Memory</property>
+ <property name="row-spacing">0</property>
+ <property name="column-spacing">6</property>
+ <property name="row-homogeneous">True</property>
+ <child>
+ <object class="GtkLabel" id="memory_label">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Memory</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="swap_label">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Swap</property>
+ </object>
+ <packing>
+ <property name="left-attach">3</property>
+ <property name="top-attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack-type">end</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="swap_label">
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkBox" id="mem_header">
+ <property name="visible">True</property>
+ <property name="margin-start">12</property>
+ <property name="can-focus">False</property>
+ <child>
+ <object class="GtkLabel" id="mem_label">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
+ <property name="can-focus">False</property>
<property name="halign">start</property>
- <property name="label" translatable="yes">Swap</property>
+ <property name="label" translatable="yes">Memory and Swap</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
</object>
<packing>
- <property name="left_attach">3</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -347,115 +367,141 @@
<placeholder/>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <placeholder/>
</child>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
</child>
<child>
- <object class="GtkLabel" id="net_label">
+ <object class="GtkExpander" id="net_expander">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Network History</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="net_graph_box">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
+ <property name="can-focus">True</property>
<property name="vexpand">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
+ <property name="expanded">True</property>
<child>
- <object class="GtkGrid" id="net_table">
+ <object class="GtkBox" id="net_graph_box">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_start">54</property>
- <property name="margin_end">12</property>
+ <property name="can-focus">False</property>
<property name="hexpand">True</property>
- <property name="row_spacing">0</property>
- <property name="column_spacing">6</property>
- <property name="row_homogeneous">True</property>
+ <property name="vexpand">True</property>
+ <property name="orientation">vertical</property>
+ <property name="margin-top">6</property>
+ <property name="spacing">6</property>
<child>
- <object class="GtkLabel" id="receiving_label">
+ <object class="GtkGrid" id="net_table">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Receiving</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="total_received_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Total Received</property>
+ <property name="can-focus">False</property>
+ <property name="margin-start">54</property>
+ <property name="margin-end">12</property>
+ <property name="hexpand">True</property>
+ <property name="row-spacing">0</property>
+ <property name="column-spacing">6</property>
+ <property name="row-homogeneous">True</property>
+ <child>
+ <object class="GtkLabel" id="receiving_label">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Receiving</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="total_received_label">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Total Received</property>
+ </object>
+ <packing>
+ <property name="left-attach">1</property>
+ <property name="top-attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="sending_label">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Sending</property>
+ </object>
+ <packing>
+ <property name="left-attach">5</property>
+ <property name="top-attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="total_sent_label">
+ <property name="visible">True</property>
+ <property name="can-focus">False</property>
+ <property name="hexpand">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">Total Sent</property>
+ </object>
+ <packing>
+ <property name="left-attach">5</property>
+ <property name="top-attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack-type">end</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="sending_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">Sending</property>
- </object>
- <packing>
- <property name="left_attach">5</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
+ <placeholder/>
</child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkBox" id="net_header">
+ <property name="visible">True</property>
+ <property name="margin-start">12</property>
+ <property name="can-focus">False</property>
<child>
- <object class="GtkLabel" id="total_sent_label">
+ <object class="GtkLabel" id="net_label">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">False</property>
+ <property name="can-focus">False</property>
<property name="halign">start</property>
- <property name="label" translatable="yes">Total Sent</property>
+ <property name="label" translatable="yes">Network</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
</object>
<packing>
- <property name="left_attach">5</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -464,32 +510,9 @@
<child>
<placeholder/>
</child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <placeholder/>
</child>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">5</property>
- </packing>
</child>
</object>
</child>
@@ -502,15 +525,14 @@
<child>
<object class="GtkBox" id="fs_box">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkScrolledWindow" id="disks_scrolled">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can-focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
- <property name="shadow_type">none</property>
<child>
<placeholder/>
</child>
@@ -531,7 +553,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="pack_type">end</property>
+ <property name="pack-type">end</property>
<property name="position">0</property>
</packing>
</child>
diff --git a/src/interface.cpp b/src/interface.cpp
index 17219ea2..8f25555d 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -196,6 +196,7 @@ static void
create_sys_view (GsmApplication *app, GtkBuilder * builder)
{
GtkBox *cpu_graph_box, *mem_graph_box, *net_graph_box;
+ GtkExpander *cpu_expander, *mem_expander, *net_expander;
GtkLabel *label,*cpu_label;
GtkGrid *table;
GsmColorButton *color_picker;
@@ -217,6 +218,8 @@ create_sys_view (GsmApplication *app, GtkBuilder * builder)
/* The CPU BOX */
cpu_graph_box = GTK_BOX (gtk_builder_get_object (builder, "cpu_graph_box"));
+ cpu_expander = GTK_EXPANDER (gtk_builder_get_object (builder, "cpu_expander"));
+ g_object_bind_property (cpu_expander, "expanded", cpu_expander, "vexpand", G_BINDING_DEFAULT);
cpu_graph = new LoadGraph(LOAD_GRAPH_CPU);
gtk_widget_set_size_request (GTK_WIDGET(load_graph_get_widget(cpu_graph)), -1, 70);
@@ -275,6 +278,8 @@ create_sys_view (GsmApplication *app, GtkBuilder * builder)
/** The memory box */
mem_graph_box = GTK_BOX (gtk_builder_get_object (builder, "mem_graph_box"));
+ mem_expander = GTK_EXPANDER (gtk_builder_get_object (builder, "mem_expander"));
+ g_object_bind_property (mem_expander, "expanded", mem_expander, "vexpand", G_BINDING_DEFAULT);
mem_graph = new LoadGraph(LOAD_GRAPH_MEM);
gtk_widget_set_size_request (GTK_WIDGET(load_graph_get_widget(mem_graph)), -1, 70);
@@ -315,6 +320,8 @@ create_sys_view (GsmApplication *app, GtkBuilder * builder)
/* The net box */
net_graph_box = GTK_BOX (gtk_builder_get_object (builder, "net_graph_box"));
+ net_expander = GTK_EXPANDER (gtk_builder_get_object (builder, "net_expander"));
+ g_object_bind_property (net_expander, "expanded", net_expander, "vexpand", G_BINDING_DEFAULT);
net_graph = new LoadGraph(LOAD_GRAPH_NET);
gtk_widget_set_size_request (GTK_WIDGET(load_graph_get_widget(net_graph)), -1, 70);
diff --git a/src/legacy/gsm_color_button.c b/src/legacy/gsm_color_button.c
index 81aebb7e..02a8ad32 100644
--- a/src/legacy/gsm_color_button.c
+++ b/src/legacy/gsm_color_button.c
@@ -235,8 +235,7 @@ gsm_color_button_draw (GtkWidget *widget, cairo_t * cr)
color->green = MIN (1.0, color->green + highlight_factor);
} else if (!sensitive) {
GtkStyleContext *context = gtk_widget_get_style_context (widget);
-
- gtk_style_context_get_color (context, GTK_STATE_FLAG_INSENSITIVE, color);
+ gtk_style_context_get_color (context, gtk_widget_get_state_flags (widget), color);
}
gdk_cairo_set_source_rgba (cr, color);
gdk_rgba_free(color);
diff --git a/src/load-graph.cpp b/src/load-graph.cpp
index 715be931..64a601d7 100644
--- a/src/load-graph.cpp
+++ b/src/load-graph.cpp
@@ -84,7 +84,7 @@ static void draw_background(LoadGraph *graph) {
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (GsmApplication::get()->stack));
- gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &fg);
+ gtk_style_context_get_color (context, gtk_widget_get_state_flags (GTK_WIDGET
(GsmApplication::get()->stack)), &fg);
cairo_paint_with_alpha (cr, 0.0);
layout = pango_cairo_create_layout (cr);
@@ -93,7 +93,7 @@ static void draw_background(LoadGraph *graph) {
pango_layout_set_attributes (layout, attrs);
g_clear_pointer (&attrs, pango_attr_list_unref);
- gtk_style_context_get (context, GTK_STATE_FLAG_NORMAL, GTK_STYLE_PROPERTY_FONT, &font_desc, NULL);
+ gtk_style_context_get (context, gtk_widget_get_state_flags (GTK_WIDGET (GsmApplication::get()->stack)),
GTK_STYLE_PROPERTY_FONT, &font_desc, NULL);
pango_font_description_set_size (font_desc, 0.8 * graph->fontsize * PANGO_SCALE);
pango_layout_set_font_description (layout, font_desc);
pango_font_description_free (font_desc);
@@ -120,7 +120,7 @@ static void draw_background(LoadGraph *graph) {
gtk_style_context_add_class (context, GTK_STYLE_CLASS_ENTRY);
/* And, as a bonus, the user can choose the color of the grid. */
- gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL, &fg_grid);
+ gtk_style_context_get_color (context, gtk_widget_get_state_flags (GTK_WIDGET
(GsmApplication::get()->stack)), &fg_grid);
/* Why not use the new features of the
* GTK instead of cairo_rectangle ?! :) */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]