📄 gdrive.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"><title>GDrive</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="GIO Reference Manual"><link rel="up" href="volume_mon.html" title="Volumes and Drives"><link rel="prev" href="GMount.html" title="GMount"><link rel="next" href="gio-Unix-Mounts.html" title="Unix Mounts"><meta name="generator" content="GTK-Doc V1.9 (XML mode)"><link rel="stylesheet" href="style.css" type="text/css"><link rel="part" href="pt01.html" title="Part I. GIO Overview"><link rel="chapter" href="ch01.html" title="Introduction"><link rel="chapter" href="ch02.html" title="Compiling GIO applications"><link rel="chapter" href="ch03.html" title="Running GIO applications"><link rel="chapter" href="gio-extension-points.html" title="Extending GIO"><link rel="part" href="pt02.html" title="Part II. API Reference"><link rel="chapter" href="file_ops.html" title="File Operations"><link rel="chapter" href="file_mon.html" title="File System Monitoring"><link rel="chapter" href="async.html" title="Asynchronous I/O"><link rel="chapter" href="streaming.html" title="Streaming I/O"><link rel="chapter" href="types.html" title="File types and applications"><link rel="chapter" href="volume_mon.html" title="Volumes and Drives"><link rel="chapter" href="icons.html" title="Icons"><link rel="chapter" href="utils.html" title="Utilities"><link rel="chapter" href="extending.html" title="Extending GIO"><link rel="part" href="migrating.html" title="Part III. Migrating to GIO"><link rel="chapter" href="ch14.html" title="Migrating from POSIX to GIO"><link rel="chapter" href="ch15.html" title="Migrating from GnomeVFS to GIO"><link rel="chapter" href="gio-hierarchy.html" title="Object Hierarchy"><link rel="index" href="ix01.html" title="Index"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="GMount.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="volume_mon.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">GIO Reference Manual</th><td><a accesskey="n" href="gio-Unix-Mounts.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr><tr><td colspan="5" class="shortcuts"><nobr><a href="#id3107000" class="shortcut">Top</a>  |  <a href="#id3213175" class="shortcut">Description</a>  |  <a href="#id3213089" class="shortcut">Object Hierarchy</a>  |  <a href="#id3213113" class="shortcut">Prerequisites</a>  |  <a href="#id3213136" class="shortcut">Signals</a></nobr></td></tr></table><div class="refentry" lang="en"><a name="GDrive"></a><div class="titlepage"></div><div class="refnamediv"><table width="100%"><tr><td valign="top"><h2><a name="id3107000"></a><span class="refentrytitle">GDrive</span></h2><p>GDrive — Virtual File System drive management</p></td><td valign="top" align="right"></td></tr></table></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">#include <gio/gio.h> <a class="link" href="GDrive.html#GDrive-struct">GDrive</a>; <a class="link" href="GDrive.html#GDriveIface">GDriveIface</a>;char* <a class="link" href="GDrive.html#g-drive-get-name">g_drive_get_name</a> (<a class="link" href="GDrive.html" title="GDrive">GDrive</a> *drive);<a class="link" href="GIcon.html" title="GIcon">GIcon</a>* <a class="link" href="GDrive.html#g-drive-get-icon">g_drive_get_icon</a> (<a class="link" href="GDrive.html" title="GDrive">GDrive</a> *drive);<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="GDrive.html#g-drive-has-volumes">g_drive_has_volumes</a> (<a class="link" href="GDrive.html" title="GDrive">GDrive</a> *drive);<ahref="/usr/share/gtk-doc/html/glib/glib-Doubly-Linked-Lists.html#GList">GList</a>* <a class="link" href="GDrive.html#g-drive-get-volumes">g_drive_get_volumes</a> (<a class="link" href="GDrive.html" title="GDrive">GDrive</a> *drive);<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="GDrive.html#g-drive-can-eject">g_drive_can_eject</a> (<a class="link" href="GDrive.html" title="GDrive">GDrive</a> *drive);<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="GDrive.html#g-drive-can-poll-for-media">g_drive_can_poll_for_media</a> (<a class="link" href="GDrive.html" title="GDrive">GDrive</a> *drive);void <a class="link" href="GDrive.html#g-drive-poll-for-media">g_drive_poll_for_media</a> (<a class="link" href="GDrive.html" title="GDrive">GDrive</a> *drive, <a class="link" href="GCancellable.html" title="GCancellable">GCancellable</a> *cancellable, <a class="link" href="GAsyncResult.html#GAsyncReadyCallback">GAsyncReadyCallback</a> callback, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> user_data);<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="GDrive.html#g-drive-poll-for-media-finish">g_drive_poll_for_media_finish</a> (<a class="link" href="GDrive.html" title="GDrive">GDrive</a> *drive, <a class="link" href="GAsyncResult.html" title="GAsyncResult">GAsyncResult</a> *result, <ahref="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError">GError</a> **error);<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="GDrive.html#g-drive-has-media">g_drive_has_media</a> (<a class="link" href="GDrive.html" title="GDrive">GDrive</a> *drive);<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="GDrive.html#g-drive-is-media-check-automatic">g_drive_is_media_check_automatic</a> (<a class="link" href="GDrive.html" title="GDrive">GDrive</a> *drive);<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="GDrive.html#g-drive-is-media-removable">g_drive_is_media_removable</a> (<a class="link" href="GDrive.html" title="GDrive">GDrive</a> *drive);void <a class="link" href="GDrive.html#g-drive-eject">g_drive_eject</a> (<a class="link" href="GDrive.html" title="GDrive">GDrive</a> *drive, <a class="link" href="GMount.html#GMountUnmountFlags">GMountUnmountFlags</a> flags, <a class="link" href="GCancellable.html" title="GCancellable">GCancellable</a> *cancellable, <a class="link" href="GAsyncResult.html#GAsyncReadyCallback">GAsyncReadyCallback</a> callback, <ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer">gpointer</a> user_data);<ahref="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean">gboolean</a> <a class="link" href="GDrive.html#g-drive-eject-finish">g_drive_eject_finish</a> (<a class="link" href="GDrive.html" title="GDrive">GDrive</a> *drive, <a class="link" href="GAsyncResult.html" title="GAsyncResult">GAsyncResult</a> *result, <ahref="/usr/share/gtk-doc/html/glib/glib-Error-Reporting.html#GError">GError</a> **error);char** <a class="link" href="GDrive.html#g-drive-enumerate-identifiers">g_drive_enumerate_identifiers</a> (<a class="link" href="GDrive.html" title="GDrive">GDrive</a> *drive);char* <a class="link" href="GDrive.html#g-drive-get-identifier">g_drive_get_identifier</a> (<a class="link" href="GDrive.html" title="GDrive">GDrive</a> *drive, const char *kind);</pre></div><div class="refsect1" lang="en"><a name="id3213089"></a><h2>Object Hierarchy</h2><pre class="synopsis"> GInterface +----GDrive</pre></div><div class="refsect1" lang="en"><a name="id3213113"></a><h2>Prerequisites</h2><p>GDrive requires <ahref="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject">GObject</a>.</p></div><div class="refsect1" lang="en"><a name="id3213136"></a><h2>Signals</h2><pre class="synopsis"> "<a class="link" href="GDrive.html#GDrive-changed">changed</a>" : Run Last "<a class="link" href="GDrive.html#GDrive-disconnected">disconnected</a>" : Run Last "<a class="link" href="GDrive.html#GDrive-eject-button">eject-button</a>" : Run Last</pre></div><div class="refsect1" lang="en"><a name="id3213175"></a><h2>Description</h2><p><a class="link" href="GDrive.html" title="GDrive"><span class="type">GDrive</span></a> - this represent a piece of hardware connected to the machine.Its generally only created for removable hardware or hardware withremovable media. </p><p><a class="link" href="GDrive.html" title="GDrive"><span class="type">GDrive</span></a> is a container class for <a class="link" href="GVolume.html" title="GVolume"><span class="type">GVolume</span></a> objects that stem fromthe same piece of media. As such, <a class="link" href="GDrive.html" title="GDrive"><span class="type">GDrive</span></a> abstracts a drive with(or without) removable media and provides operations for queryingwhether media is available, determing whether media change isautomatically detected and ejecting the media.</p><p>If the <a class="link" href="GDrive.html" title="GDrive"><span class="type">GDrive</span></a> reports that media isn't automatically detected, onecan poll for media; typically one should not do this periodicallyas a poll for media operation is potententially expensive and mayspin up the drive creating noise.</p><p>For porting from GnomeVFS note that there is no equivalent of<a class="link" href="GDrive.html" title="GDrive"><span class="type">GDrive</span></a> in that API.</p><p></p></div><div class="refsect1" lang="en"><a name="id3213259"></a><h2>Details</h2><div class="refsect2" lang="en"><a name="id3213270"></a><h3><a name="GDrive-struct"></a>GDrive</h3><a class="indexterm" name="id3213282"></a><pre class="programlisting">typedef struct _GDrive GDrive;</pre><p>Opaque drive object.</p><p></p></div><hr><div class="refsect2" lang="en"><a name="id3213301"></a><h3><a name="GDriveIface"></a>GDriveIface</h3><a class="indexterm" name="id3213313"></a><pre class="programlisting">typedef struct { GTypeInterface g_iface; /* signals */ void (*changed) (GDrive *drive); void (*disconnected) (GDrive *drive); void (*eject_button) (GDrive *drive); /* Virtual Table */ char * (*get_name) (GDrive *drive); GIcon * (*get_icon) (GDrive *drive); gboolean (*has_volumes) (GDrive *drive); GList * (*get_volumes) (GDrive *drive); gboolean (*is_media_removable) (GDrive *drive); gboolean (*has_media) (GDrive *drive); gboolean (*is_media_check_automatic) (GDrive *drive); gboolean (*can_eject) (GDrive *drive); gboolean (*can_poll_for_media) (GDrive *drive); void (*eject) (GDrive *drive, GMountUnmountFlags flags, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); gboolean (*eject_finish) (GDrive *drive, GAsyncResult *result, GError **error); void (*poll_for_media) (GDrive *drive, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); gboolean (*poll_for_media_finish) (GDrive *drive, GAsyncResult *result, GError **error); char * (*get_identifier) (GDrive *drive, const char *kind); char ** (*enumerate_identifiers) (GDrive *drive);} GDriveIface;</pre><p>Interface for creating <a class="link" href="GDrive.html" title="GDrive"><span class="type">GDrive</span></a> implementations.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><ahref="/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#GTypeInterface">GTypeInterface</a> <em class="structfield"><code>g_iface</code></em>;</span></p></td><td> The parent interface.</td></tr><tr><td><p><span class="term"><em class="structfield"><code>changed</code></em> ()</span></p></td><td> Signal emitted when the drive is changed.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -