1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gio.UnixMountEntry;
26 
27 private import gio.Icon;
28 private import gio.IconIF;
29 private import glib.ListG;
30 private import glib.Str;
31 private import gobject.ObjectG;
32 private import gtkc.gio;
33 public  import gtkc.giotypes;
34 
35 
36 /**
37  * Defines a Unix mount entry (e.g. <filename>/media/cdrom</filename>).
38  * This corresponds roughly to a mtab entry.
39  */
40 public struct UnixMountEntry
41 {
42 
43 	/**
44 	 * Determines if @mount_path is considered an implementation of the
45 	 * OS. This is primarily used for hiding mountable and mounted volumes
46 	 * that only are used in the OS and has little to no relevance to the
47 	 * casual user.
48 	 *
49 	 * Params:
50 	 *     mountPath = a mount path, e.g. `/media/disk` or `/usr`
51 	 *
52 	 * Return: %TRUE if @mount_path is considered an implementation detail
53 	 *     of the OS.
54 	 */
55 	public static bool isMountPathSystemInternal(string mountPath)
56 	{
57 		return g_unix_is_mount_path_system_internal(Str.toStringz(mountPath)) != 0;
58 	}
59 
60 	/**
61 	 * Gets a #GUnixMountEntry for a given mount path. If @time_read
62 	 * is set, it will be filled with a unix timestamp for checking
63 	 * if the mounts have changed since with g_unix_mounts_changed_since().
64 	 *
65 	 * Params:
66 	 *     mountPath = path for a possible unix mount.
67 	 *     timeRead = guint64 to contain a timestamp.
68 	 *
69 	 * Return: a #GUnixMountEntry.
70 	 */
71 	public static GUnixMountEntry* at(string mountPath, out ulong timeRead)
72 	{
73 		return g_unix_mount_at(Str.toStringz(mountPath), &timeRead);
74 	}
75 
76 	/**
77 	 * Compares two unix mounts.
78 	 *
79 	 * Params:
80 	 *     mount1 = first #GUnixMountEntry to compare.
81 	 *     mount2 = second #GUnixMountEntry to compare.
82 	 *
83 	 * Return: 1, 0 or -1 if @mount1 is greater than, equal to,
84 	 *     or less than @mount2, respectively.
85 	 */
86 	public static int compare(GUnixMountEntry* mount1, GUnixMountEntry* mount2)
87 	{
88 		return g_unix_mount_compare(mount1, mount2);
89 	}
90 
91 	/**
92 	 * Frees a unix mount.
93 	 *
94 	 * Params:
95 	 *     mountEntry = a #GUnixMountEntry.
96 	 */
97 	public static void free(GUnixMountEntry* mountEntry)
98 	{
99 		g_unix_mount_free(mountEntry);
100 	}
101 
102 	/**
103 	 * Gets the device path for a unix mount.
104 	 *
105 	 * Params:
106 	 *     mountEntry = a #GUnixMount.
107 	 *
108 	 * Return: a string containing the device path.
109 	 */
110 	public static string getDevicePath(GUnixMountEntry* mountEntry)
111 	{
112 		return Str.toString(g_unix_mount_get_device_path(mountEntry));
113 	}
114 
115 	/**
116 	 * Gets the filesystem type for the unix mount.
117 	 *
118 	 * Params:
119 	 *     mountEntry = a #GUnixMount.
120 	 *
121 	 * Return: a string containing the file system type.
122 	 */
123 	public static string getFsType(GUnixMountEntry* mountEntry)
124 	{
125 		return Str.toString(g_unix_mount_get_fs_type(mountEntry));
126 	}
127 
128 	/**
129 	 * Gets the mount path for a unix mount.
130 	 *
131 	 * Params:
132 	 *     mountEntry = input #GUnixMountEntry to get the mount path for.
133 	 *
134 	 * Return: the mount path for @mount_entry.
135 	 */
136 	public static string getMountPath(GUnixMountEntry* mountEntry)
137 	{
138 		return Str.toString(g_unix_mount_get_mount_path(mountEntry));
139 	}
140 
141 	/**
142 	 * Guesses whether a Unix mount can be ejected.
143 	 *
144 	 * Params:
145 	 *     mountEntry = a #GUnixMountEntry
146 	 *
147 	 * Return: %TRUE if @mount_entry is deemed to be ejectable.
148 	 */
149 	public static bool guessCanEject(GUnixMountEntry* mountEntry)
150 	{
151 		return g_unix_mount_guess_can_eject(mountEntry) != 0;
152 	}
153 
154 	/**
155 	 * Guesses the icon of a Unix mount.
156 	 *
157 	 * Params:
158 	 *     mountEntry = a #GUnixMountEntry
159 	 *
160 	 * Return: a #GIcon
161 	 */
162 	public static IconIF guessIcon(GUnixMountEntry* mountEntry)
163 	{
164 		auto p = g_unix_mount_guess_icon(mountEntry);
165 		
166 		if(p is null)
167 		{
168 			return null;
169 		}
170 		
171 		return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p);
172 	}
173 
174 	/**
175 	 * Guesses the name of a Unix mount.
176 	 * The result is a translated string.
177 	 *
178 	 * Params:
179 	 *     mountEntry = a #GUnixMountEntry
180 	 *
181 	 * Return: A newly allocated string that must
182 	 *     be freed with g_free()
183 	 */
184 	public static string guessName(GUnixMountEntry* mountEntry)
185 	{
186 		return Str.toString(g_unix_mount_guess_name(mountEntry));
187 	}
188 
189 	/**
190 	 * Guesses whether a Unix mount should be displayed in the UI.
191 	 *
192 	 * Params:
193 	 *     mountEntry = a #GUnixMountEntry
194 	 *
195 	 * Return: %TRUE if @mount_entry is deemed to be displayable.
196 	 */
197 	public static bool guessShouldDisplay(GUnixMountEntry* mountEntry)
198 	{
199 		return g_unix_mount_guess_should_display(mountEntry) != 0;
200 	}
201 
202 	/**
203 	 * Guesses the symbolic icon of a Unix mount.
204 	 *
205 	 * Params:
206 	 *     mountEntry = a #GUnixMountEntry
207 	 *
208 	 * Return: a #GIcon
209 	 *
210 	 * Since: 2.34
211 	 */
212 	public static IconIF guessSymbolicIcon(GUnixMountEntry* mountEntry)
213 	{
214 		auto p = g_unix_mount_guess_symbolic_icon(mountEntry);
215 		
216 		if(p is null)
217 		{
218 			return null;
219 		}
220 		
221 		return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p);
222 	}
223 
224 	/**
225 	 * Checks if a unix mount is mounted read only.
226 	 *
227 	 * Params:
228 	 *     mountEntry = a #GUnixMount.
229 	 *
230 	 * Return: %TRUE if @mount_entry is read only.
231 	 */
232 	public static bool isReadonly(GUnixMountEntry* mountEntry)
233 	{
234 		return g_unix_mount_is_readonly(mountEntry) != 0;
235 	}
236 
237 	/**
238 	 * Checks if a unix mount is a system path.
239 	 *
240 	 * Params:
241 	 *     mountEntry = a #GUnixMount.
242 	 *
243 	 * Return: %TRUE if the unix mount is for a system path.
244 	 */
245 	public static bool isSystemInternal(GUnixMountEntry* mountEntry)
246 	{
247 		return g_unix_mount_is_system_internal(mountEntry) != 0;
248 	}
249 
250 	/**
251 	 * Checks if the unix mount points have changed since a given unix time.
252 	 *
253 	 * Params:
254 	 *     time = guint64 to contain a timestamp.
255 	 *
256 	 * Return: %TRUE if the mount points have changed since @time.
257 	 */
258 	public static bool pointsChangedSince(ulong time)
259 	{
260 		return g_unix_mount_points_changed_since(time) != 0;
261 	}
262 
263 	/**
264 	 * Gets a #GList of #GUnixMountPoint containing the unix mount points.
265 	 * If @time_read is set, it will be filled with the mount timestamp,
266 	 * allowing for checking if the mounts have changed with
267 	 * g_unix_mount_points_changed_since().
268 	 *
269 	 * Params:
270 	 *     timeRead = guint64 to contain a timestamp.
271 	 *
272 	 * Return: a #GList of the UNIX mountpoints.
273 	 */
274 	public static ListG mountPointsGet(out ulong timeRead)
275 	{
276 		auto p = g_unix_mount_points_get(&timeRead);
277 		
278 		if(p is null)
279 		{
280 			return null;
281 		}
282 		
283 		return new ListG(cast(GList*) p);
284 	}
285 
286 	/**
287 	 * Checks if the unix mounts have changed since a given unix time.
288 	 *
289 	 * Params:
290 	 *     time = guint64 to contain a timestamp.
291 	 *
292 	 * Return: %TRUE if the mounts have changed since @time.
293 	 */
294 	public static bool mountsChangedSince(ulong time)
295 	{
296 		return g_unix_mounts_changed_since(time) != 0;
297 	}
298 
299 	/**
300 	 * Gets a #GList of #GUnixMountEntry containing the unix mounts.
301 	 * If @time_read is set, it will be filled with the mount
302 	 * timestamp, allowing for checking if the mounts have changed
303 	 * with g_unix_mounts_changed_since().
304 	 *
305 	 * Params:
306 	 *     timeRead = guint64 to contain a timestamp, or %NULL
307 	 *
308 	 * Return: a #GList of the UNIX mounts.
309 	 */
310 	public static ListG mountsGet(out ulong timeRead)
311 	{
312 		auto p = g_unix_mounts_get(&timeRead);
313 		
314 		if(p is null)
315 		{
316 			return null;
317 		}
318 		
319 		return new ListG(cast(GList*) p);
320 	}
321 }