diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 81e6e79c..21e606aa 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -1,25 +1,25 @@ -public class Monitor.MainWindow : Adw.ApplicationWindow { +public class Monitor.MainWindow : Gtk.ApplicationWindow { // application reference private Shortcuts shortcuts; private Resources resources; // Widgets - public Headerbar headerbar; + // public HeaderbarContent headerbar_content; // public ProcessView process_view; // public SystemView system_view; public ContainerView container_view; private Gtk.Stack stack; - private Statusbar statusbar; + // private Statusbar statusbar; public DBusServer dbusserver; // Constructs a main window public MainWindow (MonitorApp app) { - Adw.init (); + // Adw.init (); this.set_application (app); setup_window_state (); @@ -48,12 +48,22 @@ public class Monitor.MainWindow : Adw.ApplicationWindow { stack_switcher.valign = Gtk.Align.CENTER; stack_switcher.set_stack (stack); - headerbar = new Headerbar (this); - headerbar.set_title_widget (stack_switcher); - headerbar.preferences_grid.attach (new PreferencesView (), 0, 0, 1, 1); + var headerbar = new Gtk.HeaderBar () { + title_widget = stack_switcher, + hexpand = true + }; + + // headerbar.search_revealer.set_reveal_child (stack.visible_child_name == "process_view"); + // stack.notify["visible-child-name"].connect (() => { + // headerbar.search_revealer.set_reveal_child (stack.visible_child_name == "process_view"); + // }); + + // headerbar_content = new HeaderbarContent (this); + // headerbar.set_title_widget (stack_switcher); + // headerbar.preferences_grid.attach (new PreferencesView (), 0, 0, 1, 1); // sv.show_all (); - statusbar = new Statusbar (); + // statusbar = new Statusbar (); var grid = new Gtk.Grid () { orientation = Gtk.Orientation.VERTICAL @@ -61,18 +71,15 @@ public class Monitor.MainWindow : Adw.ApplicationWindow { grid.attach (headerbar, 0, 0, 1, 1); grid.attach (stack, 0, 1, 1, 1); - grid.attach (statusbar, 0, 2, 1, 1); + // grid.attach (statusbar, 0, 2, 1, 1); - set_content (grid); + // set_content (grid); + set_child (grid); present (); dbusserver = DBusServer.get_default (); - headerbar.search_revealer.set_reveal_child (stack.visible_child_name == "process_view"); - stack.notify["visible-child-name"].connect (() => { - headerbar.search_revealer.set_reveal_child (stack.visible_child_name == "process_view"); - }); new Thread ("upd", () => { Timeout.add_seconds (MonitorApp.settings.get_int ("update-time"), () => { @@ -86,7 +93,7 @@ public class Monitor.MainWindow : Adw.ApplicationWindow { // system_view.update (); dbusserver.indicator_state (MonitorApp.settings.get_boolean ("indicator-state")); var res = resources.serialize (); - statusbar.update (res); + // statusbar.update (res); dbusserver.update (res); return false; }); @@ -104,7 +111,7 @@ public class Monitor.MainWindow : Adw.ApplicationWindow { }); shortcuts = new Shortcuts (this); - key_press_event.connect ((e) => shortcuts.handle (e)); + // key_press_event.connect ((e) => shortcuts.handle (e)); app.window_removed.connect (() => { int position_x, position_y; @@ -113,8 +120,8 @@ public class Monitor.MainWindow : Adw.ApplicationWindow { // get_position (out position_x, out position_y); MonitorApp.settings.set_int ("window-width", window_width); MonitorApp.settings.set_int ("window-height", window_height); - MonitorApp.settings.set_int ("position-x", position_x); - MonitorApp.settings.set_int ("position-y", position_y); + // MonitorApp.settings.set_int ("position-x", position_x); + // MonitorApp.settings.set_int ("position-y", position_y); // MonitorApp.settings.set_boolean ("is-maximized", this.is_maximized); MonitorApp.settings.set_string ("opened-view", stack.visible_child_name); diff --git a/src/Views/ContainerView/ContainerInfoView/ContainerInfoCharts.vala b/src/Views/ContainerView/ContainerInfoView/ContainerInfoCharts.vala index 8ad2f651..13559c01 100644 --- a/src/Views/ContainerView/ContainerInfoView/ContainerInfoCharts.vala +++ b/src/Views/ContainerView/ContainerInfoView/ContainerInfoCharts.vala @@ -22,10 +22,10 @@ public class Monitor.ContainerInfoCharts : 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/ContainerView/ContainerInfoView/ContainerInfoHeader.vala b/src/Views/ContainerView/ContainerInfoView/ContainerInfoHeader.vala index bff68aa9..9943abdb 100644 --- a/src/Views/ContainerView/ContainerInfoView/ContainerInfoHeader.vala +++ b/src/Views/ContainerView/ContainerInfoView/ContainerInfoHeader.vala @@ -21,7 +21,7 @@ public class Monitor.ContainerInfoHeader : 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; diff --git a/src/Views/ContainerView/ContainerInfoView/ContainerInfoView.vala b/src/Views/ContainerView/ContainerInfoView/ContainerInfoView.vala index 7e38cf8f..69139ce6 100644 --- a/src/Views/ContainerView/ContainerInfoView/ContainerInfoView.vala +++ b/src/Views/ContainerView/ContainerInfoView/ContainerInfoView.vala @@ -20,13 +20,16 @@ public class Monitor.ContainerInfoView : Gtk.Grid { private Gtk.Label ram_label; construct { - this.expand = false; + // this.expand = false; this.width_request = 200; column_spacing = 6; row_spacing = 6; vexpand = false; - margin = 12; + margin_start = 12; + margin_end = 12; + margin_top = 12; + margin_bottom = 12; column_homogeneous = true; row_homogeneous = false; diff --git a/src/Views/ContainerView/ContainerView.vala b/src/Views/ContainerView/ContainerView.vala index 3993f66f..a443eb1b 100644 --- a/src/Views/ContainerView/ContainerView.vala +++ b/src/Views/ContainerView/ContainerView.vala @@ -15,16 +15,16 @@ public class Monitor.ContainerView : Gtk.Box { public ContainerView () { - var container_tree_view_scrolled = new Gtk.ScrolledWindow (null, null); - container_tree_view_scrolled.add (container_treeview); + var container_tree_view_scrolled = new Gtk.ScrolledWindow (); + container_tree_view_scrolled.set_child (container_treeview); var paned = new Gtk.Paned (Gtk.Orientation.HORIZONTAL); - paned.pack1 (container_tree_view_scrolled, true, false); + paned.set_start_child (container_tree_view_scrolled); // paned.pack2 (container_info_view, true, false); paned.set_position (paned.max_position); - add (paned); + append (paned); } private void set_container_container_info_view (DockerContainer container) { diff --git a/src/Views/PreferencesView/PreferencesGeneralPage.vala b/src/Views/PreferencesView/PreferencesGeneralPage.vala index bdcc4553..a4c49c97 100644 --- a/src/Views/PreferencesView/PreferencesGeneralPage.vala +++ b/src/Views/PreferencesView/PreferencesGeneralPage.vala @@ -13,7 +13,7 @@ public PreferencesGeneralPage () { - var icon = new Gtk.Image.from_icon_name ("preferences-system", Gtk.IconSize.DND); + var icon = new Gtk.Image.from_icon_name ("preferences-system"); Object ( display_widget: icon, @@ -66,10 +66,14 @@ hexpand = true }; - var content_area = new Gtk.Grid (); - content_area.column_spacing = 12; - content_area.row_spacing = 12; - content_area.margin = 12; + var content_area = new Gtk.Grid () { + column_spacing = 12, + row_spacing = 12, + margin_start = 12, + margin_end = 12, + margin_top = 12, + margin_bottom = 12, + }; content_area.attach (background_label, 0, 1, 1, 1); content_area.attach (background_switch, 1, 1, 1, 1); content_area.attach (enable_smooth_lines_label, 0, 2, 1, 1); @@ -79,7 +83,7 @@ content_area.attach (enable_containers_view_label, 0, 5, 1, 1); content_area.attach (enable_containers_view_switch, 1, 5, 1, 1); - add (content_area); + append (content_area); background_switch.notify["active"].connect (() => { MonitorApp.settings.set_boolean ("background-state", background_switch.state); diff --git a/src/Views/PreferencesView/PreferencesView.vala b/src/Views/PreferencesView/PreferencesView.vala index bfe1b7bc..3da934fa 100644 --- a/src/Views/PreferencesView/PreferencesView.vala +++ b/src/Views/PreferencesView/PreferencesView.vala @@ -3,7 +3,7 @@ * SPDX-License-Identifier: LGPL-3.0-or-later */ - public class Monitor.PreferencesView : Gtk.Paned { + public class Monitor.PreferencesView : Gtk.Box { private PreferencesGeneralPage general_page = new PreferencesGeneralPage (); private PreferencesIndicatorPage indicator_page = new PreferencesIndicatorPage (); @@ -12,9 +12,11 @@ general_page.background_switch.notify["active"].connect (() => set_background_switch_state ()); indicator_page.status_switch.notify["active"].connect (() => set_background_switch_state ()); + var paned = new Gtk.Paned (Gtk.Orientation.HORIZONTAL); + height_request = 300; width_request = 500; - set_position (135); + paned.set_position (135); var stack = new Gtk.Stack (); stack.add_named (indicator_page, "indicator_page"); @@ -24,8 +26,9 @@ width_request = 135 }; - pack1 (settings_sidebar, true, false); - pack2 (stack, true, false); + paned.set_start_child (settings_sidebar); + paned.set_end_child (stack); + append (paned); } private void set_background_switch_state () { diff --git a/src/Views/SystemView/SystemNetworkView.vala b/src/Views/SystemView/SystemNetworkView.vala index 08eecf8e..b32d178d 100644 --- a/src/Views/SystemView/SystemNetworkView.vala +++ b/src/Views/SystemView/SystemNetworkView.vala @@ -2,7 +2,7 @@ public class Monitor.SystemNetworkView : Gtk.Grid { private Chart network_chart; private Network network; - private LabelH4 network_name_label; + private Gtk.Label network_name_label; private LabelRoundy network_upload_label; private LabelRoundy network_download_label; @@ -18,7 +18,7 @@ public class Monitor.SystemNetworkView : Gtk.Grid { public SystemNetworkView (Network _network) { network = _network; - network_name_label = new LabelH4 (_("Network")); + network_name_label = new Gtk.Label (_("Network")); network_download_label = new LabelRoundy (_("DOWN")); network_download_label.val.set_width_chars (7); diff --git a/src/Views/SystemView/SystemStorageView.vala b/src/Views/SystemView/SystemStorageView.vala index 87e1295d..7872dac7 100644 --- a/src/Views/SystemView/SystemStorageView.vala +++ b/src/Views/SystemView/SystemStorageView.vala @@ -2,7 +2,7 @@ public class Monitor.SystemStorageView : Gtk.Grid { private Chart storage_chart; private Storage storage; - private LabelH4 storage_name_label; + private Gtk.Label storage_name_label; private LabelRoundy storage_read_label; private LabelRoundy storage_write_label; @@ -20,7 +20,7 @@ public class Monitor.SystemStorageView : Gtk.Grid { public SystemStorageView (Storage _storage) { storage = _storage; - storage_name_label = new LabelH4 (_("Storage")); + storage_name_label = new Gtk.Label (_("Storage")); storage_write_label = new LabelRoundy (_("WRITE")); storage_write_label.val.set_width_chars (7); diff --git a/src/Widgets/Chart/Chart.vala b/src/Widgets/Chart/Chart.vala index 0099b706..7163a068 100644 --- a/src/Widgets/Chart/Chart.vala +++ b/src/Widgets/Chart/Chart.vala @@ -27,7 +27,7 @@ public class Monitor.Chart : Gtk.Box { }; live_chart = new LiveChart.Chart (config); - live_chart.expand = true; + // live_chart.expand = true; live_chart.legend.visible = false; live_chart.grid.visible = true; live_chart.background.visible = false; @@ -60,7 +60,7 @@ public class Monitor.Chart : Gtk.Box { live_chart.add_serie (serie); } - add (live_chart); + append (live_chart); return this; } @@ -73,7 +73,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/Headerbar.vala b/src/Widgets/Headerbar/HeaderbarContent.vala similarity index 92% rename from src/Widgets/Headerbar/Headerbar.vala rename to src/Widgets/Headerbar/HeaderbarContent.vala index 5dc18fff..7b6b142a 100644 --- a/src/Widgets/Headerbar/Headerbar.vala +++ b/src/Widgets/Headerbar/HeaderbarContent.vala @@ -1,4 +1,4 @@ -public class Monitor.Headerbar : Gtk.HeaderBar { +public class Monitor.HeaderbarContent { private MainWindow window; public Search search; @@ -14,7 +14,7 @@ public class Monitor.Headerbar : Gtk.HeaderBar { // title_widget = new Gtk.Label(_("Monitor")); } - public Headerbar (MainWindow window) { + public HeaderbarContent (MainWindow window) { this.window = window; var preferences_button = new Gtk.MenuButton (); diff --git a/src/Widgets/Headerbar/Search.vala b/src/Widgets/Headerbar/Search.vala index 922f00f6..16388533 100644 --- a/src/Widgets/Headerbar/Search.vala +++ b/src/Widgets/Headerbar/Search.vala @@ -24,9 +24,9 @@ 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) { - process_tree_view.collapse_all (); - } + // if (this.is_focus) { + // process_tree_view.collapse_all (); + // } filter_model.refilter (); @@ -34,9 +34,9 @@ public class Monitor.Search : Gtk.SearchEntry { process_tree_view.focus_on_child_row (); this.grab_focus (); - if (this.text != "") { - this.insert_at_cursor (""); - } + // if (this.text != "") { + // this.insert_at_cursor (""); + // } }); } @@ -87,7 +87,7 @@ public class Monitor.Search : Gtk.SearchEntry { public void activate_entry (string search_text = "") { this.text = ""; this.search_changed (); - this.insert_at_cursor (search_text); + // this.insert_at_cursor (search_text); } } diff --git a/src/Widgets/WidgetResource/WidgetResource.vala b/src/Widgets/WidgetResource/WidgetResource.vala index 6c22a07a..ff71de5a 100644 --- a/src/Widgets/WidgetResource/WidgetResource.vala +++ b/src/Widgets/WidgetResource/WidgetResource.vala @@ -1,5 +1,5 @@ public class Monitor.WidgetResource : Gtk.Box { - private LabelH4 _title = new LabelH4 (Utils.NO_DATA); + private Gtk.Label _title = new Gtk.Label (Utils.NO_DATA); public string title { set { diff --git a/src/meson.build b/src/meson.build index 24ef83a5..a3370e00 100644 --- a/src/meson.build +++ b/src/meson.build @@ -4,8 +4,8 @@ source_app_files = [ 'Utils.vala', # Views - 'Views/ProcessView/ProcessView.vala', - 'Views/ProcessView/ProcessInfoView/ProcessInfoView.vala', + # 'Views/ProcessView/ProcessView.vala', + # 'Views/ProcessView/ProcessInfoView/ProcessInfoView.vala', 'Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala', 'Views/PreferencesView/PreferencesView.vala', @@ -27,19 +27,19 @@ source_app_files = [ 'Views/ContainerView/ContainerInfoView/ContainerInfoCharts.vala', # Widgets related only to ProcessInfoView - 'Views/ProcessView/ProcessInfoView/Preventor.vala', + # 'Views/ProcessView/ProcessInfoView/Preventor.vala', 'Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala', 'Views/ProcessView/ProcessInfoView/ProcessInfoCPURAM.vala', 'Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala', 'Views/ProcessView/ProcessInfoView/OpenFilesTreeView.vala', # Widgets - 'Widgets/Headerbar/Headerbar.vala', - 'Widgets/Headerbar/Search.vala', - 'Widgets/Statusbar/Statusbar.vala', + # 'Widgets/Headerbar/HeaderbarContent.vala', + # 'Widgets/Headerbar/Search.vala', + # 'Widgets/Statusbar/Statusbar.vala', 'Widgets/Labels/LabelVertical.vala', 'Widgets/Labels/LabelRoundy.vala', - 'Widgets/Labels/LabelH4.vala', + # 'Widgets/Labels/LabelH4.vala', 'Widgets/Chart/Chart.vala', 'Widgets/WidgetResource/WidgetResource.vala',