1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is the Mozilla GNOME integration code.
17 * The Initial Developer of the Original Code is
19 * Portions created by the Initial Developer are Copyright (C) 2004
20 * the Initial Developer. All Rights Reserved.
23 * Brian Ryner <bryner@brianryner.com>
25 * Alternatively, the contents of this file may be used under the terms of
26 * either the GNU General Public License Version 2 or later (the "GPL"), or
27 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 #include
"nsISupports.idl"
41 interface nsIUTF8StringEnumerator
;
44 /* nsIGnomeVFSMimeApp holds information about an application that is looked up
45 with nsIGnomeVFSService::GetAppForMimeType. */
47 [scriptable
, uuid(66009894-9877-405b
-9321-bf30420e34e6
)]
48 interface nsIGnomeVFSMimeApp
: nsISupports
50 const long EXPECTS_URIS
= 0;
51 const long EXPECTS_PATHS
= 1;
52 const long EXPECTS_URIS_FOR_NON_FILES
= 2;
54 readonly attribute AUTF8String
id;
55 readonly attribute AUTF8String name
;
56 readonly attribute AUTF8String command
;
57 readonly attribute
boolean canOpenMultipleFiles
;
58 readonly attribute
long expectsURIs
; // see constants above
59 readonly attribute nsIUTF8StringEnumerator supportedURISchemes
;
60 readonly attribute
boolean requiresTerminal
;
62 void launch
(in AUTF8String uri
);
66 * The VFS service makes use of two distinct registries.
68 * The application registry holds information about applications (uniquely
69 * identified by id), such as which MIME types and URI schemes they are
70 * capable of handling, whether they run in a terminal, etc.
72 * The MIME registry holds information about MIME types, such as which
73 * extensions map to a given MIME type. The MIME registry also stores the
74 * id of the application selected to handle each MIME type.
77 [scriptable
, uuid(dea20bf0
-4e4d
-48c5
-b932
-dc3e116dc64b
)]
78 interface nsIGnomeVFSService
: nsISupports
80 /*** Application registry methods ***/
83 const long APP_KEY_COMMAND
= 0;
84 const long APP_KEY_NAME
= 1;
85 const long APP_KEY_SUPPORTED_URI_SCHEMES
= 2; /* comma-separated list */
86 const long APP_KEY_EXPECTS_URIS
= 3; /* "true", "false", or "non-file" */
88 /* Set one of the above string keys for the given application id.
89 'id' can be an arbitrary, unique string to identify the application. */
90 void setAppStringKey
(in AUTF8String
id,
91 in long key
, /* see enums above */
92 in AUTF8String value
);
95 const long APP_KEY_CAN_OPEN_MULTIPLE
= 4;
96 const long APP_KEY_REQUIRES_TERMINAL
= 5;
98 /* Set one of the above boolean keys for the given application id.
99 'id' can be an arbitrary, unique string to identify the application. */
100 void setAppBoolKey
(in AUTF8String
id,
105 /* Add a MIME type to the list of types that the application can handle */
106 void addMimeType
(in AUTF8String
id,
107 in AUTF8String mimeType
);
109 /* Commit application registry changes to disk. This must be called
111 void syncAppRegistry
();
114 /*** MIME registry methods ***/
116 /* Obtain the MIME type registered for an extension. The extension
117 should not include a leading dot. */
118 AUTF8String getMimeTypeFromExtension
(in AUTF8String extension
);
120 /* Obtain the preferred application for opening a given MIME type */
121 nsIGnomeVFSMimeApp getAppForMimeType
(in AUTF8String mimeType
);
123 /* Set the preferred application for opening a given MIME type */
124 void setAppForMimeType
(in AUTF8String mimeType
,
127 /* Obtain a description for the given MIME type */
128 AUTF8String getDescriptionForMimeType
(in AUTF8String mimeType
);
130 /* Set the icon for a MIME type, which will be searched for by the shell
131 using the icon theme search path. */
132 void setIconForMimeType
(in AUTF8String mimeType
,
133 in AUTF8String iconPath
);
136 * Set the list of extensions for a given MIME type.
137 * Should be passed a space separated list of extensions with no
138 * dot, i.e. "gif jpg png".
140 void setMimeExtensions
(in AUTF8String mimeType
,
141 in AUTF8String extensionsList
);
144 /*** Misc. methods ***/
146 /* Open the given URI in the default application */
147 void showURI
(in nsIURI uri
);
148 [noscript
] void showURIForInput
(in ACString uri
);
152 #define NS_GNOMEVFSSERVICE_CONTRACTID
"@mozilla.org/gnome-vfs-service;1"