diff --git a/gramps2/src/docgen/KwordDoc.py b/gramps2/src/docgen/KwordDoc.py index 661bf0591..9fbb7c961 100644 --- a/gramps2/src/docgen/KwordDoc.py +++ b/gramps2/src/docgen/KwordDoc.py @@ -259,6 +259,14 @@ class KwordDoc(BaseDoc.BaseDoc): self.f.close() self.m.close() + if self.print_req: + import grampslib + + apptype = 'application/x-kword' + prog = grampslib.default_application_command(apptype) + os.environ["FILE"] = self.filename + os.system ('%s "$FILE" &' % prog) + def start_page(self,orientation=None): pass @@ -482,4 +490,15 @@ class KwordDoc(BaseDoc.BaseDoc): # #------------------------------------------------------------------------ +try: + import grampslib + import Utils + + prog = grampslib.default_application_command("application/x-kword") + desc = grampslib.default_application_name("application/x-kword") + if Utils.search_for(prog): + print_label=_("Open in %s") % desc +except: + print_label = None + Plugins.register_text_doc(_("KWord"),KwordDoc,1,1,1,".kwd") diff --git a/gramps2/src/grampslib_wrap.c b/gramps2/src/grampslib_wrap.c index 7c2e24348..616188c9b 100644 --- a/gramps2/src/grampslib_wrap.c +++ b/gramps2/src/grampslib_wrap.c @@ -33,6 +33,10 @@ * and things like that. * * $Log$ + * Revision 1.2 2004/01/09 03:12:28 dallingham + * * src/docgen/KwordDoc.py (KwordDoc.close): handle KWord mime type + * * src/grampslib_wrap.c: handle NULL pointers + * * Revision 1.1 2002/11/26 04:06:23 dallingham * use pygtk.require to determine database * @@ -564,12 +568,20 @@ extern const char *gnome_vfs_mime_get_value(const char *,const char *); const char* default_application_name(const char* type) { GnomeVFSMimeApplication *a = gnome_vfs_mime_get_default_application(type); - return a->name; + if (a) { + return a->name; + } else { + return (char*)0; + } } const char* default_application_command(const char* type) { GnomeVFSMimeApplication *a = gnome_vfs_mime_get_default_application(type); - return a->command; + if (a) { + return a->command; + } else { + return (char*)0; + } } static PyObject *_wrap_gnome_vfs_mime_get_icon(PyObject *self, PyObject *args) {