From 54e695b0564d698b38f994aa9193f1277aaa1e5b Mon Sep 17 00:00:00 2001 From: Clement Lefebvre Date: Fri, 8 Jun 2018 12:19:59 +0100 Subject: [PATCH] Fix RecentHelper spam in logs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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’ --- .../mintMenu/plugins/recentHelper.py | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/usr/lib/linuxmint/mintMenu/plugins/recentHelper.py b/usr/lib/linuxmint/mintMenu/plugins/recentHelper.py index 2ebf467..64cbc15 100644 --- a/usr/lib/linuxmint/mintMenu/plugins/recentHelper.py +++ b/usr/lib/linuxmint/mintMenu/plugins/recentHelper.py @@ -109,17 +109,21 @@ def buildRecentApps(): return recentApps def doRecentApps(): - for i in recentAppBox.get_children(): - i.destroy() + if recentAppBox is not None: + # recentAppBox is initiated by the recent plugin + # only build UI widgets if it's enabled - # recent apps - buildRecentApps() - for AButton in recentApps: - - AButton.set_size_request( 200, -1 ) - AButton.set_relief( Gtk.ReliefStyle.NONE ) + for i in recentAppBox.get_children(): + i.destroy() - recentAppBox.pack_start( AButton, False, True, 0 ) + # recent apps + buildRecentApps() + for AButton in recentApps: + + AButton.set_size_request( 200, -1 ) + AButton.set_relief( Gtk.ReliefStyle.NONE ) + + recentAppBox.pack_start( AButton, False, True, 0 ) return True