* src/grampslib_wrap.c: check the known mime types before calling the

gnome functions


svn: r2693
This commit is contained in:
Don Allingham 2004-01-22 02:03:21 +00:00
parent f4ae702e0e
commit f988840494

View File

@ -33,6 +33,10 @@
* and things like that. * and things like that.
* *
* $Log$ * $Log$
* Revision 1.3 2004/01/22 02:03:21 dallingham
* * src/grampslib_wrap.c: check the known mime types before calling the
* gnome functions
*
* Revision 1.2 2004/01/09 03:12:28 dallingham * Revision 1.2 2004/01/09 03:12:28 dallingham
* * src/docgen/KwordDoc.py (KwordDoc.close): handle KWord mime type * * src/docgen/KwordDoc.py (KwordDoc.close): handle KWord mime type
* * src/grampslib_wrap.c: handle NULL pointers * * src/grampslib_wrap.c: handle NULL pointers
@ -561,27 +565,54 @@ char *SWIG_GetPtr(char *_c, void **ptr, char *_t)
#define SWIG_name "grampslib" #define SWIG_name "grampslib"
#include <libgnomevfs/gnome-vfs-application-registry.h> #include <libgnomevfs/gnome-vfs-application-registry.h>
GList *gnome_vfs_get_registered_mime_types(void);
void gnome_vfs_mime_registered_mime_type_list_free(GList*);
extern const char *gnome_vfs_mime_get_icon(const char *); extern const char *gnome_vfs_mime_get_icon(const char *);
extern const char *gnome_vfs_mime_type_from_name(const char *); extern const char *gnome_vfs_mime_type_from_name(const char *);
extern const char *gnome_vfs_mime_get_description(const char *); extern const char *gnome_vfs_mime_get_description(const char *);
extern const char *gnome_vfs_mime_get_value(const char *,const char *); 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);
if (a) { GList *node;
return a->name; char* value;
} else { char* retval = NULL;
return (char*)0;
GList *s = gnome_vfs_get_registered_mime_types();
for (node = g_list_first(s); node != NULL; node = g_list_next(node)) {
if (!strcmp((char*)node->data,type)) {
GnomeVFSMimeApplication *a = gnome_vfs_mime_get_default_application(type);
if (a) {
retval = a->name;
break;
}
}
} }
gnome_vfs_mime_registered_mime_type_list_free(s);
return retval;
} }
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);
if (a) { GList *node;
return a->command; char* value;
} else { char* retval = NULL;
return (char*)0;
GList *s = gnome_vfs_get_registered_mime_types();
for (node = g_list_first(s); node != NULL; node = g_list_next(node)) {
if (!strcmp((char*)node->data,type)) {
GnomeVFSMimeApplication *a = gnome_vfs_mime_get_default_application(type);
if (a) {
retval = a->command;
break;
}
}
} }
gnome_vfs_mime_registered_mime_type_list_free(s);
return retval;
} }
static PyObject *_wrap_gnome_vfs_mime_get_icon(PyObject *self, PyObject *args) { static PyObject *_wrap_gnome_vfs_mime_get_icon(PyObject *self, PyObject *args) {