Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

gnomevfs.h

Go to the documentation of this file.
00001 
00002 // Name:        gnomevfs.h
00003 // Author:      Joe Yates
00004 // Purpose:     gnomevfs wrapper class
00005 // Created:     2004-11-25
00006 // Copyright:   (c) Joe Yates
00007 // License:     BSD license (see the file 'LICENSE.txt')
00009 
00010 #ifndef __wxGnomeVfs_h__
00011 #define __wxGnomeVfs_h__
00012 
00013 #include "wx/defs.h"
00014 #include "wx/dynlib.h"
00015 #include "wx/string.h"
00016 #include <wx/filename.h>
00017 #include <wx/dynarray.h>
00018 
00019 #include "glib-2.0/glib/gtypes.h"
00020 #include "libgnomevfs/gnome-vfs.h"
00021 #include "libgnomevfs/gnome-vfs-mime-utils.h"
00022 #include "libgnomevfs/gnome-vfs-mime-handlers.h"
00023 
00024 /*
00025 From libgnomevfs/gnome-vfs-mime-handlers.h
00026 
00027 typedef struct {
00028         char *id;
00029         char *name;
00030         char *command;
00031         gboolean can_open_multiple_files;
00032         GnomeVFSMimeApplicationArgumentType expects_uris;
00033         GList *supported_uri_schemes;
00034         gboolean requires_terminal;
00035         void *reserved1;
00036         void *reserved2;
00037                                                                                                                              
00038 } GnomeVFSMimeApplication;
00039 
00040 */
00041 
00042 class wxGnomeVfs;
00043   
00044 class wxGnomeVFSMimeApplication
00045   {
00046   friend class wxGnomeVfs;
00047 
00048   public:
00049     // Constructor for invalid instances
00050     wxGnomeVFSMimeApplication();
00051     wxGnomeVFSMimeApplication(const wxGnomeVFSMimeApplication& vma);
00052 
00053   protected:
00054     wxGnomeVFSMimeApplication(GnomeVFSMimeApplication * gvma);
00055 
00056   public:
00057     bool IsValid()
00058       { return (m_gvma != NULL)? true : false; }
00059     wxString GetId()
00060       { return m_sId; }
00061     wxString GetCommand()
00062       { return m_sCommand; }
00063 
00064   private:
00065     GnomeVFSMimeApplication * m_gvma;
00066     wxString  m_sId;
00067     wxString  m_sName;
00068     wxString  m_sCommand;
00069     wxString  m_sIconName;
00070   };
00071 
00072 WX_DECLARE_OBJARRAY(wxGnomeVFSMimeApplication, wxArrayGnomeVFSMimeApplication);
00073 
00074 class wxGnomeVfs
00075   {
00076   public:
00077     // constructors
00078     wxGnomeVfs();
00079     ~wxGnomeVfs();
00080   
00081   // Methods
00082   public:
00083     bool              IsLoaded() const;
00084     wxString          GetMimeType(const wxString& Uri) const;
00085     wxString          GetDescription(const wxString& sMimeType) const;
00086     bool              SetDescription(const wxString& sMimeType, const wxString& sNewDescription) const;
00091     wxFileName        GetIconPath(const wxString& sMimeType) const;
00092     bool              SetIconPath(const wxString& sMimeType, const wxFileName& fnmNewIcon) const;
00093     wxArrayString     GetExtensions(const wxString& sMimeType) const;
00094     bool              SetExtensions(const wxString& sMimeType, const wxArrayString& asNewExtensions) const;
00095 
00096     wxArrayGnomeVFSMimeApplication  GetShortListApplications(const wxString& sMimeType) const;
00097     wxString          GetCommand(const wxString& sApplicationId) const;
00098 
00099     wxGnomeVFSMimeApplication GetDefaultApplication(const wxString& sMimeType) const;
00100     void              FreeGnomeVFSMimeApplication(wxGnomeVFSMimeApplication& gva) const;
00101     wxString          GetIconName(wxGnomeVFSMimeApplication& gva) const;
00102 
00103   // Typedefs
00104   private:
00105     typedef gboolean (* wxgnome_vfs_initType)();
00106     typedef gboolean (* wxgnome_vfs_initializedType)();
00107     typedef void (* wxgnome_vfs_shutdownType)();
00108     typedef char* (* wxgnome_vfs_get_mime_typeType)(char*);
00109     typedef const char* (* wxgnome_vfs_mime_get_descriptionType)(const char *);
00110     typedef const char* (* wxgnome_vfs_mime_get_iconType)(const char *);
00111     typedef GList * (* wxgnome_vfs_mime_get_short_list_applicationsType)(const char*);
00112     typedef GnomeVFSMimeApplication * (* wxgnome_vfs_mime_get_default_applicationType)(const char*);
00113     typedef void (* gnome_vfs_mime_application_freeType)(GnomeVFSMimeApplication *);
00114     typedef void (* wxgnome_vfs_mime_application_list_freeType)(GList *);
00115     typedef GList * (* wxgnome_vfs_mime_get_extensions_listType)(const char*);
00116     typedef void (* wxgnome_vfs_mime_extensions_list_freeType)(GList *);
00117     typedef GnomeVFSMimeApplication * (* wxgnome_vfs_mime_application_new_from_idType)(const char *);
00118     typedef const char* (* gnome_vfs_mime_application_get_iconType)(GnomeVFSMimeApplication *app);
00119 
00120   private:
00121     bool LoadGnomeVFS();
00122 
00123   private:
00124     wxDynamicLibrary  m_libgnomevfs;
00125     bool              m_bLoaded;
00126     bool              m_bNeedsShutdown;
00127 
00128     // Function pointers
00129     wxgnome_vfs_initType                              wxgnome_vfs_init;
00130     wxgnome_vfs_initializedType                       wxgnome_vfs_initialized;
00131     wxgnome_vfs_shutdownType                          wxgnome_vfs_shutdown;
00132     wxgnome_vfs_get_mime_typeType                     wxgnome_vfs_get_mime_type;
00133     wxgnome_vfs_mime_get_descriptionType              wxgnome_vfs_mime_get_description;
00134     wxgnome_vfs_mime_get_iconType                     wxgnome_vfs_mime_get_icon;
00135     wxgnome_vfs_mime_get_short_list_applicationsType  wxgnome_vfs_mime_get_short_list_applications;
00136     wxgnome_vfs_mime_get_default_applicationType      wxgnome_vfs_mime_get_default_application;
00137     gnome_vfs_mime_application_freeType               gnome_vfs_mime_application_free;
00138     wxgnome_vfs_mime_application_list_freeType        wxgnome_vfs_mime_application_list_free;
00139     wxgnome_vfs_mime_get_extensions_listType          wxgnome_vfs_mime_get_extensions_list;
00140     wxgnome_vfs_mime_extensions_list_freeType         wxgnome_vfs_mime_extensions_list_free;
00141     wxgnome_vfs_mime_application_new_from_idType      wxgnome_vfs_mime_application_new_from_id;
00142     gnome_vfs_mime_application_get_iconType           gnome_vfs_mime_application_get_icon;
00143   };
00144 
00145 #endif // ndef __wxGnomeVfs_h__

Generated on Wed Jan 25 08:13:09 2006 for Sherpa wxWidgets Classes by doxygen 1.3.6