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
eb416e12
Commit
eb416e12
authored
Oct 06, 2016
by
Petr Štětka
Browse files
*respect naming conventions in vala
parent
214d5d7b
Changes
16
Hide whitespace changes
Inline
Side-by-side
gnome-usage.avprj
View file @
eb416e12
...
...
@@ -20,14 +20,14 @@ vala_binary: src/gnome-usage
*vala_check_package: x11
c_library: gtop-2.0
*vala_source: application.vala
*vala_source: cpu-subview.vala
*vala_source: cpu-sub
-
view.vala
*vala_source: data-view.vala
*vala_source: gnome-usage.vala
*vala_source: headerbar.vala
*vala_source: header
-
bar.vala
*vala_source: performance-view.vala
*vala_source: power-view.vala
*vala_source: process-list.vala
*vala_source: ram-subview.vala
*vala_source: ram-sub
-
view.vala
*vala_source: storage-view.vala
*vala_source: system-monitor.vala
*vala_source: view.vala
...
...
@@ -36,19 +36,19 @@ h_folder: /usr/include/libgtop-2.0
*po: po
*translate: vala src/header-bar.vala
*translate: vala src/performance-view.vala
*translate: vala src/view.vala
*translate: vala src/gnome-usage.vala
*translate: vala src/process-list.vala
*translate: vala src/storage-view.vala
*translate: vala src/cpu-subview.vala
*translate: vala src/data-view.vala
*translate: vala src/power-view.vala
*translate: vala src/system-monitor.vala
*translate: vala src/headerbar.vala
*translate: vala src/power-view.vala
*translate: vala src/cpu-sub-view.vala
*translate: vala src/process-list.vala
*translate: vala src/ram-sub-view.vala
*translate: vala src/data-view.vala
*translate: vala src/application.vala
*translate: vala src/window.vala
*translate: vala src/performance-view.vala
*translate: vala src/ram-subview.vala
*data: data/local
...
...
po/POTFILES.in
View file @
eb416e12
src/application.vala
src/cpu-subview.vala
src/cpu-sub
-
view.vala
src/data-view.vala
src/gnome-usage.vala
src/headerbar.vala
src/header
-
bar.vala
src/performance-view.vala
src/power-view.vala
src/process-list.vala
src/ram-subview.vala
src/ram-sub
-
view.vala
src/storage-view.vala
src/system-monitor.vala
src/view.vala
...
...
src/CMakeLists.txt
View file @
eb416e12
...
...
@@ -36,14 +36,14 @@ set (VALA_PACKAGES ${VALA_PACKAGES} x11)
set
(
APP_SOURCES
${
APP_SOURCES
}
${
CMAKE_CURRENT_BINARY_DIR
}
/Config.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
application.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
cpu-subview.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
cpu-sub
-
view.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
data-view.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
gnome-usage.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
headerbar.vala
)
set
(
APP_SOURCES
${
APP_SOURCES
}
header
-
bar.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-subview.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
)
...
...
src/cpu-sub-view.vala
0 → 100644
View file @
eb416e12
namespace
Usage
{
public
class
CPUSubView
:
View
{
ProcessList
process_list_box
;
Gtk
.
Label
cpu_load_label
;
List
<
ProcessRow
>
process_row_list
;
bool
show_active_process
=
true
;
public
CPUSubView
()
{
name
=
"CPU"
;
cpu_load_label
=
new
Gtk
.
Label
(
null
);
cpu_load_label
.
margin_right
=
100
;
var
processor_label
=
new
Gtk
.
Label
(
"<b>"
+
_
(
"Processor"
)
+
"</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
();
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
();
update_process
();
});
popover_box
.
show_all
();
header_bar
.
set_menu_button
(
popover_box
);
}
public
override
void
update_header_bar
()
{
header_bar
.
clear
();
header_bar
.
show_menu_button
();
header_bar
.
show_stack_switcher
();
}
}
}
src/cpu-subview.vala
deleted
100644 → 0
View file @
214d5d7b
namespace
Usage
{
public
class
CPUsubView
:
View
{
ProcessList
processListBox
;
Gtk
.
Label
CPULoadLabel
;
List
<
ProcessRow
>
processRowList
;
bool
showActiveProcess
=
true
;
public
CPUsubView
()
{
name
=
(
"CPU"
);
CPULoadLabel
=
new
Gtk
.
Label
(
null
);
CPULoadLabel
.
margin_right
=
100
;
var
processorLabel
=
new
Gtk
.
Label
(
"<b>"
+
_
(
"Processor"
)
+
"</b>"
);
processorLabel
.
set_use_markup
(
true
);
var
processorTextBox
=
new
Gtk
.
Box
(
Gtk
.
Orientation
.
HORIZONTAL
,
0
);
processorTextBox
.
set_center_widget
(
processorLabel
);
processorTextBox
.
pack_end
(
CPULoadLabel
,
false
,
true
,
0
);
processorTextBox
.
margin_top
=
20
;
processListBox
=
new
ProcessList
();
var
CPUBox
=
new
Gtk
.
Box
(
Gtk
.
Orientation
.
VERTICAL
,
0
);
var
processListBoxFrame
=
new
Gtk
.
Frame
(
null
);
processListBoxFrame
.
margin_start
=
100
;
processListBoxFrame
.
margin_end
=
100
;
processListBoxFrame
.
margin_bottom
=
20
;
processListBoxFrame
.
add
(
processListBox
);
CPUBox
.
pack_start
(
processorTextBox
,
false
,
false
,
0
);
CPUBox
.
pack_start
(
processListBoxFrame
,
true
,
false
,
0
);
var
scrolledWindowCPU
=
new
Gtk
.
ScrolledWindow
(
null
,
null
);
scrolledWindowCPU
.
add
(
CPUBox
);
scrolledWindowCPU
.
set_policy
(
Gtk
.
PolicyType
.
AUTOMATIC
,
Gtk
.
PolicyType
.
AUTOMATIC
);
constructMenuButton
();
add
(
scrolledWindowCPU
);
Timeout
.
add
(
1000
,
updateProcess
);
}
public
bool
updateProcess
()
{
processListBox
.
foreach
((
widget
)
=>
{
widget
.
destroy
();
});
CPULoadLabel
.
set_text
(((
int
)
monitor
.
cpu_load
).
to_string
()
+
" %"
);
processRowList
=
new
List
<
ProcessRow
>();
foreach
(
unowned
Process
process
in
monitor
.
get_processes
())
{
if
(
showActiveProcess
)
{
if
((
int
)
process
.
cpu_load
>
0
)
insertProcessRow
(
process
);
}
else
insertProcessRow
(
process
);
}
for
(
int
i
=
0
;
i
<
processRowList
.
length
();
i
++)
{
processListBox
.
add
(
processRowList
.
data
);
processRowList
=(
owned
)
processRowList
.
next
;
}
return
true
;
}
public
void
insertProcessRow
(
Process
process
)
{
var
processRow
=
new
ProcessRow
(
process
.
cmdline
,(
int
)
process
.
cpu_load
);
processRow
.
sortId
=(
int
)(
10
*
process
.
cpu_load
);
processRowList
.
insert_sorted
(
processRow
,(
a
,
b
)
=>
{
return
(
b
as
ProcessRow
).
sortId
-(
a
as
ProcessRow
).
sortId
;
});
}
private
void
constructMenuButton
()
{
var
popoverBox
=
new
Gtk
.
Box
(
Gtk
.
Orientation
.
VERTICAL
,
0
);
popoverBox
.
margin
=
5
;
var
active
=
new
Gtk
.
RadioButton
.
with_label_from_widget
(
null
,
_
(
"Active process"
));
popoverBox
.
pack_start
(
active
,
false
,
false
,
0
);
active
.
toggled
.
connect
(()
=>
{
monitor
.
setProcessMode
(
SystemMonitor
.
ProcessMode
.
ALL
);
showActiveProcess
=
true
;
updateProcess
();
});
var
all
=
new
Gtk
.
RadioButton
.
with_label_from_widget
(
active
,
_
(
"All process"
));
popoverBox
.
pack_start
(
all
,
false
,
false
,
0
);
all
.
toggled
.
connect
(()
=>
{
showActiveProcess
=
false
;
monitor
.
setProcessMode
(
SystemMonitor
.
ProcessMode
.
ALL
);
monitor
.
update
();
updateProcess
();
});
var
my
=
new
Gtk
.
RadioButton
.
with_label_from_widget
(
active
,
_
(
"My process"
));
popoverBox
.
pack_start
(
my
,
false
,
false
,
0
);
my
.
toggled
.
connect
(()
=>
{
showActiveProcess
=
false
;
monitor
.
setProcessMode
(
SystemMonitor
.
ProcessMode
.
USER
);
monitor
.
update
();
updateProcess
();
});
popoverBox
.
show_all
();
headerBar
.
setMenuButton
(
popoverBox
);
}
public
override
void
updateHeaderBar
()
{
headerBar
.
clear
();
headerBar
.
showMenuButton
();
headerBar
.
showStackSwitcher
();
}
}
}
src/data-view.vala
View file @
eb416e12
...
...
@@ -7,14 +7,14 @@ namespace Usage
name
=
(
"DATA"
);
title
=
_
(
"Data"
);
var
label
1
=
new
Gtk
.
Label
(
"Page Data Content."
);
add
(
label
1
);
var
label
=
new
Gtk
.
Label
(
"Page Data Content."
);
add
(
label
);
}
public
override
void
update
H
eader
B
ar
()
public
override
void
update
_h
eader
_b
ar
()
{
header
B
ar
.
clear
();
header
B
ar
.
show
S
tack
S
witcher
();
header
_b
ar
.
clear
();
header
_b
ar
.
show
_s
tack
_s
witcher
();
}
}
}
src/headerbar.vala
→
src/header
-
bar.vala
View file @
eb416e12
...
...
@@ -2,39 +2,39 @@ namespace Usage
{
public
class
HeaderBar
:
Gtk
.
HeaderBar
{
private
Gtk
.
StackSwitcher
stack
S
witcher
;
private
Gtk
.
MenuButton
menu
B
utton
;
private
Gtk
.
StackSwitcher
stack
_s
witcher
;
private
Gtk
.
MenuButton
menu
_b
utton
;
public
HeaderBar
(
Gtk
.
Stack
stack
)
{
show_close_button
=
true
;
stack
S
witcher
=
new
Gtk
.
StackSwitcher
();
stack
S
witcher
.
halign
=
Gtk
.
Align
.
CENTER
;
stack
S
witcher
.
set_stack
(
stack
);
menu
B
utton
=
new
Gtk
.
MenuButton
();
menu
B
utton
.
add
(
new
Gtk
.
Image
.
from_icon_name
(
"open-menu-symbolic"
,
Gtk
.
IconSize
.
BUTTON
));
stack
_s
witcher
=
new
Gtk
.
StackSwitcher
();
stack
_s
witcher
.
halign
=
Gtk
.
Align
.
CENTER
;
stack
_s
witcher
.
set_stack
(
stack
);
menu
_b
utton
=
new
Gtk
.
MenuButton
();
menu
_b
utton
.
add
(
new
Gtk
.
Image
.
from_icon_name
(
"open-menu-symbolic"
,
Gtk
.
IconSize
.
BUTTON
));
}
public
void
set
M
enu
B
utton
(
Gtk
.
Box
?
popover
B
ox
)
public
void
set
_m
enu
_b
utton
(
Gtk
.
Box
?
popover
_b
ox
)
{
var
popover
=
new
Gtk
.
Popover
(
menu
B
utton
);
popover
.
add
(
popover
B
ox
);
menu
B
utton
.
popover
=
popover
;
var
popover
=
new
Gtk
.
Popover
(
menu
_b
utton
);
popover
.
add
(
popover
_b
ox
);
menu
_b
utton
.
popover
=
popover
;
}
public
void
show
M
enu
B
utton
()
public
void
show
_m
enu
_b
utton
()
{
pack_end
(
menu
B
utton
);
pack_end
(
menu
_b
utton
);
}
public
void
hide
M
enu
B
utton
()
public
void
hide
_m
enu
_b
utton
()
{
remove
(
menu
B
utton
);
remove
(
menu
_b
utton
);
}
public
void
show
S
tack
S
witcher
()
public
void
show
_s
tack
_s
witcher
()
{
set_custom_title
(
stack
S
witcher
);
set_custom_title
(
stack
_s
witcher
);
}
public
void
clear
()
...
...
src/performance-view.vala
View file @
eb416e12
...
...
@@ -2,64 +2,64 @@ namespace Usage
{
public
class
PerformanceView
:
View
{
Gtk
.
Stack
performance
S
tack
;
Gtk
.
Stack
performance
_s
tack
;
public
PerformanceView
()
{
name
=
"PERFORMANCE"
;
title
=
_
(
"Performance"
);
var
CPUB
utton
=
new
Gtk
.
Button
.
with_label
(
"Processor"
);
var
memory
B
utton
=
new
Gtk
.
Button
.
with_label
(
"Memory"
);
var
disk
B
utton
=
new
Gtk
.
Button
.
with_label
(
"Disk I/O"
);
var
network
B
utton
=
new
Gtk
.
Button
.
with_label
(
"Network"
);
var
panel
B
ox
=
new
Gtk
.
Box
(
Gtk
.
Orientation
.
VERTICAL
,
0
);
var
cpu_b
utton
=
new
Gtk
.
Button
.
with_label
(
"Processor"
);
var
memory
_b
utton
=
new
Gtk
.
Button
.
with_label
(
"Memory"
);
var
disk
_b
utton
=
new
Gtk
.
Button
.
with_label
(
"Disk I/O"
);
var
network
_b
utton
=
new
Gtk
.
Button
.
with_label
(
"Network"
);
var
panel
_b
ox
=
new
Gtk
.
Box
(
Gtk
.
Orientation
.
VERTICAL
,
0
);
panel
B
ox
.
pack_start
(
CPUB
utton
,
false
,
true
,
0
);
panel
B
ox
.
pack_start
(
memory
B
utton
,
false
,
true
,
0
);
panel
B
ox
.
pack_start
(
disk
B
utton
,
false
,
true
,
0
);
panel
B
ox
.
pack_start
(
network
B
utton
,
false
,
true
,
0
);
panel
_b
ox
.
pack_start
(
cpu_b
utton
,
false
,
true
,
0
);
panel
_b
ox
.
pack_start
(
memory
_b
utton
,
false
,
true
,
0
);
panel
_b
ox
.
pack_start
(
disk
_b
utton
,
false
,
true
,
0
);
panel
_b
ox
.
pack_start
(
network
_b
utton
,
false
,
true
,
0
);
performance
S
tack
=
new
Gtk
.
Stack
();
performance
S
tack
.
set_transition_type
(
Gtk
.
StackTransitionType
.
SLIDE_UP_DOWN
);
performance
S
tack
.
set_transition_duration
(
700
);
performance
_s
tack
=
new
Gtk
.
Stack
();
performance
_s
tack
.
set_transition_type
(
Gtk
.
StackTransitionType
.
SLIDE_UP_DOWN
);
performance
_s
tack
.
set_transition_duration
(
700
);
var
sub
V
iews
=
new
View
[]
var
sub
_v
iews
=
new
View
[]
{
new
CPU
s
ubView
(),
new
RAM
s
ubView
()
new
CPU
S
ubView
(),
new
RAM
S
ubView
()
};
foreach
(
var
sub
V
iew
in
sub
V
iews
)
performance
S
tack
.
add_named
(
sub
V
iew
,
sub
V
iew
.
name
);
foreach
(
var
sub
_v
iew
in
sub
_v
iews
)
performance
_s
tack
.
add_named
(
sub
_v
iew
,
sub
_v
iew
.
name
);
CPUB
utton
.
clicked
.
connect
(()
=>
{
performance
S
tack
.
set_visible_child_name
(
sub
V
iews
[
0
].
name
);
((
View
)
performance
S
tack
.
get_visible_child
()).
update
H
eader
B
ar
();
cpu_b
utton
.
clicked
.
connect
(()
=>
{
performance
_s
tack
.
set_visible_child_name
(
sub
_v
iews
[
0
].
name
);
((
View
)
performance
_s
tack
.
get_visible_child
()).
update
_h
eader
_b
ar
();
});
memory
B
utton
.
clicked
.
connect
(()
=>
{
performance
S
tack
.
set_visible_child_name
(
sub
V
iews
[
1
].
name
);
((
View
)
performance
S
tack
.
get_visible_child
()).
update
H
eader
B
ar
();
memory
_b
utton
.
clicked
.
connect
(()
=>
{
performance
_s
tack
.
set_visible_child_name
(
sub
_v
iews
[
1
].
name
);
((
View
)
performance
_s
tack
.
get_visible_child
()).
update
_h
eader
_b
ar
();
});
disk
B
utton
.
clicked
.
connect
(()
=>
{
performance
S
tack
.
set_visible_child_name
(
"DISK"
);
header
B
ar
.
hide
M
enu
B
utton
();
disk
_b
utton
.
clicked
.
connect
(()
=>
{
performance
_s
tack
.
set_visible_child_name
(
"DISK"
);
header
_b
ar
.
hide
_m
enu
_b
utton
();
});
network
B
utton
.
clicked
.
connect
(()
=>
{
performance
S
tack
.
set_visible_child_name
(
"NETWORK"
);
header
B
ar
.
hide
M
enu
B
utton
();
network
_b
utton
.
clicked
.
connect
(()
=>
{
performance
_s
tack
.
set_visible_child_name
(
"NETWORK"
);
header
_b
ar
.
hide
_m
enu
_b
utton
();
});
var
paned
=
new
Gtk
.
Paned
(
Gtk
.
Orientation
.
HORIZONTAL
);
paned
.
add1
(
panel
B
ox
);
paned
.
add2
(
performance
S
tack
);
paned
.
add1
(
panel
_b
ox
);
paned
.
add2
(
performance
_s
tack
);
add
(
paned
);
}
public
override
void
update
H
eader
B
ar
()
public
override
void
update
_h
eader
_b
ar
()
{
var
visible
SubV
iew
=
(
View
)
performance
S
tack
.
get_visible_child
();
visible
SubV
iew
.
update
H
eader
B
ar
();
var
visible
_sub_v
iew
=
(
View
)
performance
_s
tack
.
get_visible_child
();
visible
_sub_v
iew
.
update
_h
eader
_b
ar
();
}
}
}
src/power-view.vala
View file @
eb416e12
...
...
@@ -7,14 +7,14 @@ namespace Usage
name
=
"POWER"
;
title
=
_
(
"Power"
);
var
label
1
=
new
Gtk
.
Label
(
"Page Power Content."
);
add
(
label
1
);
var
label
=
new
Gtk
.
Label
(
"Page Power Content."
);
add
(
label
);
}
public
override
void
update
H
eader
B
ar
()
public
override
void
update
_h
eader
_b
ar
()
{
header
B
ar
.
clear
();
header
B
ar
.
show
S
tack
S
witcher
();
header
_b
ar
.
clear
();
header
_b
ar
.
show
_s
tack
_s
witcher
();
}
}
}
src/process-list.vala
View file @
eb416e12
...
...
@@ -3,10 +3,10 @@ namespace Usage
public
class
ProcessRow
:
Gtk
.
ListBoxRow
{
private
Gtk
.
Image
icon
;
private
Gtk
.
Label
title
L
abel
;
private
Gtk
.
Label
load
L
abel
;
private
Gtk
.
Label
title
_l
abel
;
private
Gtk
.
Label
load
_l
abel
;
public
int
sort
I
d
;
public
int
sort
_i
d
;
public
bool
is_headline
{
get
;
private
set
;
}
...
...
@@ -14,17 +14,17 @@ namespace Usage
{
var
box
=
new
Gtk
.
Box
(
Gtk
.
Orientation
.
HORIZONTAL
,
0
);
box
.
margin
=
5
;
title
L
abel
=
new
Gtk
.
Label
(
title
);
load
L
abel
=
new
Gtk
.
Label
(
load
.
to_string
()
+
" %"
);
title
_l
abel
=
new
Gtk
.
Label
(
title
);
load
_l
abel
=
new
Gtk
.
Label
(
load
.
to_string
()
+
" %"
);
icon
=
new
Gtk
.
Image
.
from_icon_name
(
"dialog-error"
,
Gtk
.
IconSize
.
BUTTON
);
box
.
pack_start
(
icon
,
false
,
false
,
10
);
box
.
pack_start
(
title
L
abel
,
false
,
true
,
5
);
box
.
pack_end
(
load
L
abel
,
false
,
true
,
10
);
box
.
pack_start
(
title
_l
abel
,
false
,
true
,
5
);
box
.
pack_end
(
load
_l
abel
,
false
,
true
,
10
);
add
(
box
);
title
L
abel
.
show
();
load
L
abel
.
show
();
title
_l
abel
.
show
();
load
_l
abel
.
show
();
icon
.
show
();
box
.
show
();
show
();
...
...
src/ram-sub-view.vala
0 → 100644
View file @
eb416e12
namespace
Usage
{
public
class
RAMSubView
:
View
{
ProcessList
process_list_box
;
Gtk
.
Label
cpu_load_label
;
List
<
ProcessRow
>
process_row_list
;
bool
show_active_process
=
true
;
public
RAMSubView
()
{
name
=
"RAM"
;
cpu_load_label
=
new
Gtk
.
Label
(
null
);
cpu_load_label
.
margin_right
=
100
;
var
processor_label
=
new
Gtk
.
Label
(
"<b>"
+
_
(
"Processor"
)
+
"</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
);
}