Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Librem5
gnome-usage
Commits
92f7e665
Commit
92f7e665
authored
Oct 17, 2016
by
Petr Štětka
Browse files
Renamed sub views
Added graphStackSwitcher
parent
2c50a61e
Changes
12
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
92f7e665
...
...
@@ -9,6 +9,10 @@ enable_testing ()
option
(
ICON_UPDATE
"Update the icon cache after installing"
ON
)
option
(
BUILD_VALADOC
"Build API documentation if Valadoc is available"
OFF
)
if
(
NOT CMAKE_BUILD_TYPE
)
set
(
CMAKE_BUILD_TYPE Release
)
endif
()
include
(
GNUInstallDirs
)
if
(
(
${
CMAKE_INSTALL_PREFIX
}
MATCHES
"^/usr/local"
)
)
# A workaround to ensure that works 'out of the box' in Debian-based systems
...
...
@@ -41,6 +45,7 @@ set(MODULES_TO_CHECK ${MODULES_TO_CHECK} x11)
pkg_check_modules
(
DEPS REQUIRED
${
MODULES_TO_CHECK
}
)
add_subdirectory
(
po
)
add_subdirectory
(
data
)
add_subdirectory
(
src
)
...
...
cmake/ValaPrecompile.cmake
View file @
92f7e665
##
# Copyright 2009-2010 Jakob Westhoff. All rights reserved.
# Copyright 2012 elementary.
#
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
#
# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
...
...
@@ -22,7 +22,7 @@
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
#
# The views and conclusions contained in the software and documentation are those
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of Jakob Westhoff
...
...
@@ -32,30 +32,30 @@ include(ParseArguments)
find_package
(
Vala REQUIRED
)
##
# Compile vala files to their c equivalents for further processing.
# Compile vala files to their c equivalents for further processing.
#
# The "vala_precompile" macro takes care of calling the valac executable on the
# given source to produce c files which can then be processed further using
# default cmake functions.
#
#
# The first parameter provided is a variable, which will be filled with a list
# of c files outputted by the vala compiler. This list can than be used in
# conjuction with functions like "add_executable" or others to create the
# neccessary compile rules with CMake.
#
#
# The initial variable is followed by a list of .vala files to be compiled.
# Please take care to add every vala file belonging to the currently compiled
# project or library as Vala will otherwise not be able to resolve all
# dependencies.
#
#
# The following sections may be specified afterwards to provide certain options
# to the vala compiler:
#
#
# PACKAGES
# A list of vala packages/libraries to be used during the compile cycle. The
# package names are exactly the same, as they would be passed to the valac
# "--pkg=" option.
#
#
# OPTIONS
# A list of optional options to be passed to the valac executable. This can be
# used to pass "--thread" for example to enable multi-threading support.
...
...
@@ -69,7 +69,7 @@ find_package(Vala REQUIRED)
# Pass all the needed flags to the compiler to create an internal vapi for
# the compiled library. The provided name will be used for this and a
# <provided_name>.vapi file will be created.
#
#
# GENERATE_HEADER
# Let the compiler generate a header file for the compiled code. There will
# be a header file as well as an internal header file being generated called
...
...
@@ -82,7 +82,7 @@ find_package(Vala REQUIRED)
#
# GENERATE_SYMBOLS
# Output a <provided_name>.symbols file containing all the exported symbols.
#
#
# The following call is a simple example to the vala_precompile macro showing
# an example to every of the optional sections:
#
...
...
@@ -197,7 +197,7 @@ macro(vala_precompile output target_name)
list
(
APPEND out_files_display
"
${
ARGS_GENERATE_SYMBOLS
}
.symbols"
)
set
(
symbols_arguments
"--symbols=
${
ARGS_GENERATE_SYMBOLS
}
.symbols"
)
endif
(
ARGS_GENERATE_SYMBOLS
)
set
(
os_defines
""
)
if
(
WIN32
)
list
(
APPEND os_defines
"-D"
"
\"
G_OS_WIN32
\"
"
)
...
...
@@ -211,27 +211,27 @@ macro(vala_precompile output target_name)
add_custom_command
(
OUTPUT
${
OUTPUT_STAMP
}
COMMAND
${
VALA_EXECUTABLE
}
ARGS
"-C"
${
header_arguments
}
${
vapi_arguments
}
${
gir_arguments
}
${
symbols_arguments
}
"-b"
${
CMAKE_CURRENT_SOURCE_DIR
}
"-d"
${
DIRECTORY
}
${
os_defines
}
${
vala_pkg_opts
}
${
ARGS_OPTIONS
}
${
in_files
}
COMMAND
${
VALA_EXECUTABLE
}
ARGS
"-C"
${
header_arguments
}
${
vapi_arguments
}
${
gir_arguments
}
${
symbols_arguments
}
"-b"
${
CMAKE_CURRENT_SOURCE_DIR
}
"-d"
${
DIRECTORY
}
${
os_defines
}
${
vala_pkg_opts
}
${
ARGS_OPTIONS
}
${
in_files
}
${
custom_vapi_arguments
}
COMMAND
touch
ARGS
${
OUTPUT_STAMP
}
DEPENDS
${
in_files
}
DEPENDS
${
in_files
}
${
ARGS_CUSTOM_VAPIS
}
COMMENT
"Generating
${
out_files_display
}
"
...
...
gnome-usage.avprj
View file @
92f7e665
### AutoVala Project ###
autovala_version: 2
1
autovala_version: 2
3
project_name: gnome-usage
*vala_version: 0.32
...
...
@@ -26,12 +26,15 @@ c_library: gtop-2.0 ${CMAKE_SOURCE_DIR}/external/rg/librg.a ${CMAKE_SOURCE_DIR}/
*vala_source: cpu-graph.vala
*vala_source: cpu-sub-view.vala
*vala_source: data-view.vala
*vala_source: disk-sub-view.vala
*vala_source: gnome-usage.vala
*vala_source: graph-stack-switcher.vala
*vala_source: header-bar.vala
*vala_source: memory-sub-view.vala
*vala_source: network-sub-view.vala
*vala_source: performance-view.vala
*vala_source: power-view.vala
*vala_source: process-list.vala
*vala_source: ram-sub-view.vala
*vala_source: storage-view.vala
*vala_source: system-monitor.vala
*vala_source: view.vala
...
...
@@ -43,19 +46,22 @@ h_folder: /usr/include/libgtop-2.0
*po: po
*translate: vala src/cpu-graph.vala
*translate: vala src/system-monitor.vala
*translate: vala src/memory-sub-view.vala
*translate: vala src/performance-view.vala
*translate: vala src/header-bar.vala
*translate: vala src/disk-sub-view.vala
*translate: vala src/network-sub-view.vala
*translate: vala src/graph-stack-switcher.vala
*translate: vala src/cpu-sub-view.vala
*translate: vala src/view.vala
*translate: vala src/storage-view.vala
*translate: vala src/power-view.vala
*translate: vala src/process-list.vala
*translate: vala src/ram-sub-view.vala
*translate: vala src/application.vala
*translate: vala src/data-view.vala
*translate: vala src/cpu-graph-table.vala
*translate: vala src/performance-view.vala
*translate: vala src/window.vala
*translate: vala src/system-monitor.vala
*translate: vala src/cpu-sub-view.vala
*translate: vala src/gnome-usage.vala
*data: data/local
...
...
po/POTFILES.in
View file @
92f7e665
...
...
@@ -3,12 +3,15 @@ src/cpu-graph-table.vala
src/cpu-graph.vala
src/cpu-sub-view.vala
src/data-view.vala
src/disk-sub-view.vala
src/gnome-usage.vala
src/graph-stack-switcher.vala
src/header-bar.vala
src/memory-sub-view.vala
src/network-sub-view.vala
src/performance-view.vala
src/power-view.vala
src/process-list.vala
src/ram-sub-view.vala
src/storage-view.vala
src/system-monitor.vala
src/view.vala
...
...
src/CMakeLists.txt
View file @
92f7e665
...
...
@@ -40,12 +40,15 @@ set (APP_SOURCES ${APP_SOURCES} cpu-graph-table.vala)
set
(
APP_SOURCES
${
APP_SOURCES
}
cpu-graph.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
cpu-sub-view.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
data-view.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
disk-sub-view.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
gnome-usage.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
graph-stack-switcher.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
header-bar.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
memory-sub-view.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
network-sub-view.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
performance-view.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
power-view.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
process-list.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
ram-sub-view.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
storage-view.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
system-monitor.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
view.vala
)
...
...
@@ -55,6 +58,11 @@ set (CUSTOM_VAPIS_LIST ${CUSTOM_VAPIS_LIST} ${CMAKE_SOURCE_DIR}/src/vapis/egg-pr
set
(
CUSTOM_VAPIS_LIST
${
CUSTOM_VAPIS_LIST
}
${
CMAKE_SOURCE_DIR
}
/src/vapis/glibtop.vapi
)
set
(
CUSTOM_VAPIS_LIST
${
CUSTOM_VAPIS_LIST
}
${
CMAKE_SOURCE_DIR
}
/src/vapis/rg.vapi
)
if
((
${
CMAKE_BUILD_TYPE
}
STREQUAL
"Debug"
)
OR
(
${
CMAKE_BUILD_TYPE
}
STREQUAL
"RelWithDebInfo"
))
set
(
COMPILE_OPTIONS
${
COMPILE_OPTIONS
}
"-g"
)
endif
()
include_directories
(
AFTER ../external/egg
)
include_directories
(
AFTER ../external/rg
)
include_directories
(
AFTER /usr/include/libgtop-2.0
)
...
...
src/cpu-sub-view.vala
View file @
92f7e665
...
...
@@ -2,16 +2,16 @@ using Rg;
namespace
Usage
{
public
class
CPU
SubView
:
View
public
class
Processor
SubView
:
View
{
ProcessList
process_list_box
;
Gtk
.
Label
cpu_load_label
;
List
<
ProcessRow
>
process_row_list
;
bool
show_active_process
=
true
;
public
CPU
SubView
()
public
Processor
SubView
()
{
name
=
"
CPU
"
;
name
=
"
PROCESSOR
"
;
const
int
margin_side
=
50
;
cpu_load_label
=
new
Gtk
.
Label
(
null
);
...
...
src/
ram
-sub-view.vala
→
src/
disk
-sub-view.vala
View file @
92f7e665
namespace
Usage
{
public
class
RAM
SubView
:
View
public
class
Disk
SubView
:
View
{
ProcessList
process_list_box
;
Gtk
.
Label
cpu_load_label
;
List
<
ProcessRow
>
process_row_list
;
bool
show_active_process
=
true
;
public
RAM
SubView
()
public
Disk
SubView
()
{
name
=
"
RAM
"
;
name
=
"
DISK
"
;
cpu_load_label
=
new
Gtk
.
Label
(
null
);
cpu_load_label
.
margin_right
=
100
;
var
processor_label
=
new
Gtk
.
Label
(
"<b>"
+
_
(
"
Processor
"
)
+
"</b>"
);
var
processor_label
=
new
Gtk
.
Label
(
"<b>"
+
_
(
"
Disk I/O
"
)
+
"</b>"
);
processor_label
.
set_use_markup
(
true
);
var
processor_text_box
=
new
Gtk
.
Box
(
Gtk
.
Orientation
.
HORIZONTAL
,
0
);
processor_text_box
.
set_center_widget
(
processor_label
);
...
...
src/graph-stack-switcher.vala
0 → 100644
View file @
92f7e665
namespace
Usage
{
public
class
GraphStackSwitcher
:
Gtk
.
Box
{
Gtk
.
Stack
stack
;
View
[]
sub_views
;
Gtk
.
ToggleButton
cpu_button
;
Gtk
.
ToggleButton
memory_button
;
Gtk
.
ToggleButton
disk_button
;
Gtk
.
ToggleButton
network_button
;
bool
can_change
=
true
;
public
GraphStackSwitcher
(
Gtk
.
Stack
stack
,
View
[]
sub_views
)
{
Object
(
orientation
:
Gtk
.
Orientation
.
VERTICAL
,
spacing
:
0
);
this
.
stack
=
stack
;
this
.
sub_views
=
sub_views
;
cpu_button
=
new
Gtk
.
ToggleButton
.
with_label
(
"Processor"
);
cpu_button
.
relief
=
Gtk
.
ReliefStyle
.
NONE
;
memory_button
=
new
Gtk
.
ToggleButton
.
with_label
(
"Memory"
);
memory_button
.
relief
=
Gtk
.
ReliefStyle
.
NONE
;
disk_button
=
new
Gtk
.
ToggleButton
.
with_label
(
"Disk I/O"
);
disk_button
.
relief
=
Gtk
.
ReliefStyle
.
NONE
;
network_button
=
new
Gtk
.
ToggleButton
.
with_label
(
"Network"
);
network_button
.
relief
=
Gtk
.
ReliefStyle
.
NONE
;
this
.
pack_start
(
cpu_button
,
false
,
true
,
0
);
this
.
pack_start
(
memory_button
,
false
,
true
,
0
);
this
.
pack_start
(
disk_button
,
false
,
true
,
0
);
this
.
pack_start
(
network_button
,
false
,
true
,
0
);
cpu_button
.
set_active
(
true
);
cpu_button
.
clicked
.
connect
(()
=>
{
if
(
can_change
)
{
if
(
cpu_button
.
active
)
{
can_change
=
false
;
memory_button
.
active
=
false
;
disk_button
.
active
=
false
;
network_button
.
active
=
false
;
this
.
stack
.
set_visible_child_name
(
this
.
sub_views
[
0
].
name
);
((
View
)
this
.
stack
.
get_visible_child
()).
update_header_bar
();
can_change
=
true
;
}
else
{
can_change
=
false
;
cpu_button
.
active
=
true
;
can_change
=
true
;
}
}
});
memory_button
.
clicked
.
connect
(()
=>
{
if
(
can_change
)
{
if
(
memory_button
.
active
)
{
can_change
=
false
;
cpu_button
.
active
=
false
;
disk_button
.
active
=
false
;
network_button
.
active
=
false
;
this
.
stack
.
set_visible_child_name
(
this
.
sub_views
[
1
].
name
);
((
View
)
this
.
stack
.
get_visible_child
()).
update_header_bar
();
can_change
=
true
;
}
else
{
can_change
=
false
;
memory_button
.
active
=
true
;
can_change
=
true
;
}
}
});
disk_button
.
clicked
.
connect
(()
=>
{
if
(
can_change
)
{
if
(
disk_button
.
active
)
{
can_change
=
false
;
cpu_button
.
active
=
false
;
memory_button
.
active
=
false
;
network_button
.
active
=
false
;
this
.
stack
.
set_visible_child_name
(
this
.
sub_views
[
2
].
name
);
((
View
)
this
.
stack
.
get_visible_child
()).
update_header_bar
();
can_change
=
true
;
}
else
{
can_change
=
false
;
disk_button
.
active
=
true
;
can_change
=
true
;
}
}
});
network_button
.
clicked
.
connect
(()
=>
{
if
(
can_change
)
{
if
(
network_button
.
active
)
{
can_change
=
false
;
cpu_button
.
active
=
false
;
memory_button
.
active
=
false
;
disk_button
.
active
=
false
;
this
.
stack
.
set_visible_child_name
(
this
.
sub_views
[
3
].
name
);
((
View
)
this
.
stack
.
get_visible_child
()).
update_header_bar
();
can_change
=
true
;
}
else
{
can_change
=
false
;
network_button
.
active
=
true
;
can_change
=
true
;
}
}
});
}
}
}
src/memory-sub-view.vala
0 → 100644
View file @
92f7e665
namespace
Usage
{
public
class
MemorySubView
:
View
{
ProcessList
process_list_box
;
Gtk
.
Label
cpu_load_label
;
List
<
ProcessRow
>
process_row_list
;
bool
show_active_process
=
true
;
public
MemorySubView
()
{
name
=
"MEMORY"
;
cpu_load_label
=
new
Gtk
.
Label
(
null
);
cpu_load_label
.
margin_right
=
100
;
var
processor_label
=
new
Gtk
.
Label
(
"<b>"
+
_
(
"Memory"
)
+
"</b>"
);
processor_label
.
set_use_markup
(
true
);
var
processor_text_box
=
new
Gtk
.
Box
(
Gtk
.
Orientation
.
HORIZONTAL
,
0
);
processor_text_box
.
set_center_widget
(
processor_label
);
processor_text_box
.
pack_end
(
cpu_load_label
,
false
,
true
,
0
);
processor_text_box
.
margin_top
=
20
;
process_list_box
=
new
ProcessList
();
var
cpu_box
=
new
Gtk
.
Box
(
Gtk
.
Orientation
.
VERTICAL
,
0
);
var
process_list_box_frame
=
new
Gtk
.
Frame
(
null
);
process_list_box_frame
.
margin_start
=
100
;
process_list_box_frame
.
margin_end
=
100
;
process_list_box_frame
.
margin_bottom
=
20
;
process_list_box_frame
.
add
(
process_list_box
);
cpu_box
.
pack_start
(
processor_text_box
,
false
,
false
,
0
);
cpu_box
.
pack_start
(
process_list_box_frame
,
true
,
false
,
0
);
var
scrolled_window
=
new
Gtk
.
ScrolledWindow
(
null
,
null
);
scrolled_window
.
add
(
cpu_box
);
scrolled_window
.
set_policy
(
Gtk
.
PolicyType
.
AUTOMATIC
,
Gtk
.
PolicyType
.
AUTOMATIC
);
//construct_menu_button();
add
(
scrolled_window
);
Timeout
.
add
(
1000
,
update_process
);
}
public
bool
update_process
()
{
process_list_box
.
foreach
((
widget
)
=>
{
widget
.
destroy
();
});
cpu_load_label
.
set_text
(((
int
)
monitor
.
cpu_load
).
to_string
()
+
" %"
);
process_row_list
=
new
List
<
ProcessRow
>();
foreach
(
unowned
Process
process
in
monitor
.
get_processes
())
{
if
(
show_active_process
)
{
if
((
int
)
process
.
cpu_load
>
0
)
insert_process_row
(
process
);
}
else
insert_process_row
(
process
);
}
for
(
int
i
=
0
;
i
<
process_row_list
.
length
();
i
++)
{
process_list_box
.
add
(
process_row_list
.
data
);
process_row_list
=(
owned
)
process_row_list
.
next
;
}
return
true
;
}
public
void
insert_process_row
(
Process
process
)
{
var
process_row
=
new
ProcessRow
(
process
.
cmdline
,(
int
)
process
.
cpu_load
);
process_row
.
sort_id
=(
int
)(
10
*
process
.
cpu_load
);
process_row_list
.
insert_sorted
(
process_row
,(
a
,
b
)
=>
{
return
(
b
as
ProcessRow
).
sort_id
-(
a
as
ProcessRow
).
sort_id
;
});
}
private
void
construct_menu_button
()
{
var
popover_box
=
new
Gtk
.
Box
(
Gtk
.
Orientation
.
VERTICAL
,
0
);
popover_box
.
margin
=
5
;
var
active
=
new
Gtk
.
RadioButton
.
with_label_from_widget
(
null
,
_
(
"Active process"
));
popover_box
.
pack_start
(
active
,
false
,
false
,
0
);
active
.
toggled
.
connect
(()
=>
{
monitor
.
set_process_mode
(
SystemMonitor
.
ProcessMode
.
ALL
);
show_active_process
=
true
;
update_process
();
});
var
all
=
new
Gtk
.
RadioButton
.
with_label_from_widget
(
active
,
_
(
"All process"
));
popover_box
.
pack_start
(
all
,
false
,
false
,
0
);
all
.
toggled
.
connect
(()
=>
{
show_active_process
=
false
;
monitor
.
set_process_mode
(
SystemMonitor
.
ProcessMode
.
ALL
);
monitor
.
update_data
();
update_process
();
});
var
my
=
new
Gtk
.
RadioButton
.
with_label_from_widget
(
active
,
_
(
"My process"
));
popover_box
.
pack_start
(
my
,
false
,
false
,
0
);
my
.
toggled
.
connect
(()
=>
{
show_active_process
=
false
;
monitor
.
set_process_mode
(
SystemMonitor
.
ProcessMode
.
USER
);
monitor
.
update_data
();
update_process
();
});
popover_box
.
show_all
();
header_bar
.
set_menu_button
(
popover_box
);
}
public
override
void
update_header_bar
()
{
header_bar
.
clear
();
//headerBar.showMenuButton();
header_bar
.
show_stack_switcher
();
}
}
}
src/network-sub-view.vala
0 → 100644
View file @
92f7e665
namespace
Usage
{
public
class
NetworkSubView
:
View
{
ProcessList
process_list_box
;
Gtk
.
Label
cpu_load_label
;
List
<
ProcessRow
>
process_row_list
;
bool
show_active_process
=
true
;
public
NetworkSubView
()
{
name
=
"NETWORK"
;
cpu_load_label
=
new
Gtk
.
Label
(
null
);
cpu_load_label
.
margin_right
=
100
;
var
processor_label
=
new
Gtk
.
Label
(
"<b>"
+
_
(
"Network"
)
+
"</b>"
);
processor_label
.
set_use_markup
(
true
);
var
processor_text_box
=
new
Gtk
.
Box
(
Gtk
.
Orientation
.
HORIZONTAL
,
0
);
processor_text_box
.
set_center_widget
(
processor_label
);
processor_text_box
.
pack_end
(
cpu_load_label
,
false
,
true
,
0
);
processor_text_box
.
margin_top
=
20
;
process_list_box
=
new
ProcessList
();
var
cpu_box
=
new
Gtk
.
Box
(
Gtk
.
Orientation
.
VERTICAL
,
0
);
var
process_list_box_frame
=
new
Gtk
.
Frame
(
null
);
process_list_box_frame
.
margin_start
=
100
;
process_list_box_frame
.
margin_end
=
100
;
process_list_box_frame
.
margin_bottom
=
20
;
process_list_box_frame
.
add
(
process_list_box
);
cpu_box
.
pack_start
(
processor_text_box
,
false
,
false
,
0
);
cpu_box
.
pack_start
(
process_list_box_frame
,
true
,
false
,
0
);
var
scrolled_window
=
new
Gtk
.
ScrolledWindow
(
null
,
null
);
scrolled_window
.
add
(
cpu_box
);
scrolled_window
.
set_policy
(
Gtk
.
PolicyType
.
AUTOMATIC
,
Gtk
.
PolicyType
.
AUTOMATIC
);
//construct_menu_button();
add
(
scrolled_window
);
Timeout
.
add
(
1000
,
update_process
);
}
public
bool
update_process
()
{
process_list_box
.
foreach
((
widget
)
=>
{
widget
.
destroy
();
});
cpu_load_label
.
set_text
(((
int
)
monitor
.
cpu_load
).
to_string
()
+
" %"
);
process_row_list
=
new
List
<
ProcessRow
>();
foreach
(
unowned
Process
process
in
monitor
.
get_processes
())
{
if
(
show_active_process
)
{
if
((
int
)
process
.
cpu_load
>
0
)
insert_process_row
(
process
);
}
else
insert_process_row
(
process
);
}
for
(
int
i
=
0
;
i
<
process_row_list
.
length
();
i
++)
{
process_list_box
.
add
(
process_row_list
.
data
);
process_row_list
=(
owned
)
process_row_list
.
next
;
}