diff --git a/data/com.github.stsdc.monitor.gschema.xml b/data/com.github.stsdc.monitor.gschema.xml index a242f8ff..dd366b6b 100644 --- a/data/com.github.stsdc.monitor.gschema.xml +++ b/data/com.github.stsdc.monitor.gschema.xml @@ -90,10 +90,15 @@ Update time This value sets update time for updating data and charts. - + false To show Containers view or not To show Containers view or not + + true + To show Flatpak infobar or not + To show Flatpak infobar or not + diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 5c620623..86c51feb 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -60,7 +60,23 @@ public class Monitor.MainWindow : Hdy.ApplicationWindow { orientation = Gtk.Orientation.VERTICAL }; + var flatpak_infobar = new Gtk.InfoBar (); + flatpak_infobar.message_type = Gtk.MessageType.WARNING; + flatpak_infobar.revealed = MonitorApp.settings.get_boolean ("flatpak-infobar-state"); + var button = new Gtk.Button.with_label("Hide"); + button.margin_start = 20; + button.hexpand = true; + button.halign = Gtk.Align.END; + flatpak_infobar.get_content_area ().add (new Gtk.Label (_("Some of Monitor features are limited by Flatpak environment."))); + flatpak_infobar.get_content_area ().add (new Gtk.LinkButton.with_label ("https://github.com/stsdc/monitor", _("Try native."))); + flatpak_infobar.get_content_area ().add (button); + button.clicked.connect(() => { + flatpak_infobar.revealed = false; + MonitorApp.settings.set_boolean ("flatpak-infobar-state", false); + }); + grid.add (headerbar); + if (ProcessUtils.is_flatpak_env ()) grid.add (flatpak_infobar); grid.add (stack); grid.add (statusbar); diff --git a/src/Managers/Process.vala b/src/Managers/Process.vala index b59db33b..b21edc0a 100644 --- a/src/Managers/Process.vala +++ b/src/Managers/Process.vala @@ -100,10 +100,10 @@ public class Monitor.Process : GLib.Object { var process_provider = ProcessProvider.get_default (); string ? status = process_provider.pids_status.get (this.stat.pid); var status_line = status.split ("\n"); - + int uid = int.parse (status_line[8].split ("\t")[1]); - // @TODO parse users file instead + // @TODO parse users file instead if (uid == 0) username = "root"; return uid;