Imported Upstream version 2.28.4
[platform/upstream/pygobject2.git] / docs / html / class-giodrive.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gio.Drive</title><link rel="stylesheet" type="text/css" href="style.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><link rel="home" href="index.html" title="PyGObject Reference Manual"><link rel="up" href="gio-class-reference.html" title="PyGio Class Reference"><link rel="prev" href="class-giodataoutputstream.html" title="gio.DataOutputStream"><link rel="next" href="class-gioemblem.html" title="gio.Emblem"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">gio.Drive</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-giodataoutputstream.html">Prev</a> </td><th width="60%" align="center">PyGio Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-gioemblem.html">Next</a></td></tr></table><hr></div><div class="refentry" title="gio.Drive"><a name="class-giodrive"></a><div class="titlepage"></div><div class="refnamediv"><h2>gio.Drive</h2><p>gio.Drive — Virtual File System drive management.</p></div><div class="refsect1" title="Synopsis"><a name="id642711"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gio.Drive</span></span>(<span class="ooclass"><span class="classname"><a class="link" href="class-gobjectginterface.html" title="gobject.GInterface">gobject.GInterface</a></span></span>):
2 <code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-giodrive.html#method-giodrive--can-eject" title="gio.Drive.can_eject">can_eject</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-giodrive.html#method-giodrive--can-poll-for-media" title="gio.Drive.can_poll_for_media">can_poll_for_media</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-giodrive.html#method-giodrive--eject" title="gio.Drive.eject">eject</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>callback</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>flags</code></strong></span><span class="initializer">=gio.MOUNT_UNMOUNT_NONE</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>cancellable</code></strong></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>user_data</code></strong></span><span class="initializer">=None</span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-giodrive.html#method-giodrive--eject-finish" title="gio.Drive.eject_finish">eject_finish</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>result</code></strong></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-giodrive.html#method-giodrive--enumerate-identifiers" title="gio.Drive.enumerate_identifiers">enumerate_identifiers</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-giodrive.html#method-giodrive--get-icon" title="gio.Drive.get_icon">get_icon</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-giodrive.html#method-giodrive--get-identifier" title="gio.Drive.get_identifier">get_identifier</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-giodrive.html#method-giodrive--get-name" title="gio.Drive.get_name">get_name</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-giodrive.html#method-giodrive--get-volumes" title="gio.Drive.get_volumes">get_volumes</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-giodrive.html#method-giodrive--has-media" title="gio.Drive.has_media">has_media</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-giodrive.html#method-giodrive--has-volumes" title="gio.Drive.has_volumes">has_volumes</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-giodrive.html#method-giodrive--is-media-check-automatic" title="gio.Drive.is_media_check_automatic">is_media_check_automatic</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-giodrive.html#method-giodrive--is-media-removable" title="gio.Drive.is_media_removable">is_media_removable</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-giodrive.html#method-giodrive--poll-for-media" title="gio.Drive.poll_for_media">poll_for_media</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>callback</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>cancellable</code></strong></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>user_data</code></strong></span><span class="initializer">=None</span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-giodrive.html#method-giodrive--poll-for-media-finish" title="gio.Drive.poll_for_media_finish">poll_for_media_finish</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>result</code></strong></span></span>)</code><br></pre></td></tr></table></div><div class="refsect1" title="Ancestry"><a name="id647875"></a><h2>Ancestry</h2><pre class="synopsis">+-- <a class="link" href="class-gobjectginterface.html" title="gobject.GInterface">gobject.GInterface</a>
3   +-- <a class="link" href="class-giodrive.html" title="gio.Drive">gio.Drive</a>
4 </pre></div><div class="refsect1" title="Prerequisites"><a name="id610721"></a><h2>Prerequisites</h2><p>
5             <a class="link" href="class-giodrive.html" title="gio.Drive"><code class="classname">gio.Drive</code></a> requires
6             <a class="link" href="class-gobject.html" title="gobject.GObject"><code class="classname">gobject.GObject</code></a>
7         </p></div><div class="refsect1" title="Description"><a name="id612385"></a><h2>Description</h2><p>
8             <a class="link" href="class-giodrive.html" title="gio.Drive"><code class="classname">gio.Drive</code></a>
9             - this represent a piece of hardware connected to the machine. Its generally
10             only created for removable hardware or hardware with removable media. 
11         </p><p>
12             <a class="link" href="class-giodrive.html" title="gio.Drive"><code class="classname">gio.Drive</code></a>
13             is a container class for GVolume objects that stem from the same piece of media.
14             As such, <a class="link" href="class-giodrive.html" title="gio.Drive"><code class="classname">gio.Drive</code></a>
15             abstracts a drive with (or without) removable media and provides operations for
16             querying whether media is available, determing whether media change is automatically
17             detected and ejecting the media. 
18         </p><p>
19             If the <a class="link" href="class-giodrive.html" title="gio.Drive"><code class="classname">gio.Drive</code></a>
20             reports that media isn't automatically detected, one can poll for media; typically
21             one should not do this periodically as a poll for media operation is potententially
22             expensive and may spin up the drive creating noise. 
23         </p><p>
24             For porting from GnomeVFS note that there is no equivalent of
25             <a class="link" href="class-giodrive.html" title="gio.Drive"><code class="classname">gio.Drive</code></a>
26             in that API.
27         </p></div><div class="refsect1" title="Methods"><a name="id647766"></a><h2>Methods</h2><div class="refsect2" title="gio.Drive.can_eject"><a name="method-giodrive--can-eject"></a><h3>gio.Drive.can_eject</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">can_eject</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if the drive can be ejected,
28                     <code class="literal">False</code> otherwise.
29                     </td></tr></tbody></table><p>
30                 The <code class="methodname">can_eject</code>() method checks if a drive can be ejected.
31             </p></div><div class="refsect2" title="gio.Drive.can_poll_for_media"><a name="method-giodrive--can-poll-for-media"></a><h3>gio.Drive.can_poll_for_media</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">can_poll_for_media</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if the drive can be polled
32                     for media changes, <code class="literal">False</code> otherwise. 
33                     </td></tr></tbody></table><p>
34                 The <code class="methodname">can_poll_for_media</code>() method checks if a drive
35                 can be polled for media changes.
36             </p></div><div class="refsect2" title="gio.Drive.eject"><a name="method-giodrive--eject"></a><h3>gio.Drive.eject</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">eject</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>callback</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>flags</code></strong></span><span class="initializer">=gio.MOUNT_UNMOUNT_NONE</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>cancellable</code></strong></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>user_data</code></strong></span><span class="initializer">=None</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>callback</code></strong> :</span></p></td><td>A GAsyncReadyCallback to call when the request is satisfied.
37                   </td></tr><tr><td><p><span class="term"><strong class="parameter"><code>flags</code></strong> :</span></p></td><td>flags affecting the unmount if required for eject.
38                   </td></tr><tr><td><p><span class="term"><strong class="parameter"><code>cancellable</code></strong> :</span></p></td><td>Optional
39                   <a class="link" href="class-giocancellable.html" title="gio.Cancellable"><code class="classname">gio.Cancellable</code></a>
40                   object, <code class="literal">None</code> to ignore.
41                   </td></tr><tr><td><p><span class="term"><strong class="parameter"><code>user_data</code></strong> :</span></p></td><td>The data to pass to callback function.
42                   </td></tr></tbody></table><p>
43                 The <code class="methodname">eject</code>() method asynchronously ejects a drive. 
44             </p><p>
45                 When the operation is finished, callback will be called. You can then call
46                 <code class="methodname"><a class="link" href="class-giodrive.html#method-giodrive--eject-finish" title="gio.Drive.eject_finish">gio.Drive.eject_finish</a></code>()
47                 to obtain the result of the operation.
48             </p></div><div class="refsect2" title="gio.Drive.eject_finish"><a name="method-giodrive--eject-finish"></a><h3>gio.Drive.eject_finish</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">eject_finish</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>result</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>result</code></strong> :</span></p></td><td>a <a class="link" href="class-gioasyncresult.html" title="gio.AsyncResult"><code class="classname">gio.AsyncResult</code></a>.
49                   </td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if the drive has been ejected
50                     successfully, <code class="literal">False</code> otherwise.
51                     </td></tr></tbody></table><p>
52                 The <code class="methodname">eject_finish</code>() method finishes ejecting a drive.
53             </p></div><div class="refsect2" title="gio.Drive.enumerate_identifiers"><a name="method-giodrive--enumerate-identifiers"></a><h3>gio.Drive.enumerate_identifiers</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">enumerate_identifiers</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a list of strings containing kinds of identifiers.
54                     </td></tr></tbody></table><p>
55                 The <code class="methodname">enumerate_identifiers</code>() method gets the kinds
56                 of identifiers that drive has. Use
57                 <code class="methodname"><a class="link" href="class-giodrive.html#method-giodrive--get-identifier" title="gio.Drive.get_identifier">gio.Drive.get_identifier</a></code>()
58                 to obtain the identifiers themselves.
59             </p></div><div class="refsect2" title="gio.Drive.get_icon"><a name="method-giodrive--get-icon"></a><h3>gio.Drive.get_icon</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_icon</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><a class="link" href="class-gioicon.html" title="gio.Icon"><code class="classname">gio.Icon</code></a>
60                     for the drive.
61                     </td></tr></tbody></table><p>
62                 The <code class="methodname">get_icon</code>() method gets the icon for drive.
63             </p></div><div class="refsect2" title="gio.Drive.get_identifier"><a name="method-giodrive--get-identifier"></a><h3>gio.Drive.get_identifier</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_identifier</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>A string containing the requested identfier, or
64                     <code class="literal">None</code> if the
65                     <a class="link" href="class-giodrive.html" title="gio.Drive"><code class="classname">gio.Drive</code></a>
66                     doesn't have this kind of identifier. 
67                     </td></tr></tbody></table><p>
68                 The <code class="methodname">get_identifier</code>() method gets the identifier of
69                 the given kind for drive.
70             </p></div><div class="refsect2" title="gio.Drive.get_name"><a name="method-giodrive--get-name"></a><h3>gio.Drive.get_name</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_name</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>A string containing drive's name.
71                     </td></tr></tbody></table><p>
72                 The <code class="methodname">get_name</code>() method gets the name of drive.
73             </p></div><div class="refsect2" title="gio.Drive.get_volumes"><a name="method-giodrive--get-volumes"></a><h3>gio.Drive.get_volumes</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_volumes</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>A list containing any
74                     <a class="link" href="class-giovolume.html" title="gio.Volume"><code class="classname">gio.Volume</code></a>
75                     objects on the given drive. 
76                     </td></tr></tbody></table><p>
77                 The <code class="methodname">get_volumes</code>() method get a list of mountable
78                 volumes for drive. 
79             </p></div><div class="refsect2" title="gio.Drive.has_media"><a name="method-giodrive--has-media"></a><h3>gio.Drive.has_media</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">has_media</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if drive has media,
80                     <code class="literal">False</code> otherwise.</td></tr></tbody></table><p>
81                 The <code class="methodname">has_media</code>() method checks if the drive
82                 has media. Note that the OS may not be polling the drive for media changes; see
83                 <code class="methodname"><a class="link" href="class-giodrive.html#method-giodrive--is-media-check-automatic" title="gio.Drive.is_media_check_automatic">gio.Drive.is_media_check_automatic</a></code>()
84                 for more details.
85             </p></div><div class="refsect2" title="gio.Drive.has_volumes"><a name="method-giodrive--has-volumes"></a><h3>gio.Drive.has_volumes</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">has_volumes</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if drive contains volumes,
86                     <code class="literal">False</code> otherwise.</td></tr></tbody></table><p>
87                 The <code class="methodname">has_volumes</code>() method check if drive has any mountable volumes.
88             </p></div><div class="refsect2" title="gio.Drive.is_media_check_automatic"><a name="method-giodrive--is-media-check-automatic"></a><h3>gio.Drive.is_media_check_automatic</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">is_media_check_automatic</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if drive is capabable
89                     of automatically detecting media changes,
90                     <code class="literal">False</code> otherwise.</td></tr></tbody></table><p>
91                 The <code class="methodname">is_media_check_automatic</code>() method checks if
92                 drive is capabable of automatically detecting media changes.
93             </p></div><div class="refsect2" title="gio.Drive.is_media_removable"><a name="method-giodrive--is-media-removable"></a><h3>gio.Drive.is_media_removable</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">is_media_removable</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if drive supports removable media,
94                     <code class="literal">False</code> otherwise.</td></tr></tbody></table><p>
95                 The <code class="methodname">is_media_removable</code>() method checks if the
96                 drive supports removable media.
97             </p></div><div class="refsect2" title="gio.Drive.poll_for_media"><a name="method-giodrive--poll-for-media"></a><h3>gio.Drive.poll_for_media</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">poll_for_media</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>callback</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>cancellable</code></strong></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>user_data</code></strong></span><span class="initializer">=None</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>callback</code></strong> :</span></p></td><td>A GAsyncReadyCallback to call when the request is satisfied.
98                   </td></tr><tr><td><p><span class="term"><strong class="parameter"><code>cancellable</code></strong> :</span></p></td><td>Optional
99                   <a class="link" href="class-giocancellable.html" title="gio.Cancellable"><code class="classname">gio.Cancellable</code></a>
100                   object, <code class="literal">None</code> to ignore.
101                   </td></tr><tr><td><p><span class="term"><strong class="parameter"><code>user_data</code></strong> :</span></p></td><td>The data to pass to callback function.
102                   </td></tr></tbody></table><p>
103                 The <code class="methodname">poll_for_media</code>() method asynchronously polls
104                 drive to see if media has been inserted or removed. 
105             </p><p>
106                 When the operation is finished, callback will be called. You can then call
107                 <code class="methodname"><a class="link" href="class-giodrive.html#method-giodrive--poll-for-media-finish" title="gio.Drive.poll_for_media_finish">gio.Drive.poll_for_media_finish</a></code>()
108                 to obtain the result of the operation.
109             </p></div><div class="refsect2" title="gio.Drive.poll_for_media_finish"><a name="method-giodrive--poll-for-media-finish"></a><h3>gio.Drive.poll_for_media_finish</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">poll_for_media_finish</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>result</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>result</code></strong> :</span></p></td><td>a <a class="link" href="class-gioasyncresult.html" title="gio.AsyncResult"><code class="classname">gio.AsyncResult</code></a>.
110                   </td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">True</code> if the drive has been poll_for_mediaed
111                     successfully, <code class="literal">False</code> otherwise.
112                     </td></tr></tbody></table><p>
113                 The <code class="methodname">poll_for_media_finish</code>() method finishes
114                 an operation started with
115                 <code class="methodname"><a class="link" href="class-giodrive.html#method-giodrive--poll-for-media" title="gio.Drive.poll_for_media">gio.Drive.poll_for_media</a></code>()
116                 on a drive.
117             </p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-giodataoutputstream.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="gio-class-reference.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="class-gioemblem.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gio.DataOutputStream </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> gio.Emblem</td></tr></table></div></body></html>