Fixed links on about page
This commit is contained in:
parent
6e58ac99f9
commit
adfb8a82d4
2 changed files with 13 additions and 0 deletions
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue