From 3fe6ea60148c9da7a75388cb7a0cd4ce0c64fce0 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Fri, 2 Sep 2016 20:01:25 +0530 Subject: [PATCH] frontpage: Cleanup urls for showing description In a module, when URL is not avialable for a shortcut, send None instead of an implementation specific detail on how to show description. This allows use to change the implementation of how description is shown without changes to modules. --- plinth/frontpage.py | 3 +++ plinth/modules/minetest/__init__.py | 4 ++-- plinth/modules/mumble/__init__.py | 4 ++-- plinth/modules/privoxy/__init__.py | 4 ++-- plinth/modules/quassel/__init__.py | 4 ++-- plinth/modules/radicale/__init__.py | 4 ++-- plinth/modules/repro/__init__.py | 4 ++-- plinth/modules/xmpp/__init__.py | 4 ++-- 8 files changed, 17 insertions(+), 14 deletions(-) diff --git a/plinth/frontpage.py b/plinth/frontpage.py index 633133095..6b819199a 100644 --- a/plinth/frontpage.py +++ b/plinth/frontpage.py @@ -29,6 +29,9 @@ def get_shortcuts(): def add_shortcut(id, label, url, icon, details=None): """Add shortcut to front page.""" + if not url: + url = '?selected={id}'.format(id=id) + shortcuts[id] = { 'id': id, 'label': label, diff --git a/plinth/modules/minetest/__init__.py b/plinth/modules/minetest/__init__.py index 5a8cf27e0..fc0eef46d 100644 --- a/plinth/modules/minetest/__init__.py +++ b/plinth/modules/minetest/__init__.py @@ -74,8 +74,8 @@ def setup(helper, old_version=None): def add_shortcut(): - frontpage.add_shortcut('minetest', title, '?selected=minetest', - 'glyphicon-th-large', description) + frontpage.add_shortcut('minetest', title, None, 'glyphicon-th-large', + description) def enable(): diff --git a/plinth/modules/mumble/__init__.py b/plinth/modules/mumble/__init__.py index 1ac8a940d..88d59ac43 100644 --- a/plinth/modules/mumble/__init__.py +++ b/plinth/modules/mumble/__init__.py @@ -79,8 +79,8 @@ def setup(helper, old_version=None): def add_shortcut(): - frontpage.add_shortcut('mumble', title, '?selected=mumble', - 'glyphicon-headphones', description) + frontpage.add_shortcut('mumble', title, None, 'glyphicon-headphones', + description) def enable(): diff --git a/plinth/modules/privoxy/__init__.py b/plinth/modules/privoxy/__init__.py index 621cd87e1..e7c4e0a0d 100644 --- a/plinth/modules/privoxy/__init__.py +++ b/plinth/modules/privoxy/__init__.py @@ -83,8 +83,8 @@ def setup(helper, old_version=None): def add_shortcut(): - frontpage.add_shortcut('privoxy', title, '?selected=privoxy', - 'glyphicon-cloud-upload', description) + frontpage.add_shortcut('privoxy', title, None, 'glyphicon-cloud-upload', + description) def enable(): diff --git a/plinth/modules/quassel/__init__.py b/plinth/modules/quassel/__init__.py index b4ecab192..31fa2a44b 100644 --- a/plinth/modules/quassel/__init__.py +++ b/plinth/modules/quassel/__init__.py @@ -87,8 +87,8 @@ def setup(helper, old_version=None): def add_shortcut(): - frontpage.add_shortcut('quassel', title, '?selected=quassel', - 'glyphicon-retweet', description) + frontpage.add_shortcut('quassel', title, None, 'glyphicon-retweet', + description) def enable(): diff --git a/plinth/modules/radicale/__init__.py b/plinth/modules/radicale/__init__.py index 463d2fc23..6467651e5 100644 --- a/plinth/modules/radicale/__init__.py +++ b/plinth/modules/radicale/__init__.py @@ -77,8 +77,8 @@ def setup(helper, old_version=None): def add_shortcut(): - frontpage.add_shortcut('radicale', title, '?selected=radicale', - 'glyphicon-calendar', description) + frontpage.add_shortcut('radicale', title, None, 'glyphicon-calendar', + description) def enable(): diff --git a/plinth/modules/repro/__init__.py b/plinth/modules/repro/__init__.py index bd38b2ad2..d9900bcf9 100644 --- a/plinth/modules/repro/__init__.py +++ b/plinth/modules/repro/__init__.py @@ -91,8 +91,8 @@ def setup(helper, old_version=None): def add_shortcut(): - frontpage.add_shortcut('repro', title, '?selected=repro', - 'glyphicon-phone-alt', description) + frontpage.add_shortcut('repro', title, None, 'glyphicon-phone-alt', + description) def enable(): diff --git a/plinth/modules/xmpp/__init__.py b/plinth/modules/xmpp/__init__.py index 1dd2a2bfb..9336c58de 100644 --- a/plinth/modules/xmpp/__init__.py +++ b/plinth/modules/xmpp/__init__.py @@ -93,8 +93,8 @@ def setup(helper, old_version=None): def add_shortcut(): frontpage.add_shortcut('jwchat', _('Chat Client (JWChat)'), '/jwchat', 'glyphicon-comment') - frontpage.add_shortcut('xmpp', title, '?selected=xmpp', - 'glyphicon-comment', description) + frontpage.add_shortcut('xmpp', title, None, 'glyphicon-comment', + description) class EjabberdServiceView(ServiceView):