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

Subprocess dropdown improved well.

Added css for styling.
Fixed .desktop
parent 613b6c61
......@@ -46,6 +46,7 @@ set(MODULES_TO_CHECK ${MODULES_TO_CHECK} x11)
pkg_check_modules(DEPS REQUIRED ${MODULES_TO_CHECK})
add_subdirectory(data/local)
add_subdirectory(po)
add_subdirectory(data)
add_subdirectory(src)
......
#GNOME Usage
I started working on the new GNOME Usage for GNOME according to official design from Allan.<br>
New GNOME Usage for GNOME according to official design from Allan.
##Current status:
![Screenshot](screenshot.png?raw=true )
......@@ -14,6 +14,8 @@ cmake ..
make
sudo make install
```
##Run
In terminal run ```gnome-usage``` command or run GNOME Usage application from app launcher.
##Version
Actual version is 0.0.5
......
No preview for this file type
.processListBoxRow-opened { background: #3b4043; }
.processListBoxRow:hover { background: #4d5356; }
.processListBoxRow-max { background: #8E0000; }
.processListBoxRow-max-opened { background: #b40000; }
.processListBoxRow-max:hover { background: #b40000; }
.processDetailListBoxRow { background: #2c3032; }
.processDetailListBoxRow:hover { background: #4d5356; }
row { padding: 0 }
\ No newline at end of file
.processListBoxRow-opened { background: #9c9c9c; }
.processListBoxRow:hover { background: #e2e2e2; }
.processListBoxRow-max { background: #fabbbb; }
.processListBoxRow-max-opened { background: #faa5a2; }
.processListBoxRow-max:hover { background: #faa5a2; }
.processDetailListBoxRow { background: #f2f2f2; }
.processDetailListBoxRow:hover { background: #e2e2e2; }
row { padding: 0 }
\ No newline at end of file
[Desktop Entry]
Name=GNOME Usage
Comment=View current processes and monitor system state
Categories=GNOME;GTK;System;Monitor;
Exec=hello-again
Comment=View current application and monitor system state
Categories=GNOME;GTK;
Exec=gnome-usage
Icon=application-default-icon
Terminal=false
Type=Application
......
......@@ -54,9 +54,10 @@ h_folder: /usr/include/libgtop-2.0
*po: po
translate: c src/better-box.c
*translate: vala src/graph-switcher-button.vala
*translate: vala src/settings.vala
*translate: vala src/cpu-graph-table.vala
*translate: vala src/process-list.vala
*translate: vala src/application.vala
*translate: vala src/window.vala
*translate: vala src/header-bar.vala
*translate: vala src/memory-sub-view.vala
*translate: vala src/network-sub-view.vala
......@@ -65,14 +66,13 @@ translate: c src/better-box.c
*translate: vala src/memory-graph-table.vala
*translate: vala src/system-monitor.vala
*translate: vala src/view.vala
*translate: vala src/gnome-usage.vala
*translate: vala src/disk-sub-view.vala
*translate: vala src/window.vala
*translate: vala src/graph-stack-switcher.vala
*translate: vala src/cpu-sub-view.vala
*translate: vala src/cpu-graph-table.vala
*translate: vala src/application.vala
*translate: vala src/graph-stack-switcher.vala
*translate: vala src/gnome-usage.vala
*translate: vala src/graph-switcher-button.vala
*translate: vala src/memory-graph.vala
*translate: vala src/settings.vala
*translate: vala src/storage-view.vala
*translate: vala src/power-view.vala
*translate: vala src/data-view.vala
......
screenshot.png

85 KB | W: | H:

screenshot.png

79.6 KB | W: | H:

screenshot.png
screenshot.png
screenshot.png
screenshot.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -12,12 +12,17 @@ namespace Usage
public int sort_id;
public bool is_headline { get; private set; }
public bool showing_details { get; private set; }
public bool max_usage { get; private set; }
public ProcessListBoxRow(string title, int load)
{
if(load >= 90)
max_usage = true;
this.margin = 0;
var main_box = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 0);
var box_vertical = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
main_box.margin = 10;
box_vertical.margin = 0;
main_box.margin = 12;
title_label = new Gtk.Label(title);
load_label = new Gtk.Label(load.to_string() + " %");
icon = new Gtk.Image.from_icon_name("dialog-error", Gtk.IconSize.BUTTON); //TODO implement give icon
......@@ -41,27 +46,59 @@ namespace Usage
event_box.button_press_event.connect ((event) => {
switch_details();
return true;
return false;
});
box_vertical.pack_start(event_box, false, true, 0);
box_vertical.pack_end(revealer, false, true, 0);
add(box_vertical);
style(false);
show_all();
}
private void style(bool opened)
{
if(max_usage)
{
if(opened)
{
this.get_style_context().remove_class("processListBoxRow-max");
this.get_style_context().add_class("processListBoxRow-max-opened");
}
else
{
this.get_style_context().remove_class("processListBoxRow-max-opened");
this.get_style_context().add_class("processListBoxRow-max");
}
}
else
{
if(opened)
{
this.get_style_context().remove_class("processListBoxRow");
this.get_style_context().add_class("processListBoxRow-opened");
}
else
{
this.get_style_context().remove_class("processListBoxRow-opened");
this.get_style_context().add_class("processListBoxRow");
}
}
}
private void hide_details()
{
showing_details = false;
revealer.set_reveal_child(false);
style(false);
}
private void show_details()
{
showing_details = true;
revealer.set_reveal_child(true);
//TODO change color of main_box
style(true);
}
private void switch_details()
......@@ -106,8 +143,10 @@ namespace Usage
public ProcessDetailListBoxRow(string title, int load)
{
set_can_focus(true);
this.get_style_context().add_class("processDetailListBoxRow");
var box = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 0);
box.margin = 10;
box.margin = 12;
title_label = new Gtk.Label(title);
load_label = new Gtk.Label(load.to_string() + " %");
icon = new Gtk.Image.from_icon_name("system-run-symbolic", Gtk.IconSize.BUTTON);
......
......@@ -2,7 +2,7 @@ using Gtk;
namespace Usage {
public class Settings : Object{
public class Settings : Object {
public uint graph_timespan { get; set; default = 30000;}
public uint graph_max_samples { get; set; default = 30; }
......
......@@ -36,6 +36,31 @@ namespace Usage
views[0].update_header_bar();
set_titlebar(header_bar);
this.add(stack);
load_css();
Gtk.Settings.get_for_screen(get_screen()).notify["gtk-application-prefer-dark-theme"].connect((s, p) =>
{
load_css();
});
}
private void load_css()
{
string name_css = "adwaita.css";
var settings = Gtk.Settings.get_for_screen(get_screen());
if(settings.gtk_application_prefer_dark_theme)
name_css = "adwaita-dark.css";
var provider = new Gtk.CssProvider();
try {
Gtk.StyleContext.reset_widgets(get_screen());
provider.load_from_path(GLib.Path.build_filename(Constants.PKGDATADIR, name_css));
Gtk.StyleContext.add_provider_for_screen(get_screen(), provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
}
catch (Error e) {
stdout.printf("Could not load CSS. %s\n", e.message);
}
}
}
}
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