Back to index

lightning-sunbird  0.9+nobinonly
nsIGnomeVFSService.idl
Go to the documentation of this file.
00001 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is the Mozilla GNOME integration code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * IBM Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 2004
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *  Brian Ryner <bryner@brianryner.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #include "nsISupports.idl"
00040 
00041 interface nsIUTF8StringEnumerator;
00042 interface nsIURI;
00043 
00044 /* nsIGnomeVFSMimeApp holds information about an application that is looked up
00045    with nsIGnomeVFSService::GetAppForMimeType. */
00046 
00047 [scriptable, uuid(99ae024f-e869-4973-958b-54768a84295a)]
00048 interface nsIGnomeVFSMimeApp : nsISupports
00049 {
00050   const long EXPECTS_URIS  = 0;
00051   const long EXPECTS_PATHS = 1;
00052   const long EXPECTS_URIS_FOR_NON_FILES = 2;
00053 
00054   readonly attribute AUTF8String         id;
00055   readonly attribute AUTF8String         name;
00056   readonly attribute AUTF8String         command;
00057   readonly attribute boolean             canOpenMultipleFiles;
00058   readonly attribute long                expectsURIs;  // see constants above
00059   readonly attribute nsIUTF8StringEnumerator supportedURISchemes;
00060   readonly attribute boolean             requiresTerminal;
00061 };
00062 
00063 /*
00064  * The VFS service makes use of two distinct registries.
00065  *
00066  * The application registry holds information about applications (uniquely
00067  * identified by id), such as which MIME types and URI schemes they are
00068  * capable of handling, whether they run in a terminal, etc.
00069  *
00070  * The MIME registry holds information about MIME types, such as which
00071  * extensions map to a given MIME type.  The MIME registry also stores the
00072  * id of the application selected to handle each MIME type.
00073  */
00074 
00075 [scriptable, uuid(4d6b9f23-8682-41b3-bbff-937a958e6496)]
00076 interface nsIGnomeVFSService : nsISupports
00077 {
00078   /*** Application registry methods ***/
00079 
00080   /* string keys */
00081   const long APP_KEY_COMMAND = 0;
00082   const long APP_KEY_NAME = 1;
00083   const long APP_KEY_SUPPORTED_URI_SCHEMES = 2;  /* comma-separated list */
00084   const long APP_KEY_EXPECTS_URIS = 3; /* "true", "false", or "non-file" */
00085 
00086   /* Set one of the above string keys for the given application id.
00087      'id' can be an arbitrary, unique string to identify the application. */
00088   void               setAppStringKey(in AUTF8String id,
00089                                      in long        key,  /* see enums above */
00090                                      in AUTF8String value);
00091 
00092   /* boolean keys */
00093   const long APP_KEY_CAN_OPEN_MULTIPLE = 4;
00094   const long APP_KEY_REQUIRES_TERMINAL = 5;
00095 
00096   /* Set one of the above boolean keys for the given application id.
00097      'id' can be an arbitrary, unique string to identify the application. */
00098   void               setAppBoolKey(in AUTF8String id,
00099                                    in long        key,
00100                                    in boolean     value);
00101 
00102 
00103   /* Add a MIME type to the list of types that the application can handle */
00104   void               addMimeType(in AUTF8String id,
00105                                  in AUTF8String mimeType);
00106 
00107   /* Commit application registry changes to disk.  This must be called
00108      to save changes. */
00109   void               syncAppRegistry();
00110 
00111 
00112   /*** MIME registry methods ***/
00113 
00114   /* Obtain the MIME type registered for an extension.  The extension
00115      should not include a leading dot. */
00116   AUTF8String        getMimeTypeFromExtension(in AUTF8String extension);
00117 
00118   /* Obtain the preferred application for opening a given MIME type */
00119   nsIGnomeVFSMimeApp getAppForMimeType(in AUTF8String mimeType);
00120 
00121   /* Set the preferred application for opening a given MIME type */
00122   void               setAppForMimeType(in AUTF8String mimeType,
00123                                        in AUTF8String id);
00124 
00125   /* Obtain a description for the given MIME type */
00126   AUTF8String        getDescriptionForMimeType(in AUTF8String mimeType);
00127 
00128   /* Set the icon for a MIME type, which will be searched for by the shell
00129      using the icon theme search path. */
00130   void               setIconForMimeType(in AUTF8String mimeType,
00131                                         in AUTF8String iconPath);
00132 
00133   /*
00134    * Set the list of extensions for a given MIME type.
00135    * Should be passed a space separated list of extensions with no
00136    * dot, i.e. "gif jpg png".
00137    */
00138   void setMimeExtensions(in AUTF8String mimeType,
00139                          in AUTF8String extensionsList);
00140 
00141 
00142   /*** Misc. methods ***/
00143 
00144   /* Open the given URI in the default application */
00145   void               showURI(in nsIURI uri);
00146 };
00147 
00148 %{C++
00149 #define NS_GNOMEVFSSERVICE_CONTRACTID "@mozilla.org/gnome-vfs-service;1"
00150 %}