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

Updated .desktop file

Added application entries preference, about and quit.
Added about window.
parent 3640c849
......@@ -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.5
Actual version is 0.0.6
##License
Code is under GNU GPLv3 license.
......
No preview for this file type
[Desktop Entry]
Name=GNOME Usage
Name=Usage
Comment=View current application and monitor system state
Categories=GNOME;GTK;
Exec=gnome-usage
Icon=application-default-icon
Terminal=false
StartupNotify=true
Type=Application
X-GNOME-Gettext-Domain=gnome-usage
Keywords=Monitor;System;Process;CPU;Memory;Network;History;Usage;Performance;Task;Manager;
......@@ -5,7 +5,7 @@ project_name: gnome-usage
vala_binary: src/gnome-usage
*version: 0.0.5
*version: 0.0.6
*vala_vapi: vapis/better.vapi
*vala_vapi: vapis/egg-private.vapi
*vala_vapi: vapis/glibtop.vapi
......@@ -58,23 +58,23 @@ h_folder: /usr/include/libgtop-2.0
translate: c src/better-box.c
*translate: vala src/cpu-graph-table.vala
*translate: vala src/cpu-sub-view.vala
*translate: vala src/application.vala
*translate: vala src/window.vala
*translate: vala src/gnome-usage.vala
*translate: vala src/header-bar.vala
*translate: vala src/memory-sub-view.vala
*translate: vala src/network-sub-view.vala
*translate: vala src/cpu-graph.vala
*translate: vala src/performance-view.vala
*translate: vala src/memory-graph-table.vala
*translate: vala src/process-list.vala
*translate: vala src/process-row.vala
*translate: vala src/window.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/graph-stack-switcher.vala
*translate: vala src/gnome-usage.vala
*translate: vala src/process-row.vala
*translate: vala src/memory-graph.vala
*translate: vala src/system-monitor.vala
*translate: vala src/application.vala
*translate: vala src/memory-graph.vala
*translate: vala src/process-list.vala
*translate: vala src/settings.vala
*translate: vala src/storage-view.vala
*translate: vala src/power-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.5")
set (VERSION "0.0.6")
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.5")
set (VERSION "0.0.6")
add_definitions (${DEPS_CFLAGS})
link_libraries ( ${DEPS_LIBRARIES} )
link_directories ( ${DEPS_LIBRARY_DIRS} )
......
......@@ -8,6 +8,13 @@ namespace Usage
public Window window;
public SystemMonitor monitor;
private const GLib.ActionEntry app_entries[] =
{
{ "preferences", on_preferences },
{ "about", on_about },
{ "quit", on_quit }
};
public Application ()
{
application_id = "org.gnome.usage";
......@@ -18,7 +25,56 @@ namespace Usage
public override void activate()
{
window = new Window(this);
// Create menu
GLib.Menu menu_preferences = new GLib.Menu();
GLib.MenuItem item = new GLib.MenuItem (_("Preferences"), "app.preferences");
menu_preferences.append_item(item);
GLib.Menu menu_common = new GLib.Menu();
item = new GLib.MenuItem (_("About"), "app.about");
menu_common.append_item(item);
item = new GLib.MenuItem (_("Quit"), "app.quit");
item.set_attribute("accel", "s", "<Primary>q");
menu_common.append_item(item);
GLib.Menu menu = new GLib.Menu();
menu.append_section(null, menu_preferences);
menu.append_section(null, menu_common);
set_app_menu(menu);
window.show_all();
}
protected override void startup()
{
base.startup();
add_action_entries(app_entries, this);
}
private void on_preferences(GLib.SimpleAction action, GLib.Variant? parameter)
{
//TODO settings window
}
private void on_about(GLib.SimpleAction action, GLib.Variant? parameter)
{
string[] authors = {"Petr Štětka"};
Gtk.show_about_dialog (window,
program_name: _("Usage"),
comments: _("View current application and monitor system state"),
authors: authors,
website: "https://wiki.gnome.org/Apps/Usage",
website_label: _("Websites"),
version: Constants.VERSION,
license_type: License.GPL_3_0);
}
private void on_quit(GLib.SimpleAction action, GLib.Variant? parameter)
{
window.destroy();
}
}
}
// project version=0.0.5
// project version=0.0.6
public static int main (string[] args)
{
......
......@@ -48,6 +48,19 @@ namespace Usage
foreach(Row row in rows)
row.alive = false;
/*GLib.List<unowned Process> processes = (GLib.Application.get_default() as Application).monitor.get_processes();
for(int i = 0; i < processes.length(); i++)
{
for(int j = i + 1; j < processes.length(); j++)
{
if(processes.nth_data(i).cmdline == processes.nth_data(j).cmdline)
stdout.printf(processes.nth_data(i).pid.to_string() + " " + processes.nth_data(j).pid.to_string() + " " + processes.nth_data(i).cmdline + " " + processes.nth_data(j).cmdline + "\n");
}
}
stdout.printf("\n\n\n");*/
foreach(unowned Process process in (GLib.Application.get_default() as Application).monitor.get_processes())
{
if(!(process.pid in process_rows_table))
......
......@@ -12,6 +12,7 @@ namespace Usage
this.set_default_size(950, 600);
this.set_size_request(855, 300);
this.window_position = Gtk.WindowPosition.CENTER;
this.set_title(_("Usage"));
stack = new Gtk.Stack();
header_bar = new Usage.HeaderBar(stack);
......
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