* src/docgen/KwordDoc.py (KwordDoc.close): handle KWord mime type

* src/grampslib_wrap.c: handle NULL pointers


svn: r2613
This commit is contained in:
Don Allingham 2004-01-09 03:12:28 +00:00
parent f9b0f6c78c
commit 7c66298bf8
2 changed files with 33 additions and 2 deletions

View File

@ -259,6 +259,14 @@ class KwordDoc(BaseDoc.BaseDoc):
self.f.close() self.f.close()
self.m.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): def start_page(self,orientation=None):
pass 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") Plugins.register_text_doc(_("KWord"),KwordDoc,1,1,1,".kwd")

View File

@ -33,6 +33,10 @@
* and things like that. * and things like that.
* *
* $Log$ * $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 * Revision 1.1 2002/11/26 04:06:23 dallingham
* use pygtk.require to determine database * 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) { const char* default_application_name(const char* type) {
GnomeVFSMimeApplication *a = gnome_vfs_mime_get_default_application(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) { const char* default_application_command(const char* type) {
GnomeVFSMimeApplication *a = gnome_vfs_mime_get_default_application(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) { static PyObject *_wrap_gnome_vfs_mime_get_icon(PyObject *self, PyObject *args) {