Fix RecentHelper spam in logs

When recent plugin is disabled, recentAppBox is None,
resulting in errors in the logs:

org.mate.panel.applet.MintMenuAppletFactory[1038]: File “/usr/lib/linuxmint/mintMenu/plugins/recentHelper.py”, line 130, in applicationButtonClicked
org.mate.panel.applet.MintMenuAppletFactory[1038]: doRecentApps()
org.mate.panel.applet.MintMenuAppletFactory[1038]: File “/usr/lib/linuxmint/mintMenu/plugins/recentHelper.py”, line 112, in doRecentApps
org.mate.panel.applet.MintMenuAppletFactory[1038]: for i in recentAppBox.get_children():
org.mate.panel.applet.MintMenuAppletFactory[1038]: AttributeError: ‘NoneType’ object has no attribute ‘get_children’
This commit is contained in:
Clement Lefebvre 2018-06-08 12:19:59 +01:00
parent c2ddf199aa
commit 54e695b056

View File

@ -109,17 +109,21 @@ def buildRecentApps():
return recentApps return recentApps
def doRecentApps(): def doRecentApps():
for i in recentAppBox.get_children(): if recentAppBox is not None:
i.destroy() # recentAppBox is initiated by the recent plugin
# only build UI widgets if it's enabled
# recent apps for i in recentAppBox.get_children():
buildRecentApps() i.destroy()
for AButton in recentApps:
AButton.set_size_request( 200, -1 ) # recent apps
AButton.set_relief( Gtk.ReliefStyle.NONE ) buildRecentApps()
for AButton in recentApps:
recentAppBox.pack_start( AButton, False, True, 0 ) AButton.set_size_request( 200, -1 )
AButton.set_relief( Gtk.ReliefStyle.NONE )
recentAppBox.pack_start( AButton, False, True, 0 )
return True return True