libgnomevfsmm 2.26.0
|
00001 // -*- c++ -*- 00002 // Generated by gtkmmproc -- DO NOT MODIFY! 00003 #ifndef _LIBGNOMEVFSMM_MIME_APPLICATION_H 00004 #define _LIBGNOMEVFSMM_MIME_APPLICATION_H 00005 00006 00007 #include <glibmm.h> 00008 00009 /* Copyright 2003 gnome-vfsmm Development Team 00010 * 00011 * This library is free software; you can redistribute it and/or 00012 * modify it under the terms of the GNU Lesser General Public 00013 * License as published by the Free Software Foundation; either 00014 * version 2.1 of the License, or (at your option) any later version. 00015 * 00016 * This library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Lesser General Public License for more details. 00020 * 00021 * You should have received a copy of the GNU Lesser General Public 00022 * License along with this library; if not, write to the Free 00023 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00024 */ 00025 00026 #include <libgnomevfs/gnome-vfs-mime-handlers.h> 00027 #include <libgnomevfs/gnome-vfs-application-registry.h> 00028 00029 #include <libgnomevfsmm/enums.h> 00030 #include <libgnomevfsmm/exception.h> 00031 00032 00033 namespace Gnome 00034 { 00035 00036 namespace Vfs 00037 { 00038 00039 typedef Glib::ListHandle<Glib::ustring> ListHandleStrings; 00040 00041 //TODO: What is a MimeApplication? How can I get one. What could I do with one. 00042 class MimeApplication 00043 { 00044 public: 00045 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00046 typedef MimeApplication CppObjectType; 00047 typedef GnomeVFSMimeApplication BaseObjectType; 00048 #endif /* DOXYGEN_SHOULD_SKIP_THIS */ 00049 00050 MimeApplication(); 00051 00052 // Use make_a_copy=true when getting it directly from a struct. 00053 explicit MimeApplication(GnomeVFSMimeApplication* castitem, bool make_a_copy = false); 00054 00055 MimeApplication(const MimeApplication& src); 00056 MimeApplication& operator=(const MimeApplication& src); 00057 00058 ~MimeApplication(); 00059 00060 GnomeVFSMimeApplication* gobj() { return gobject_; } 00061 const GnomeVFSMimeApplication* gobj() const { return gobject_; } 00062 00064 GnomeVFSMimeApplication* gobj_copy() const; 00065 00066 protected: 00067 GnomeVFSMimeApplication* gobject_; 00068 00069 private: 00070 00071 00072 public: 00073 MimeApplication(const Glib::ustring& id); 00074 00075 MimeApplication(const Glib::ustring& id, const Glib::ustring& name, 00076 const Glib::ustring& command, MimeApplicationArgumentType argument_type, 00077 ListHandleStrings supported_uri_schemes, bool multiple_files, bool requires_terminal); 00078 00079 //Test whether this is a valid instance. 00080 operator bool() const; 00081 00085 Glib::ustring get_id() const; 00086 00090 Glib::ustring get_name() const; 00091 00095 Glib::ustring get_command() const; 00096 00100 MimeApplicationArgumentType get_argument_type() const; 00101 00105 Glib::ListHandle<Glib::ustring> get_supported_uri_schemes() const; 00106 00110 bool can_open_multiple_files() const; 00111 00115 bool requires_terminal() const; 00116 00117 //TODO: These don't seem to use g_strdup(), but they should. 00118 void set_id(const Glib::ustring& value); 00119 void set_name(const Glib::ustring& value); 00120 void set_command(const Glib::ustring& value); 00121 void set_argument_type(const MimeApplicationArgumentType& value); 00122 void set_supported_uri_schemes(const Glib::ListHandle<Glib::ustring>& value); 00123 00124 void set_open_multiple_files(bool value = true); 00125 void set_requires_terminal(bool value = true); 00126 00127 /* 00128 * Application Registry convenience functions 00129 */ 00130 00136 bool is_user_owned() const; 00137 00138 bool exists_in_registry() const; 00139 void remove_from_registry(); 00140 00147 void save_to_registry(); 00148 00149 ListHandleStrings get_keys() const; 00150 00151 ListHandleStrings get_mime_types() const; 00152 void clear_mime_types(); 00153 00154 bool supports_mime_type(const Glib::ustring& mime_type) const; 00155 bool supports_uri_scheme(const Glib::ustring& uri_scheme) const; 00156 00157 Glib::ustring get_value(const Glib::ustring& key) const; 00158 bool get_value_bool(const Glib::ustring& key, bool& got_key) const; 00159 bool get_value_bool(const Glib::ustring& key) const; 00160 00161 void set_value(const Glib::ustring& key, const Glib::ustring& value); 00162 void set_value(const Glib::ustring& key, bool value); 00163 void unset_key(const Glib::ustring& key); 00164 00165 void add_mime_type(const Glib::ustring& mime_type); 00166 void remove_mime_type(const Glib::ustring& mime_type); 00167 00168 /* 00169 * Mime Database convenience functions 00170 */ 00171 00172 #ifdef GLIBMM_EXCEPTIONS_ENABLED 00173 00174 void set_default(const Glib::ustring& mime_type) throw(exception); 00175 void add_to_short_list(const Glib::ustring& mime_type) throw(exception); 00176 void remove_from_short_list(const Glib::ustring& mime_type) throw(exception); 00177 00178 void launch(const Glib::ListHandle<Glib::ustring>& uris) throw(exception); 00179 void launch(const Glib::ListHandle<Glib::ustring>& uris, const Glib::ustring& envp) throw(exception); 00180 00181 #else 00182 00183 void set_default(const Glib::ustring& mime_type, std::auto_ptr<Gnome::Vfs::exception>& error); 00184 void add_to_short_list(const Glib::ustring& mime_type, std::auto_ptr<Gnome::Vfs::exception>& error); 00185 void remove_from_short_list(const Glib::ustring& mime_type, std::auto_ptr<Gnome::Vfs::exception>& error); 00186 00187 void launch(const Glib::ListHandle<Glib::ustring>& uris, std::auto_ptr<Gnome::Vfs::exception>& error); 00188 void launch(const Glib::ListHandle<Glib::ustring>& uris, const Glib::ustring& envp, std::auto_ptr<Gnome::Vfs::exception>& error); 00189 00190 #endif 00191 00192 00193 }; 00194 00195 } // namespace Vfs 00196 } // namespace Gnome 00197 00198 00199 namespace Glib 00200 { 00201 00210 Gnome::Vfs::MimeApplication wrap(GnomeVFSMimeApplication* object, bool take_copy = false); 00211 00212 } // namespace Glib 00213 00214 00215 #endif /* _LIBGNOMEVFSMM_MIME_APPLICATION_H */ 00216