Skip to content

Commit

Permalink
Merge main into rpi-gpu-support
Browse files Browse the repository at this point in the history
  • Loading branch information
nokyan committed Dec 25, 2024
2 parents 7992dda + ea3501c commit 5cfc73d
Show file tree
Hide file tree
Showing 45 changed files with 555 additions and 154 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "resources"
version = "1.7.1"
authors = ["nokyan <[email protected]>"]
authors = ["nokyan <[email protected]>"]
edition = "2021"
rust-version = "1.80.0"
homepage = "https://apps.gnome.org/app/net.nokyan.Resources/"
Expand Down
2 changes: 1 addition & 1 deletion data/net.nokyan.Resources.metainfo.xml.in.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<developer id="net.nokyan">
<name translate="no">nokyan</name>
</developer>
<update_contact>[email protected]</update_contact>
<update_contact>[email protected]</update_contact>
<translation type="gettext">@gettext-package@</translation>
<launchable type="desktop-id">@[email protected]</launchable>
<branding>
Expand Down
2 changes: 1 addition & 1 deletion lib/process_data/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "process-data"
version = "1.7.1"
authors = ["nokyan <[email protected]>"]
authors = ["nokyan <[email protected]>"]
edition = "2021"
rust-version = "1.80.0"
homepage = "https://apps.gnome.org/app/net.nokyan.Resources/"
Expand Down
2 changes: 1 addition & 1 deletion lib/process_data/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ static NVIDIA_PROCESS_INFOS: Lazy<RwLock<HashMap<PciSlot, Vec<ProcessInfo>>>> =
#[nutype(
validate(less_or_equal = 19),
validate(greater_or_equal = -20),
derive(Debug, Default, Clone, Hash, PartialEq, Eq, Serialize, Deserialize, Copy, FromStr, Deref, TryFrom),
derive(Debug, Default, Clone, Hash, PartialEq, Eq, Serialize, Deserialize, Copy, FromStr, Deref, TryFrom, Display),
default = 0
)]
pub struct Niceness(i8);
Expand Down
2 changes: 1 addition & 1 deletion lib/process_data/src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ test(
'Cargo tests (process_data)',
cargo,
args: ['test', cargo_options],
timeout: 600,
timeout: 3600,
env: cargo_env,
)
8 changes: 4 additions & 4 deletions po/de.po
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#
# piekay <>, 2024.
# nokyan <[email protected]>, 2022-2024.
# nokyan <[email protected]>, 2022-2024.
#
msgid ""
msgstr ""
"Project-Id-Version: resources\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-10-19 13:51+0200\n"
"PO-Revision-Date: 2024-10-19 13:57+0200\n"
"Last-Translator: nokyan <[email protected]>\n"
"Language-Team: German <[email protected]>\n"
"Last-Translator: nokyan <[email protected]>\n"
"Language-Team: German <[email protected]>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -133,7 +133,7 @@ msgstr "Probleme melden"
#. One name per line, please do not remove previous names.
#: src/application.rs:278
msgid "translator-credits"
msgstr "nokyan <[email protected]>piekay"
msgstr "nokyan <[email protected]>piekay"

#: src/application.rs:279
msgid "Icon by"
Expand Down
13 changes: 3 additions & 10 deletions resources.doap
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<Project xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:gnome="http://api.gnome.org/doap-extensions#"
xmlns="http://usefulinc.com/ns/doap#">

<Project xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:gnome="http://api.gnome.org/doap-extensions#" xmlns="http://usefulinc.com/ns/doap#">
<name xml:lang="en">Resources</name>
<shortdesc xml:lang="en">Keep an eye on system resources</shortdesc>
<homepage rdf:resource="https://apps.gnome.org/app/net.nokyan.Resources/"/>
<bug-database rdf:resource="https://github.com/nokyan/resources/issues/"/>

<programming-language>Rust</programming-language>
<platform>GTK 4</platform>
<platform>Libadwaita</platform>

<maintainer>
<foaf:Person>
<foaf:name>nokyan</foaf:name>
<foaf:mbox rdf:resource="mailto:[email protected]" />
<foaf:mbox rdf:resource="mailto:[email protected]"/>
<foaf:account>
<foaf:OnlineAccount>
<foaf:accountServiceHomepage rdf:resource="https://github.com"/>
Expand All @@ -26,4 +19,4 @@
</foaf:account>
</foaf:Person>
</maintainer>
</Project>
</Project>
33 changes: 19 additions & 14 deletions src/application.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use log::{debug, info};
use log::{debug, info, trace};

