diff --git a/src/GrampsDisplay.py b/src/GrampsDisplay.py index 1973a5d4f..7edcd9651 100644 --- a/src/GrampsDisplay.py +++ b/src/GrampsDisplay.py @@ -21,6 +21,7 @@ # $Id$ import const +import config import locale import os @@ -73,10 +74,16 @@ def help(webpage='', section=''): link = link + '#' + section url(link) -def url(link): +def url(link, uistate=None): """ Open the specified URL in a browser. """ + if uistate and config.get('htmlview.url-handler'): + if 'Web' in uistate.viewmanager.get_categories(): + uistate.viewmanager.goto_category('Web') + page = uistate.viewmanager.get_category_page('Web') + page.open(link) + return if not run_file(link): run_browser(link) diff --git a/src/config.py b/src/config.py index 1b376d6a7..36f278954 100644 --- a/src/config.py +++ b/src/config.py @@ -165,6 +165,7 @@ register('geoview.stylesheet', "") register('geoview.zoom', 0) register('htmlview.start-url', "http://gramps-project.org") +register('htmlview.url-handler', False) register('interface.address-height', 450) register('interface.address-width', 650) diff --git a/src/gui/widgets/styledtexteditor.py b/src/gui/widgets/styledtexteditor.py index c88904e35..2f9cc0437 100644 --- a/src/gui/widgets/styledtexteditor.py +++ b/src/gui/widgets/styledtexteditor.py @@ -717,7 +717,8 @@ class StyledTextEditor(gtk.TextView): else: return # If ok, then let's open - display_url(url) + obj = find_parent_with_attr(self, attr="dbstate") + display_url(url, obj.uistate) def _copy_url_cb(self, menuitem, url, flavor): """Copy url to both useful selections."""