Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
gnome-usage
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
9
Issues
9
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Librem5
gnome-usage
Commits
4a491191
Commit
4a491191
authored
Sep 12, 2019
by
Adrien Plazas
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'librem5-3-32-0' into pureos/sloppy
parents
00b8378e
711404e7
Pipeline
#32949
canceled with stages
Changes
18
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
155 additions
and
50 deletions
+155
-50
data/icons/hicolor/scalable/status/speedometer-symbolic.svg
data/icons/hicolor/scalable/status/speedometer-symbolic.svg
+8
-0
data/org.gnome.Usage.gresource.xml
data/org.gnome.Usage.gresource.xml
+1
-0
data/ui/header-bar.ui
data/ui/header-bar.ui
+26
-3
data/ui/performance-view.ui
data/ui/performance-view.ui
+33
-11
data/ui/process-row.ui
data/ui/process-row.ui
+0
-1
data/ui/storage-view.ui
data/ui/storage-view.ui
+8
-3
meson.build
meson.build
+6
-0
src/application.vala
src/application.vala
+3
-0
src/cpu-sub-view.vala
src/cpu-sub-view.vala
+0
-2
src/gnome-usage.vala
src/gnome-usage.vala
+2
-0
src/header-bar.vala
src/header-bar.vala
+44
-20
src/memory-sub-view.vala
src/memory-sub-view.vala
+0
-1
src/meson.build
src/meson.build
+1
-0
src/performance-view.vala
src/performance-view.vala
+2
-1
src/storage-list-box.vala
src/storage-list-box.vala
+1
-1
src/storage-view.vala
src/storage-view.vala
+7
-4
src/view.vala
src/view.vala
+1
-0
src/window.vala
src/window.vala
+12
-3
No files found.
data/icons/hicolor/scalable/status/speedometer-symbolic.svg
0 → 100644
View file @
4a491191
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"16.011"
height=
"16"
>
<g
fill=
"#2e3436"
>
<path
d=
"M8.017 1.001c-2.049 0-4.098.78-5.656 2.338-3.116 3.116-3.116 8.197 0 11.313a1 1 0 101.414-1.414 5.984 5.984 0 010-8.485 5.984 5.984 0 018.485 0 5.984 5.984 0 010 8.485 1 1 0 101.414 1.414c3.116-3.116 3.116-8.197 0-11.313a7.975 7.975 0 00-5.657-2.338z"
style=
"line-height:normal;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;text-transform:none;text-orientation:mixed;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal;solid-color:#000;solid-opacity:1;marker:none"
color=
"#000"
font-weight=
"400"
font-family=
"sans-serif"
overflow=
"visible"
/>
<path
d=
"M10.017 8.995a2 2 0 01-2 2 2 2 0 01-2-2 2 2 0 012-2 2 2 0 012 2z"
/>
<path
d=
"M4.01 4.238a.75.75 0 00-.524 1.289l3 3A.751.751 0 107.55 7.464l-3-3a.75.75 0 00-.54-.226zM7.517 1.995v2h1v-2z"
style=
"line-height:normal;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;text-transform:none;text-orientation:mixed;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal;solid-color:#000;solid-opacity:1"
color=
"#000"
font-weight=
"400"
font-family=
"sans-serif"
overflow=
"visible"
fill-rule=
"evenodd"
/>
<path
d=
"M3.422 3.693l-.707.707 1.414 1.414.707-.707zM1.017 8.495v1h2v-1zM13.017 8.495v1h2v-1zM12.613 3.693L11.2 5.107l.707.707L13.32 4.4zM4.129 12.177l-1.414 1.414.707.707 1.414-1.414zM11.906 12.177l-.707.707 1.414 1.414.707-.707z"
style=
"line-height:normal;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;text-transform:none;text-orientation:mixed;white-space:normal;shape-padding:0;isolation:auto;mix-blend-mode:normal;solid-color:#000;solid-opacity:1"
color=
"#000"
font-weight=
"400"
font-family=
"sans-serif"
overflow=
"visible"
fill-rule=
"evenodd"
/>
</g>
</svg>
data/org.gnome.Usage.gresource.xml
View file @
4a491191
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource
prefix=
"/org/gnome/Usage"
>
<file
preprocess=
"xml-stripblanks"
>
icons/hicolor/scalable/status/speedometer-symbolic.svg
</file>
<file
compressed=
"true"
>
interface/adwaita.css
</file>
<file
preprocess=
"xml-stripblanks"
>
ui/primary-menu.ui
</file>
<file
preprocess=
"xml-stripblanks"
>
ui/header-bar.ui
</file>
...
...
data/ui/header-bar.ui
View file @
4a491191
...
...
@@ -2,9 +2,10 @@
<interface>
<!-- interface-requires gtk+ 3.12 -->
<template
class=
"UsageHeaderBar"
parent=
"
Gtk
HeaderBar"
>
<template
class=
"UsageHeaderBar"
parent=
"
Hdy
HeaderBar"
>
<property
name=
"visible"
>
False
</property>
<property
name=
"show-close-button"
>
True
</property>
<property
name=
"centering-policy"
>
strict
</property>
<child>
<object
class=
"GtkButton"
id=
"storage_back_button"
>
...
...
@@ -25,8 +26,24 @@
</child>
<child
type=
"title"
>
<object
class=
"
GtkStackSwitcher"
id=
"stack_switch
er"
>
<object
class=
"
HdySqueezer"
id=
"squeez
er"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"transition-type"
>
crossfade
</property>
<signal
name=
"notify::visible-child"
handler=
"on_squeezer_visible_child_changed"
/>
<child>
<object
class=
"HdyViewSwitcher"
id=
"view_switcher"
>
<property
name=
"visible"
>
True
</property>
</object>
</child>
<child>
<object
class=
"GtkLabel"
id=
"title_label"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"label"
translatable=
"yes"
>
Usage
</property>
<style>
<class
name=
"title"
/>
</style>
</object>
</child>
</object>
</child>
...
...
@@ -46,9 +63,13 @@
</child>
<child>
<object
class=
"Gtk
Button"
id=
"storage_rescan_button
"
>
<object
class=
"Gtk
Revealer"
id=
"storage_rescan_revealer
"
>
<property
name=
"visible"
>
False
</property>
<property
name=
"no-show-all"
>
True
</property>
<property
name=
"reveal-child"
>
True
</property>
<child>
<object
class=
"GtkButton"
id=
"storage_rescan_button"
>
<property
name=
"visible"
>
true
</property>
<signal
name=
"clicked"
handler=
"on_storage_rescan_button_clicked"
/>
<child>
...
...
@@ -58,6 +79,8 @@
</object>
</child>
</object>
</child>
</object>
<packing>
<property
name=
"pack-type"
>
end
</property>
</packing>
...
...
data/ui/performance-view.ui
View file @
4a491191
...
...
@@ -7,13 +7,16 @@
<child>
<object
class=
"
GtkPaned"
id=
"paned
"
>
<object
class=
"
HdyLeaflet"
id=
"leaflet
"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"orientation"
>
horizontal
</property>
<property
name=
"mode-transition-type"
>
slide
</property>
<property
name=
"visible-child"
>
content_box
</property>
<child>
<object
class=
"GtkBox"
id=
"switcher_box"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"hexpand"
>
False
</property>
<property
name=
"hexpand-set"
>
True
</property>
<property
name=
"width-request"
>
200
</property>
<style>
<class
name=
"sidebar"
/>
...
...
@@ -22,19 +25,28 @@
</child>
<child>
<object
class=
"GtkBox"
>
<object
class=
"GtkBox"
id=
"content_box"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"orientation"
>
vertical
</property>
<property
name=
"width-request"
>
360
</property>
<child>
<object
class=
"
Gtk
SearchBar"
id=
"search_bar"
>
<property
name=
"visible"
>
True
</property>
<object
class=
"
Hdy
SearchBar"
id=
"search_bar"
>
<property
name=
"visible"
>
True
</property>
<child>
<object
class=
"
GtkSearchEntry"
id=
"search_entry
"
>
<object
class=
"
HdyColumn
"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"width-request"
>
350
</property>
<signal
name=
"search-changed"
handler=
"on_search_entry_changed"
/>
<property
name=
"hexpand"
>
True
</property>
<property
name=
"maximum-width"
>
400
</property>
<property
name=
"linear-growth-width"
>
300
</property>
<child>
<object
class=
"GtkSearchEntry"
id=
"search_entry"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"hexpand"
>
True
</property>
<signal
name=
"search-changed"
handler=
"on_search_entry_changed"
/>
</object>
</child>
</object>
</child>
</object>
...
...
@@ -45,10 +57,20 @@
<property
name=
"visible"
>
True
</property>
<property
name=
"vexpand"
>
True
</property>
<child>
<object
class=
"
GtkBox"
id=
"performance_content
"
>
<object
class=
"
HdyColumn
"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"orientation"
>
vertical
</property>
<property
name=
"spacing"
>
30
</property>
<property
name=
"margin-start"
>
12
</property>
<property
name=
"margin-end"
>
12
</property>
<property
name=
"expand"
>
True
</property>
<property
name=
"maximum-width"
>
600
</property>
<property
name=
"linear-growth-width"
>
400
</property>
<child>
<object
class=
"GtkBox"
id=
"performance_content"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"orientation"
>
vertical
</property>
<property
name=
"spacing"
>
30
</property>
</object>
</child>
</object>
</child>
</object>
...
...
data/ui/process-row.ui
View file @
4a491191
...
...
@@ -3,7 +3,6 @@
<!-- interface-requires gtk+ 3.10 -->
<template
class=
"UsageProcessRow"
parent=
"GtkListBoxRow"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"width-request"
>
600
</property>
<property
name=
"can_focus"
>
False
</property>
<child>
<object
class=
"GtkBox"
>
...
...
data/ui/storage-view.ui
View file @
4a491191
...
...
@@ -18,23 +18,28 @@
<child>
<object
class=
"GtkBox"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"no-show-all"
>
True
</property>
<property
name=
"orientation"
>
vertical
</property>
<child>
<object
class=
"
GtkPaned"
id=
"paned
"
>
<object
class=
"
HdyLeaflet"
id=
"leaflet
"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"orientation"
>
horizontal
</property>
<property
name=
"position"
>
300
</property>
<property
name=
"mode-transition-type"
>
slide
</property>
<property
name=
"visible-child"
>
scrolled_window
</property>
<child>
<object
class=
"GtkScrolledWindow"
id=
"scrolled_window"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"hexpand"
>
False
</property>
<property
name=
"hexpand-set"
>
True
</property>
<property
name=
"vexpand"
>
True
</property>
<property
name=
"width-request"
>
300
</property>
</object>
</child>
</object>
</child>
<child>
<object
class=
"GtkRevealer"
id=
"revealer"
>
<property
name=
"visible"
>
Tru
e
</property>
<property
name=
"visible"
>
Fals
e
</property>
<property
name=
"transition-type"
>
slide-up
</property>
<property
name=
"transition-duration"
>
400
</property>
</object>
...
...
meson.build
View file @
4a491191
...
...
@@ -13,10 +13,16 @@ gobject_dep = dependency('gobject-2.0')
gio_dep = dependency('gio-2.0')
gtk_dep = dependency('gtk+-3.0', version : '>=3.20.10')
libdazzle_dep = dependency('libdazzle-1.0', version : '>=3.30')
libhandy_dep = dependency('libhandy-0.0', version : '>=0.0.10')
gnome = import('gnome')
i18n = import('i18n')
add_project_arguments (
'-DHANDY_USE_UNSTABLE_API',
language: 'c'
)
po_dir = join_paths(meson.source_root(), 'po')
vapi_dir = join_paths (meson.source_root (), 'vapi')
...
...
src/application.vala
View file @
4a491191
...
...
@@ -61,6 +61,9 @@ namespace Usage
base
.
startup
();
add_action_entries
(
app_entries
,
this
);
set_accels_for_action
(
"app.search"
,
{
"<Primary>f"
});
var
icon_theme
=
Gtk
.
IconTheme
.
get_default
();
icon_theme
.
add_resource_path
(
"/org/gnome/Usage/icons/hicolor"
);
}
private
void
on_about
(
GLib
.
SimpleAction
action
,
GLib
.
Variant
?
parameter
)
...
...
src/cpu-sub-view.vala
View file @
4a491191
...
...
@@ -38,7 +38,6 @@ namespace Usage
cpu_graph
.
hexpand
=
true
;
var
cpu_graph_box
=
new
GraphBox
(
cpu_graph
);
cpu_graph_box
.
height_request
=
225
;
cpu_graph_box
.
width_request
=
600
;
cpu_graph_box
.
valign
=
Gtk
.
Align
.
START
;
process_list_box
=
new
ProcessListBox
(
ProcessListBoxType
.
PROCESSOR
);
...
...
@@ -53,7 +52,6 @@ namespace Usage
no_process_view
=
new
NoResultsFoundView
();
var
cpu_box
=
new
Gtk
.
Box
(
Gtk
.
Orientation
.
VERTICAL
,
0
);
cpu_box
.
halign
=
Gtk
.
Align
.
CENTER
;
cpu_box
.
pack_start
(
label
,
false
,
false
,
0
);
cpu_box
.
pack_start
(
cpu_graph_box
,
false
,
false
,
0
);
cpu_box
.
pack_start
(
spinner
,
true
,
true
,
0
);
...
...
src/gnome-usage.vala
View file @
4a491191
...
...
@@ -25,6 +25,8 @@ public static int main (string[] args)
Intl
.
textdomain
(
Config
.
GETTEXT_PACKAGE
);
Intl
.
bind_textdomain_codeset
(
Config
.
GETTEXT_PACKAGE
,
"utf-8"
);
Hdy
.
init
(
ref
args
);
var
application
=
new
Usage
.
Application
();
return
application
.
run
(
args
);
}
src/header-bar.vala
View file @
4a491191
...
...
@@ -29,10 +29,16 @@ namespace Usage
}
[
GtkTemplate
(
ui
=
"/org/gnome/Usage/ui/header-bar.ui"
)]
public
class
HeaderBar
:
Gtk
.
HeaderBar
public
class
HeaderBar
:
Hdy
.
HeaderBar
{
[
GtkChild
]
private
Gtk
.
StackSwitcher
stack_switcher
;
private
Hdy
.
Squeezer
squeezer
;
[
GtkChild
]
private
Hdy
.
ViewSwitcher
view_switcher
;
[
GtkChild
]
private
Gtk
.
Label
title_label
;
[
GtkChild
]
private
Gtk
.
ToggleButton
performance_search_button
;
...
...
@@ -41,7 +47,7 @@ namespace Usage
private
Gtk
.
Button
storage_back_button
;
[
GtkChild
]
private
Gtk
.
Button
storage_rescan_button
;
private
Gtk
.
Revealer
storage_rescan_revealer
;
[
GtkChild
]
private
Gtk
.
Button
storage_select_button
;
...
...
@@ -57,6 +63,8 @@ namespace Usage
private
HeaderBarMode
mode
;
private
Usage
.
PrimaryMenu
menu
;
public
bool
view_switcher_visible
{
get
;
private
set
;
}
const
GLib
.
ActionEntry
[]
select_action_entries
=
{
{
"select-all"
,
select_all
},
{
"select-none"
,
select_none
},
...
...
@@ -66,12 +74,16 @@ namespace Usage
{
mode
=
HeaderBarMode
.
PERFORMANCE
;
menu
=
new
Usage
.
PrimaryMenu
();
stack
_switcher
.
set_stack
(
stack
);
view
_switcher
.
set_stack
(
stack
);
this
.
primary_menu_button
.
set_popover
(
menu
);
set_mode
(
HeaderBarMode
.
PERFORMANCE
);
}
construct
{
update_view_switcher_visible
();
}
public
void
set_mode
(
HeaderBarMode
mode
)
{
switch
(
this
.
mode
)
...
...
@@ -81,7 +93,7 @@ namespace Usage
break
;
case
HeaderBarMode
.
STORAGE
:
storage_back_button
.
hide
();
storage_rescan_
button
.
hide
();
storage_rescan_
revealer
.
hide
();
storage_select_button
.
hide
();
storage_cancel_button
.
hide
();
break
;
...
...
@@ -90,17 +102,17 @@ namespace Usage
switch
(
mode
)
{
case
HeaderBarMode
.
PERFORMANCE
:
show_
stack
_switcher
();
show_
view
_switcher
();
performance_search_button
.
show
();
break
;
case
HeaderBarMode
.
STORAGE
:
if
(
title_text
==
""
)
show_
stack
_switcher
();
show_
view
_switcher
();
else
show_title
();
storage_rescan_
button
.
show
();
storage_select_button
.
show
();
storage_rescan_
revealer
.
show
();
storage_select_button
.
hide
();
break
;
}
...
...
@@ -108,6 +120,15 @@ namespace Usage
this
.
mode
=
mode
;
}
private
void
update_view_switcher_visible
()
{
view_switcher_visible
=
squeezer
.
visible_child
==
view_switcher
;
}
[
GtkCallback
]
private
void
on_squeezer_visible_child_changed
()
{
update_view_switcher_visible
();
}
[
GtkCallback
]
private
void
on_performance_search_button_toggled
()
{
/* TODO: Implement a saner way of toggling this mode. */
...
...
@@ -121,10 +142,10 @@ namespace Usage
[
GtkCallback
]
private
void
on_storage_rescan_button_clicked
()
{
stack
_switcher
.
show
();
view
_switcher
.
show
();
storage_select_button
.
hide
();
storage_rescan_
button
.
hide
()
;
storage_rescan_
revealer
.
reveal_child
=
false
;
storage_back_button
.
hide
();
StorageAnalyzer
.
get_default
().
create_cache
.
begin
(
true
);
...
...
@@ -159,33 +180,36 @@ namespace Usage
public
void
show_title
()
{
set_custom_title
(
null
);
squeezer
.
set_child_enabled
(
view_switcher
,
false
);
set_title
(
title_text
);
}
public
void
set_title_text
(
string
title
)
{
this
.
title_text
=
title
;
title_label
.
label
=
title
;
}
public
void
show_
stack
_switcher
()
public
void
show_
view
_switcher
()
{
s
et_custom_title
(
stack_switcher
);
s
queezer
.
set_child_enabled
(
view_switcher
,
true
);
}
public
void
show_storage_back_button
(
bool
show
)
{
show
&=
mode
==
HeaderBarMode
.
STORAGE
;
storage_back_button
.
visible
=
show
;
}
public
void
show_storage_rescan_button
(
bool
show
)
{
storage_rescan_
button
.
visible
=
show
;
storage_rescan_
revealer
.
reveal_child
=
show
;
}
public
void
show_storage_select_button
(
bool
show
)
{
storage_select_button
.
visible
=
show
;
show
&=
mode
==
HeaderBarMode
.
STORAGE
;
storage_select_button
.
visible
=
false
;
}
public
void
action_on_search
()
...
...
@@ -204,7 +228,7 @@ namespace Usage
{
if
(
show
)
{
storage_rescan_
button
.
hide
();
storage_rescan_
revealer
.
hide
();
storage_select_button
.
hide
();
storage_back_button
.
hide
();
storage_cancel_button
.
show
();
...
...
@@ -238,12 +262,12 @@ namespace Usage
{
storage_back_button
.
show
();
storage_rescan_
button
.
show
();
storage_select_button
.
show
();
storage_rescan_
revealer
.
show
();
storage_select_button
.
hide
();
storage_cancel_button
.
hide
();
storage_selection_menu
=
null
;
if
(
title_text
==
""
)
show_
stack
_switcher
();
show_
view
_switcher
();
else
show_title
();
((
StorageView
)
(
GLib
.
Application
.
get_default
()
as
Application
).
get_window
().
get_views
()[
Views
.
STORAGE
]).
show_action_bar
(
false
);
...
...
src/memory-sub-view.vala
View file @
4a491191
...
...
@@ -50,7 +50,6 @@ namespace Usage
speedometers
.
margin_top
=
30
;
var
memory_box
=
new
Gtk
.
Box
(
Gtk
.
Orientation
.
VERTICAL
,
0
);
memory_box
.
halign
=
Gtk
.
Align
.
CENTER
;
memory_box
.
pack_start
(
speedometers
,
false
,
false
,
0
);
memory_box
.
pack_start
(
spinner
,
true
,
true
,
0
);
memory_box
.
add
(
no_process_view
);
...
...
src/meson.build
View file @
4a491191
...
...
@@ -51,6 +51,7 @@ deps = [
gtk_dep,
dependency('libgtop-2.0', version : '>= 2.34.0'),
libdazzle_dep,
libhandy_dep,
cc.find_library('m'),
valac.find_library('config', dirs: vapi_dir),
valac.find_library('posix')
...
...
src/performance-view.vala
View file @
4a491191
...
...
@@ -32,7 +32,7 @@ namespace Usage
private
Gtk
.
Box
performance_content
;
[
GtkChild
]
private
Gtk
.
SearchBar
search_bar
;
private
Hdy
.
SearchBar
search_bar
;
[
GtkChild
]
private
Gtk
.
SearchEntry
search_entry
;
...
...
@@ -46,6 +46,7 @@ namespace Usage
{
name
=
"PERFORMANCE"
;
title
=
_
(
"Performance"
);
icon_name
=
"speedometer-symbolic"
;
sub_views
=
new
View
[]
{
...
...
src/storage-list-box.vala
View file @
4a491191
...
...
@@ -90,7 +90,7 @@ namespace Usage
{
(
GLib
.
Application
.
get_default
()
as
Application
).
get_window
().
get_header_bar
().
show_storage_back_button
(
false
);
(
GLib
.
Application
.
get_default
()
as
Application
).
get_window
().
get_header_bar
().
set_title_text
(
""
);
(
GLib
.
Application
.
get_default
()
as
Application
).
get_window
().
get_header_bar
().
show_
stack
_switcher
();
(
GLib
.
Application
.
get_default
()
as
Application
).
get_window
().
get_header_bar
().
show_
view
_switcher
();
}
else
{
...
...
src/storage-view.vala
View file @
4a491191
...
...
@@ -37,19 +37,24 @@ namespace Usage
private
Gtk
.
ScrolledWindow
scrolled_window
;
[
GtkChild
]
private
Gtk
.
Paned
paned
;
private
Hdy
.
Leaflet
leaflet
;
public
StorageView
()
{
name
=
"STORAGE"
;
title
=
_
(
"Storage"
);
icon_name
=
"drive-harddisk-symbolic"
;
/* It would be nice being able to this in the template file. */
storage_list_box
=
new
StorageListBox
();
scrolled_window
.
add
(
storage_list_box
);
var
graph
=
new
StorageGraph
();
paned
.
add2
(
graph
);
graph
.
hexpand
=
true
;
graph
.
vexpand
=
true
;
graph
.
width_request
=
300
;
graph
.
show
();
leaflet
.
add
(
graph
);
action_bar
=
new
StorageActionBar
();
revealer
.
add
(
action_bar
);
...
...
@@ -82,8 +87,6 @@ namespace Usage
public
void
show_action_bar
(
bool
show
)
{
revealer
.
set_reveal_child
(
show
);
action_bar
.
hide_all
();
}
}
}
src/view.vala
View file @
4a491191
...
...
@@ -23,6 +23,7 @@ namespace Usage
public
abstract
class
View
:
Gtk
.
Bin
{
public
string
title
;
public
string
icon_name
;
protected
View
()
{
...
...
src/window.vala
View file @
4a491191
...
...
@@ -29,6 +29,7 @@ namespace Usage
public
class
Window
:
Gtk
.
ApplicationWindow
{
private
Usage
.
HeaderBar
header_bar
;
private
Hdy
.
ViewSwitcherBar
viewswitcher_bar
;
private
View
[]
views
;
public
Window
(
Gtk
.
Application
application
)
...
...
@@ -36,7 +37,6 @@ namespace Usage
GLib
.
Object
(
application
:
application
);
this
.
set_default_size
(
950
,
600
);
this
.
set_size_request
(
930
,
300
);
this
.
window_position
=
Gtk
.
WindowPosition
.
CENTER
;
this
.
set_title
(
_
(
"Usage"
));
...
...
@@ -47,8 +47,12 @@ namespace Usage
});
var
stack
=
new
Gtk
.
Stack
();
stack
.
vexpand
=
true
;
header_bar
=
new
Usage
.
HeaderBar
(
stack
);
set_titlebar
(
header_bar
);
viewswitcher_bar
=
new
Hdy
.
ViewSwitcherBar
();
viewswitcher_bar
.
stack
=
stack
;
header_bar
.
bind_property
(
"view-switcher-visible"
,
viewswitcher_bar
,
"reveal"
,
BindingFlags
.
SYNC_CREATE
|
BindingFlags
.
INVERT_BOOLEAN
);
views
=
new
View
[]
{
...
...
@@ -56,8 +60,10 @@ namespace Usage
new
StorageView
(),
};
foreach
(
var
view
in
views
)
foreach
(
var
view
in
views
)
{
stack
.
add_titled
(
view
,
view
.
name
,
view
.
title
);
stack
.
child_set
(
view
,
"icon-name"
,
view
.
icon_name
,
null
);
}
stack
.
notify
.
connect
(()
=>
{
if
(
stack
.
visible_child_name
==
views
[
Views
.
PERFORMANCE
].
name
)
...
...
@@ -71,7 +77,10 @@ namespace Usage
}
});
this
.
add
(
stack
);
var
box
=
new
Gtk
.
Box
(
Gtk
.
Orientation
.
VERTICAL
,
0
);
box
.
add
(
stack
);
box
.
add
(
viewswitcher_bar
);
this
.
add
(
box
);
}
public
Usage
.
HeaderBar
get_header_bar
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment