Skip to content

Commit d5451e0

Browse files
committed
Fix update notifier for python3 and Gtk+3
1 parent 60498b4 commit d5451e0

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

src/sboui-systray.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@
33
# System tray notifier for sboui updates. Source code adapted from
44
# salix-update-notifier by George Vlahavas (gapan).
55

6-
import gtk
76
import sys
7+
if sys.version_info[0] < 3:
8+
import gtk
9+
else:
10+
import gi
11+
# Note: see deprecation note near the bottom.
12+
gi.require_version('Gtk', '3.0')
13+
from gi.repository import Gtk as gtk
814

915
def accept(data=None):
1016
sys.exit(0)
@@ -51,7 +57,12 @@ def on_left_click(event):
5157
accept()
5258

5359
if __name__ == '__main__':
54-
icon = gtk.status_icon_new_from_icon_name("sboui")
60+
if sys.version_info[0] < 3:
61+
icon = gtk.status_icon_new_from_icon_name("sboui")
62+
else:
63+
# Note: this is deprecated in Gtk+3 and removed in Gtk+4. Will
64+
# eventually need to find a replacement.
65+
icon = gtk.StatusIcon().new_from_icon_name("sboui")
5566
icon.set_tooltip_text('SBo updates are available')
5667
icon.connect('popup-menu', on_right_click)
5768
icon.connect('activate', on_left_click)

src/sboui-update-notifier.in

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ def sbo_updates_available():
1313
stdout=subprocess.PIPE)
1414
retval = False
1515
for line in iter(proc.stdout.readline,''):
16-
if line.find("upgradable SlackBuild") != -1:
17-
if line.startswith("No"):
16+
if sys.version_info[0] < 3:
17+
dcdline = line
18+
else:
19+
dcdline = line.decode()
20+
if dcdline.find("upgradable SlackBuild") != -1:
21+
if dcdline.startswith("No"):
1822
break
1923
else:
2024
retval = True

0 commit comments

Comments
 (0)