Skip to content

Commit

Permalink
Save flatpak-infobar-state
Browse files Browse the repository at this point in the history
  • Loading branch information
stsdc committed Jan 6, 2024
1 parent 9d28856 commit b2119c0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
7 changes: 6 additions & 1 deletion data/com.github.stsdc.monitor.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,15 @@
<summary>Update time</summary>
<description>This value sets update time for updating data and charts.</description>
</key>
<key type='b' name="containers-view-state">
<key type='b' name="containers-view-state">
<default>false</default>
<summary>To show Containers view or not</summary>
<description>To show Containers view or not</description>
</key>
<key type='b' name="flatpak-infobar-state">
<default>true</default>
<summary>To show Flatpak infobar or not</summary>
<description>To show Flatpak infobar or not</description>
</key>
</schema>
</schemalist>
16 changes: 16 additions & 0 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions src/Managers/Process.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit b2119c0

Please sign in to comment.