2002-10-25 10:22:51 +05:30
|
|
|
%module grampslib
|
2002-10-28 19:06:39 +05:30
|
|
|
%{
|
2004-01-23 09:08:23 +05:30
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2002-10-28 19:06:39 +05:30
|
|
|
#include <libgnomevfs/gnome-vfs-application-registry.h>
|
2004-01-23 09:08:23 +05:30
|
|
|
GList *gnome_vfs_get_registered_mime_types(void);
|
|
|
|
void gnome_vfs_mime_registered_mime_type_list_free(GList*);
|
2002-10-28 19:06:39 +05:30
|
|
|
%}
|
2002-10-25 10:22:51 +05:30
|
|
|
|
2002-10-28 19:06:39 +05:30
|
|
|
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_get_description(const char*);
|
|
|
|
extern const char* gnome_vfs_mime_get_value(const char*,const char*);
|
|
|
|
|
|
|
|
%inline %{
|
|
|
|
const char* default_application_name(const char* type) {
|
2004-01-23 09:08:23 +05:30
|
|
|
|
|
|
|
GList *node;
|
|
|
|
char* value;
|
|
|
|
char* retval = NULL;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2004-01-10 23:35:36 +05:30
|
|
|
}
|
2004-01-23 09:08:23 +05:30
|
|
|
gnome_vfs_mime_registered_mime_type_list_free(s);
|
|
|
|
return retval;
|
2002-10-28 19:06:39 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
const char* default_application_command(const char* type) {
|
2004-01-23 09:08:23 +05:30
|
|
|
|
|
|
|
GList *node;
|
|
|
|
char* value;
|
|
|
|
char* retval = NULL;
|
|
|
|
|
|
|
|
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;
|
2002-10-28 19:06:39 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
%}
|