From 5ab1a680be0e79f9ef2907b8d248be238804b91d Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Thu, 15 May 2025 23:49:40 +0200 Subject: [PATCH 01/42] Switch dependencies to GTK4 --- .github/workflows/ci.yml | 6 +++--- meson.build | 11 +++++------ src/Managers/Process.vala | 5 +++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 156adc92..2a3beb83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,14 +26,14 @@ jobs: - name: Install Dependencies run: | apt update - apt install -y libgala-dev libgee-0.8-dev libglib2.0-dev libgranite-dev libgtk-3-dev libhandy-1-dev \ - libdbus-glib-1-dev libwnck-3-dev libgtop2-dev libwingpanel-3.0-dev libudisks2-dev \ + apt install -y libgala-dev libgee-0.8-dev libglib2.0-dev libgranite-dev libgtk-4-dev libadwaita-1-dev \ + libdbus-glib-1-dev libgtop2-dev libwingpanel-3.0-dev libudisks2-dev \ libxnvctrl0 libxnvctrl-dev libcurl4-gnutls-dev libflatpak-dev libjson-glib-dev \ liblivechart-1-dev libpci-dev \ meson valac sassc git - name: Build run: | - meson setup -Dindicator-wingpanel=enabled build + meson setup -Dindicator-wingpanel=disabled build meson compile -C build # Tests disabled since it starts to test live-chart and some tests fail there # meson test -C build --print-errorlogs diff --git a/meson.build b/meson.build index 8636cf10..ef8219d4 100644 --- a/meson.build +++ b/meson.build @@ -22,17 +22,16 @@ add_project_arguments(['-DWNCK_I_KNOW_THIS_IS_UNSTABLE', '-w'], language: 'c') # elementary_stylesheet = subproject('stylesheet') app_dependencies = [ - dependency('granite', version: '>= 5.2.0'), + dependency('granite-7'), dependency('glib-2.0'), - dependency('gtk+-3.0'), + dependency('gtk4'), dependency('gee-0.8'), dependency('gio-2.0'), dependency('gobject-2.0'), dependency('libgtop-2.0'), - dependency('libwnck-3.0'), - dependency('libhandy-1', version: '>=0.90.0'), - dependency('gdk-x11-3.0'), - dependency('x11'), + # dependency('libwnck-3.0'), + dependency('libadwaita-1', version: '>=1.0.0'), + dependency('gtk4-x11'), dependency('udisks2'), dependency('json-glib-1.0'), dependency('flatpak'), diff --git a/src/Managers/Process.vala b/src/Managers/Process.vala index 91f74f9d..0b5a845e 100644 --- a/src/Managers/Process.vala +++ b/src/Managers/Process.vala @@ -324,8 +324,9 @@ public class Monitor.Process : GLib.Object { // also if it is using X Window Server if (Gdk.Display.get_default () is Gdk.X11.Display) { - Wnck.ResourceUsage resu = Wnck.ResourceUsage.pid_read (Gdk.Display.get_default (), stat.pid); - mem_usage += (resu.total_bytes_estimate / 1024); + // @TODO figure this out for wayland and X11 in gtk4 + // Wnck.ResourceUsage resu = Wnck.ResourceUsage.pid_read (Gdk.Display.get_default (), stat.pid); + // mem_usage += (resu.total_bytes_estimate / 1024); } var total_installed_memory = (double) mem.total / 1024; From 188bc7665d10f6426646ef4fd6b47a13d4091fac Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Sat, 17 May 2025 00:28:43 +0200 Subject: [PATCH 02/42] GTK4 wip --- src/MainWindow.vala | 52 ++++++++---------- src/Monitor.vala | 8 ++- src/Views/PreferencesView.vala | 47 ++++++++-------- .../SystemView/SystemCPUInfoPopover.vala | 55 +++++++++++-------- src/Views/SystemView/SystemCPUView.vala | 39 ++++++++----- src/Views/SystemView/SystemGPUView.vala | 24 +++++--- src/Views/SystemView/SystemNetworkView.vala | 17 ++++-- src/Views/SystemView/SystemStorageView.vala | 42 ++++++++++---- src/Views/SystemView/SystemView.vala | 30 ++++++---- src/Widgets/Labels/LabelVertical.vala | 18 +++--- src/Widgets/Statusbar/Statusbar.vala | 8 +-- .../WidgetResource/WidgetResource.vala | 2 +- 12 files changed, 203 insertions(+), 139 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 6f34070c..9046a52e 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -3,7 +3,7 @@ * SPDX-FileCopyrightText: 2025 elementary, Inc. (https://elementary.io) */ -public class Monitor.MainWindow : Hdy.ApplicationWindow { +public class Monitor.MainWindow : Adw.ApplicationWindow { private Resources resources; // Widgets @@ -43,15 +43,14 @@ public class Monitor.MainWindow : Hdy.ApplicationWindow { stack_switcher.valign = Gtk.Align.CENTER; stack_switcher.set_stack (stack); - var sv = new PreferencesView (); - sv.show_all (); + var preferences_view = new PreferencesView (); - var preferences_popover = new Gtk.Popover (null) { - child = sv + var preferences_popover = new Gtk.Popover () { + child = preferences_view }; var preferences_button = new Gtk.MenuButton () { - image = new Gtk.Image.from_icon_name ("open-menu", Gtk.IconSize.LARGE_TOOLBAR), + icon_name = "open-menu", popover = preferences_popover, tooltip_text = (_("Settings")) }; @@ -65,13 +64,9 @@ public class Monitor.MainWindow : Hdy.ApplicationWindow { transition_type = SLIDE_LEFT }; - var headerbar = new Hdy.HeaderBar () { - has_subtitle = false, - show_close_button = true, - title = _("Monitor") - }; + var headerbar = new Adw.HeaderBar (); headerbar.pack_start (search_revealer); - headerbar.set_custom_title (stack_switcher); + headerbar.set_title_widget (stack_switcher); headerbar.pack_end (preferences_button); statusbar = new Statusbar (); @@ -80,13 +75,13 @@ public class Monitor.MainWindow : Hdy.ApplicationWindow { orientation = Gtk.Orientation.VERTICAL }; - grid.add (headerbar); - grid.add (stack); - grid.add (statusbar); + set_titlebar (headerbar); + grid.attach (stack, 0, 1, 1, 1); + grid.attach (statusbar, 0, 2, 1, 1); - add (grid); + set_child (grid); - show_all (); + present (); dbusserver = DBusServer.get_default (); @@ -114,31 +109,32 @@ public class Monitor.MainWindow : Hdy.ApplicationWindow { dbusserver.quit.connect (() => app.quit ()); dbusserver.show.connect (() => { - this.deiconify (); this.present (); setup_window_state (); - this.show_all (); + this.present (); }); - key_press_event.connect (search.handle_event); + // @TODO: Handle search.handle_event + // The name `key_press_event' does not exist in the context of `Monitor.MainWindow.new' + // key_press_event.connect (search.handle_event); - this.delete_event.connect (() => { + app.window_removed.connect (() => { int window_width, window_height; - get_size (out window_width, out window_height); - MonitorApp.settings.set_int ("window-width", window_width); - MonitorApp.settings.set_int ("window-height", window_height); - MonitorApp.settings.set_boolean ("is-maximized", this.is_maximized); + MonitorApp.settings.set_int ("window-width", get_size (Gtk.Orientation.HORIZONTAL)); + MonitorApp.settings.set_int ("window-height", get_size (Gtk.Orientation.VERTICAL)); + + // @TODO: Handle is-maximized + // MonitorApp.settings.set_boolean ("is-maximized", this.is_maximized); MonitorApp.settings.set_string ("opened-view", stack.visible_child_name); if (MonitorApp.settings.get_boolean ("indicator-state")) { - this.hide_on_delete (); + // Read: https://discourse.gnome.org/t/how-to-hide-widget-instead-removing-them-in-gtk-4/8176 + this.hide (); } else { dbusserver.indicator_state (false); app.quit (); } - - return true; }); dbusserver.indicator_state (MonitorApp.settings.get_boolean ("indicator-state")); diff --git a/src/Monitor.vala b/src/Monitor.vala index dc80381c..226f6b9a 100644 --- a/src/Monitor.vala +++ b/src/Monitor.vala @@ -34,7 +34,8 @@ namespace Monitor { public override void startup () { base.startup (); - Hdy.init (); + Granite.init (); + Adw.init (); Appearance.set_prefered_style (); @@ -58,7 +59,7 @@ namespace Monitor { public override void activate () { // only have one window if (get_windows () != null) { - window.show_all (); + // window.show_all (); window.present (); return; } @@ -89,7 +90,8 @@ namespace Monitor { window.hide (); MonitorApp.settings.set_boolean ("background-state", true); } else { - window.show_all (); + // @TODO: Find out how this should work without show_all () + // window.show_all (); } window.process_view.process_tree_view.focus_on_first_row (); diff --git a/src/Views/PreferencesView.vala b/src/Views/PreferencesView.vala index 32891397..63811159 100644 --- a/src/Views/PreferencesView.vala +++ b/src/Views/PreferencesView.vala @@ -3,7 +3,7 @@ * SPDX-FileCopyrightText: 2025 elementary, Inc. (https://elementary.io) */ -public class Monitor.PreferencesView : Gtk.Bin { +public class Monitor.PreferencesView : Gtk.Box { private Gtk.Adjustment update_freq_adjustment; construct { @@ -23,7 +23,7 @@ public class Monitor.PreferencesView : Gtk.Bin { halign = START, margin_bottom = 6 }; - update_freq_description.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); + update_freq_description.get_style_context ().add_class (Granite.STYLE_CLASS_DIM_LABEL); update_freq_description.get_style_context ().add_class (Granite.STYLE_CLASS_SMALL_LABEL); update_freq_scale.add_mark (1.0, BOTTOM, _("1s")); @@ -38,9 +38,9 @@ public class Monitor.PreferencesView : Gtk.Bin { margin_top = 12, margin_bottom = 12 }; - update_freq_box.add (update_freq_label); - update_freq_box.add (update_freq_description); - update_freq_box.add (update_freq_scale); + update_freq_box.append (update_freq_label); + update_freq_box.append (update_freq_description); + update_freq_box.append (update_freq_scale); update_freq_adjustment.value_changed.connect (() => { MonitorApp.settings.set_int ("update-time", (int) update_freq_adjustment.get_value ()); @@ -112,18 +112,18 @@ public class Monitor.PreferencesView : Gtk.Bin { margin_bottom = 6, margin_start = 12 }; - indicator_options_box.add (cpu_check); - indicator_options_box.add (cpu_freq_check); - indicator_options_box.add (cpu_temp_check); - indicator_options_box.add (new Gtk.Separator (HORIZONTAL)); - indicator_options_box.add (memory_check); - indicator_options_box.add (new Gtk.Separator (HORIZONTAL)); - indicator_options_box.add (gpu_check); - indicator_options_box.add (gpu_memory_check); - indicator_options_box.add (gpu_temp_check); - indicator_options_box.add (new Gtk.Separator (HORIZONTAL)); - indicator_options_box.add (network_upload_check); - indicator_options_box.add (network_download_check); + indicator_options_box.append (cpu_check); + indicator_options_box.append (cpu_freq_check); + indicator_options_box.append (cpu_temp_check); + indicator_options_box.append (new Gtk.Separator (HORIZONTAL)); + indicator_options_box.append (memory_check); + indicator_options_box.append (new Gtk.Separator (HORIZONTAL)); + indicator_options_box.append (gpu_check); + indicator_options_box.append (gpu_memory_check); + indicator_options_box.append (gpu_temp_check); + indicator_options_box.append (new Gtk.Separator (HORIZONTAL)); + indicator_options_box.append (network_upload_check); + indicator_options_box.append (network_download_check); var indicator_options_revealer = new Gtk.Revealer () { child = indicator_options_box @@ -132,13 +132,14 @@ public class Monitor.PreferencesView : Gtk.Bin { var box = new Gtk.Box (VERTICAL, 0) { margin_bottom = 6 }; - box.add (update_freq_box); - box.add (enable_smooth_lines_switch); - box.add (background_switch); - box.add (indicator_switch); - box.add (indicator_options_revealer); + box.append (update_freq_box); + box.append (enable_smooth_lines_switch); + box.append (background_switch); + box.append (indicator_switch); + box.append (indicator_options_revealer); - child = box; + + append (box); indicator_switch.bind_property ("active", indicator_options_revealer, "reveal-child", SYNC_CREATE); diff --git a/src/Views/SystemView/SystemCPUInfoPopover.vala b/src/Views/SystemView/SystemCPUInfoPopover.vala index 418f9a59..52739ab2 100755 --- a/src/Views/SystemView/SystemCPUInfoPopover.vala +++ b/src/Views/SystemView/SystemCPUInfoPopover.vala @@ -7,7 +7,10 @@ public class Monitor.SystemCPUInfoPopover : Gtk.Box { private CPU cpu; construct { - margin = 12; + margin_top = 12; + margin_bottom = 12; + margin_start = 12; + margin_end = 12; orientation = Gtk.Orientation.VERTICAL; } @@ -33,8 +36,8 @@ public class Monitor.SystemCPUInfoPopover : Gtk.Box { }; stack_switcher.set_stack (stack); - add (stack_switcher); - add (stack); + append (stack_switcher); + append (stack); } private Gtk.Label label (string text) { @@ -42,7 +45,10 @@ public class Monitor.SystemCPUInfoPopover : Gtk.Box { halign = Gtk.Align.START, valign = Gtk.Align.CENTER, wrap = true, - margin = 6, + margin_top = 6, + margin_bottom = 6, + margin_start = 6, + margin_end = 6, }; return label; @@ -53,31 +59,31 @@ public class Monitor.SystemCPUInfoPopover : Gtk.Box { activate_on_single_click = false }; - listbox.add (label (_("Model:") + " " + cpu.model)); - listbox.add (label (_("Family:") + " " + cpu.family)); - listbox.add (label (_("Microcode ver.:") + " " + cpu.microcode)); - listbox.add (label (_("Bogomips:") + " " + cpu.bogomips)); + listbox.append (label (_("Model:") + " " + cpu.model)); + listbox.append (label (_("Family:") + " " + cpu.family)); + listbox.append (label (_("Microcode ver.:") + " " + cpu.microcode)); + listbox.append (label (_("Bogomips:") + " " + cpu.bogomips)); if (cpu.core_list[0].caches.has_key ("L1Instruction")) { var value = cpu.cache_multipliers["L1Instruction"].to_string () + "×" + cpu.core_list[0].caches["L1Instruction"].size; - listbox.add (label (_("L1 Instruction cache: ") + value)); + listbox.append (label (_("L1 Instruction cache: ") + value)); } if (cpu.core_list[0].caches.has_key ("L1Data")) { var value = cpu.cache_multipliers["L1Data"].to_string () + "×" + cpu.core_list[0].caches["L1Data"].size; - listbox.add (label (_("L1 Data cache: ") + value)); + listbox.append (label (_("L1 Data cache: ") + value)); } if (cpu.core_list[0].caches.has_key ("L1")) { var value = cpu.cache_multipliers["L1"].to_string () + "×" + cpu.core_list[0].caches["L1"].size; - listbox.add (label (_("L1 cache: ") + value)); + listbox.append (label (_("L1 cache: ") + value)); } if (cpu.core_list[0].caches.has_key ("L2")) { - listbox.add (label (_("L2 Cache size: ") + cpu.cache_multipliers["L2"].to_string () + "×" + cpu.core_list[0].caches["L2"].size)); + listbox.append (label (_("L2 Cache size: ") + cpu.cache_multipliers["L2"].to_string () + "×" + cpu.core_list[0].caches["L2"].size)); } if (cpu.core_list[0].caches.has_key ("L3")) { - listbox.add (label (_("L3 Cache size: ") + cpu.cache_multipliers["L3"].to_string () + "×" + cpu.core_list[0].caches["L3"].size)); + listbox.append (label (_("L3 Cache size: ") + cpu.cache_multipliers["L3"].to_string () + "×" + cpu.core_list[0].caches["L3"].size)); } - listbox.add (label (_("Address sizes: ") + cpu.address_sizes)); + listbox.append (label (_("Address sizes: ") + cpu.address_sizes)); return listbox; } @@ -88,11 +94,12 @@ public class Monitor.SystemCPUInfoPopover : Gtk.Box { }; foreach (var feature in cpu.features) { - listbox.add (create_row (feature.key, feature.value)); + listbox.append (create_row (feature.key, feature.value)); } - var scrolled_window = new Gtk.ScrolledWindow (null, null); - scrolled_window.add (listbox); + var scrolled_window = new Gtk.ScrolledWindow () { + child = listbox + }; return scrolled_window; } @@ -103,11 +110,12 @@ public class Monitor.SystemCPUInfoPopover : Gtk.Box { }; foreach (var bug in cpu.bugs) { - listbox.add (create_row (bug.key, bug.value)); + listbox.append (create_row (bug.key, bug.value)); } - var scrolled_window = new Gtk.ScrolledWindow (null, null); - scrolled_window.add (listbox); + var scrolled_window = new Gtk.ScrolledWindow () { + child = listbox + }; return scrolled_window; } @@ -122,14 +130,17 @@ public class Monitor.SystemCPUInfoPopover : Gtk.Box { halign = Gtk.Align.START, valign = Gtk.Align.CENTER, wrap = true, - margin = 6, + margin_top = 6, + margin_bottom = 6, + margin_start = 6, + margin_end = 6, }; flag_label.get_style_context ().add_class ("flags_badge"); grid.attach (flag_label, 0, 0, 1, 1); grid.attach (label (flag_description), 1, 0, 1, 1); - row.add (grid); + row.set_child (grid); return row; } diff --git a/src/Views/SystemView/SystemCPUView.vala b/src/Views/SystemView/SystemCPUView.vala index 6c9df8db..9ed4a17e 100644 --- a/src/Views/SystemView/SystemCPUView.vala +++ b/src/Views/SystemView/SystemCPUView.vala @@ -14,18 +14,25 @@ public class Monitor.SystemCPUView : Monitor.WidgetResource { private Gtk.Grid grid_temperature_info = new Gtk.Grid (); - private Gee.ArrayList core_label_list; + private Gee.ArrayList core_label_list; construct { core_label_list = new Gee.ArrayList (); - cpu_frequency_label = new LabelRoundy (_("Frequency")); - cpu_frequency_label.margin = 6; - cpu_frequency_label.margin_top = 2; + cpu_frequency_label = new LabelRoundy (_("Frequency")) { + margin_top = 2, + margin_bottom = 6, + margin_start = 6, + margin_end = 6, + }; + + cpu_temperature_label = new LabelRoundy (_("Temperature")) { + margin_top = 2, + margin_bottom = 6, + margin_start = 6, + margin_end = 6, + }; - cpu_temperature_label = new LabelRoundy (_("Temperature")); - cpu_temperature_label.margin = 6; - cpu_temperature_label.margin_top = 2; cpu_frequency_chart = new Chart (1); cpu_frequency_chart.set_serie_color (0, Utils.Colors.get_rgba_color (Utils.Colors.LIME_500)); @@ -75,12 +82,12 @@ public class Monitor.SystemCPUView : Monitor.WidgetResource { public void update () { cpu_frequency_chart.update (0, cpu.frequency); - // int temperature_index = 0; - // foreach (var temperature in cpu.paths_temperatures.values) { - // debug (temperature.input); - // cpu_temperature_chart.update (temperature_index, int.parse (temperature.input) / 1000); - // temperature_index++; - // }] + // int temperature_index = 0; + // foreach (var temperature in cpu.paths_temperatures.values) { + // debug (temperature.input); + // cpu_temperature_chart.update (temperature_index, int.parse (temperature.input) / 1000); + // temperature_index++; + // }] cpu_temperature_chart.update (0, cpu.temperature_mean); cpu_temperature_label.set_text (("%.2f %s").printf (cpu.temperature_mean, _("℃"))); @@ -135,7 +142,10 @@ public class Monitor.SystemCPUView : Monitor.WidgetResource { Gtk.Grid grid = new Gtk.Grid () { column_spacing = 8, row_spacing = 4, - margin = 6 + margin_top = 6, + margin_bottom = 6, + margin_start = 6, + margin_end = 6, }; int column = 0; @@ -161,4 +171,5 @@ public class Monitor.SystemCPUView : Monitor.WidgetResource { return grid; } + } diff --git a/src/Views/SystemView/SystemGPUView.vala b/src/Views/SystemView/SystemGPUView.vala index 2891145b..46b614ac 100644 --- a/src/Views/SystemView/SystemGPUView.vala +++ b/src/Views/SystemView/SystemGPUView.vala @@ -14,13 +14,18 @@ public class Monitor.SystemGPUView : Monitor.WidgetResource { construct { - gpu_vram_percentage_label = new LabelRoundy (_("VRAM")); - gpu_vram_percentage_label.margin = 6; - gpu_vram_percentage_label.margin_top = 2; - - gpu_temperature_label = new LabelRoundy (_("TEMPERATURE")); - gpu_temperature_label.margin = 6; - gpu_temperature_label.margin_top = 2; + gpu_vram_percentage_label = new LabelRoundy (_("VRAM")){ + margin_top = 2, + margin_bottom = 6, + margin_start = 6, + margin_end = 6 + }; + gpu_temperature_label = new LabelRoundy (_("TEMPERATURE")) { + margin_top = 2, + margin_bottom = 6, + margin_start = 6, + margin_end = 6 + }; gpu_vram_percentage_chart = new Chart (1); gpu_vram_percentage_chart.set_serie_color (0, Utils.Colors.get_rgba_color (Utils.Colors.LIME_500)); @@ -68,7 +73,10 @@ public class Monitor.SystemGPUView : Monitor.WidgetResource { Gtk.Grid grid = new Gtk.Grid () { column_spacing = 8, row_spacing = 4, - margin = 6 + margin_top = 6, + margin_bottom = 6, + margin_start = 6, + margin_end = 6 }; return grid; diff --git a/src/Views/SystemView/SystemNetworkView.vala b/src/Views/SystemView/SystemNetworkView.vala index 010821d4..47fa850b 100644 --- a/src/Views/SystemView/SystemNetworkView.vala +++ b/src/Views/SystemView/SystemNetworkView.vala @@ -12,7 +12,10 @@ public class Monitor.SystemNetworkView : Gtk.Grid { private LabelRoundy network_download_label; construct { - margin = 12; + margin_top = 12; + margin_bottom = 12; + margin_start = 12; + margin_end = 12; column_spacing = 12; set_vexpand (false); } @@ -36,10 +39,14 @@ public class Monitor.SystemNetworkView : Gtk.Grid { network_chart.set_serie_color (0, { 155 / 255.0, 219 / 255.0, 77 / 255.0, 1.0 }); network_chart.set_serie_color (1, { 100 / 255.0, 186 / 255.0, 255 / 255.0, 1.0 }); - var labels_grid = new Gtk.Grid (); - labels_grid.row_spacing = 6; - labels_grid.column_spacing = 6; - labels_grid.margin = 6; + var labels_grid = new Gtk.Grid () { + margin_top = 6, + margin_bottom = 6, + margin_start = 6, + margin_end = 6, + row_spacing = 6, + }; + labels_grid.attach (network_download_label, 0, 0, 1, 1); labels_grid.attach (network_upload_label, 1, 0, 1, 1); diff --git a/src/Views/SystemView/SystemStorageView.vala b/src/Views/SystemView/SystemStorageView.vala index 0bd40ca5..c919388c 100644 --- a/src/Views/SystemView/SystemStorageView.vala +++ b/src/Views/SystemView/SystemStorageView.vala @@ -14,7 +14,10 @@ public class Monitor.SystemStorageView : Gtk.Grid { private Gtk.Box drive_cards_container; construct { - margin = 12; + margin_top = 12; + margin_bottom = 12; + margin_start = 12; + margin_end = 12; column_spacing = 12; set_vexpand (false); } @@ -40,7 +43,10 @@ public class Monitor.SystemStorageView : Gtk.Grid { var labels_grid = new Gtk.Grid (); labels_grid.row_spacing = 6; labels_grid.column_spacing = 6; - labels_grid.margin = 6; + labels_grid.margin_top = 6; + labels_grid.margin_bottom = 6; + labels_grid.margin_start = 6; + labels_grid.margin_end = 6; labels_grid.attach (storage_write_label, 0, 0, 1, 1); labels_grid.attach (storage_read_label, 1, 0, 1, 1); @@ -55,7 +61,7 @@ public class Monitor.SystemStorageView : Gtk.Grid { } private bool add_drive_card (owned Disk ? drive) { - drive_cards_container.add (build_drive_card (drive.model, drive.device, drive.size, drive.free)); + drive_cards_container.append (build_drive_card (drive.model, drive.device, drive.size, drive.free)); return true; } @@ -72,11 +78,16 @@ public class Monitor.SystemStorageView : Gtk.Grid { var drive_grid = new Gtk.Grid (); // drive_grid.row_spacing = 6; drive_grid.column_spacing = 6; - drive_grid.margin = 6; + drive_grid.margin_top = 6; + drive_grid.margin_bottom = 6; + drive_grid.margin_start = 6; + drive_grid.margin_end = 6; var drive_name_label = new Gtk.Label (model); drive_name_label.get_style_context ().add_class ("h3"); - drive_name_label.margin = 6; + drive_name_label.margin_start = 6; + drive_name_label.margin_end = 6; + drive_name_label.margin_top = 6; drive_name_label.margin_bottom = 0; drive_name_label.halign = Gtk.Align.START; @@ -90,7 +101,9 @@ public class Monitor.SystemStorageView : Gtk.Grid { var drive_block_name_and_size_label = new Gtk.Label (drive_block_name_and_size_string); drive_block_name_and_size_label.get_style_context ().add_class ("h4"); drive_block_name_and_size_label.get_style_context ().add_class ("text-secondary"); - drive_block_name_and_size_label.margin = 6; + drive_block_name_and_size_label.margin_bottom = 6; + drive_block_name_and_size_label.margin_start = 6; + drive_block_name_and_size_label.margin_end = 6; drive_block_name_and_size_label.margin_top = 0; drive_block_name_and_size_label.halign = Gtk.Align.START; @@ -99,12 +112,17 @@ public class Monitor.SystemStorageView : Gtk.Grid { drive_not_mounted_label.get_style_context ().add_class ("h4"); drive_not_mounted_label.margin_start = 6; - var usagebar = new Gtk.LevelBar (); + var usagebar = new Gtk.LevelBar () { + margin_top = 0, + margin_bottom = 6, + margin_start = 6, + margin_end = 6, + + max_value = 100.0, + min_value = 0.0, + }; usagebar.get_style_context ().add_class ("flat"); - usagebar.margin = 6; - usagebar.margin_top = 0; - usagebar.set_max_value (100.0); - usagebar.set_min_value (0.0); + usagebar.set_value (100.0 * (size - free) / size); drive_grid.attach (drive_name_label, 0, 0, 1, 1); @@ -114,7 +132,7 @@ public class Monitor.SystemStorageView : Gtk.Grid { } else { drive_grid.attach (usagebar, 0, 2, 1, 1); } - drive_card.add (drive_grid); + drive_card.append (drive_grid); return drive_card; } diff --git a/src/Views/SystemView/SystemView.vala b/src/Views/SystemView/SystemView.vala index ab320b64..cf07ac3b 100644 --- a/src/Views/SystemView/SystemView.vala +++ b/src/Views/SystemView/SystemView.vala @@ -25,28 +25,31 @@ public class Monitor.SystemView : Gtk.Box { network_view = new SystemNetworkView (resources.network); storage_view = new SystemStorageView (resources.storage); - var scrolled_window = new Gtk.ScrolledWindow (null, null); - var wrapper = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); - wrapper.expand = true; - scrolled_window.add (wrapper); + var wrapper = new Gtk.Box (Gtk.Orientation.VERTICAL, 0) { + hexpand = true, + vexpand = true + }; + var scrolled_window = new Gtk.ScrolledWindow () { + child = wrapper + }; - wrapper.add (cpu_view); - wrapper.add (memory_view); - wrapper.add (network_view); - wrapper.add (storage_view); + wrapper.append (cpu_view); + wrapper.append (memory_view); + wrapper.append (network_view); + wrapper.append (storage_view); foreach (IGPU gpu in resources.gpu_list) { if (gpu is GPUIntel || gpu is GPUNvidia) { - wrapper.add (build_no_support_label (gpu.name)); + wrapper.append (build_no_support_label (gpu.name)); } else { var gpu_view = new SystemGPUView (gpu); gpu_views.append (gpu_view); - wrapper.add (gpu_view); + wrapper.append (gpu_view); } } - add (scrolled_window); + append (scrolled_window); } public void update () { @@ -60,7 +63,10 @@ public class Monitor.SystemView : Gtk.Box { private Granite.HeaderLabel build_no_support_label (string gpu_name) { string notification_text = _("The %s GPU was detected, but is not yet supported.").printf (gpu_name); return new Granite.HeaderLabel (notification_text) { - margin = 12, + margin_start = 12, + margin_end = 12, + margin_top = 12, + margin_bottom = 12, }; } diff --git a/src/Widgets/Labels/LabelVertical.vala b/src/Widgets/Labels/LabelVertical.vala index 7441ecc3..985e9214 100644 --- a/src/Widgets/Labels/LabelVertical.vala +++ b/src/Widgets/Labels/LabelVertical.vala @@ -3,7 +3,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -public class Monitor.LabelVertical : Gtk.EventBox { +public class Monitor.LabelVertical : Gtk.Box { private Gtk.Grid grid; public signal void clicked (); @@ -29,14 +29,18 @@ public class Monitor.LabelVertical : Gtk.EventBox { grid.attach (desc, 0, 0, 1, 1); grid.attach (val, 0, 1, 1, 1); - add (grid); + append (grid); - events |= Gdk.EventMask.BUTTON_RELEASE_MASK; + // @TODO: Find out why it was here. + // It is probably a remainings of expandable label, + // which is not a thing anymore. - button_release_event.connect ((event) => { - clicked (); - return false; - }); + // events |= Gdk.EventMask.BUTTON_RELEASE_MASK; + + // button_release_event.connect ((event) => { + // clicked (); + // return false; + // }); } public void set_text (string text) { diff --git a/src/Widgets/Statusbar/Statusbar.vala b/src/Widgets/Statusbar/Statusbar.vala index 24f9f0c5..0c09dfc0 100644 --- a/src/Widgets/Statusbar/Statusbar.vala +++ b/src/Widgets/Statusbar/Statusbar.vala @@ -10,19 +10,19 @@ public class Monitor.Statusbar : Gtk.ActionBar { Gtk.Label gpu_usage_label; construct { - var cpu_icon = new Gtk.Image.from_icon_name ("cpu-symbolic", Gtk.IconSize.SMALL_TOOLBAR) { + var cpu_icon = new Gtk.Image.from_icon_name ("cpu-symbolic") { tooltip_text = _("CPU") }; - var ram_icon = new Gtk.Image.from_icon_name ("ram-symbolic", Gtk.IconSize.SMALL_TOOLBAR) { + var ram_icon = new Gtk.Image.from_icon_name ("ram-symbolic") { tooltip_text = _("Memory") }; - var swap_icon = new Gtk.Image.from_icon_name ("swap-symbolic", Gtk.IconSize.SMALL_TOOLBAR) { + var swap_icon = new Gtk.Image.from_icon_name ("swap-symbolic") { tooltip_text = _("Swap") }; - var gpu_icon = new Gtk.Image.from_icon_name ("gpu-symbolic", Gtk.IconSize.SMALL_TOOLBAR) { + var gpu_icon = new Gtk.Image.from_icon_name ("gpu-symbolic") { tooltip_text = _("GPU") }; diff --git a/src/Widgets/WidgetResource/WidgetResource.vala b/src/Widgets/WidgetResource/WidgetResource.vala index 86020a88..cab7a12d 100644 --- a/src/Widgets/WidgetResource/WidgetResource.vala +++ b/src/Widgets/WidgetResource/WidgetResource.vala @@ -99,7 +99,7 @@ public class Monitor.WidgetResource : Gtk.Box { popover_more_info.closed.connect (() => { button_more_info.set_active (false); }); button_more_info.clicked.connect (() => { popover_more_info.show_all (); }); - popover_more_info.add (widget); + popover_more_info.set_child (widget); grid_header.attach (button_more_info, 1, 0, 1, 1); } From 185e7d7372d58a089f57baa4b6e1252eaec34fd1 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Sat, 17 May 2025 17:13:51 +0200 Subject: [PATCH 03/42] =?UTF-8?q?livechart-1=20=E2=86=92=20livechart-2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- meson.build | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index bdcae9c8..2b042228 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ Monitor will be available from the Applications menu. If you plan to install WITH a wingpanel-indicator ```bash -sudo apt install build-essential cmake sassc valac libgtk-3-dev libgee-0.8-dev libgranite-dev libgtop2-dev libwnck-3-dev libhandy-1-dev libudisks2-dev libjson-glib-dev libflatpak-dev libxnvctrl-dev liblivechart-1-dev libpci-dev libwingpanel-dev +sudo apt install build-essential cmake sassc valac libgtk-3-dev libgee-0.8-dev libgranite-dev libgtop2-dev libwnck-3-dev libhandy-1-dev libudisks2-dev libjson-glib-dev libflatpak-dev libxnvctrl-dev liblivechart-2-dev libpci-dev libwingpanel-dev ``` Alternatively, if you plan to install WITHOUT a wingpanel-indicator diff --git a/meson.build b/meson.build index ef8219d4..5edc51a0 100644 --- a/meson.build +++ b/meson.build @@ -36,10 +36,9 @@ app_dependencies = [ dependency('json-glib-1.0'), dependency('flatpak'), - # FIXME Bump required version to >= 1.10.0 when GTK 4 porting dependency( - 'livechart', - version: '< 1.10.0', + 'livechart-2', + version: '>= 1.10.0', fallback: ['live-chart', 'livechart_dep'], ), From c94a754956dffe3eb74632755399af02dc194110 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Sat, 17 May 2025 19:46:19 +0200 Subject: [PATCH 04/42] GTK4 wip --- src/Services/Appearance.vala | 2 +- .../ProcessInfoView/Preventor.vala | 8 ++-- .../ProcessInfoView/ProcessInfoCPURAM.vala | 4 +- .../ProcessInfoView/ProcessInfoHeader.vala | 14 +++---- .../ProcessInfoView/ProcessInfoIOStats.vala | 5 ++- .../ProcessInfoView/ProcessInfoView.vala | 42 ++++++++++++------- .../ProcessTreeView/CPUProcessTreeView.vala | 2 +- src/Views/ProcessView/ProcessView.vala | 23 ++++++---- src/Views/SystemView/SystemMemoryView.vala | 5 ++- src/Views/SystemView/SystemNetworkView.vala | 4 +- src/Views/SystemView/SystemStorageView.vala | 4 +- src/Widgets/Chart/Chart.vala | 10 +++-- src/Widgets/Headerbar/Search.vala | 9 ++-- .../WidgetResource/WidgetResource.vala | 40 +++++++++--------- 14 files changed, 100 insertions(+), 72 deletions(-) diff --git a/src/Services/Appearance.vala b/src/Services/Appearance.vala index 36e8276f..1089a3a5 100644 --- a/src/Services/Appearance.vala +++ b/src/Services/Appearance.vala @@ -20,7 +20,7 @@ public class Monitor.Appearance : Object { provider.load_from_resource ("/io/elementary/monitor/monitor-light.css"); } - Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + Gtk.StyleContext.add_provider_for_display (Gdk.Display.get_default (), provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); // We listen to changes in Granite.Settings and update our app if the user changes their preference granite_settings.notify["prefers-color-scheme"].connect (() => { diff --git a/src/Views/ProcessView/ProcessInfoView/Preventor.vala b/src/Views/ProcessView/ProcessInfoView/Preventor.vala index 36f6f47e..db190e88 100644 --- a/src/Views/ProcessView/ProcessInfoView/Preventor.vala +++ b/src/Views/ProcessView/ProcessInfoView/Preventor.vala @@ -27,13 +27,13 @@ public class Monitor.Preventor : Gtk.Stack { confirm_button = new Gtk.Button.with_label (_("Yes")); confirm_button.margin_end = 10; - confirm_button.get_style_context ().add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION); + confirm_button.get_style_context ().add_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); deny_button = new Gtk.Button.with_label (_("No")); - preventive_action_bar.add (confirmation_label); - preventive_action_bar.add (confirm_button); - preventive_action_bar.add (deny_button); + preventive_action_bar.append (confirmation_label); + preventive_action_bar.append (confirm_button); + preventive_action_bar.append (deny_button); } public Preventor (Gtk.Widget _child, string name) { diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoCPURAM.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoCPURAM.vala index d1fd6000..b1d6e82e 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoCPURAM.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoCPURAM.vala @@ -26,10 +26,10 @@ public class Monitor.ProcessInfoCPURAM : Gtk.Grid { ram_chart.height_request = 60; var cpu_graph_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); - cpu_graph_box.add (cpu_chart); + cpu_graph_box.append (cpu_chart); var mem_graph_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); - mem_graph_box.add (ram_chart); + mem_graph_box.append (ram_chart); cpu_label = new Gtk.Label ("CPU: " + Utils.NO_DATA); cpu_label.get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL); diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala index 38975d41..ee112c4c 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala @@ -25,7 +25,7 @@ public class Monitor.ProcessInfoHeader : Gtk.Grid { regex = /(?i:^.*\.(xpm|png)$)/; // vala-lint=space-before-paren, /* *INDENT-ON* */ - icon = new Gtk.Image.from_icon_name ("application-x-executable", Gtk.IconSize.DIALOG); + icon = new Gtk.Image.from_icon_name ("application-x-executable"); icon.set_pixel_size (64); icon.valign = Gtk.Align.END; @@ -55,11 +55,11 @@ public class Monitor.ProcessInfoHeader : Gtk.Grid { username = new LabelRoundy (""); var wrapper = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); - wrapper.add (pid); - wrapper.add (priority); - wrapper.add (nice); - wrapper.add (num_threads); - wrapper.add (username); + wrapper.append (pid); + wrapper.append (priority); + wrapper.append (nice); + wrapper.append (num_threads); + wrapper.append (username); attach (icon_container, 0, 0, 1, 2); attach (application_name, 1, 0, 3, 1); @@ -101,7 +101,7 @@ public class Monitor.ProcessInfoHeader : Gtk.Grid { var icon_name = process.icon.to_string (); if (!regex.match (icon_name)) { - icon.set_from_icon_name (icon_name, Gtk.IconSize.DIALOG); + icon.set_from_icon_name (icon_name); } else { try { var pixbuf = new Gdk.Pixbuf.from_file_at_size (icon_name, 48, -1); diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala index 6281ca53..5fafe957 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala @@ -54,9 +54,10 @@ public class Monitor.ProcessInfoIOStats : Gtk.Grid { // attach (opened_files_label, 0, 3, 3, 1); var model = new OpenFilesTreeViewModel (); - var open_files_tree_view_scrolled = new Gtk.ScrolledWindow (null, null); + var open_files_tree_view_scrolled = new Gtk.ScrolledWindow () { + child = open_files_tree_view + }; open_files_tree_view = new OpenFilesTreeView (model); - open_files_tree_view_scrolled.add (open_files_tree_view); attach (open_files_tree_view_scrolled, 0, 4, 3, 1); } diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala index 7fa5d92b..45c66f81 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala @@ -21,7 +21,8 @@ public class Monitor.ProcessInfoView : Gtk.Box { process_info_header.update (_process); - this.show_all (); + // @TODO: Find workaround for show_all() in PRocessInfoView + // this.show_all (); if (_process.uid != Posix.getuid ()) { process_info_cpu_ram.hide (); process_info_io_stats.hide (); @@ -37,7 +38,8 @@ public class Monitor.ProcessInfoView : Gtk.Box { permission_error_infobar.revealed = false; process_info_io_stats.open_files_tree_view.model.process = _process; - process_info_io_stats.open_files_tree_view.show_all (); + // @TODO: Find workaround for show_all() in PRocessInfoView + // process_info_io_stats.open_files_tree_view.show_all (); } } } @@ -60,22 +62,28 @@ public class Monitor.ProcessInfoView : Gtk.Box { permission_error_infobar.message_type = Gtk.MessageType.ERROR; permission_error_infobar.revealed = false; permission_error_label = new Gtk.Label (Utils.NO_DATA); - permission_error_infobar.get_content_area ().add (permission_error_label); - add (permission_error_infobar); + permission_error_infobar.add_child (permission_error_label); + append (permission_error_infobar); var grid = new Gtk.Grid () { - margin = 12, + margin_top = 12, + margin_bottom = 12, + margin_start = 12, + margin_end = 12, hexpand = true, column_spacing = 12 }; - add (grid); + append (grid); process_info_header = new ProcessInfoHeader (); grid.attach (process_info_header, 0, 0, 1, 1); var separator = new Gtk.Separator (Gtk.Orientation.HORIZONTAL) { - margin = 12, + margin_top = 12, + margin_bottom = 12, + margin_start = 12, + margin_end = 12, hexpand = true }; grid.attach (separator, 0, 1, 1, 1); @@ -96,35 +104,37 @@ public class Monitor.ProcessInfoView : Gtk.Box { end_process_button.margin_end = 10; end_process_button.tooltip_markup = Granite.markup_accel_tooltip ({ "E" }, _("End selected process")); var end_process_button_context = end_process_button.get_style_context (); - end_process_button_context.add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); + end_process_button_context.add_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); kill_process_button = new Gtk.Button.with_label (_("Kill Process")); kill_process_button.tooltip_markup = Granite.markup_accel_tooltip ({ "K" }, _("Kill selected process")); var kill_process_button_context = kill_process_button.get_style_context (); - kill_process_button_context.add_class (Gtk.STYLE_CLASS_DESTRUCTIVE_ACTION); + kill_process_button_context.add_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); - process_action_bar.add (end_process_button); - process_action_bar.add (kill_process_button); + process_action_bar.append (end_process_button); + process_action_bar.append (kill_process_button); preventor = new Preventor (process_action_bar, "process_action_bar"); kill_process_button.clicked.connect (() => { preventor.set_prevention (_("Confirm kill of the process?")); preventor.confirmed.connect ((is_confirmed) => { - if (is_confirmed) process.kill (); // maybe add a toast that process killed + if (is_confirmed)process.kill (); // maybe add a toast that process killed }); }); end_process_button.clicked.connect (() => { preventor.set_prevention (_("Confirm end of the process?")); preventor.confirmed.connect ((is_confirmed) => { - if (is_confirmed) process.end (); // maybe add a toast that process ended + if (is_confirmed)process.end (); // maybe add a toast that process ended }); }); grid.attach (preventor, 0, 5, 1, 1); - show_all (); + // @TODO: Find workaround for show_all() in PRocessInfoView + + // show_all (); process_info_cpu_ram.hide (); process_info_io_stats.hide (); preventor.hide (); @@ -144,7 +154,9 @@ public class Monitor.ProcessInfoView : Gtk.Box { process_info_io_stats.update (process); process_info_io_stats.open_files_tree_view.model.process = _process; - process_info_io_stats.open_files_tree_view.show_all (); + // @TODO: Find workaround for show_all() in PRocessInfoView + + // process_info_io_stats.open_files_tree_view.show_all (); } } diff --git a/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala b/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala index 4d6d12f3..c3246886 100644 --- a/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala +++ b/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala @@ -95,7 +95,7 @@ public class Monitor.CPUProcessTreeView : Gtk.TreeView { insert_action_group ("process", action_group); - var key_controller = new Gtk.EventControllerKey (this); + var key_controller = new Gtk.EventControllerKey (); key_controller.key_released.connect ((keyval, keycode, state) => { switch (keyval) { case Gdk.Key.Left: diff --git a/src/Views/ProcessView/ProcessView.vala b/src/Views/ProcessView/ProcessView.vala index 450992e7..8c5e0d40 100644 --- a/src/Views/ProcessView/ProcessView.vala +++ b/src/Views/ProcessView/ProcessView.vala @@ -13,7 +13,8 @@ public class Monitor.ProcessView : Gtk.Box { process_info_view = new ProcessInfoView (); // hide on startup - process_info_view.no_show_all = true; + // @TODO: Figure out how to no_show_all in GTK4 + // process_info_view.no_show_all = true; } public ProcessView () { @@ -23,22 +24,26 @@ public class Monitor.ProcessView : Gtk.Box { process_tree_view.process_selected.connect ((process) => on_process_selected (process)); // making tree view scrollable - var process_tree_view_scrolled = new Gtk.ScrolledWindow (null, null); - process_tree_view_scrolled.add (process_tree_view); + var process_tree_view_scrolled = new Gtk.ScrolledWindow () { + child = process_tree_view + }; var paned = new Gtk.Paned (Gtk.Orientation.HORIZONTAL); - paned.pack1 (process_tree_view_scrolled, true, false); - paned.pack2 (process_info_view, false, false); - // paned.set_min_position (200); - paned.set_position (paned.max_position); + paned.set_start_child (process_tree_view_scrolled); + // paned.set_end_child (process_info_view); + paned.set_shrink_end_child (false); + paned.set_resize_end_child (false); + paned.set_position (paned.max_position - 200); paned.set_hexpand (true); - add (paned); + append (paned); } public void on_process_selected (Process process) { process_info_view.process = process; - process_info_view.no_show_all = false; + + // @TODO: Figure out how to no_show_all in GTK4 + // process_info_view.no_show_all = true; // process_info_view.show_all (); } diff --git a/src/Views/SystemView/SystemMemoryView.vala b/src/Views/SystemView/SystemMemoryView.vala index 30ac693f..dc7d1cda 100644 --- a/src/Views/SystemView/SystemMemoryView.vala +++ b/src/Views/SystemView/SystemMemoryView.vala @@ -41,7 +41,10 @@ public class Monitor.SystemMemoryView : Monitor.WidgetResource { Gtk.Grid grid = new Gtk.Grid () { column_spacing = 8, row_spacing = 4, - margin = 6 + margin_top = 6, + margin_bottom = 6, + margin_start = 6, + margin_end = 6, }; grid.attach (memory_used_label, 0, 0, 1, 1); diff --git a/src/Views/SystemView/SystemNetworkView.vala b/src/Views/SystemView/SystemNetworkView.vala index 47fa850b..b2ff5663 100644 --- a/src/Views/SystemView/SystemNetworkView.vala +++ b/src/Views/SystemView/SystemNetworkView.vala @@ -36,8 +36,8 @@ public class Monitor.SystemNetworkView : Gtk.Grid { network_chart = new Chart (2); network_chart.config.y_axis.fixed_max = null; - network_chart.set_serie_color (0, { 155 / 255.0, 219 / 255.0, 77 / 255.0, 1.0 }); - network_chart.set_serie_color (1, { 100 / 255.0, 186 / 255.0, 255 / 255.0, 1.0 }); + network_chart.set_serie_color (0, { 155 / 255.0f, 219 / 255.0f, 77 / 255.0f, 1.0f }); + network_chart.set_serie_color (1, { 100 / 255.0f, 186 / 255.0f, 255 / 255.0f, 1.0f }); var labels_grid = new Gtk.Grid () { margin_top = 6, diff --git a/src/Views/SystemView/SystemStorageView.vala b/src/Views/SystemView/SystemStorageView.vala index c919388c..18f7f64f 100644 --- a/src/Views/SystemView/SystemStorageView.vala +++ b/src/Views/SystemView/SystemStorageView.vala @@ -37,8 +37,8 @@ public class Monitor.SystemStorageView : Gtk.Grid { storage_chart = new Chart (2); storage_chart.config.y_axis.fixed_max = null; - storage_chart.set_serie_color (0, { 155 / 255.0, 219 / 255.0, 77 / 255.0, 1.0 }); - storage_chart.set_serie_color (1, { 100 / 255.0, 186 / 255.0, 255 / 255.0, 1.0 }); + storage_chart.set_serie_color (0, { 155 / 255.0f, 219 / 255.0f, 77 / 255.0f, 1.0f }); + storage_chart.set_serie_color (1, { 100 / 255.0f, 186 / 255.0f, 255 / 255.0f, 1.0f }); var labels_grid = new Gtk.Grid (); labels_grid.row_spacing = 6; diff --git a/src/Widgets/Chart/Chart.vala b/src/Widgets/Chart/Chart.vala index 7133f44c..17662def 100644 --- a/src/Widgets/Chart/Chart.vala +++ b/src/Widgets/Chart/Chart.vala @@ -31,8 +31,10 @@ public class Monitor.Chart : Gtk.Box { left = -1 }; - live_chart = new LiveChart.Chart (config); - live_chart.expand = true; + live_chart = new LiveChart.Chart (config) { + hexpand = true, + vexpand = true, + }; live_chart.legend.visible = false; live_chart.grid.visible = true; live_chart.background.visible = false; @@ -65,7 +67,7 @@ public class Monitor.Chart : Gtk.Box { live_chart.add_serie (serie); } - add (live_chart); + append (live_chart); return this; } @@ -78,7 +80,7 @@ public class Monitor.Chart : Gtk.Box { serie.line.color = colors.get_color_by_index (i); live_chart.add_serie (serie); } - add (live_chart); + append (live_chart); return this; } diff --git a/src/Widgets/Headerbar/Search.vala b/src/Widgets/Headerbar/Search.vala index b6b3316c..4bdcf647 100644 --- a/src/Widgets/Headerbar/Search.vala +++ b/src/Widgets/Headerbar/Search.vala @@ -29,7 +29,7 @@ public class Monitor.Search : Gtk.SearchEntry { private void connect_signal () { this.search_changed.connect (() => { // collapse tree only when search is focused and changed - if (this.is_focus) { + if (this.is_focus ()) { process_tree_view.collapse_all (); } @@ -40,7 +40,8 @@ public class Monitor.Search : Gtk.SearchEntry { this.grab_focus (); if (this.text != "") { - this.insert_at_cursor (""); + // @TODO: Investigate insert_at_cursor workaround for GTK4 + // this.insert_at_cursor (""); } }); @@ -96,7 +97,9 @@ public class Monitor.Search : Gtk.SearchEntry { public void activate_entry (string search_text = "") { this.text = ""; this.search_changed (); - this.insert_at_cursor (search_text); + + // @TODO: Investigate insert_at_cursor workaround for GTK4 + // this.insert_at_cursor (search_text); } } diff --git a/src/Widgets/WidgetResource/WidgetResource.vala b/src/Widgets/WidgetResource/WidgetResource.vala index cab7a12d..a6ce69c1 100644 --- a/src/Widgets/WidgetResource/WidgetResource.vala +++ b/src/Widgets/WidgetResource/WidgetResource.vala @@ -29,7 +29,9 @@ public class Monitor.WidgetResource : Gtk.Box { construct { - margin = 12; + margin_start = 12; + margin_end = 12; + margin_bottom = 12; margin_top = 6; set_vexpand (false); orientation = Gtk.Orientation.VERTICAL; @@ -40,22 +42,25 @@ public class Monitor.WidgetResource : Gtk.Box { column_spacing = 6, }; grid_header.attach (_title, 0, 0, 1, 1); - add (grid_header); + append (grid_header); grid_main_chart_container = new Gtk.Grid (); grid_main_chart_container.attach (build_grid_main_onchart_info_container (), 0, 0, 1, 1); - charts_container.pack_start (grid_main_chart_container, true, true, 0); + charts_container.prepend (grid_main_chart_container); - add (charts_container); + append (charts_container); } private Gtk.Grid build_grid_main_onchart_info_container () { grid_main_onchart_info_container = new Gtk.Grid () { column_spacing = 6, - margin = 6, + margin_top = 6, + margin_bottom = 6, + margin_start = 6, + margin_end = 6, valign = Gtk.Align.START, halign = Gtk.Align.START, }; @@ -75,32 +80,29 @@ public class Monitor.WidgetResource : Gtk.Box { } public void add_charts_container (Gtk.Widget widget) { - charts_container.pack_start (widget, false, false, 0); + charts_container.prepend (widget); } public void set_popover_more_info (Gtk.Widget widget) { - var button_more_info = new Gtk.ToggleButton () { - has_focus = false, + var button_more_info = new Gtk.MenuButton () { + focusable = false, valign = Gtk.Align.START, halign = Gtk.Align.START }; button_more_info.get_style_context ().add_class ("circular"); - // button_more_info.get_style_context ().add_class ("popup"); - var icon = new Gtk.Image (); - icon.gicon = new ThemedIcon ("dialog-information"); - icon.pixel_size = 16; - button_more_info.set_image (icon); + // button_more_info.get_style_context ().add_class ("popup"); - popover_more_info = new Gtk.Popover (button_more_info) { + + button_more_info.set_icon_name ("dialog-information"); + + popover_more_info = new Gtk.Popover () { position = Gtk.PositionType.BOTTOM, - modal = true, visible = false, + autohide = true, + child = widget, }; - popover_more_info.closed.connect (() => { button_more_info.set_active (false); }); - button_more_info.clicked.connect (() => { popover_more_info.show_all (); }); - - popover_more_info.set_child (widget); grid_header.attach (button_more_info, 1, 0, 1, 1); } + } From b6205d89c589a8a8a60847e96c7a7cb40e26c095 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Sat, 17 May 2025 22:03:21 +0200 Subject: [PATCH 05/42] first GTK4 run --- src/MainWindow.vala | 2 +- .../ProcessInfoView/Preventor.vala | 48 +++++++++++-------- src/Widgets/Headerbar/Search.vala | 26 +++++----- src/Widgets/Statusbar/Statusbar.vala | 33 +++++++------ 4 files changed, 63 insertions(+), 46 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 9046a52e..a462fb76 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -3,7 +3,7 @@ * SPDX-FileCopyrightText: 2025 elementary, Inc. (https://elementary.io) */ -public class Monitor.MainWindow : Adw.ApplicationWindow { +public class Monitor.MainWindow : Gtk.ApplicationWindow { private Resources resources; // Widgets diff --git a/src/Views/ProcessView/ProcessInfoView/Preventor.vala b/src/Views/ProcessView/ProcessInfoView/Preventor.vala index db190e88..d5a70d5a 100644 --- a/src/Views/ProcessView/ProcessInfoView/Preventor.vala +++ b/src/Views/ProcessView/ProcessInfoView/Preventor.vala @@ -3,31 +3,37 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -public class Monitor.Preventor : Gtk.Stack { +public class Monitor.Preventor : Gtk.Box { private Gtk.Box preventive_action_bar; private Gtk.Label confirmation_label; private Gtk.Button confirm_button; private Gtk.Button deny_button; + private Gtk.Stack stack; + private Gtk.Widget child_widget; public signal void confirmed (bool is_confirmed); construct { valign = Gtk.Align.END; + halign = Gtk.Align.END; - preventive_action_bar = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); - preventive_action_bar.valign = Gtk.Align.START; - preventive_action_bar.halign = Gtk.Align.END; - preventive_action_bar.margin_top = 10; + preventive_action_bar = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0) { + valign = Gtk.Align.START, + halign = Gtk.Align.END, + margin_top = 10 + }; - confirmation_label = new Gtk.Label (_("Are you sure you want to do this?")); - confirmation_label.margin_end = 10; + confirmation_label = new Gtk.Label (_("Are you sure you want to do this?")) { + margin_end = 10 + }; - confirm_button = new Gtk.Button.with_label (_("Yes")); - confirm_button.margin_end = 10; - confirm_button.get_style_context ().add_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); + confirm_button = new Gtk.Button.with_label (_("Yes")) { + margin_end = 10 + }; + confirm_button.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); deny_button = new Gtk.Button.with_label (_("No")); @@ -36,28 +42,30 @@ public class Monitor.Preventor : Gtk.Stack { preventive_action_bar.append (deny_button); } - public Preventor (Gtk.Widget _child, string name) { - child_widget = _child; - add_named (child_widget, name); - add_named (preventive_action_bar, "preventive_action_bar"); + public Preventor (Gtk.Widget child_widget, string name) { + stack = new Gtk.Stack (); + append (stack); + stack.add_named (child_widget, name); + stack.add_named (preventive_action_bar, "preventive_action_bar"); deny_button.clicked.connect (() => { - set_transition_type (Gtk.StackTransitionType.SLIDE_UP); - set_visible_child (child_widget); + stack.set_transition_type (Gtk.StackTransitionType.SLIDE_UP); + stack.set_visible_child (child_widget); confirmed (false); }); confirm_button.clicked.connect (() => { - set_transition_type (Gtk.StackTransitionType.SLIDE_UP); - set_visible_child (child_widget); + stack.set_transition_type (Gtk.StackTransitionType.SLIDE_UP); + stack.set_visible_child (child_widget); confirmed (true); }); } public void set_prevention (string confirmation_text) { - set_transition_type (Gtk.StackTransitionType.SLIDE_DOWN); + stack.set_transition_type (Gtk.StackTransitionType.SLIDE_DOWN); confirmation_label.set_text (_(confirmation_text)); - set_visible_child (preventive_action_bar); + stack.set_visible_child (preventive_action_bar); + preventive_action_bar.visible = true; } } diff --git a/src/Widgets/Headerbar/Search.vala b/src/Widgets/Headerbar/Search.vala index 4bdcf647..a6767a7b 100644 --- a/src/Widgets/Headerbar/Search.vala +++ b/src/Widgets/Headerbar/Search.vala @@ -3,19 +3,23 @@ * SPDX-FileCopyrightText: 2025 elementary, Inc. (https://elementary.io) */ -public class Monitor.Search : Gtk.SearchEntry { +public class Monitor.Search : Gtk.Box { public MainWindow window { get; construct; } private Gtk.TreeModelFilter filter_model; private CPUProcessTreeView process_tree_view; + private Gtk.SearchEntry search_entry; public Search (MainWindow window) { Object (window: window); } construct { + search_entry = new Gtk.SearchEntry () { + tooltip_markup = Granite.markup_accel_tooltip ({ "F" }, _("Type process name or PID to search")), + placeholder_text = _("Search Process") + }; + this.process_tree_view = window.process_view.process_tree_view; - this.placeholder_text = _("Search Process"); - this.tooltip_markup = Granite.markup_accel_tooltip ({ "F" }, _("Type process name or PID to search")); filter_model = new Gtk.TreeModelFilter (window.process_view.treeview_model, null); connect_signal (); @@ -27,9 +31,9 @@ public class Monitor.Search : Gtk.SearchEntry { } private void connect_signal () { - this.search_changed.connect (() => { + search_entry.search_changed.connect (() => { // collapse tree only when search is focused and changed - if (this.is_focus ()) { + if (search_entry.is_focus ()) { process_tree_view.collapse_all (); } @@ -39,13 +43,13 @@ public class Monitor.Search : Gtk.SearchEntry { process_tree_view.focus_on_child_row (); this.grab_focus (); - if (this.text != "") { + if (search_entry.text != "") { // @TODO: Investigate insert_at_cursor workaround for GTK4 // this.insert_at_cursor (""); } }); - activate.connect (() => { + search_entry.activate.connect (() => { window.process_view.process_tree_view.focus_on_first_row (); }); } @@ -55,7 +59,7 @@ public class Monitor.Search : Gtk.SearchEntry { int pid_haystack; string cmd_haystack; bool found = false; - var needle = this.text; + var needle = search_entry.text; // should help with assertion errors, donno // if (needle == null) return true; @@ -95,11 +99,11 @@ public class Monitor.Search : Gtk.SearchEntry { // reset filter, grab focus and insert the character public void activate_entry (string search_text = "") { - this.text = ""; - this.search_changed (); + search_entry.text = ""; + search_entry.search_changed (); // @TODO: Investigate insert_at_cursor workaround for GTK4 - // this.insert_at_cursor (search_text); + // search_entry.insert_at_cursor (search_text); } } diff --git a/src/Widgets/Statusbar/Statusbar.vala b/src/Widgets/Statusbar/Statusbar.vala index 0c09dfc0..dfe631b5 100644 --- a/src/Widgets/Statusbar/Statusbar.vala +++ b/src/Widgets/Statusbar/Statusbar.vala @@ -3,13 +3,18 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -public class Monitor.Statusbar : Gtk.ActionBar { +public class Monitor.Statusbar : Gtk.Box { Gtk.Label cpu_usage_label; Gtk.Label memory_usage_label; Gtk.Label swap_usage_label; Gtk.Label gpu_usage_label; construct { + var actionbar = new Gtk.ActionBar () { + hexpand = true, + }; + append (actionbar); + var cpu_icon = new Gtk.Image.from_icon_name ("cpu-symbolic") { tooltip_text = _("CPU") }; @@ -29,29 +34,29 @@ public class Monitor.Statusbar : Gtk.ActionBar { cpu_usage_label = new Gtk.Label (_("Calculating…")); cpu_usage_label.set_width_chars (4); cpu_usage_label.xalign = 0; - pack_start (cpu_icon); - pack_start (cpu_usage_label); + actionbar.pack_start (cpu_icon); + actionbar.pack_start (cpu_usage_label); memory_usage_label = new Gtk.Label (_("Calculating…")); memory_usage_label.set_width_chars (4); memory_usage_label.xalign = 0; ram_icon.margin_start = 6; - pack_start (ram_icon); - pack_start (memory_usage_label); + actionbar.pack_start (ram_icon); + actionbar.pack_start (memory_usage_label); swap_usage_label = new Gtk.Label (_("Calculating…")); swap_usage_label.set_width_chars (4); swap_usage_label.xalign = 0; swap_icon.margin_start = 6; - pack_start (swap_icon); - pack_start (swap_usage_label); + actionbar.pack_start (swap_icon); + actionbar.pack_start (swap_usage_label); gpu_usage_label = new Gtk.Label (_("Calculating…")); gpu_usage_label.set_width_chars (4); gpu_usage_label.xalign = 0; gpu_icon.margin_start = 6; - pack_start (gpu_icon); - pack_start (gpu_usage_label); + actionbar.pack_start (gpu_icon); + actionbar.pack_start (gpu_usage_label); var support_ua_label = new Gtk.LinkButton.with_label ("http://stand-with-ukraine.pp.ua/", _("🇺🇦")); var github_label = new Gtk.LinkButton.with_label ("https://github.com/elementary/monitor", _("Check on Github")); @@ -62,11 +67,11 @@ public class Monitor.Statusbar : Gtk.ActionBar { version_label.get_style_context ().add_class ("dim-label"); // pack_end (build_separator_middot ()); - pack_end (github_label); - pack_end (build_separator_middot ()); - pack_end (version_label); - pack_end (build_separator_middot ()); - pack_end (support_ua_label); + actionbar.pack_end (github_label); + actionbar.pack_end (build_separator_middot ()); + actionbar.pack_end (version_label); + actionbar.pack_end (build_separator_middot ()); + actionbar.pack_end (support_ua_label); } From cd7acbd1561faa824152624a80ff223be5d8c845 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Sat, 17 May 2025 22:08:47 +0200 Subject: [PATCH 06/42] bring back searchbox --- src/Widgets/Headerbar/Search.vala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Widgets/Headerbar/Search.vala b/src/Widgets/Headerbar/Search.vala index a6767a7b..73488e44 100644 --- a/src/Widgets/Headerbar/Search.vala +++ b/src/Widgets/Headerbar/Search.vala @@ -19,6 +19,8 @@ public class Monitor.Search : Gtk.Box { placeholder_text = _("Search Process") }; + append (search_entry); + this.process_tree_view = window.process_view.process_tree_view; filter_model = new Gtk.TreeModelFilter (window.process_view.treeview_model, null); From 8ee64a4bf7a171d22b8f4fb639ae5b4a69373fd1 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Sat, 17 May 2025 22:12:38 +0200 Subject: [PATCH 07/42] Update livechart in CI --- .github/workflows/ci.yml | 2 +- src/Views/SystemView/SystemGPUView.vala | 2 +- subprojects/live-chart.wrap | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2a3beb83..946ae475 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: apt install -y libgala-dev libgee-0.8-dev libglib2.0-dev libgranite-dev libgtk-4-dev libadwaita-1-dev \ libdbus-glib-1-dev libgtop2-dev libwingpanel-3.0-dev libudisks2-dev \ libxnvctrl0 libxnvctrl-dev libcurl4-gnutls-dev libflatpak-dev libjson-glib-dev \ - liblivechart-1-dev libpci-dev \ + liblivechart-2-dev libpci-dev \ meson valac sassc git - name: Build run: | diff --git a/src/Views/SystemView/SystemGPUView.vala b/src/Views/SystemView/SystemGPUView.vala index 46b614ac..a9092c9b 100644 --- a/src/Views/SystemView/SystemGPUView.vala +++ b/src/Views/SystemView/SystemGPUView.vala @@ -14,7 +14,7 @@ public class Monitor.SystemGPUView : Monitor.WidgetResource { construct { - gpu_vram_percentage_label = new LabelRoundy (_("VRAM")){ + gpu_vram_percentage_label = new LabelRoundy (_("VRAM")) { margin_top = 2, margin_bottom = 6, margin_start = 6, diff --git a/subprojects/live-chart.wrap b/subprojects/live-chart.wrap index 127b82f5..6de6241d 100644 --- a/subprojects/live-chart.wrap +++ b/subprojects/live-chart.wrap @@ -1,6 +1,6 @@ [wrap-git] url = https://github.com/elementary/live-chart.git -revision = 5a690045f2e3df1d78ff0ea1e5df6470a6760639 +revision = 1cdb953dd6313d5102e441c65be8e35c3e12cc32 depth = 1 [provide] From fa37ab4dbd02bbd87975c2f57d40266ecb13c92d Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Sun, 18 May 2025 20:10:32 +0200 Subject: [PATCH 08/42] Fix get_style_context dprecation warning --- src/MainWindow.vala | 3 +- src/Monitor.vala | 7 +++++ src/Views/PreferencesView.vala | 4 +-- .../ProcessInfoView/Preventor.vala | 2 +- .../ProcessInfoView/ProcessInfoCPURAM.vala | 4 +-- .../ProcessInfoView/ProcessInfoHeader.vala | 22 +++++++-------- .../ProcessInfoView/ProcessInfoIOStats.vala | 10 +++---- .../ProcessInfoView/ProcessInfoView.vala | 6 ++-- .../SystemView/SystemCPUInfoPopover.vala | 2 +- src/Views/SystemView/SystemCPUView.vala | 28 +++++++++---------- src/Views/SystemView/SystemStorageView.vala | 14 +++++----- src/Widgets/Chart/Chart.vala | 2 +- src/Widgets/Labels/LabelRoundy.vala | 6 ++-- src/Widgets/Labels/LabelVertical.vala | 6 ++-- src/Widgets/Statusbar/Statusbar.vala | 4 +-- .../WidgetResource/WidgetResource.vala | 4 +-- 16 files changed, 64 insertions(+), 60 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index a462fb76..3bf81e49 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -26,7 +26,7 @@ public class Monitor.MainWindow : Gtk.ApplicationWindow { title = _("Monitor"); - get_style_context ().add_class ("rounded"); + add_css_class ("rounded"); resources = new Resources (); @@ -119,7 +119,6 @@ public class Monitor.MainWindow : Gtk.ApplicationWindow { // key_press_event.connect (search.handle_event); app.window_removed.connect (() => { - int window_width, window_height; MonitorApp.settings.set_int ("window-width", get_size (Gtk.Orientation.HORIZONTAL)); MonitorApp.settings.set_int ("window-height", get_size (Gtk.Orientation.VERTICAL)); diff --git a/src/Monitor.vala b/src/Monitor.vala index 226f6b9a..8d7075dd 100644 --- a/src/Monitor.vala +++ b/src/Monitor.vala @@ -110,6 +110,13 @@ namespace Monitor { PCIUtils.LIBPCI_PATCH_VER ); + print( + "Gtk %d.%d.%d\n", + Gtk.MAJOR_VERSION, + Gtk.MINOR_VERSION, + Gtk.MICRO_VERSION + ); + // add command line options try { var opt_context = new OptionContext (""); diff --git a/src/Views/PreferencesView.vala b/src/Views/PreferencesView.vala index 63811159..e193a659 100644 --- a/src/Views/PreferencesView.vala +++ b/src/Views/PreferencesView.vala @@ -23,8 +23,8 @@ public class Monitor.PreferencesView : Gtk.Box { halign = START, margin_bottom = 6 }; - update_freq_description.get_style_context ().add_class (Granite.STYLE_CLASS_DIM_LABEL); - update_freq_description.get_style_context ().add_class (Granite.STYLE_CLASS_SMALL_LABEL); + update_freq_description.add_css_class (Granite.STYLE_CLASS_DIM_LABEL); + update_freq_description.add_css_class (Granite.STYLE_CLASS_SMALL_LABEL); update_freq_scale.add_mark (1.0, BOTTOM, _("1s")); update_freq_scale.add_mark (2.0, BOTTOM, _("2s")); diff --git a/src/Views/ProcessView/ProcessInfoView/Preventor.vala b/src/Views/ProcessView/ProcessInfoView/Preventor.vala index d5a70d5a..7155a791 100644 --- a/src/Views/ProcessView/ProcessInfoView/Preventor.vala +++ b/src/Views/ProcessView/ProcessInfoView/Preventor.vala @@ -11,7 +11,7 @@ public class Monitor.Preventor : Gtk.Box { private Gtk.Stack stack; - private Gtk.Widget child_widget; + // private Gtk.Widget child_widget; public signal void confirmed (bool is_confirmed); diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoCPURAM.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoCPURAM.vala index b1d6e82e..d4a375b6 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoCPURAM.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoCPURAM.vala @@ -32,11 +32,11 @@ public class Monitor.ProcessInfoCPURAM : Gtk.Grid { mem_graph_box.append (ram_chart); cpu_label = new Gtk.Label ("CPU: " + Utils.NO_DATA); - cpu_label.get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL); + cpu_label.add_css_class (Granite.STYLE_CLASS_H4_LABEL); cpu_label.halign = Gtk.Align.START; ram_label = new Gtk.Label ("RAM: " + Utils.NO_DATA); - ram_label.get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL); + ram_label.add_css_class (Granite.STYLE_CLASS_H4_LABEL); ram_label.halign = Gtk.Align.START; attach (cpu_label, 0, 0, 1, 1); diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala index ee112c4c..9de7fa92 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala @@ -31,14 +31,14 @@ public class Monitor.ProcessInfoHeader : Gtk.Grid { state = new Gtk.Label ("?"); state.halign = Gtk.Align.START; - state.get_style_context ().add_class ("state_badge"); + state.add_css_class ("state_badge"); var icon_container = new Gtk.Fixed (); icon_container.put (icon, 0, 0); icon_container.put (state, -5, 48); application_name = new Gtk.Label (_("N/A")); - application_name.get_style_context ().add_class ("h2"); + application_name.add_css_class ("h2"); application_name.ellipsize = Pango.EllipsizeMode.END; application_name.tooltip_text = _("N/A"); application_name.halign = Gtk.Align.START; @@ -74,17 +74,17 @@ public class Monitor.ProcessInfoHeader : Gtk.Grid { priority.set_text (process.stat.priority.to_string ()); if (process.uid == 0) { - username.val.get_style_context ().add_class ("username-root"); - username.val.get_style_context ().remove_class ("username-other"); - username.val.get_style_context ().remove_class ("username-current"); + username.val.add_css_class ("username-root"); + username.val.remove_css_class ("username-other"); + username.val.remove_css_class ("username-current"); } else if (process.uid == (int) Posix.getuid ()) { - username.val.get_style_context ().add_class ("username-current"); - username.val.get_style_context ().remove_class ("username-other"); - username.val.get_style_context ().remove_class ("username-root"); + username.val.add_css_class ("username-current"); + username.val.remove_css_class ("username-other"); + username.val.remove_css_class ("username-root"); } else { - username.val.get_style_context ().add_class ("username-other"); - username.val.get_style_context ().remove_class ("username-root"); - username.val.get_style_context ().remove_class ("username-current"); + username.val.add_css_class ("username-other"); + username.val.remove_css_class ("username-root"); + username.val.remove_css_class ("username-current"); } username.set_text (process.username); diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala index 5fafe957..dd52b8fa 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala @@ -21,26 +21,26 @@ public class Monitor.ProcessInfoIOStats : Gtk.Grid { row_homogeneous = false; var opened_files_label = create_label (_("Opened files")); - opened_files_label.get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL); + opened_files_label.add_css_class (Granite.STYLE_CLASS_H4_LABEL); opened_files_label.margin_top = 24; var characters_label = create_label (_("Characters")); - characters_label.get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL); + characters_label.add_css_class (Granite.STYLE_CLASS_H4_LABEL); rchar_label = create_label (_("N/A")); wchar_label = create_label (_("N/A")); var system_calls_label = create_label (_("System calls")); - system_calls_label.get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL); + system_calls_label.add_css_class (Granite.STYLE_CLASS_H4_LABEL); syscr_label = create_label (_("N/A")); syscw_label = create_label (_("N/A")); var io_label = create_label (_("Read/Written")); - io_label.get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL); + io_label.add_css_class (Granite.STYLE_CLASS_H4_LABEL); write_bytes_label = create_label (_("N/A")); read_bytes_label = create_label (_("N/A")); var cancelled_write_label = create_label (_("Cancelled write")); - cancelled_write_label.get_style_context ().add_class (Granite.STYLE_CLASS_H4_LABEL); + cancelled_write_label.add_css_class (Granite.STYLE_CLASS_H4_LABEL); cancelled_write_bytes_label = create_label (Utils.NO_DATA); diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala index 45c66f81..c8f092b8 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala @@ -103,13 +103,11 @@ public class Monitor.ProcessInfoView : Gtk.Box { end_process_button = new Gtk.Button.with_label (_("End Process")); end_process_button.margin_end = 10; end_process_button.tooltip_markup = Granite.markup_accel_tooltip ({ "E" }, _("End selected process")); - var end_process_button_context = end_process_button.get_style_context (); - end_process_button_context.add_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); + end_process_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); kill_process_button = new Gtk.Button.with_label (_("Kill Process")); kill_process_button.tooltip_markup = Granite.markup_accel_tooltip ({ "K" }, _("Kill selected process")); - var kill_process_button_context = kill_process_button.get_style_context (); - kill_process_button_context.add_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); + kill_process_button.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); process_action_bar.append (end_process_button); process_action_bar.append (kill_process_button); diff --git a/src/Views/SystemView/SystemCPUInfoPopover.vala b/src/Views/SystemView/SystemCPUInfoPopover.vala index 52739ab2..fef173f7 100755 --- a/src/Views/SystemView/SystemCPUInfoPopover.vala +++ b/src/Views/SystemView/SystemCPUInfoPopover.vala @@ -135,7 +135,7 @@ public class Monitor.SystemCPUInfoPopover : Gtk.Box { margin_start = 6, margin_end = 6, }; - flag_label.get_style_context ().add_class ("flags_badge"); + flag_label.add_css_class ("flags_badge"); grid.attach (flag_label, 0, 0, 1, 1); diff --git a/src/Views/SystemView/SystemCPUView.vala b/src/Views/SystemView/SystemCPUView.vala index 9ed4a17e..23ea5555 100644 --- a/src/Views/SystemView/SystemCPUView.vala +++ b/src/Views/SystemView/SystemCPUView.vala @@ -112,26 +112,26 @@ public class Monitor.SystemCPUView : Monitor.WidgetResource { string percentage_formatted = ("% 3d%%").printf ((int) core_percentage); core_label_list[i].set_text (percentage_formatted); - core_label_list[i].get_style_context ().remove_class ("core_badge-mild-warning"); - core_label_list[i].get_style_context ().remove_class ("core_badge-strong-warning"); - core_label_list[i].get_style_context ().remove_class ("core_badge-critical-warning"); + core_label_list[i].remove_css_class ("core_badge-mild-warning"); + core_label_list[i].remove_css_class ("core_badge-strong-warning"); + core_label_list[i].remove_css_class ("core_badge-critical-warning"); if (core_percentage > 75.0) { - core_label_list[i].get_style_context ().add_class ("core_badge-mild-warning"); - core_label_list[i].get_style_context ().remove_class ("core_badge-strong-warning"); - core_label_list[i].get_style_context ().remove_class ("core_badge-critical-warning"); + core_label_list[i].add_css_class ("core_badge-mild-warning"); + core_label_list[i].remove_css_class ("core_badge-strong-warning"); + core_label_list[i].remove_css_class ("core_badge-critical-warning"); } if (core_percentage > 85.0) { - core_label_list[i].get_style_context ().add_class ("core_badge-strong-warning"); - core_label_list[i].get_style_context ().remove_class ("core_badge-mild-warning"); - core_label_list[i].get_style_context ().remove_class ("core_badge-critical-warning"); + core_label_list[i].add_css_class ("core_badge-strong-warning"); + core_label_list[i].remove_css_class ("core_badge-mild-warning"); + core_label_list[i].remove_css_class ("core_badge-critical-warning"); } if (core_percentage > 90.0) { - core_label_list[i].get_style_context ().add_class ("core_badge-critical-warning"); - core_label_list[i].get_style_context ().remove_class ("core_badge-mild-warning"); - core_label_list[i].get_style_context ().remove_class ("core_badge-strong-warning"); + core_label_list[i].add_css_class ("core_badge-critical-warning"); + core_label_list[i].remove_css_class ("core_badge-mild-warning"); + core_label_list[i].remove_css_class ("core_badge-strong-warning"); } } label_vertical_main_metric = ("%d%%").printf (cpu.percentage); @@ -153,7 +153,7 @@ public class Monitor.SystemCPUView : Monitor.WidgetResource { for (int i = 0; i < cpu.core_list.size; i++) { var core_label = new Gtk.Label (Utils.NO_DATA); core_label.set_width_chars (4); - core_label.get_style_context ().add_class ("core_badge"); + core_label.add_css_class ("core_badge"); // core_label.set_text (Utils.NO_DATA); core_label_list.add (core_label); @@ -166,7 +166,7 @@ public class Monitor.SystemCPUView : Monitor.WidgetResource { } } var threads_label = new Gtk.Label (_("THREADS")); - threads_label.get_style_context ().add_class ("small-text"); + threads_label.add_css_class ("small-text"); grid.attach (threads_label, 0, -1, column, 1); return grid; diff --git a/src/Views/SystemView/SystemStorageView.vala b/src/Views/SystemView/SystemStorageView.vala index 18f7f64f..e2073c9b 100644 --- a/src/Views/SystemView/SystemStorageView.vala +++ b/src/Views/SystemView/SystemStorageView.vala @@ -67,8 +67,8 @@ public class Monitor.SystemStorageView : Gtk.Grid { private Gtk.Box build_drive_card (string model, string device, uint64 size, uint64 free) { var drive_card = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); - drive_card.get_style_context ().add_class ("card"); - drive_card.get_style_context ().add_class ("rounded"); + drive_card.add_css_class ("card"); + drive_card.add_css_class ("rounded"); drive_card.halign = Gtk.Align.START; drive_card.margin_end = 12; @@ -84,7 +84,7 @@ public class Monitor.SystemStorageView : Gtk.Grid { drive_grid.margin_end = 6; var drive_name_label = new Gtk.Label (model); - drive_name_label.get_style_context ().add_class ("h3"); + drive_name_label.add_css_class ("h3"); drive_name_label.margin_start = 6; drive_name_label.margin_end = 6; drive_name_label.margin_top = 6; @@ -99,8 +99,8 @@ public class Monitor.SystemStorageView : Gtk.Grid { if (free == 0)drive_block_name_and_size_string = "%s 𐄁 %s".printf (device, size_string); var drive_block_name_and_size_label = new Gtk.Label (drive_block_name_and_size_string); - drive_block_name_and_size_label.get_style_context ().add_class ("h4"); - drive_block_name_and_size_label.get_style_context ().add_class ("text-secondary"); + drive_block_name_and_size_label.add_css_class ("h4"); + drive_block_name_and_size_label.add_css_class ("text-secondary"); drive_block_name_and_size_label.margin_bottom = 6; drive_block_name_and_size_label.margin_start = 6; drive_block_name_and_size_label.margin_end = 6; @@ -109,7 +109,7 @@ public class Monitor.SystemStorageView : Gtk.Grid { var drive_not_mounted_label = new Gtk.Label (_("Not mounted")); drive_not_mounted_label.halign = Gtk.Align.START; - drive_not_mounted_label.get_style_context ().add_class ("h4"); + drive_not_mounted_label.add_css_class ("h4"); drive_not_mounted_label.margin_start = 6; var usagebar = new Gtk.LevelBar () { @@ -121,7 +121,7 @@ public class Monitor.SystemStorageView : Gtk.Grid { max_value = 100.0, min_value = 0.0, }; - usagebar.get_style_context ().add_class ("flat"); + usagebar.add_css_class ("flat"); usagebar.set_value (100.0 * (size - free) / size); diff --git a/src/Widgets/Chart/Chart.vala b/src/Widgets/Chart/Chart.vala index 17662def..04604967 100644 --- a/src/Widgets/Chart/Chart.vala +++ b/src/Widgets/Chart/Chart.vala @@ -11,7 +11,7 @@ public class Monitor.Chart : Gtk.Box { construct { - get_style_context ().add_class ("graph"); + add_css_class ("graph"); vexpand = true; height_request = 120; diff --git a/src/Widgets/Labels/LabelRoundy.vala b/src/Widgets/Labels/LabelRoundy.vala index 220ef42b..a285b535 100644 --- a/src/Widgets/Labels/LabelRoundy.vala +++ b/src/Widgets/Labels/LabelRoundy.vala @@ -11,17 +11,17 @@ public class Monitor.LabelRoundy : Gtk.Fixed { val = new Gtk.Label (Utils.NO_DATA) { selectable = true }; - val.get_style_context ().add_class ("roundy-label"); + val.add_css_class ("roundy-label"); desc = new Gtk.Label (description.up ()); - desc.get_style_context ().add_class ("small-text"); + desc.add_css_class ("small-text"); put (val, 0, 12); put (desc, 6, 0); } public void set_color (string colorname) { - val.get_style_context ().add_class (colorname); + val.add_css_class (colorname); } public void set_text (string text) { diff --git a/src/Widgets/Labels/LabelVertical.vala b/src/Widgets/Labels/LabelVertical.vala index 985e9214..1c8c5859 100644 --- a/src/Widgets/Labels/LabelVertical.vala +++ b/src/Widgets/Labels/LabelVertical.vala @@ -16,15 +16,15 @@ public class Monitor.LabelVertical : Gtk.Box { margin_start = 12; margin_top = 6; - get_style_context ().add_class ("label-vertical"); + add_css_class ("label-vertical"); } public LabelVertical (string description) { val = new Gtk.Label (Utils.NO_DATA); - val.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL); + val.add_css_class (Granite.STYLE_CLASS_H2_LABEL); desc = new Gtk.Label (description.up ()); - desc.get_style_context ().add_class ("small-text"); + desc.add_css_class ("small-text"); grid.attach (desc, 0, 0, 1, 1); grid.attach (val, 0, 1, 1, 1); diff --git a/src/Widgets/Statusbar/Statusbar.vala b/src/Widgets/Statusbar/Statusbar.vala index dfe631b5..02c7d020 100644 --- a/src/Widgets/Statusbar/Statusbar.vala +++ b/src/Widgets/Statusbar/Statusbar.vala @@ -64,7 +64,7 @@ public class Monitor.Statusbar : Gtk.Box { var version_label = new Gtk.Label ("%s".printf (VCS_TAG)) { selectable = true }; - version_label.get_style_context ().add_class ("dim-label"); + version_label.add_css_class ("dim-label"); // pack_end (build_separator_middot ()); actionbar.pack_end (github_label); @@ -80,7 +80,7 @@ public class Monitor.Statusbar : Gtk.Box { margin_end = 6, margin_start = 6, }; - label.get_style_context ().add_class ("dim-label"); + label.add_css_class ("dim-label"); return label; } diff --git a/src/Widgets/WidgetResource/WidgetResource.vala b/src/Widgets/WidgetResource/WidgetResource.vala index a6ce69c1..4fd4e9ef 100644 --- a/src/Widgets/WidgetResource/WidgetResource.vala +++ b/src/Widgets/WidgetResource/WidgetResource.vala @@ -65,7 +65,7 @@ public class Monitor.WidgetResource : Gtk.Box { halign = Gtk.Align.START, }; - grid_main_onchart_info_container.get_style_context ().add_class ("usage-label-container"); + grid_main_onchart_info_container.add_css_class ("usage-label-container"); grid_main_onchart_info_container.attach (_label_vertical_main_metric, 0, 0, 1, 1); return grid_main_onchart_info_container; @@ -89,7 +89,7 @@ public class Monitor.WidgetResource : Gtk.Box { valign = Gtk.Align.START, halign = Gtk.Align.START }; - button_more_info.get_style_context ().add_class ("circular"); + button_more_info.add_css_class ("circular"); // button_more_info.get_style_context ().add_class ("popup"); From 6038748b19b484deac5195ad5e4713a0723ae2e4 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Thu, 3 Jul 2025 16:51:29 +0200 Subject: [PATCH 09/42] Bring back search --- README.md | 2 +- src/MainWindow.vala | 3 --- .../ProcessView/ProcessTreeView/CPUProcessTreeView.vala | 4 +++- src/Widgets/Headerbar/Search.vala | 5 ++++- subprojects/live-chart | 1 + 5 files changed, 9 insertions(+), 6 deletions(-) create mode 160000 subprojects/live-chart diff --git a/README.md b/README.md index 2b042228..99a7ebe5 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ sudo apt install build-essential cmake sassc valac libgtk-3-dev libgee-0.8-dev l Alternatively, if you plan to install WITHOUT a wingpanel-indicator ```bash -sudo apt install build-essential cmake sassc valac libgtk-3-dev libgee-0.8-dev libgranite-dev libgtop2-dev libwnck-3-dev libhandy-1-dev libudisks2-dev libjson-glib-dev libflatpak-dev libxnvctrl-dev liblivechart-1-dev libpci-dev +sudo apt install build-essential cmake sassc valac libgtk-3-dev libgee-0.8-dev libgranite-dev libgtop2-dev libwnck-3-dev libhandy-1-dev libudisks2-dev libjson-glib-dev libflatpak-dev libxnvctrl-dev liblivechart-2-dev libpci-dev ``` diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 3bf81e49..61dca96f 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -114,9 +114,6 @@ public class Monitor.MainWindow : Gtk.ApplicationWindow { this.present (); }); - // @TODO: Handle search.handle_event - // The name `key_press_event' does not exist in the context of `Monitor.MainWindow.new' - // key_press_event.connect (search.handle_event); app.window_removed.connect (() => { MonitorApp.settings.set_int ("window-width", get_size (Gtk.Orientation.HORIZONTAL)); diff --git a/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala b/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala index c3246886..40183642 100644 --- a/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala +++ b/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala @@ -19,6 +19,8 @@ public class Monitor.CPUProcessTreeView : Gtk.TreeView { regex = /(?i:^.*\.(xpm|png)$)/; // vala-lint=space-before-paren, /* *INDENT-ON* */ + enable_search = false; + // setup name column name_column = new Gtk.TreeViewColumn (); name_column.title = _("Process Name"); @@ -232,7 +234,7 @@ public class Monitor.CPUProcessTreeView : Gtk.TreeView { tree_model.get (iter, Column.PID, out pid); Process process = model.process_manager.get_process (pid); process_selected (process); - // debug ("cursor changed"); + debug ("cursor changed"); } } diff --git a/src/Widgets/Headerbar/Search.vala b/src/Widgets/Headerbar/Search.vala index 73488e44..74c535d2 100644 --- a/src/Widgets/Headerbar/Search.vala +++ b/src/Widgets/Headerbar/Search.vala @@ -15,11 +15,14 @@ public class Monitor.Search : Gtk.Box { construct { search_entry = new Gtk.SearchEntry () { - tooltip_markup = Granite.markup_accel_tooltip ({ "F" }, _("Type process name or PID to search")), + // Commented because there is no need to ctrl-f when you can just type? + // tooltip_markup = Granite.markup_accel_tooltip ({ "F" }, _("Type process name or PID to search")), placeholder_text = _("Search Process") }; append (search_entry); + search_entry.set_key_capture_widget (window); + this.process_tree_view = window.process_view.process_tree_view; diff --git a/subprojects/live-chart b/subprojects/live-chart new file mode 160000 index 00000000..1cdb953d --- /dev/null +++ b/subprojects/live-chart @@ -0,0 +1 @@ +Subproject commit 1cdb953dd6313d5102e441c65be8e35c3e12cc32 From 7246a459074d8673bef7afe2d806c6d9cc9bcfa0 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Mon, 14 Jul 2025 22:19:29 +0200 Subject: [PATCH 10/42] Bring back ProcessInfoView --- src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala | 6 +++--- src/Views/ProcessView/ProcessView.vala | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala index ccbc374a..50c95c2f 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala @@ -171,9 +171,9 @@ public class Monitor.ProcessInfoView : Gtk.Box { // @TODO: Find workaround for show_all() in PRocessInfoView // show_all (); - process_info_cpu_ram.hide (); - process_info_io_stats.hide (); - process_action_bar.hide (); + // process_info_cpu_ram.hide (); + // process_info_io_stats.hide (); + // process_action_bar.hide (); } private void show_permission_error_infobar (string error) { diff --git a/src/Views/ProcessView/ProcessView.vala b/src/Views/ProcessView/ProcessView.vala index 8c5e0d40..51c95df4 100644 --- a/src/Views/ProcessView/ProcessView.vala +++ b/src/Views/ProcessView/ProcessView.vala @@ -30,7 +30,7 @@ public class Monitor.ProcessView : Gtk.Box { var paned = new Gtk.Paned (Gtk.Orientation.HORIZONTAL); paned.set_start_child (process_tree_view_scrolled); - // paned.set_end_child (process_info_view); + paned.set_end_child (process_info_view); paned.set_shrink_end_child (false); paned.set_resize_end_child (false); paned.set_position (paned.max_position - 200); From 95240d23931339bbac4114e848dde0888fe59e1b Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Wed, 16 Jul 2025 14:58:07 +0200 Subject: [PATCH 11/42] Do not clone submodules --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 946ae475..89ee49af 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,8 +20,6 @@ jobs: steps: - uses: actions/checkout@v4 - with: - submodules: true - name: Install Dependencies run: | From 2629e40097fea059c1d7cf0606bd0f49f479dfca Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Wed, 16 Jul 2025 15:00:46 +0200 Subject: [PATCH 12/42] Fix lint --- src/MainWindow.vala | 4 ++-- src/Monitor.vala | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 6704e168..ddf1dfad 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -60,7 +60,7 @@ public class Monitor.MainWindow : Gtk.ApplicationWindow { headerbar.pack_end (preferences_button); var statusbar = new Statusbar (); - + var grid = new Gtk.Grid () { orientation = Gtk.Orientation.VERTICAL }; @@ -105,7 +105,7 @@ public class Monitor.MainWindow : Gtk.ApplicationWindow { }); - app.window_removed.connect (() => { + application.window_removed.connect (() => { MonitorApp.settings.set_int ("window-width", get_size (Gtk.Orientation.HORIZONTAL)); MonitorApp.settings.set_int ("window-height", get_size (Gtk.Orientation.VERTICAL)); diff --git a/src/Monitor.vala b/src/Monitor.vala index 8d7075dd..d95923bc 100644 --- a/src/Monitor.vala +++ b/src/Monitor.vala @@ -110,7 +110,7 @@ namespace Monitor { PCIUtils.LIBPCI_PATCH_VER ); - print( + print ( "Gtk %d.%d.%d\n", Gtk.MAJOR_VERSION, Gtk.MINOR_VERSION, From 3841548a330c1050fa6f7c254bfb1b664dcd98e2 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Wed, 16 Jul 2025 16:51:09 +0200 Subject: [PATCH 13/42] Refactor --- src/Monitor.vala | 1 - src/Views/PreferencesView.vala | 4 ++-- .../ProcessInfoView/ProcessInfoView.vala | 14 +++++++------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Monitor.vala b/src/Monitor.vala index d95923bc..7034ea33 100644 --- a/src/Monitor.vala +++ b/src/Monitor.vala @@ -59,7 +59,6 @@ namespace Monitor { public override void activate () { // only have one window if (get_windows () != null) { - // window.show_all (); window.present (); return; } diff --git a/src/Views/PreferencesView.vala b/src/Views/PreferencesView.vala index e193a659..4e71898b 100644 --- a/src/Views/PreferencesView.vala +++ b/src/Views/PreferencesView.vala @@ -3,7 +3,7 @@ * SPDX-FileCopyrightText: 2025 elementary, Inc. (https://elementary.io) */ -public class Monitor.PreferencesView : Gtk.Box { +public class Monitor.PreferencesView : Granite.Bin { private Gtk.Adjustment update_freq_adjustment; construct { @@ -139,7 +139,7 @@ public class Monitor.PreferencesView : Gtk.Box { box.append (indicator_options_revealer); - append (box); + child = box; indicator_switch.bind_property ("active", indicator_options_revealer, "reveal-child", SYNC_CREATE); diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala index 50c95c2f..fafef3d5 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala @@ -118,10 +118,10 @@ public class Monitor.ProcessInfoView : Gtk.Box { _("This may lead to data loss. Only Force Quit if Shut Down has failed."), new ThemedIcon ("computer-fail"), Gtk.ButtonsType.CANCEL - ) { + ) { badge_icon = new ThemedIcon ("process-stop"), modal = true, - // transient_for = (Gtk.Window) get_toplevel () + // transient_for = (Gtk.Window) get_toplevel () }; var accept_button = confirmation_dialog.add_button (_("Force Quit"), Gtk.ResponseType.ACCEPT); @@ -145,10 +145,10 @@ public class Monitor.ProcessInfoView : Gtk.Box { _("The process will be asked to initiate shutdown tasks and close. In some cases the process may not quit."), new ThemedIcon ("system-shutdown"), Gtk.ButtonsType.CANCEL - ) { + ) { badge_icon = new ThemedIcon ("dialog-question"), modal = true, - // transient_for = (Gtk.Window) get_toplevel () + // transient_for = (Gtk.Window) get_toplevel () }; var accept_button = confirmation_dialog.add_button (_("Shut Down"), Gtk.ResponseType.ACCEPT); @@ -171,9 +171,9 @@ public class Monitor.ProcessInfoView : Gtk.Box { // @TODO: Find workaround for show_all() in PRocessInfoView // show_all (); - // process_info_cpu_ram.hide (); - // process_info_io_stats.hide (); - // process_action_bar.hide (); + // process_info_cpu_ram.hide (); + // process_info_io_stats.hide (); + // process_action_bar.hide (); } private void show_permission_error_infobar (string error) { From 89537b9436f3290191692aded9472b8a18a85b6e Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Thu, 17 Jul 2025 20:45:38 +0200 Subject: [PATCH 14/42] Fix GTK4 build --- src/Views/SystemView/SystemStorageView.vala | 36 ++++++++------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/src/Views/SystemView/SystemStorageView.vala b/src/Views/SystemView/SystemStorageView.vala index 910098e3..d262f6f8 100644 --- a/src/Views/SystemView/SystemStorageView.vala +++ b/src/Views/SystemView/SystemStorageView.vala @@ -12,14 +12,6 @@ public class Monitor.SystemStorageView : Gtk.Box { private Gtk.Box drive_cards_container; - construct { - margin_top = 12; - margin_bottom = 12; - margin_start = 12; - margin_end = 12; - column_spacing = 12; - set_vexpand (false); - } public SystemStorageView (Storage _storage) { Object (storage: _storage); @@ -47,8 +39,8 @@ public class Monitor.SystemStorageView : Gtk.Box { margin_bottom = 6, margin_start = 6 }; - labels_box.add (storage_write_label); - labels_box.add (storage_read_label); + labels_box.append (storage_write_label); + labels_box.append (storage_read_label); var chart_overlay = new Gtk.Overlay () { child = storage_chart @@ -66,12 +58,12 @@ public class Monitor.SystemStorageView : Gtk.Box { margin_start = 12; orientation = VERTICAL; - add (storage_name_label); - add (drive_cards_container); - add (chart_overlay); + append (storage_name_label); + append (drive_cards_container); + append (chart_overlay); storage.get_drives ().foreach ((drive) => { - drive_cards_container.add ( + drive_cards_container.append ( new DriveCard (drive) ); @@ -116,19 +108,19 @@ public class Monitor.SystemStorageView : Gtk.Box { halign = START, margin_bottom = 6 }; - drive_block_name_and_size_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); + drive_block_name_and_size_label.get_style_context ().add_class (Granite.STYLE_CLASS_DIM_LABEL); var drive_not_mounted_label = new Gtk.Label (_("Not mounted")) { halign = START }; - drive_not_mounted_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); + drive_not_mounted_label.get_style_context ().add_class (Granite.STYLE_CLASS_DIM_LABEL); var usagebar = new Gtk.LevelBar () { max_value = 100.0, min_value = 0.0, margin_bottom = 6 }; - usagebar.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT); + usagebar.get_style_context ().add_class (Granite.STYLE_CLASS_FLAT); usagebar.set_value (100.0 * (drive.size - drive.free) / drive.size); var drive_box = new Gtk.Box (VERTICAL, 0) { @@ -137,17 +129,17 @@ public class Monitor.SystemStorageView : Gtk.Box { margin_bottom = 6, margin_start = 12 }; - drive_box.add (drive_name_label); - drive_box.add (drive_block_name_and_size_label); + drive_box.append (drive_name_label); + drive_box.append (drive_block_name_and_size_label); if (drive.free == 0) { - drive_box.add (drive_not_mounted_label); + drive_box.append (drive_not_mounted_label); } else { - drive_box.add (usagebar); + drive_box.append (usagebar); } get_style_context ().add_class (Granite.STYLE_CLASS_CARD); get_style_context ().add_class (Granite.STYLE_CLASS_ROUNDED); - add (drive_box); + append (drive_box); } } } From 092ea0f512c8309d0ccb6897dfc3fd5570c698f6 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Fri, 18 Jul 2025 18:21:53 +0200 Subject: [PATCH 15/42] Use `add_css_class ()` --- .../ProcessInfoView/ProcessInfoHeader.vala | 4 ++-- .../ProcessView/ProcessInfoView/ProcessInfoView.vala | 6 +++--- src/Views/SystemView/SystemCPUInfoPopover.vala | 2 +- src/Views/SystemView/SystemStorageView.vala | 12 ++++++------ src/Widgets/WidgetResource/WidgetResource.vala | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala index a0103ff0..cf0c90e4 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala @@ -27,7 +27,7 @@ public class Monitor.ProcessInfoHeader : Gtk.Grid { halign = START, valign = END }; - state.get_style_context ().add_class ("state_badge"); + state.add_css_class ("state_badge"); var icon_container = new Gtk.Overlay () { child = icon @@ -40,7 +40,7 @@ public class Monitor.ProcessInfoHeader : Gtk.Grid { valign = START, tooltip_text = _("N/A") }; - application_name.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL); + application_name.add_css_class (Granite.STYLE_CLASS_H2_LABEL); pid = new LabelRoundy (_("PID")); nice = new LabelRoundy (_("NI")); diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala index fafef3d5..db473074 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala @@ -101,7 +101,7 @@ public class Monitor.ProcessInfoView : Gtk.Box { kill_process_button = new Gtk.Button.with_label (_("Force Quit…")) { tooltip_markup = Granite.markup_accel_tooltip ({ "K" }) }; - kill_process_button.get_style_context ().add_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); + kill_process_button.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); process_action_bar = new Gtk.Box (HORIZONTAL, 12) { halign = END, @@ -125,7 +125,7 @@ public class Monitor.ProcessInfoView : Gtk.Box { }; var accept_button = confirmation_dialog.add_button (_("Force Quit"), Gtk.ResponseType.ACCEPT); - accept_button.get_style_context ().add_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); + accept_button.add_css_class (Granite.STYLE_CLASS_DESTRUCTIVE_ACTION); confirmation_dialog.response.connect ((response) => { if (response == Gtk.ResponseType.ACCEPT) { @@ -152,7 +152,7 @@ public class Monitor.ProcessInfoView : Gtk.Box { }; var accept_button = confirmation_dialog.add_button (_("Shut Down"), Gtk.ResponseType.ACCEPT); - accept_button.get_style_context ().add_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); + accept_button.add_css_class (Granite.STYLE_CLASS_SUGGESTED_ACTION); confirmation_dialog.response.connect ((response) => { if (response == Gtk.ResponseType.ACCEPT) { diff --git a/src/Views/SystemView/SystemCPUInfoPopover.vala b/src/Views/SystemView/SystemCPUInfoPopover.vala index fef173f7..a6ba8bc4 100755 --- a/src/Views/SystemView/SystemCPUInfoPopover.vala +++ b/src/Views/SystemView/SystemCPUInfoPopover.vala @@ -140,7 +140,7 @@ public class Monitor.SystemCPUInfoPopover : Gtk.Box { grid.attach (flag_label, 0, 0, 1, 1); grid.attach (label (flag_description), 1, 0, 1, 1); - row.set_child (grid); + row.child = grid; return row; } diff --git a/src/Views/SystemView/SystemStorageView.vala b/src/Views/SystemView/SystemStorageView.vala index d262f6f8..49eefc95 100644 --- a/src/Views/SystemView/SystemStorageView.vala +++ b/src/Views/SystemView/SystemStorageView.vala @@ -93,7 +93,7 @@ public class Monitor.SystemStorageView : Gtk.Box { var drive_name_label = new Gtk.Label (drive.model) { halign = START }; - drive_name_label.get_style_context ().add_class (Granite.STYLE_CLASS_H3_LABEL); + drive_name_label.add_css_class (Granite.STYLE_CLASS_H3_LABEL); string size_string = format_size ((uint64) drive.size, IEC_UNITS); string used_string = format_size ((uint64) (drive.size - drive.free), IEC_UNITS); @@ -108,19 +108,19 @@ public class Monitor.SystemStorageView : Gtk.Box { halign = START, margin_bottom = 6 }; - drive_block_name_and_size_label.get_style_context ().add_class (Granite.STYLE_CLASS_DIM_LABEL); + drive_block_name_and_size_label.add_css_class (Granite.STYLE_CLASS_DIM_LABEL); var drive_not_mounted_label = new Gtk.Label (_("Not mounted")) { halign = START }; - drive_not_mounted_label.get_style_context ().add_class (Granite.STYLE_CLASS_DIM_LABEL); + drive_not_mounted_label.add_css_class (Granite.STYLE_CLASS_DIM_LABEL); var usagebar = new Gtk.LevelBar () { max_value = 100.0, min_value = 0.0, margin_bottom = 6 }; - usagebar.get_style_context ().add_class (Granite.STYLE_CLASS_FLAT); + usagebar.add_css_class (Granite.STYLE_CLASS_FLAT); usagebar.set_value (100.0 * (drive.size - drive.free) / drive.size); var drive_box = new Gtk.Box (VERTICAL, 0) { @@ -137,8 +137,8 @@ public class Monitor.SystemStorageView : Gtk.Box { drive_box.append (usagebar); } - get_style_context ().add_class (Granite.STYLE_CLASS_CARD); - get_style_context ().add_class (Granite.STYLE_CLASS_ROUNDED); + add_css_class (Granite.STYLE_CLASS_CARD); + add_css_class (Granite.STYLE_CLASS_ROUNDED); append (drive_box); } } diff --git a/src/Widgets/WidgetResource/WidgetResource.vala b/src/Widgets/WidgetResource/WidgetResource.vala index 4fd4e9ef..a0838b91 100644 --- a/src/Widgets/WidgetResource/WidgetResource.vala +++ b/src/Widgets/WidgetResource/WidgetResource.vala @@ -90,7 +90,7 @@ public class Monitor.WidgetResource : Gtk.Box { halign = Gtk.Align.START }; button_more_info.add_css_class ("circular"); - // button_more_info.get_style_context ().add_class ("popup"); + button_more_info.add_css_class ("popup"); button_more_info.set_icon_name ("dialog-information"); From b86bbd97d37c3cddeb7715079099012bf353636e Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Fri, 18 Jul 2025 18:29:42 +0200 Subject: [PATCH 16/42] Replace grid with a box --- src/MainWindow.vala | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index ddf1dfad..94a0d7f2 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -61,15 +61,13 @@ public class Monitor.MainWindow : Gtk.ApplicationWindow { var statusbar = new Statusbar (); - var grid = new Gtk.Grid () { - orientation = Gtk.Orientation.VERTICAL - }; + var main_container = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); set_titlebar (headerbar); - grid.attach (stack, 0, 1, 1, 1); - grid.attach (statusbar, 0, 2, 1, 1); + main_container.append (stack); + main_container.append (statusbar); - child = grid; + child = main_container; present (); From febdcb65def9914c381a29f2c694c133a1ef5da1 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Fri, 18 Jul 2025 18:52:57 +0200 Subject: [PATCH 17/42] Refactor --- src/Views/ProcessView/ProcessView.vala | 16 ++++++++-------- src/Views/SystemView/SystemStorageView.vala | 3 --- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/Views/ProcessView/ProcessView.vala b/src/Views/ProcessView/ProcessView.vala index 51c95df4..19205701 100644 --- a/src/Views/ProcessView/ProcessView.vala +++ b/src/Views/ProcessView/ProcessView.vala @@ -10,11 +10,13 @@ public class Monitor.ProcessView : Gtk.Box { public ProcessInfoView process_info_view; construct { - process_info_view = new ProcessInfoView (); - - // hide on startup - // @TODO: Figure out how to no_show_all in GTK4 - // process_info_view.no_show_all = true; + process_info_view = new ProcessInfoView (){ + // This might be useless since first process is selected + // automatically and this triggers on_process_selected (). + // Keeping it just to not forget what was the OG behavior + // in GTK3 version. + visible = false, + }; } public ProcessView () { @@ -42,9 +44,7 @@ public class Monitor.ProcessView : Gtk.Box { public void on_process_selected (Process process) { process_info_view.process = process; - // @TODO: Figure out how to no_show_all in GTK4 - // process_info_view.no_show_all = true; - // process_info_view.show_all (); + process_info_view.visible = true; } public void update () { diff --git a/src/Views/SystemView/SystemStorageView.vala b/src/Views/SystemView/SystemStorageView.vala index 49eefc95..7c404cad 100644 --- a/src/Views/SystemView/SystemStorageView.vala +++ b/src/Views/SystemView/SystemStorageView.vala @@ -10,9 +10,6 @@ public class Monitor.SystemStorageView : Gtk.Box { private LabelRoundy storage_read_label; private LabelRoundy storage_write_label; - private Gtk.Box drive_cards_container; - - public SystemStorageView (Storage _storage) { Object (storage: _storage); } From 4b1ea34cfa6dc18239208b96ac166bbd2924b77e Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Mon, 21 Jul 2025 22:40:13 +0200 Subject: [PATCH 18/42] Remove `show_all()` comments --- .../ProcessView/ProcessInfoView/ProcessInfoView.vala | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala index db473074..8c1b6d8d 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala @@ -148,6 +148,7 @@ public class Monitor.ProcessInfoView : Gtk.Box { ) { badge_icon = new ThemedIcon ("dialog-question"), modal = true, + // @TODO: not sure how to set it in GTK4 // transient_for = (Gtk.Window) get_toplevel () }; @@ -167,13 +168,6 @@ public class Monitor.ProcessInfoView : Gtk.Box { }); grid.attach (process_action_bar, 0, 5); - - // @TODO: Find workaround for show_all() in PRocessInfoView - - // show_all (); - // process_info_cpu_ram.hide (); - // process_info_io_stats.hide (); - // process_action_bar.hide (); } private void show_permission_error_infobar (string error) { From e4ad9ed6a499459e1debbbd7a408f5608a837e94 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Mon, 21 Jul 2025 22:46:45 +0200 Subject: [PATCH 19/42] Use Box instead of Grid for labels container on a Chart --- src/Views/SystemView/SystemNetworkView.vala | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Views/SystemView/SystemNetworkView.vala b/src/Views/SystemView/SystemNetworkView.vala index b2ff5663..b594d4d9 100644 --- a/src/Views/SystemView/SystemNetworkView.vala +++ b/src/Views/SystemView/SystemNetworkView.vala @@ -39,19 +39,18 @@ public class Monitor.SystemNetworkView : Gtk.Grid { network_chart.set_serie_color (0, { 155 / 255.0f, 219 / 255.0f, 77 / 255.0f, 1.0f }); network_chart.set_serie_color (1, { 100 / 255.0f, 186 / 255.0f, 255 / 255.0f, 1.0f }); - var labels_grid = new Gtk.Grid () { + var labels_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0) { margin_top = 6, margin_bottom = 6, margin_start = 6, margin_end = 6, - row_spacing = 6, }; - labels_grid.attach (network_download_label, 0, 0, 1, 1); - labels_grid.attach (network_upload_label, 1, 0, 1, 1); + labels_box.append (network_download_label); + labels_box.append (network_upload_label); attach (network_name_label, 0, 0, 1, 1); - attach (labels_grid, 0, 1, 2, 2); + attach (labels_box, 0, 1, 2, 2); attach (network_chart, 0, 1, 2, 2); } From 5ffd5f9fa8d82320a62f3cb77330a2ec719f0eb2 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Mon, 21 Jul 2025 22:57:35 +0200 Subject: [PATCH 20/42] Replace `show_all()` with `present()` in MonitorApp and remove TODO comments in ProcessInfoView --- src/Monitor.vala | 3 +-- src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Monitor.vala b/src/Monitor.vala index 7034ea33..064f0220 100644 --- a/src/Monitor.vala +++ b/src/Monitor.vala @@ -89,8 +89,7 @@ namespace Monitor { window.hide (); MonitorApp.settings.set_boolean ("background-state", true); } else { - // @TODO: Find out how this should work without show_all () - // window.show_all (); + window.present (); } window.process_view.process_tree_view.focus_on_first_row (); diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala index 8c1b6d8d..86abf2f2 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala @@ -21,8 +21,6 @@ public class Monitor.ProcessInfoView : Gtk.Box { process_info_header.update (_process); - // @TODO: Find workaround for show_all() in PRocessInfoView - // this.show_all (); if (_process.uid != Posix.getuid ()) { process_info_cpu_ram.hide (); process_info_io_stats.hide (); From 8afa0a3da282cfd0bacc72c9058a84493f093a75 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Mon, 21 Jul 2025 23:02:24 +0200 Subject: [PATCH 21/42] Fix saving is-maximized in settings --- src/MainWindow.vala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 94a0d7f2..8eb12700 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -107,8 +107,7 @@ public class Monitor.MainWindow : Gtk.ApplicationWindow { MonitorApp.settings.set_int ("window-width", get_size (Gtk.Orientation.HORIZONTAL)); MonitorApp.settings.set_int ("window-height", get_size (Gtk.Orientation.VERTICAL)); - // @TODO: Handle is-maximized - // MonitorApp.settings.set_boolean ("is-maximized", this.is_maximized); + MonitorApp.settings.set_boolean ("is-maximized", this.is_maximized()); MonitorApp.settings.set_string ("opened-view", stack.visible_child_name); From 5a000fc5438232ea4754faaf74c06a1c996843d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw?= <6031763+stsdc@users.noreply.github.com> Date: Tue, 22 Jul 2025 23:58:41 +0200 Subject: [PATCH 22/42] Update src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Danielle Foré --- src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala index 86abf2f2..b9f9ad22 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala @@ -146,8 +146,7 @@ public class Monitor.ProcessInfoView : Gtk.Box { ) { badge_icon = new ThemedIcon ("dialog-question"), modal = true, - // @TODO: not sure how to set it in GTK4 - // transient_for = (Gtk.Window) get_toplevel () + transient_for = (Gtk.Window) get_root () }; var accept_button = confirmation_dialog.add_button (_("Shut Down"), Gtk.ResponseType.ACCEPT); From ead2ed67d68438faeaf21bf36e46a95fb570051b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw?= <6031763+stsdc@users.noreply.github.com> Date: Tue, 22 Jul 2025 23:58:52 +0200 Subject: [PATCH 23/42] Update src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Danielle Foré --- src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala index b9f9ad22..5de3cfb5 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala @@ -119,7 +119,7 @@ public class Monitor.ProcessInfoView : Gtk.Box { ) { badge_icon = new ThemedIcon ("process-stop"), modal = true, - // transient_for = (Gtk.Window) get_toplevel () + transient_for = (Gtk.Window) get_root () }; var accept_button = confirmation_dialog.add_button (_("Force Quit"), Gtk.ResponseType.ACCEPT); From ae0d1784523f3fc6830c982868c52a839074be5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanis=C5=82aw?= <6031763+stsdc@users.noreply.github.com> Date: Tue, 22 Jul 2025 23:59:39 +0200 Subject: [PATCH 24/42] Update src/Views/SystemView/SystemCPUView.vala MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Danielle Foré --- src/Views/SystemView/SystemCPUView.vala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Views/SystemView/SystemCPUView.vala b/src/Views/SystemView/SystemCPUView.vala index 23ea5555..78284bcf 100644 --- a/src/Views/SystemView/SystemCPUView.vala +++ b/src/Views/SystemView/SystemCPUView.vala @@ -21,16 +21,16 @@ public class Monitor.SystemCPUView : Monitor.WidgetResource { cpu_frequency_label = new LabelRoundy (_("Frequency")) { margin_top = 2, - margin_bottom = 6, - margin_start = 6, margin_end = 6, + margin_bottom = 6, + margin_start = 6 }; cpu_temperature_label = new LabelRoundy (_("Temperature")) { margin_top = 2, - margin_bottom = 6, - margin_start = 6, margin_end = 6, + margin_bottom = 6, + margin_start = 6 }; From db5057612d31dce635bcbb192eb10faee9ef1e23 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Wed, 23 Jul 2025 00:02:54 +0200 Subject: [PATCH 25/42] Fix formatting of margin properties in SystemView and adjust indentation in ProcessInfoView --- .../ProcessView/ProcessInfoView/ProcessInfoView.vala | 4 ++-- src/Views/SystemView/SystemView.vala | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala index 5de3cfb5..abb59c0c 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala @@ -116,7 +116,7 @@ public class Monitor.ProcessInfoView : Gtk.Box { _("This may lead to data loss. Only Force Quit if Shut Down has failed."), new ThemedIcon ("computer-fail"), Gtk.ButtonsType.CANCEL - ) { + ) { badge_icon = new ThemedIcon ("process-stop"), modal = true, transient_for = (Gtk.Window) get_root () @@ -143,7 +143,7 @@ public class Monitor.ProcessInfoView : Gtk.Box { _("The process will be asked to initiate shutdown tasks and close. In some cases the process may not quit."), new ThemedIcon ("system-shutdown"), Gtk.ButtonsType.CANCEL - ) { + ) { badge_icon = new ThemedIcon ("dialog-question"), modal = true, transient_for = (Gtk.Window) get_root () diff --git a/src/Views/SystemView/SystemView.vala b/src/Views/SystemView/SystemView.vala index cf07ac3b..b039078e 100644 --- a/src/Views/SystemView/SystemView.vala +++ b/src/Views/SystemView/SystemView.vala @@ -63,10 +63,10 @@ public class Monitor.SystemView : Gtk.Box { private Granite.HeaderLabel build_no_support_label (string gpu_name) { string notification_text = _("The %s GPU was detected, but is not yet supported.").printf (gpu_name); return new Granite.HeaderLabel (notification_text) { - margin_start = 12, - margin_end = 12, - margin_top = 12, - margin_bottom = 12, + margin_top = 12, + margin_end = 12, + margin_bottom = 12, + margin_start = 12 }; } From d9e157fc85e0b4dfb4553e0575ec1fa83bb6286e Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Wed, 23 Jul 2025 00:08:22 +0200 Subject: [PATCH 26/42] Set spacing to 6 in labels_box --- src/Views/SystemView/SystemNetworkView.vala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Views/SystemView/SystemNetworkView.vala b/src/Views/SystemView/SystemNetworkView.vala index b594d4d9..b41d1f10 100644 --- a/src/Views/SystemView/SystemNetworkView.vala +++ b/src/Views/SystemView/SystemNetworkView.vala @@ -39,11 +39,11 @@ public class Monitor.SystemNetworkView : Gtk.Grid { network_chart.set_serie_color (0, { 155 / 255.0f, 219 / 255.0f, 77 / 255.0f, 1.0f }); network_chart.set_serie_color (1, { 100 / 255.0f, 186 / 255.0f, 255 / 255.0f, 1.0f }); - var labels_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0) { + var labels_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6) { margin_top = 6, - margin_bottom = 6, - margin_start = 6, margin_end = 6, + margin_bottom = 6, + margin_start = 6 }; labels_box.append (network_download_label); From b857816c7981217ac713d0e02a7cb5bc376256c0 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Wed, 23 Jul 2025 00:14:35 +0200 Subject: [PATCH 27/42] Use just `HORIZONTAL` --- src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala index cf0c90e4..c206be21 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala @@ -52,7 +52,7 @@ public class Monitor.ProcessInfoHeader : Gtk.Grid { // TODO: tooltip_text UID username = new LabelRoundy (""); - var wrapper = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); + var wrapper = new Gtk.Box (HORIZONTAL, 0); wrapper.append (pid); wrapper.append (priority); wrapper.append (nice); From dc3a10bec94371465785a1166b6883d0c3667361 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Wed, 23 Jul 2025 00:16:10 +0200 Subject: [PATCH 28/42] Fix lint --- src/Views/ProcessView/ProcessView.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Views/ProcessView/ProcessView.vala b/src/Views/ProcessView/ProcessView.vala index 19205701..e8281f66 100644 --- a/src/Views/ProcessView/ProcessView.vala +++ b/src/Views/ProcessView/ProcessView.vala @@ -10,7 +10,7 @@ public class Monitor.ProcessView : Gtk.Box { public ProcessInfoView process_info_view; construct { - process_info_view = new ProcessInfoView (){ + process_info_view = new ProcessInfoView () { // This might be useless since first process is selected // automatically and this triggers on_process_selected (). // Keeping it just to not forget what was the OG behavior From 133575ca8934482aef1848633161df53a1797df8 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Wed, 23 Jul 2025 00:18:12 +0200 Subject: [PATCH 29/42] fix lint --- src/MainWindow.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 8eb12700..4e943f8b 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -107,7 +107,7 @@ public class Monitor.MainWindow : Gtk.ApplicationWindow { MonitorApp.settings.set_int ("window-width", get_size (Gtk.Orientation.HORIZONTAL)); MonitorApp.settings.set_int ("window-height", get_size (Gtk.Orientation.VERTICAL)); - MonitorApp.settings.set_boolean ("is-maximized", this.is_maximized()); + MonitorApp.settings.set_boolean ("is-maximized", this.is_maximized ()); MonitorApp.settings.set_string ("opened-view", stack.visible_child_name); From c4b3ce4bc68db69b90263b2fe94d70bcb2ebd95c Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Wed, 23 Jul 2025 15:54:30 +0200 Subject: [PATCH 30/42] Set `key_controller` in process tree view --- src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala b/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala index 40183642..5b8ac431 100644 --- a/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala +++ b/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala @@ -98,6 +98,7 @@ public class Monitor.CPUProcessTreeView : Gtk.TreeView { insert_action_group ("process", action_group); var key_controller = new Gtk.EventControllerKey (); + add_controller (key_controller); key_controller.key_released.connect ((keyval, keycode, state) => { switch (keyval) { case Gdk.Key.Left: From 368115312f3814fbaffaea3077c9c1798eb9ba64 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Wed, 23 Jul 2025 20:03:25 +0200 Subject: [PATCH 31/42] Do not prepend smol charts --- src/Views/SystemView/SystemView.vala | 1 - src/Widgets/WidgetResource/WidgetResource.vala | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Views/SystemView/SystemView.vala b/src/Views/SystemView/SystemView.vala index b039078e..e2af50b6 100644 --- a/src/Views/SystemView/SystemView.vala +++ b/src/Views/SystemView/SystemView.vala @@ -69,5 +69,4 @@ public class Monitor.SystemView : Gtk.Box { margin_start = 12 }; } - } diff --git a/src/Widgets/WidgetResource/WidgetResource.vala b/src/Widgets/WidgetResource/WidgetResource.vala index a0838b91..6ec33ea4 100644 --- a/src/Widgets/WidgetResource/WidgetResource.vala +++ b/src/Widgets/WidgetResource/WidgetResource.vala @@ -58,9 +58,9 @@ public class Monitor.WidgetResource : Gtk.Box { grid_main_onchart_info_container = new Gtk.Grid () { column_spacing = 6, margin_top = 6, + margin_end = 6, margin_bottom = 6, margin_start = 6, - margin_end = 6, valign = Gtk.Align.START, halign = Gtk.Align.START, }; @@ -80,7 +80,7 @@ public class Monitor.WidgetResource : Gtk.Box { } public void add_charts_container (Gtk.Widget widget) { - charts_container.prepend (widget); + charts_container.append (widget); } public void set_popover_more_info (Gtk.Widget widget) { From a8aa44f6470ac8636b8c6fd0a1cc57e73c3f5bf8 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Wed, 23 Jul 2025 21:15:08 +0200 Subject: [PATCH 32/42] Fix visibility handling in ProcessInfoView --- src/Models/OpenFilesTreeViewModel.vala | 1 + .../ProcessInfoView/ProcessInfoIOStats.vala | 2 +- .../ProcessView/ProcessInfoView/ProcessInfoView.vala | 12 ++++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Models/OpenFilesTreeViewModel.vala b/src/Models/OpenFilesTreeViewModel.vala index c2b5b910..4fafe88c 100644 --- a/src/Models/OpenFilesTreeViewModel.vala +++ b/src/Models/OpenFilesTreeViewModel.vala @@ -37,6 +37,7 @@ public class Monitor.OpenFilesTreeViewModel : Gtk.TreeStore { } private bool add_path (string path) { + debug ("Adding path: %s", path); if (path.substring (0, 1) == "/") { Gtk.TreeIter iter; append (out iter, null); diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala index dd52b8fa..51c655eb 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala @@ -51,7 +51,7 @@ public class Monitor.ProcessInfoIOStats : Gtk.Grid { attach (cancelled_write_label, 1, 1, 1, 1); attach (cancelled_write_bytes_label, 1, 2, 1, 1); - // attach (opened_files_label, 0, 3, 3, 1); + attach (opened_files_label, 0, 3, 3, 1); var model = new OpenFilesTreeViewModel (); var open_files_tree_view_scrolled = new Gtk.ScrolledWindow () { diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala index abb59c0c..6a4607ba 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala @@ -33,11 +33,15 @@ public class Monitor.ProcessInfoView : Gtk.Box { process_info_cpu_ram.clear_graphs (); process_info_cpu_ram.set_charts_data (_process); + // Setting visibility + process_info_cpu_ram.visible = true; + process_action_bar.visible = true; + process_info_io_stats.visible = true; + permission_error_infobar.revealed = false; process_info_io_stats.open_files_tree_view.model.process = _process; - // @TODO: Find workaround for show_all() in PRocessInfoView - // process_info_io_stats.open_files_tree_view.show_all (); + process_info_io_stats.open_files_tree_view.visible = true; } } } @@ -181,9 +185,9 @@ public class Monitor.ProcessInfoView : Gtk.Box { process_info_io_stats.update (process); process_info_io_stats.open_files_tree_view.model.process = _process; - // @TODO: Find workaround for show_all() in PRocessInfoView - // process_info_io_stats.open_files_tree_view.show_all (); + + process_info_io_stats.open_files_tree_view.visible = true; } } From 5c4211245a7cb4a053534c1720830920a6a1ce52 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Wed, 23 Jul 2025 21:41:38 +0200 Subject: [PATCH 33/42] Bring back OpenFilesTreeView --- src/Models/OpenFilesTreeViewModel.vala | 34 ++++++++----------- .../ProcessInfoView/OpenFilesTreeView.vala | 5 +-- .../ProcessInfoView/ProcessInfoIOStats.vala | 3 +- .../ProcessInfoView/ProcessInfoView.vala | 1 - 4 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/Models/OpenFilesTreeViewModel.vala b/src/Models/OpenFilesTreeViewModel.vala index 4fafe88c..bfecf40f 100644 --- a/src/Models/OpenFilesTreeViewModel.vala +++ b/src/Models/OpenFilesTreeViewModel.vala @@ -4,7 +4,7 @@ */ public class Monitor.OpenFilesTreeViewModel : Gtk.TreeStore { - private Gee.Map open_files_paths = new Gee.HashMap (); + private Gee.Map open_files_paths = new Gee.HashMap (); private Process _process; @@ -37,37 +37,31 @@ public class Monitor.OpenFilesTreeViewModel : Gtk.TreeStore { } private bool add_path (string path) { - debug ("Adding path: %s", path); if (path.substring (0, 1) == "/") { Gtk.TreeIter iter; append (out iter, null); - set (iter, - Column.NAME, path, - -1); + set (iter, Column.NAME, path, -1); - // open_files_paths.set (path, iter); + open_files_paths.set (path, iter); return true; } return false; } public void update_model (Process process) { - if (process.open_files_paths.size > 0) { - foreach (var path in process.open_files_paths) { + // if (process.open_files_paths.size > 0) { + // foreach (var path in process.open_files_paths) { - // print("sdsd"); - // Gtk.TreeIter iter = open_files_paths[path]; - print (path); - //// display only real paths - //// probably should be done in process class - // if (path.substring (0, 1) == "/") { - // set (iter, - // Column.NAME, path, - // -1); - // } - } - } + // Gtk.TreeIter iter = open_files_paths[path]; + // print (path); + //// display only real paths + //// probably should be done in process class + // if (path.substring (0, 1) == "/") { + // set (iter, Column.NAME, path, -1); + // } + // } + // } } } diff --git a/src/Views/ProcessView/ProcessInfoView/OpenFilesTreeView.vala b/src/Views/ProcessView/ProcessInfoView/OpenFilesTreeView.vala index 372e9ad8..c355a12e 100644 --- a/src/Views/ProcessView/ProcessInfoView/OpenFilesTreeView.vala +++ b/src/Views/ProcessView/ProcessInfoView/OpenFilesTreeView.vala @@ -10,8 +10,9 @@ public class Monitor.OpenFilesTreeView : Gtk.TreeView { public signal void process_selected (Process process); - public OpenFilesTreeView (OpenFilesTreeViewModel model) { - this.model = model; + public OpenFilesTreeView () { + this.model = new OpenFilesTreeViewModel (); +; /* *INDENT-OFF* */ regex = /(?i:^.*\.(xpm|png)$)/; // vala-lint=space-before-paren, /* *INDENT-ON* */ diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala index 51c655eb..ecb8ab86 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala @@ -53,11 +53,10 @@ public class Monitor.ProcessInfoIOStats : Gtk.Grid { attach (opened_files_label, 0, 3, 3, 1); - var model = new OpenFilesTreeViewModel (); + open_files_tree_view = new OpenFilesTreeView (); var open_files_tree_view_scrolled = new Gtk.ScrolledWindow () { child = open_files_tree_view }; - open_files_tree_view = new OpenFilesTreeView (model); attach (open_files_tree_view_scrolled, 0, 4, 3, 1); } diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala index 6a4607ba..6fc85a5d 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala @@ -186,7 +186,6 @@ public class Monitor.ProcessInfoView : Gtk.Box { process_info_io_stats.open_files_tree_view.model.process = _process; - process_info_io_stats.open_files_tree_view.visible = true; } } From 5d608043e7b066033712fe92c348330c2745bc6a Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Wed, 23 Jul 2025 22:10:13 +0200 Subject: [PATCH 34/42] Fix cpu info popover --- src/Views/SystemView/SystemCPUView.vala | 14 +++++----- .../WidgetResource/WidgetResource.vala | 26 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Views/SystemView/SystemCPUView.vala b/src/Views/SystemView/SystemCPUView.vala index 78284bcf..1647d3f6 100644 --- a/src/Views/SystemView/SystemCPUView.vala +++ b/src/Views/SystemView/SystemCPUView.vala @@ -45,16 +45,16 @@ public class Monitor.SystemCPUView : Monitor.WidgetResource { grid_temperature_info.attach (cpu_temperature_label, 0, 0, 1, 1); + var smol_charts_container = new Gtk.Grid () { + width_request = 200, + hexpand = false, + halign = Gtk.Align.START, + row_spacing = 6, + margin_start = 6, + }; - - var smol_charts_container = new Gtk.Grid (); - smol_charts_container.width_request = 200; - smol_charts_container.hexpand = false; - smol_charts_container.halign = Gtk.Align.START; smol_charts_container.attach (grid_frequency_info, 0, 0, 1, 1); smol_charts_container.attach (grid_temperature_info, 0, 1, 1, 1); - smol_charts_container.row_spacing = 6; - smol_charts_container.margin_start = 6; add_charts_container (smol_charts_container); } diff --git a/src/Widgets/WidgetResource/WidgetResource.vala b/src/Widgets/WidgetResource/WidgetResource.vala index 6ec33ea4..1bfd4871 100644 --- a/src/Widgets/WidgetResource/WidgetResource.vala +++ b/src/Widgets/WidgetResource/WidgetResource.vala @@ -4,7 +4,9 @@ */ public class Monitor.WidgetResource : Gtk.Box { - private Granite.HeaderLabel _title = new Granite.HeaderLabel (Utils.NO_DATA); + private Granite.HeaderLabel _title = new Granite.HeaderLabel (Utils.NO_DATA) { + valign = Gtk.Align.CENTER, + }; public string title { set { @@ -12,7 +14,6 @@ public class Monitor.WidgetResource : Gtk.Box { } } - public Gtk.Popover popover_more_info; private LabelVertical _label_vertical_main_metric = new LabelVertical (_("UTILIZATION")); public string label_vertical_main_metric { @@ -84,24 +85,23 @@ public class Monitor.WidgetResource : Gtk.Box { } public void set_popover_more_info (Gtk.Widget widget) { + var popover_more_info = new Gtk.Popover () { + position = Gtk.PositionType.BOTTOM, + // visible = false, + autohide = true, + child = widget, + }; var button_more_info = new Gtk.MenuButton () { focusable = false, + icon_name = "dialog-information", valign = Gtk.Align.START, - halign = Gtk.Align.START + halign = Gtk.Align.START, + popover = popover_more_info, + }; button_more_info.add_css_class ("circular"); button_more_info.add_css_class ("popup"); - - button_more_info.set_icon_name ("dialog-information"); - - popover_more_info = new Gtk.Popover () { - position = Gtk.PositionType.BOTTOM, - visible = false, - autohide = true, - child = widget, - }; - grid_header.attach (button_more_info, 1, 0, 1, 1); } From 1cd238f09e11ed9a66155a7f6027df3996a4ba71 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Wed, 23 Jul 2025 23:27:49 +0200 Subject: [PATCH 35/42] Delete some `present ()`'s --- src/MainWindow.vala | 5 +---- src/Views/PreferencesView.vala | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 4e943f8b..45ced765 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -69,8 +69,6 @@ public class Monitor.MainWindow : Gtk.ApplicationWindow { child = main_container; - present (); - var dbusserver = DBusServer.get_default (); search_revealer.reveal_child = stack.visible_child == process_view; @@ -97,9 +95,8 @@ public class Monitor.MainWindow : Gtk.ApplicationWindow { dbusserver.quit.connect (() => application.quit ()); dbusserver.show.connect (() => { - this.present (); setup_window_state (); - this.present (); + present (); }); diff --git a/src/Views/PreferencesView.vala b/src/Views/PreferencesView.vala index 4e71898b..45474b71 100644 --- a/src/Views/PreferencesView.vala +++ b/src/Views/PreferencesView.vala @@ -138,7 +138,6 @@ public class Monitor.PreferencesView : Granite.Bin { box.append (indicator_switch); box.append (indicator_options_revealer); - child = box; indicator_switch.bind_property ("active", indicator_options_revealer, "reveal-child", SYNC_CREATE); From b396bbc30f8030bf0df860c915c192540982cfab Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Sat, 26 Jul 2025 22:27:55 +0200 Subject: [PATCH 36/42] Remove commented `insert_at_cursor ()` in `Search ()` --- src/Widgets/Headerbar/Search.vala | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/Widgets/Headerbar/Search.vala b/src/Widgets/Headerbar/Search.vala index 74c535d2..20cbac63 100644 --- a/src/Widgets/Headerbar/Search.vala +++ b/src/Widgets/Headerbar/Search.vala @@ -47,11 +47,6 @@ public class Monitor.Search : Gtk.Box { // focus on child row to avoid the app crashes by clicking "Kill/End Process" buttons in headerbar process_tree_view.focus_on_child_row (); this.grab_focus (); - - if (search_entry.text != "") { - // @TODO: Investigate insert_at_cursor workaround for GTK4 - // this.insert_at_cursor (""); - } }); search_entry.activate.connect (() => { @@ -106,9 +101,6 @@ public class Monitor.Search : Gtk.Box { public void activate_entry (string search_text = "") { search_entry.text = ""; search_entry.search_changed (); - - // @TODO: Investigate insert_at_cursor workaround for GTK4 - // search_entry.insert_at_cursor (search_text); } } From 325537eb5d76d781ea58deddf89ec6070195dd07 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Sat, 26 Jul 2025 22:30:37 +0200 Subject: [PATCH 37/42] Remove obsolete commented code in LabelVertical --- src/Widgets/Labels/LabelVertical.vala | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Widgets/Labels/LabelVertical.vala b/src/Widgets/Labels/LabelVertical.vala index 1c8c5859..ab830d45 100644 --- a/src/Widgets/Labels/LabelVertical.vala +++ b/src/Widgets/Labels/LabelVertical.vala @@ -30,17 +30,6 @@ public class Monitor.LabelVertical : Gtk.Box { grid.attach (val, 0, 1, 1, 1); append (grid); - - // @TODO: Find out why it was here. - // It is probably a remainings of expandable label, - // which is not a thing anymore. - - // events |= Gdk.EventMask.BUTTON_RELEASE_MASK; - - // button_release_event.connect ((event) => { - // clicked (); - // return false; - // }); } public void set_text (string text) { From c045b89f8065ba7253eec195e6e748d2e7a48677 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Sat, 26 Jul 2025 23:10:27 +0200 Subject: [PATCH 38/42] Regex matching is unnecessary in CPUProcessTreeView; clean up OpenFilesTreeView constructor --- .../ProcessInfoView/OpenFilesTreeView.vala | 5 ----- .../ProcessTreeView/CPUProcessTreeView.vala | 11 +---------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/src/Views/ProcessView/ProcessInfoView/OpenFilesTreeView.vala b/src/Views/ProcessView/ProcessInfoView/OpenFilesTreeView.vala index c355a12e..70992c9e 100644 --- a/src/Views/ProcessView/ProcessInfoView/OpenFilesTreeView.vala +++ b/src/Views/ProcessView/ProcessInfoView/OpenFilesTreeView.vala @@ -6,16 +6,11 @@ public class Monitor.OpenFilesTreeView : Gtk.TreeView { public new OpenFilesTreeViewModel model; private Gtk.TreeViewColumn path_column; - private Regex ? regex; public signal void process_selected (Process process); public OpenFilesTreeView () { this.model = new OpenFilesTreeViewModel (); -; - /* *INDENT-OFF* */ - regex = /(?i:^.*\.(xpm|png)$)/; // vala-lint=space-before-paren, - /* *INDENT-ON* */ show_expanders = false; diff --git a/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala b/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala index 5b8ac431..fc25fb34 100644 --- a/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala +++ b/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala @@ -115,16 +115,7 @@ public class Monitor.CPUProcessTreeView : Gtk.TreeView { model.get_value (iter, Column.ICON, out icon_name); string path = ((string) icon_name); - if (regex.match (path)) { - try { - Gdk.Pixbuf icon = new Gdk.Pixbuf.from_file_at_size (path, 16, -1); - ((Gtk.CellRendererPixbuf)icon_cell).pixbuf = icon; - } catch (Error e) { - warning (e.message); - } - } else { - ((Gtk.CellRendererPixbuf)icon_cell).icon_name = path; - } + ((Gtk.CellRendererPixbuf)icon_cell).icon_name = path; } public void cpu_usage_cell_layout (Gtk.CellLayout cell_layout, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter) { From 2b934c6a0ae52a0ffc4be4026503f09f077211ce Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Sat, 26 Jul 2025 23:13:29 +0200 Subject: [PATCH 39/42] Remove unused regex variable from CPUProcessTreeView constructor --- src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala b/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala index fc25fb34..e49c1476 100644 --- a/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala +++ b/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala @@ -9,15 +9,11 @@ public class Monitor.CPUProcessTreeView : Gtk.TreeView { private Gtk.TreeViewColumn pid_column; private Gtk.TreeViewColumn cpu_column; private Gtk.TreeViewColumn memory_column; - private Regex ? regex; public signal void process_selected (Process process); public CPUProcessTreeView (TreeViewModel model) { this.model = model; - /* *INDENT-OFF* */ - regex = /(?i:^.*\.(xpm|png)$)/; // vala-lint=space-before-paren, - /* *INDENT-ON* */ enable_search = false; From ef76dc16216db1b05504899318336a210db69f68 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Tue, 29 Jul 2025 23:49:32 +0200 Subject: [PATCH 40/42] Refactor permission_error_infobar initialization and improve conditional check for revealed state --- .../ProcessInfoView/ProcessInfoView.vala | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala index 6fc85a5d..d719a754 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala @@ -47,6 +47,7 @@ public class Monitor.ProcessInfoView : Gtk.Box { } public string ? icon_name; + // How to replace: https://docs.gtk.org/gtk4/class.InfoBar.html private Gtk.InfoBar permission_error_infobar; private Gtk.Label permission_error_label; @@ -60,9 +61,10 @@ public class Monitor.ProcessInfoView : Gtk.Box { orientation = Gtk.Orientation.VERTICAL; hexpand = true; - permission_error_infobar = new Gtk.InfoBar (); - permission_error_infobar.message_type = Gtk.MessageType.ERROR; - permission_error_infobar.revealed = false; + permission_error_infobar = new Gtk.InfoBar () { + message_type = Gtk.MessageType.ERROR, + revealed = false, + }; permission_error_label = new Gtk.Label (Utils.NO_DATA); permission_error_infobar.add_child (permission_error_label); append (permission_error_infobar); @@ -120,7 +122,7 @@ public class Monitor.ProcessInfoView : Gtk.Box { _("This may lead to data loss. Only Force Quit if Shut Down has failed."), new ThemedIcon ("computer-fail"), Gtk.ButtonsType.CANCEL - ) { + ) { badge_icon = new ThemedIcon ("process-stop"), modal = true, transient_for = (Gtk.Window) get_root () @@ -147,7 +149,7 @@ public class Monitor.ProcessInfoView : Gtk.Box { _("The process will be asked to initiate shutdown tasks and close. In some cases the process may not quit."), new ThemedIcon ("system-shutdown"), Gtk.ButtonsType.CANCEL - ) { + ) { badge_icon = new ThemedIcon ("dialog-question"), modal = true, transient_for = (Gtk.Window) get_root () @@ -172,7 +174,7 @@ public class Monitor.ProcessInfoView : Gtk.Box { } private void show_permission_error_infobar (string error) { - if (permission_error_infobar.revealed == false) { + if (!permission_error_infobar.revealed) { permission_error_label.set_text (error); permission_error_infobar.revealed = true; } From 536685edae75cb6239e1d6572ebf1b6ea9315b81 Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Tue, 29 Jul 2025 23:55:37 +0200 Subject: [PATCH 41/42] Refactor Statusbar labels --- src/Widgets/Statusbar/Statusbar.vala | 39 +++++++++++++++++----------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/src/Widgets/Statusbar/Statusbar.vala b/src/Widgets/Statusbar/Statusbar.vala index 02c7d020..64ab7568 100644 --- a/src/Widgets/Statusbar/Statusbar.vala +++ b/src/Widgets/Statusbar/Statusbar.vala @@ -31,30 +31,39 @@ public class Monitor.Statusbar : Gtk.Box { tooltip_text = _("GPU") }; - cpu_usage_label = new Gtk.Label (_("Calculating…")); - cpu_usage_label.set_width_chars (4); - cpu_usage_label.xalign = 0; + cpu_usage_label = new Gtk.Label (_("Calculating…")) { + width_chars = 4, + xalign = 0, + margin_start = 6, + }; + actionbar.pack_start (cpu_icon); actionbar.pack_start (cpu_usage_label); - memory_usage_label = new Gtk.Label (_("Calculating…")); - memory_usage_label.set_width_chars (4); - memory_usage_label.xalign = 0; - ram_icon.margin_start = 6; + memory_usage_label = new Gtk.Label (_("Calculating…")) { + width_chars = 4, + xalign = 0, + margin_start = 6, + }; + actionbar.pack_start (ram_icon); actionbar.pack_start (memory_usage_label); - swap_usage_label = new Gtk.Label (_("Calculating…")); - swap_usage_label.set_width_chars (4); - swap_usage_label.xalign = 0; - swap_icon.margin_start = 6; + swap_usage_label = new Gtk.Label (_("Calculating…")) { + width_chars = 4, + xalign = 0, + margin_start = 6, + }; + actionbar.pack_start (swap_icon); actionbar.pack_start (swap_usage_label); - gpu_usage_label = new Gtk.Label (_("Calculating…")); - gpu_usage_label.set_width_chars (4); - gpu_usage_label.xalign = 0; - gpu_icon.margin_start = 6; + gpu_usage_label = new Gtk.Label (_("Calculating…")) { + width_chars = 4, + xalign = 0, + margin_start = 6, + }; + actionbar.pack_start (gpu_icon); actionbar.pack_start (gpu_usage_label); From e78f54a087a7117aec25cd04bf2c86f5489e5e6b Mon Sep 17 00:00:00 2001 From: stsdc <6031763+stsdc@users.noreply.github.com> Date: Fri, 1 Aug 2025 18:49:11 +0200 Subject: [PATCH 42/42] re-enable Indicator build --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89ee49af..c81e959d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: meson valac sassc git - name: Build run: | - meson setup -Dindicator-wingpanel=disabled build + meson setup -Dindicator-wingpanel=enabled build meson compile -C build # Tests disabled since it starts to test live-chart and some tests fail there # meson test -C build --print-errorlogs