/usr/include/gnome-vfsmm-2.6/libgnomevfsmm/mime-handlers.h is in libgnome-vfsmm-2.6-dev 2.26.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | /* Copyright 2003 gnome-vfsmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _LIBGNOMEVFSMM_MIME_HANDLERS_H
#define _LIBGNOMEVFSMM_MIME_HANDLERS_H
#include <glibmm.h>
#include <libgnomevfsmm/enums.h>
#include <libgnomevfsmm/exception.h>
#include <libgnomevfsmm/mime-application.h>
#include <libgnomevfsmm/mime-action.h>
/*
* If the underlying GConf implementation does not use Orbit, then
* stub out the return of functions which are Bonobo-specific
*/
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#ifdef DISABLE_ORBIT
typedef void Bonobo_ServerInfo;
#endif
namespace Gnome
{
namespace Vfs
{
//TODO: Explain when/how someone might use this stuff.
//TODO: Consider renaming this to MimeDatabase or something similar. Murray.
//e.g. Direct people to
//- get_registered_types() to discover all MIME types.
//- get_description() to get a human-readable description of a MIME type.
//- get_all_applications() to get a list of applications that can handle the MIME type.
//TODO: Tell them how to get the MIME type for a file.
namespace Mime
{
typedef Glib::ListHandle<Gnome::Vfs::MimeApplication*> ListHandleApps;
//Removed from gnome-vfs: typedef GList* ListHandleComps;
typedef Glib::ListHandle<Glib::ustring> ListHandleStrings;
/*
* Accessor functions
*/
//TODO: The result is either APPLICATION or COMPONENT. These don't sound like actions,
// so my explanation seems necessary. Murray.
/** Get a default action type for specified @a mime_type.
* @param mime_type A string containing an MIME type.
* @return An enum value representing what to do for this MIME type.
*/
MimeActionType get_default_action_type(const Glib::ustring& mime_type);
/** Get the default application for specified @a mime_type.
* @param mime_type A string containing an MIME type.
* @return An MimeApplication representing the default application for this MIME type.
*/
MimeApplication get_default_application(const Glib::ustring& mime_type);
/** Get the default action for specified @a mime_type.
* @param mime_type A string containing an MIME type.
* @return An MimeAction representing the default action for this MIME type.
*/
GnomeVFSMimeAction* get_default_action(const Glib::ustring& mime_type);
// TODO: Figure out how the heck to wrap this Bonobo_ServerInfo thingy...
//Removed from gnome-vfs: Bonobo_ServerInfo* get_default_component(const Glib::ustring& mime_type);
//TODO: What determines whether an application is in the short list or the all list? Murray.
//TODO: This is a list of pointers. Who deletes them? Murray
/** Get a short list of applications for specified @a mime_type.
* @param mime_type A string containing an MIME type.
* @return A short list of MimeApplications for this MIME type.
*/
ListHandleApps get_short_list_applications(const Glib::ustring& mime_type);
//TODO: This is a list of pointers. Who deletes them? Murray.
/** Get the entire list of applications for specified @a mime_type.
* @param mime_type A string containing an MIME type.
* @return A list of all MimeApplications for this MIME type.
*/
ListHandleApps get_all_applications(const Glib::ustring& mime_type);
//Removed from gnome-vfs: ListHandleComps get_short_list_components(const Glib::ustring& mime_type);
//Removed from gnome-vfs: ListHandleComps get_all_components(const Glib::ustring& mime_type);
//TODO: If this is just a convenience function, then we should say so. Murray.
/** Test if an application ID is in a list of applications.
* @param id A string containing the application ID.
* @param applications A list of MimeApplications.
* @return <tt>true</tt> if the ID is in this application list; <tt>false</tt> otherwise.
*/
bool id_in_application_list(const Glib::ustring& id, const ListHandleApps& applications);
//TODO: If this is just a convenience function, then we should say so. Murray.
/** Get a list of IDs corresponding to the applications in a list.
* @param applications A list of MimeApplications.
* @return A list of strings corresponding to the ID of each application in @a applications.
*/
ListHandleStrings id_list_from_application_list(const ListHandleApps& applications);
//Removed from gnome-vfs: bool id_in_component_list(const Glib::ustring& iid, ListHandleComps components);
//Removed from gnome-vfs: ListHandleStrings id_list_from_component_list(ListHandleComps components);
/** Query the MIME database for an icon representing the specified MIME type.
* @param mime_type A string containing an MIME type.
* @return The filename of the icon as listed in the MIME database. This is
* usually a filename without path information, e.g. "i-chardev.png", and sometimes
* does not have an extension, e.g. "i-regular" if the icon is supposed to be image
* type agnostic between icon themes. Icons are generic, and not theme specific. These
* will not necessarily match with the icons a user sees in Nautilus, you have been warned.
*/
Glib::ustring get_icon(const Glib::ustring& mime_type);
/** Query the MIME database for a description of the specified MIME type.
* @param mime_type A string containing an MIME type.
* @return A description of the MIME type.
*/
Glib::ustring get_description(const Glib::ustring& mime_type);
/** Test whether files of this MIME type might conceivably be executable.
* Default for known types is <tt>false</tt>. Default for unknown types is <tt>true</tt>.
* @param mime_type A string containing an MIME type.
* @return <tt>true</tt> if some files of this MIME type are registered as being executable, and <tt>false</tt> otherwise.
*/
bool can_be_executable(const Glib::ustring& mime_type);
/** Test to see if @a mime_type is in the MIME database at all.
* @param mime_type A string containing an MIME type.
* @return <tt>true</tt> if anything is known about @a mime_type, otherwise <tt>false</tt>.
*/
bool type_is_known(const Glib::ustring& mime_type);
/** Get the file extensions associated with an MIME type.
* @param mime_type A string containing an MIME type.
* @return A list of strings of extensions.
*/
ListHandleStrings get_extensions_list(const Glib::ustring& mime_type);
/** Retrieves the extensions associated with @a mime_type.
* @param mime_type A string containing an MIME type.
* @param pretty Whether to format the returned string with spaces (<tt>false</tt>) or commas (<tt>true</tt>).
* @return A string containing extensions for this mime-type, formatted based on @a pretty.
*/
Glib::ustring get_extensions_string(const Glib::ustring& mime_type, bool pretty = false);
/** Get a list of registered MIME types from the MIME database.
* @return A list of strings containing the MIME types registered.
*/
ListHandleStrings get_registered_types();
//TODO: What happens if the key is invalid? Murray.
//TODO: What is a key? Murray.
//TODO: What is a GnomeMimeContext? Murray.
//TODO: What data does this return? Murray.
/** Retrieve the value associated with @a key in the given GnomeMimeContext.
* @param mime_type A string containing an MIME type.
* @param key A key to lookup for the given MIME type.
* @return A string containing the data for the MIME type and key.
*/
Glib::ustring get_value(Glib::ustring& mime_type, Glib::ustring& key);
/** Retrieve a list of all keys associated with @a mime_type.
* @param mime_type A string containing an MIME type to lookup.
* @return A list of strings containing keys associated with @a mime_type.
*/
ListHandleStrings get_key_list(Glib::ustring& mime_type);
/*
* Mutator functions
* TODO: "Mutator" means nothing to me in this context. Murray.
*/
/** Sets the default action type to be performed on files of the specified MIME type.
* @param mime_type A string containing an MIME type.
* @param action_type An enum specifying the default action to perform.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void set_default_action_type(const Glib::ustring& mime_type, MimeActionType action_type) throw(exception);
#else
void set_default_action_type(const Glib::ustring& mime_type, MimeActionType action_type, std::auto_ptr<Gnome::Vfs::exception>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Sets the default application to run on files of the specified MIME type.
* @param mime_type A string containing an MIME type.
* @param application_id A string containing an ID of an application in the MIME database.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void set_default_application(const Glib::ustring& mime_type, const Glib::ustring& application_id) throw(exception);
#else
void set_default_application(const Glib::ustring& mime_type, const Glib::ustring& application_id, std::auto_ptr<Gnome::Vfs::exception>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Sets the default component to use with files of the specified MIME type.
* @param mime_type A string containing an MIME type.
* @param iid A string containing an OAF IID of a component in the MIME database.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void set_default_component(const Glib::ustring& mime_type, const Glib::ustring& iid) throw(exception);
#else
void set_default_component(const Glib::ustring& mime_type, const Glib::ustring& iid, std::auto_ptr<Gnome::Vfs::exception>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Set the icon entry for a particular MIME type in the MIME database.
* Note that icon entries need not necessarily contain the full path, and do not necessarily need to
* specify an extension. So "i-regular", "my-special-icon.png", and "some-icon"
* are all valid icon filenames.
* @param mime_type A string containing an MIME type.
* @param filename A string containing an image filename.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void set_icon(const Glib::ustring& mime_type, const Glib::ustring& filename) throw(exception);
#else
void set_icon(const Glib::ustring& mime_type, const Glib::ustring& filename, std::auto_ptr<Gnome::Vfs::exception>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Set the description of this MIME type in the MIME database.
* The description should be something like "Gnumeric spreadsheet".
* @param mime_type A string containing an MIME type.
* @param description A description of this MIME type.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void set_description(const Glib::ustring& mime_type, const Glib::ustring& description) throw(exception);
#else
void set_description(const Glib::ustring& mime_type, const Glib::ustring& description, std::auto_ptr<Gnome::Vfs::exception>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Set whether files of this MIME type might conceivably be executable.
* @param mime_type A string containing an MIME type.
* @param new_value A boolean value indicating whether @a mime_type could be executable.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void set_can_be_executable(const Glib::ustring& mime_type, bool new_value) throw(exception);
#else
void set_can_be_executable(const Glib::ustring& mime_type, bool new_value, std::auto_ptr<Gnome::Vfs::exception>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Set the short list of applications for the specified MIME type.
* The short list contains applications recommended for possible selection by the user.
* @param mime_type A string containing an MIME type.
* @param application_ids A list of application IDs.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void set_short_list_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids) throw(exception);
#else
void set_short_list_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids, std::auto_ptr<Gnome::Vfs::exception>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Set the short list of components for the specified MIME type.
* The short list contains components recommended for possible selection by the user.
* @param mime_type A string containing an MIME type.
* @param component_iids A list of OAF IID's.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void set_short_list_components(const Glib::ustring& mime_type, ListHandleStrings& component_iids) throw(exception);
#else
void set_short_list_components(const Glib::ustring& mime_type, ListHandleStrings& component_iids, std::auto_ptr<Gnome::Vfs::exception>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Add an application to the short list for the specified MIME type.
* The short list contains applications recommended for possible selection by the user.
* @param mime_type A string containing an MIME type.
* @param application_id A string containing the application's ID in the MIME database.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void add_application_to_short_list(const Glib::ustring& mime_type, Glib::ustring& application_id) throw(exception);
#else
void add_application_to_short_list(const Glib::ustring& mime_type, Glib::ustring& application_id, std::auto_ptr<Gnome::Vfs::exception>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Remove an application from the short list for the specified MIME type.
* The short list contains applications recommended for possible selection by the user.
* @param mime_type A string containing an MIME type.
* @param application_id A string containing the application's ID in the MIME database.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void remove_application_from_short_list(const Glib::ustring& mime_type, Glib::ustring& application_id) throw(exception);
#else
void remove_application_from_short_list(const Glib::ustring& mime_type, Glib::ustring& application_id, std::auto_ptr<Gnome::Vfs::exception>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Add a component to the short list for the specified MIME type.
* The short list contains components recommended for possible selection by the user.
* @param mime_type A string containing an MIME type.
* @param component_iid A string containing the component's OAF IID in the MIME database.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void add_component_to_short_list(const Glib::ustring& mime_type, Glib::ustring& component_iid) throw(exception);
#else
void add_component_to_short_list(const Glib::ustring& mime_type, Glib::ustring& component_iid, std::auto_ptr<Gnome::Vfs::exception>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Remove a component from the short list for the specified MIME type.
* The short list contains components recommended for possible selection by the user.
* @param mime_type A string containing an MIME type.
* @param component_iid A string containing the component's OAF IID in the MIME database.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void remove_component_from_short_list(const Glib::ustring& mime_type, Glib::ustring& component_iid) throw(exception);
#else
void remove_component_from_short_list(const Glib::ustring& mime_type, Glib::ustring& component_iid, std::auto_ptr<Gnome::Vfs::exception>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Add a file extension to the specified MIME type in the database.
* @param mime_type The mime type to add the extension to.
* @param extension The extension to add.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void add_extension(const Glib::ustring& mime_type, Glib::ustring& extension) throw(exception);
#else
void add_extension(const Glib::ustring& mime_type, Glib::ustring& extension, std::auto_ptr<Gnome::Vfs::exception>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Removes a file extension from the specified MIME type in the database.
* @param mime_type The mime type to remove the extension from.
* @param extension The extension to remove.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void remove_extension(const Glib::ustring& mime_type, Glib::ustring& extension) throw(exception);
#else
void remove_extension(const Glib::ustring& mime_type, Glib::ustring& extension, std::auto_ptr<Gnome::Vfs::exception>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Sets the extensions for a given mime type.
* Overrides the previously set extensions.
* @param mime_type A string containing an MIME type.
* @param extensions_list A whitespace-separated list of the extensions to set for this MIME type.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void set_extensions_list(const Glib::ustring& mime_type, const Glib::ustring& extensions_list) throw(exception);
#else
void set_extensions_list(const Glib::ustring& mime_type, const Glib::ustring& extensions_list, std::auto_ptr<Gnome::Vfs::exception>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Register @a mime_type as being handled by all applications listed in @a application_ids.
* @param mime_type A string containing an MIME type.
* @param application_ids A list of strings containing application ids.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void extend_all_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids) throw(exception);
#else
void extend_all_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids, std::auto_ptr<Gnome::Vfs::exception>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Remove @a mime_type as a handled type from every application in @a application_ids.
* @param mime_type A string containing an MIME type.
* @param application_ids A list of strings containing application ids.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void remove_from_all_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids) throw(exception);
#else
void remove_from_all_applications(const Glib::ustring& mime_type, ListHandleStrings& application_ids, std::auto_ptr<Gnome::Vfs::exception>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Delete an MIME type for the user who runs this command.
* You can only undo this by calling Gnome::Vfs::Mime::reset().
* @param mime_type A string containing the MIME type to delete.
*/
void registered_mime_type_delete(const Glib::ustring& mime_type);
/** Set the key data for the registered MIME type's hash table.
* @param mime_type A string containing the MIME type.
* @param key A string containing the key to set.
* @param data A string containing the data to set for @a key.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void set_registered_type_key(const Glib::ustring& mime_type, const Glib::ustring& key, const Glib::ustring& data) throw(exception);
#else
void set_registered_type_key(const Glib::ustring& mime_type, const Glib::ustring& key, const Glib::ustring& data, std::auto_ptr<Gnome::Vfs::exception>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/** Set the value associated with the key.
* Will save it to the user's file if necessary.
* @param mime_type A string containing the MIME type.
* @param key A string containing the key to store the value in.
* @param value A string containing the value to stor in the key.
*/
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void set_value(const Glib::ustring& mime_type, const Glib::ustring& key, const Glib::ustring& value) throw(exception);
#else
void set_value(const Glib::ustring& mime_type, const Glib::ustring& key, const Glib::ustring& value, std::auto_ptr<Gnome::Vfs::exception>& error);
#endif //GLIBMM_EXCEPTIONS_ENABLED
/*
* Mime Control
*/
/** Freeze the MIME data so that you can do multiple
* updates to the data in one batch without needing
* to back-up the files to disk or rewind them.
*/
void freeze();
/** UnFreeze the MIME data after a freeze.
*/
void thaw();
/** Reload the MIME database from disk.
* This als notifies any listeners holding active Gnome::Vfs::MimeMonitor objects.
*/
void info_reload();
/** Reset the user's MIME database to the system defaults.
*/
void reset();
} // namespace Mime
} // namespace Vfs
} // namespace Gnome
#endif /* _LIBGNOMEVFSMM_MIME_HANDLERS_H */
|