Change the way we "launch" files using their default application. Instead of trying to find the application ourselves, use the OS built in functions to open a file with its default application. We no longer show the name of the application that we will open the file with because we don't know.

svn: r11781
This commit is contained in:
Brian Matherly
2009-02-01 04:21:17 +00:00
parent 6fccf8d75f
commit 3259b393da
18 changed files with 107 additions and 261 deletions

View File

@@ -125,9 +125,8 @@ class PdfDoc(CairoDoc):
fontmap.set_resolution(saved_resolution)
# load the result into an external viewer
if self.print_req:
app = Mime.get_application('application/pdf')
Utils.launch(app[0], self._filename)
if self.open_req:
Utils.open_file_with_default_application(self._filename)
#------------------------------------------------------------------------
#
@@ -137,17 +136,8 @@ class PdfDoc(CairoDoc):
def register_docgen():
"""Register the docgen with the GRAMPS plugin system.
"""
try:
mprog = Mime.get_application("application/pdf")
mtype = Mime.get_description("application/pdf")
if Utils.search_for(mprog[0]):
print_label = _("Open in %s") % mprog[1]
else:
print_label = None
except:
mtype = _('PDF document')
print_label = None
mtype = _('PDF document')
print_label = _("Open with default viewer")
pmgr = PluginManager.get_instance()
pmgr.register_text_doc(mtype, PdfDoc, 1, 1, ".pdf", print_label)