Commit e8ef33d7 authored by Petr Štětka's avatar Petr Štětka
Browse files

Implemented memory usage.

Restyled css.
Tweaked graphs.
Added screenshots.
Updated README.
parent 60093de0
#GNOME Usage
New GNOME Usage for GNOME according to official design from Allan.
New GNOME Usage!
##Current status:
![Screenshot](screenshot.png?raw=true )
## Actual TODO:
- [x] Processor Usage
- [x] Memory usage
- [ ] Fix bug in LibGTop with x_cpu_load
- [ ] Disk usage
- [ ] Network usage [#1](http://github.com/petr-stety-stetka/gnome-usage/issues/1)
##Compilation:
```
......@@ -18,10 +22,17 @@ sudo make install
In terminal run ```gnome-usage``` command or run GNOME Usage application from app launcher.
##Version
Actual version is 0.1.0
Actual version is 0.2.0
##License
Code is under GNU GPLv3 license.
##Screenshots:
More screenshots is in screenshots subdirectory.
![Screenshot](screenshots/screenshot3.png?raw=true )
![Screenshot](screenshots/screenshot4.png?raw=true )
##Design:
<img src="https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/usage/usage-wires.png">
No preview for this file type
......@@ -12,21 +12,50 @@ list, graph-box {
border: 1px solid #3f3f3f;
}
separator.list {
background-color: #3f3f3f;
list row {
padding: 0;
}
list separator {
background: #3f3f3f;
}
row {
padding: 0;
/*background: #232729;*/
list row.max {
background: #8E0000;
border: 1px solid #b40000;
}
list row.max:hover {
background: #b40000;
border: 1px solid #b40000;
}
list row.opened {
background: #3b4043;
}
list row.opened:hover {
background: #3b4043;
}
row:hover {
subprocess-list row {
padding: 0;
background: #2c3032;
}
subprocess-list row:hover {
background: #4d5356;
}
subprocess-list row.max {
background: #8E0000;
border: 1px solid #b40000;
}
graph-stack-switcher {
background: #2b3032;
}
graph-switcher-button {
padding: 6px 10px;
border-style: none;
......@@ -46,7 +75,11 @@ graph-switcher-button:active {
background-color: #383D3F;
}
line-graph.big {
scrolledwindow {
background: #33393b;
}
rg-graph.big {
background-color: #232729;
background-size: 57px 57px;
background-image: repeating-linear-gradient(0deg, #3f3f3f, #3f3f3f 1px, transparent 1px, transparent 57px);
......
.subProcessSubRow-max { background: #fabbbb; border: 1px solid #faa5a2; }
.subProcessSubRow-max-hover { background: #faa5a2; border: 1px solid #faa5a2; }
list, graph-box {
border: 1px solid #d3d7cf;
}
......@@ -78,7 +75,7 @@ scrolledwindow {
background: #f1f2f1;
}
cpu-all-graph.big {
rg-graph.big {
background-color: #ffffff;
background-size: 57px 57px;
background-image: repeating-linear-gradient(0deg, #e6e6e6, #e6e6e6 1px, transparent 1px, transparent 57px);
......
......@@ -5,7 +5,7 @@ project_name: gnome-usage
vala_binary: src/gnome-usage
*version: 0.1.0
*version: 0.2.0
*vala_vapi: vapis/better.vapi
*vala_vapi: vapis/egg-private.vapi
*vala_vapi: vapis/glibtop.vapi
......@@ -65,32 +65,32 @@ h_folder: /usr/include/libgtop-2.0
translate: c src/better-box.c
*translate: vala src/cpu-graph-table.vala
*translate: vala src/sub-process-sub-row.vala
*translate: vala src/application.vala
*translate: vala src/header-bar.vala
*translate: vala src/network-sub-view.vala
*translate: vala src/process-list-box.vala
*translate: vala src/performance-view.vala
*translate: vala src/network-sub-view.vala
*translate: vala src/memory-graph-table.vala
*translate: vala src/performance-view.vala
*translate: vala src/memory-graph.vala
*translate: vala src/graph-box.vala
*translate: vala src/process-dialog.vala
*translate: vala src/view.vala
*translate: vala src/process-row.vala
*translate: vala src/disk-sub-view.vala
*translate: vala src/graph-block.vala
*translate: vala src/settings.vala
*translate: vala src/gnome-usage.vala
*translate: vala src/sub-process-list-box.vala
*translate: vala src/cpu-graph.vala
*translate: vala src/system-monitor.vala
*translate: vala src/window.vala
*translate: vala src/memory-sub-view.vala
*translate: vala src/sub-process-sub-row.vala
*translate: vala src/color-rectangle.vala
*translate: vala src/memory-graph.vala
*translate: vala src/cpu-graph.vala
*translate: vala src/gnome-usage.vala
*translate: vala src/cpu-sub-view.vala
*translate: vala src/graph-stack-switcher.vala
*translate: vala src/storage-view.vala
*translate: vala src/process-dialog.vala
*translate: vala src/sub-process-list-box.vala
*translate: vala src/system-monitor.vala
*translate: vala src/graph-block.vala
*translate: vala src/process-row.vala
*translate: vala src/settings.vala
*translate: vala src/power-view.vala
*translate: vala src/cpu-sub-view.vala
*translate: vala src/memory-sub-view.vala
*translate: vala src/cookie-graph.vala
*translate: vala src/graph-block-row.vala
*translate: vala src/graph-switcher-button.vala
......
......@@ -7,13 +7,13 @@ set (GETTEXT_PACKAGE "gnome-usage")
set (RELEASE_NAME "gnome-usage")
set (CMAKE_C_FLAGS "")
set (PREFIX ${CMAKE_INSTALL_PREFIX})
set (VERSION "0.1.0")
set (VERSION "0.2.0")
set (TESTSRCDIR "${CMAKE_SOURCE_DIR}")
set (DOLLAR "$")
configure_file (${CMAKE_SOURCE_DIR}/src/Config.vala.cmake ${CMAKE_BINARY_DIR}/src/Config.vala)
add_definitions(-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\")
set (VERSION "0.1.0")
set (VERSION "0.2.0")
add_definitions (${DEPS_CFLAGS})
link_libraries ( ${DEPS_LIBRARIES} )
link_directories ( ${DEPS_LIBRARY_DIRS} )
......
......@@ -12,6 +12,11 @@ namespace Usage
private Gdk.RGBA color_max;
private Gdk.RGBA color_normal;
class construct
{
set_css_name("rg-graph");
}
public CpuGraphMostUsed ()
{
color_max.parse("#ee2222");
......@@ -40,7 +45,7 @@ namespace Usage
/**
* Graph showing all processor cores.
**/
public class CpuGraphAllCores : Rg.Graph
public class CpuGraphBig : Rg.Graph
{
private static CpuGraphTableComplex table;
private LineRenderer[] renderers;
......@@ -49,10 +54,10 @@ namespace Usage
class construct
{
set_css_name("cpu-all-graph");
set_css_name("rg-graph");
}
public CpuGraphAllCores()
public CpuGraphBig()
{
color_max.parse("#ee2222");
color_normal.parse("#4a90d9");
......@@ -69,7 +74,7 @@ namespace Usage
renderers[i] = new LineRenderer();
renderers[i].column = i;
renderers[i].stroke_color_rgba = color_normal;
renderers[i].line_width = 2.5;
renderers[i].line_width = 1.5;
add_renderer(renderers[i]);
}
......
......@@ -6,19 +6,19 @@ namespace Usage
{
name = "PROCESSOR";
var label = new Gtk.Label("<span font_desc=\"14.0\">" + _("Processor") + "</span>");
var label = new Gtk.Label("<span font_desc=\"14.0\">" + _("Processor") + "</span>");
label.set_use_markup(true);
label.margin_top = 20;
label.margin_top = 25;
label.margin_bottom = 15;
var cpu_graph = new CpuGraphAllCores();
var cpu_graph = new CpuGraphBig();
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;
var process_list_box = new ProcessListBoxNew();
var process_list_box = new ProcessListBoxNew(ProcessListBoxType.PROCESSOR);
process_list_box.margin_bottom = 20;
process_list_box.margin_top = 30;
......@@ -37,7 +37,6 @@ namespace Usage
scrolled_window.add(better_box);
scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
add(scrolled_window);
}
......
// project version=0.1.0
// project version=0.2.0
public static int main (string[] args)
{
......
......@@ -6,6 +6,10 @@ namespace Usage {
{
public const int column_ram_id = 0;
public const int column_swap_id = 1;
public signal void big_ram_usage();
public signal void small_ram_usage();
private bool change_big_ram_usage = true;
private bool change_small_ram_usage = true;
public MemoryGraphTable ()
{
......@@ -25,9 +29,32 @@ namespace Usage {
{
Rg.TableIter iter;
push (out iter, get_monotonic_time ());
iter.set (column_ram_id, (GLib.Application.get_default() as Application).monitor.mem_usage, -1);
SystemMonitor monitor = (GLib.Application.get_default() as Application).monitor;
double ram_usage = monitor.mem_usage;
iter.set (column_ram_id, ram_usage, -1);
iter.set (column_swap_id, (GLib.Application.get_default() as Application).monitor.swap_usage, -1);
if(ram_usage >= 90)
{
if(change_big_ram_usage)
{
big_ram_usage();
change_big_ram_usage = false;
change_small_ram_usage = true;
}
}
else
{
if(change_small_ram_usage)
{
small_ram_usage();
change_small_ram_usage = false;
change_big_ram_usage = true;
}
}
return true;
}
}
......
......@@ -2,12 +2,65 @@ using Rg;
namespace Usage
{
public class MemoryGraph: Rg.Graph
public class MemoryGraph : Rg.Graph
{
private static MemoryGraphTable rg_table;
private Gdk.RGBA color_max;
private Gdk.RGBA color_normal;
class construct
{
set_css_name("rg-graph");
}
public MemoryGraph ()
{
color_max.parse("#ee2222");
color_normal.parse("#4a90d9");
if(rg_table == null)
{
rg_table = new MemoryGraphTable();
set_table(rg_table);
}
else
set_table(rg_table);
LineRenderer renderer_ram = new LineRenderer();
renderer_ram.column = MemoryGraphTable.column_ram_id;
renderer_ram.stroke_color_rgba = color_normal;
renderer_ram.line_width = 1.2;
add_renderer(renderer_ram);
rg_table.big_ram_usage.connect (() => {
renderer_ram.stroke_color_rgba = color_max;
});
rg_table.small_ram_usage.connect (() => {
renderer_ram.stroke_color_rgba = color_normal;
});
}
}
public class MemoryGraphBig : Rg.Graph
{
private static MemoryGraphTable rg_table;
private Gdk.RGBA color_max;
private Gdk.RGBA color_normal;
private Gdk.RGBA color_swap;
class construct
{
set_css_name("rg-graph");
}
public MemoryGraphBig()
{
color_max.parse("#ee2222");
color_normal.parse("#4a90d9");
color_swap.parse("#ff9900");
get_style_context().add_class("big");
if(rg_table == null)
{
rg_table = new MemoryGraphTable();
......@@ -18,15 +71,23 @@ namespace Usage
LineRenderer renderer_ram = new LineRenderer();
renderer_ram.column = MemoryGraphTable.column_ram_id;
renderer_ram.stroke_color = "#ef2929";
renderer_ram.line_width = 2;
renderer_ram.stroke_color_rgba = color_normal;
renderer_ram.line_width = 1.5;
add_renderer(renderer_ram);
LineRenderer renderer_swap = new LineRenderer();
renderer_swap.column = MemoryGraphTable.column_swap_id;
renderer_swap.stroke_color = "#73d216";
renderer_swap.line_width = 2;
renderer_swap.stroke_color_rgba = color_swap;
renderer_swap.line_width = 1.5;
add_renderer(renderer_swap);
rg_table.big_ram_usage.connect (() => {
renderer_ram.stroke_color_rgba = color_max;
});
rg_table.small_ram_usage.connect (() => {
renderer_ram.stroke_color_rgba = color_normal;
});
}
}
}
using Better;
namespace Usage
{
public class MemorySubView : View
{
Gtk.Label memory_load_label;
public MemorySubView()
{
name = "MEMORY";
memory_load_label = new Gtk.Label(null);
var label = new Gtk.Label("<span font_desc=\"14.0\">" + _("Memory") + "</span>");
label.set_use_markup(true);
label.margin_top = 20;
label.margin_top = 25;
label.margin_bottom = 15;
var memory_graph = new MemoryGraph();
var memory_graph_frame = new Gtk.Frame(null);
memory_graph_frame.height_request = 225;
memory_graph_frame.width_request = 600;
memory_graph_frame.valign = Gtk.Align.START;
memory_graph_frame.add(memory_graph);
var memory_graph = new MemoryGraphBig();
memory_graph.hexpand = true;
var memory_graph_box = new GraphBox(memory_graph);
memory_graph_box.height_request = 225;
memory_graph_box.width_request = 600;
memory_graph_box.valign = Gtk.Align.START;
var process_list_box_frame = new Gtk.Frame(null);
process_list_box_frame.margin_top = 30;
var process_list_box = new ProcessListBoxNew(ProcessListBoxType.MEMORY);
process_list_box.margin_bottom = 20;
process_list_box.margin_top = 30;
var memory_box = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
memory_box.pack_start(label, false, false, 0);
memory_box.pack_start(memory_graph_frame, false, false, 0);
memory_box.pack_start(process_list_box_frame, false, false, 0);
memory_box.pack_start(memory_graph_box, false, false, 0);
memory_box.pack_start(process_list_box, false, false, 0);
var better_box = new Better.Box();
better_box.max_width_request = 600;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment