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

Display name, instead of cmdline in row.

Added Showing icons for apps
parent 64ea83fa
......@@ -18,7 +18,7 @@ sudo make install
In terminal run ```gnome-usage``` command or run GNOME Usage application from app launcher.
##Version
Actual version is 0.0.9
Actual version is 0.1.0
##License
Code is under GNU GPLv3 license.
......
No preview for this file type
......@@ -5,7 +5,7 @@ project_name: gnome-usage
vala_binary: src/gnome-usage
*version: 0.0.9
*version: 0.1.0
*vala_vapi: vapis/better.vapi
*vala_vapi: vapis/egg-private.vapi
*vala_vapi: vapis/glibtop.vapi
......@@ -60,29 +60,29 @@ h_folder: /usr/include/libgtop-2.0
translate: c src/better-box.c
*translate: vala src/cpu-graph-table.vala
*translate: vala src/gnome-usage.vala
*translate: vala src/application.vala
*translate: vala src/process-dialog.vala
*translate: vala src/header-bar.vala
*translate: vala src/network-sub-view.vala
*translate: vala src/cpu-graph.vala
*translate: vala src/process-list-box.vala
*translate: vala src/performance-view.vala
*translate: vala src/memory-graph-table.vala
*translate: vala src/cpu-sub-view.vala
*translate: vala src/memory-sub-view.vala
*translate: vala src/view.vala
*translate: vala src/graph-switcher-button.vala
*translate: vala src/disk-sub-view.vala
*translate: vala src/memory-sub-view.vala
*translate: vala src/sub-process-sub-row.vala
*translate: vala src/graph-stack-switcher.vala
*translate: vala src/sub-process-list-box.vala
*translate: vala src/gnome-usage.vala
*translate: vala src/window.vala
*translate: vala src/process-list-box.vala
*translate: vala src/system-monitor.vala
*translate: vala src/cpu-graph.vala
*translate: vala src/memory-graph.vala
*translate: vala src/sub-process-sub-row.vala
*translate: vala src/process-row.vala
*translate: vala src/settings.vala
*translate: vala src/storage-view.vala
*translate: vala src/system-monitor.vala
*translate: vala src/process-dialog.vala
*translate: vala src/cpu-sub-view.vala
*translate: vala src/sub-process-list-box.vala
*translate: vala src/process-row.vala
*translate: vala src/power-view.vala
*translate: vala src/data-view.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.0.9")
set (VERSION "0.1.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.0.9")
set (VERSION "0.1.0")
add_definitions (${DEPS_CFLAGS})
link_libraries ( ${DEPS_LIBRARIES} )
link_directories ( ${DEPS_LIBRARY_DIRS} )
......
// project version=0.0.9
// project version=0.1.0
public static int main (string[] args)
{
......
......@@ -9,10 +9,12 @@ namespace Usage
public ProcessDialog(pid_t pid, string name)
{
Object(use_header_bar: 1);
set_transient_for((GLib.Application.get_default() as Application).window);
set_position(Gtk.WindowPosition.CENTER);
this.pid = pid;
this.title = name;
this.border_width = 5;
set_default_size (350, 100);
set_default_size (900, 350);
create_widgets();
connect_signals();
}
......
......@@ -14,6 +14,7 @@ namespace Usage
pid_t pid;
int value;
string cmdline;
string display_name;
bool alive = true;
bool group = false;
......@@ -30,13 +31,12 @@ namespace Usage
this.orientation = Gtk.Orientation.VERTICAL;
var main_box = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 0);
main_box.margin = 12;
title_label = new Gtk.Label(cmdline); //TODO implement give name
load_label = new Gtk.Label(null);
load_label.ellipsize = Pango.EllipsizeMode.END;
load_label.max_width_chars = 30;
icon = new Gtk.Image.from_icon_name("dialog-error", Gtk.IconSize.BUTTON); //TODO implement give icon
main_box.pack_start(icon, false, false, 10);
load_icon_and_name();
main_box.pack_start(icon, false, false, 0);
main_box.pack_start(title_label, false, true, 5);
main_box.pack_end(load_label, false, true, 10);
......@@ -53,7 +53,7 @@ namespace Usage
switch_details();
else
{
var dialog = new ProcessDialog(pid, cmdline);
var dialog = new ProcessDialog(pid, display_name);
dialog.show_all ();
}
......@@ -83,6 +83,44 @@ namespace Usage
show_all();
}
public void load_icon_and_name()
{
AppInfo app_info = null;
var apps_info = AppInfo.get_all();
foreach (AppInfo info in apps_info)
{
string commandline = info.get_commandline();
for (int i = 0; i < commandline.length; i++)
{
if(commandline[i] == ' ')
commandline = commandline.substring(0, i);
}
commandline = Path.get_basename(commandline);
if(commandline == cmdline)
app_info = info;
}
if(app_info != null)
{
display_name = app_info.get_display_name();
title_label = new Gtk.Label(display_name);
if(app_info.get_icon() == null)
icon = new Gtk.Image.from_icon_name("system-run-symbolic", Gtk.IconSize.LARGE_TOOLBAR);
else
icon = new Gtk.Image.from_gicon(app_info.get_icon(), Gtk.IconSize.LARGE_TOOLBAR);
}
else
{
display_name = cmdline;
title_label = new Gtk.Label(display_name);
icon = new Gtk.Image.from_icon_name("system-run-symbolic", Gtk.IconSize.LARGE_TOOLBAR);
}
icon.margin_left = 10;
icon.margin_right = 10;
}
public void pre_update()
{
alive = false;
......
......@@ -28,7 +28,6 @@ namespace Usage
main_box.margin = 12;
title_label = new Gtk.Label(cmdline);
load_label = new Gtk.Label(null);
//load_label.ellipsize = Pango.EllipsizeMode.END;
icon = new Gtk.Image.from_icon_name("system-run-symbolic", Gtk.IconSize.BUTTON);
main_box.pack_start(icon, false, false, 10);
......
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