use adw::{prelude::*, subclass::prelude::*};
use glib::clone;
Expand Down Expand Up @@ -78,6 +78,8 @@ glib::wrapper! {

impl Application {
pub fn new() -> Self {
trace!("Creating Application GObject…");

glib::Object::builder::<Self>()
.property("application-id", Some(APP_ID))
.property("flags", gio::ApplicationFlags::empty())
Expand Down Expand Up @@ -263,7 +265,7 @@ impl Application {
.application_name(i18n("Resources"))
.application_icon(config::APP_ID)
.developer_name(i18n("The Nalux Team"))
.developers(vec!["nokyan <[email protected]>".to_string()])
.developers(vec!["nokyan <[email protected]>"])
.license_type(gtk::License::Gpl30)
.version(config::VERSION)
.website("https://apps.gnome.org/app/net.nokyan.Resources/")
Expand All @@ -283,19 +285,22 @@ impl Application {
}

pub fn run(&self) {
trace!("Starting the application");
info!("Resources ({APP_ID})");
info!("Version: {VERSION}");
info!("Datadir: {PKGDATADIR}");

let os_info = OsInfo::get();
debug!(
"Operating system: {}",
os_info.name.as_deref().unwrap_or("N/A")
);
debug!(
"Kernel version: {}",
os_info.kernel_version.as_deref().unwrap_or("N/A")
);
info!("Version: {VERSION} ({PROFILE})");
info!("Datadir: `{PKGDATADIR}`");

if log::log_enabled!(log::Level::Debug) {
let os_info = OsInfo::get();
debug!(
"Operating system: {}",
os_info.name.as_deref().unwrap_or("N/A")
);
debug!(
"Kernel version: {}",
os_info.kernel_version.as_deref().unwrap_or("N/A")
);
}

if PROFILE == "Devel" {
info!(
Expand Down
2 changes: 2 additions & 0 deletions src/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::utils::IS_FLATPAK;
use clap::{command, Parser};
use gettextrs::{gettext, LocaleCategory};
use gtk::{gio, glib};
use log::trace;

use self::application::Application;
use self::config::{GETTEXT_PACKAGE, LOCALEDIR, RESOURCES_FILE};
Expand Down Expand Up @@ -65,6 +66,7 @@ pub fn main() {

// Initialize logger
pretty_env_logger::init();
trace!("Trace logs activated. Brace yourself for *lots* of logs. Slowdowns may occur.");

// reset XDG_DATA_DIRS to use absolute paths instead of relative paths because Flatpak seemingly cannot resolve them
// this must happen now because once the GTK app is loaded, it's too late
Expand Down
2 changes: 1 addition & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test(
'Cargo tests (main application)',
cargo,
args: ['test', cargo_options],
timeout: 600,
timeout: 3600,
env: cargo_env,
)

Expand Down
7 changes: 7 additions & 0 deletions src/ui/dialogs/app_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::utils::units::{convert_speed, convert_storage};
use adw::{prelude::*, subclass::prelude::*};
use gtk::gio::ThemedIcon;
use gtk::glib;
use log::trace;

mod imp {

Expand Down Expand Up @@ -99,6 +100,8 @@ impl Default for ResAppDialog {

impl ResAppDialog {
pub fn new() -> Self {
trace!("Creating ResAppDialog GObject…");

glib::Object::new::<Self>()
}

Expand All @@ -107,6 +110,8 @@ impl ResAppDialog {
}

pub fn setup_widgets(&self, app: &ApplicationEntry) {
trace!("Setting up ResAppDialog widgets…");

let imp = self.imp();

if app.id().is_none() // this will be the case for System Processes
Expand Down Expand Up @@ -153,6 +158,8 @@ impl ResAppDialog {
}

pub fn update(&self, app: &ApplicationEntry) {
trace!("Refreshing ResAppDialog…");

let imp = self.imp();

imp.cpu_usage
Expand Down
6 changes: 6 additions & 0 deletions src/ui/dialogs/process_dialog.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use adw::{prelude::*, subclass::prelude::*};
use gtk::glib::{self, GString};
use log::trace;

use crate::config::PROFILE;
use crate::i18n::i18n;
Expand Down Expand Up @@ -105,6 +106,7 @@ impl Default for ResProcessDialog {

impl ResProcessDialog {
pub fn new() -> Self {
trace!("Creating ResProcessDialog GObject…");
glib::Object::new::<Self>()
}

Expand All @@ -113,6 +115,8 @@ impl ResProcessDialog {
}

pub fn setup_widgets(&self, process: &ProcessEntry, user: &str) {
trace!("Setting up ResProcessDialog widgets…");

let imp = self.imp();

imp.name.set_label(&process.name());
Expand Down Expand Up @@ -148,6 +152,8 @@ impl ResProcessDialog {
}

pub fn update(&self, process: &ProcessEntry) {
trace!("Refreshing ResProcessDialog…");

let imp = self.imp();

imp.cpu_usage
Expand Down
6 changes: 6 additions & 0 deletions src/ui/dialogs/process_options_dialog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::{
use adw::{prelude::*, subclass::prelude::*, ToastOverlay};
use async_channel::Sender;
use gtk::glib::{self, clone, MainContext};
use log::trace;
use process_data::Niceness;

mod imp {
Expand Down Expand Up @@ -87,6 +88,7 @@ impl Default for ResProcessOptionsDialog {

impl ResProcessOptionsDialog {
pub fn new() -> Self {
trace!("Creating ResProcessOptionsDialog GObject…");
glib::Object::new::<Self>()
}

Expand Down Expand Up @@ -118,6 +120,8 @@ impl ResProcessOptionsDialog {
}

pub fn setup_widgets(&self, process: &ProcessEntry) {
trace!("Setting up ResProcessOptionsDialog widgets…");

let imp = self.imp();

imp.name.set_label(&process.name());
Expand Down Expand Up @@ -168,6 +172,8 @@ impl ResProcessOptionsDialog {
sender: Sender<Action>,
toast_overlay: &ToastOverlay,
) {
trace!("Setting up ResProcessOptionsDialog signals…");

let imp = self.imp();

imp.select_all_button.connect_clicked(clone!(
Expand Down
7 changes: 7 additions & 0 deletions src/ui/dialogs/settings_dialog.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use adw::{prelude::*, subclass::prelude::*};
use gtk::glib;
use log::trace;

use crate::{
config::PROFILE,
Expand Down Expand Up @@ -155,6 +156,8 @@ impl Default for ResSettingsDialog {

impl ResSettingsDialog {
pub fn new() -> Self {
trace!("Creating ResSettingsDialog GObject…");

glib::Object::new::<Self>()
}

Expand All @@ -164,6 +167,8 @@ impl ResSettingsDialog {
}

pub fn setup_widgets(&self) {
trace!("Setting up ResSettingsDialog widgets…");

let imp = self.imp();
imp.prefix_combo_row
.set_selected((SETTINGS.base() as u8) as u32);
Expand Down Expand Up @@ -252,6 +257,8 @@ impl ResSettingsDialog {
}

pub fn setup_signals(&self) {
trace!("Setting up ResSettingsDialog signals…");

let imp = self.imp();
imp.prefix_combo_row
.connect_selected_item_notify(|combo_row| {
Expand Down
5 changes: 5 additions & 0 deletions src/ui/pages/applications/application_entry.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use gtk::glib::{self};
use log::trace;
use process_data::Containerization;

use crate::{
Expand Down Expand Up @@ -179,6 +180,8 @@ glib::wrapper! {

impl ApplicationEntry {
pub fn new(app: &App, apps_context: &AppsContext) -> Self {
trace!("Creating ApplicationEntry ({}) GObject…", app.display_name);

let containerization = match app.containerization {
Containerization::None => i18n("No"),
Containerization::Flatpak => i18n("Yes (Flatpak)"),
Expand All @@ -198,6 +201,8 @@ impl ApplicationEntry {
}

pub fn update(&self, app: &App, apps_context: &AppsContext) {
trace!("Refreshing ApplicationEntry ({})…", app.display_name);

self.set_cpu_usage(app.cpu_time_ratio(apps_context));
self.set_memory_usage(app.memory_usage(apps_context) as u64);
self.set_swap_usage(app.swap_usage(apps_context) as u64);
Expand Down
3 changes: 3 additions & 0 deletions src/ui/pages/applications/application_name_cell.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use adw::{glib::property::PropertySet, prelude::*, subclass::prelude::*};
use gtk::{gio::Icon, glib};
use log::trace;

mod imp {
use std::cell::{Cell, RefCell};
Expand Down Expand Up @@ -160,6 +161,8 @@ impl Default for ResApplicationNameCell {

impl ResApplicationNameCell {
pub fn new() -> Self {
trace!("Creating ResApplicationNameCell GObject…");

glib::Object::new::<Self>()
}
}
Loading

0 comments on commit 5cfc73d

Please sign in to comment.