Fixed links on about page

This commit is contained in:
boltgolt 2020-12-24 14:16:27 +01:00
parent 6e58ac99f9
commit adfb8a82d4
No known key found for this signature in database
GPG key ID: BECEC9937E1AAE26
2 changed files with 13 additions and 0 deletions

View file

@ -276,6 +276,7 @@
<attribute name="foreground" value="#2929ababe2e2"/>
<attribute name="underline-color" value="#2929ababe2e2"/>
</attributes>
<signal name="activate-link" handler="on_about_link" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@ -295,6 +296,7 @@
<attribute name="foreground" value="#2929ababe2e2"/>
<attribute name="underline-color" value="#2929ababe2e2"/>
</attributes>
<signal name="activate-link" handler="on_about_link" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>

View file

@ -5,6 +5,7 @@ import signal
import sys
import os
import elevate
import subprocess
# Make sure we have the libs we need
gi.require_version("Gtk", "3.0")
@ -81,6 +82,16 @@ class MainWindow(gtk.Window):
self.treeview.set_model(self.listmodel)
def on_about_link(self, label, uri):
"""Open links on about page as a non-root user"""
try:
user = os.getlogin()
except Exception:
user = os.environ.get("SUDO_USER")
status, output = subprocess.getstatusoutput(["sudo -u " + user + " timeout 10 xdg-open " + uri])
return True
def exit(self, widget, context):
"""Cleanly exit"""
gtk.main_quit()