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, true);
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 		auto retStr = g_unix_mount_guess_name(mountEntry);
187 		
188 		scope(exit) Str.freeString(retStr);
189 		return Str.toString(retStr);
190 	}
191 
192 	/**
193 	 * Guesses whether a Unix mount should be displayed in the UI.
194 	 *
195 	 * Params:
196 	 *     mountEntry = a #GUnixMountEntry
197 	 *
198 	 * Return: %TRUE if @mount_entry is deemed to be displayable.
199 	 */
200 	public static bool guessShouldDisplay(GUnixMountEntry* mountEntry)
201 	{
202 		return g_unix_mount_guess_should_display(mountEntry) != 0;
203 	}
204 
205 	/**
206 	 * Guesses the symbolic icon of a Unix mount.
207 	 *
208 	 * Params:
209 	 *     mountEntry = a #GUnixMountEntry
210 	 *
211 	 * Return: a #GIcon
212 	 *
213 	 * Since: 2.34
214 	 */
215 	public static IconIF guessSymbolicIcon(GUnixMountEntry* mountEntry)
216 	{
217 		auto p = g_unix_mount_guess_symbolic_icon(mountEntry);
218 		
219 		if(p is null)
220 		{
221 			return null;
222 		}
223 		
224 		return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p, true);
225 	}
226 
227 	/**
228 	 * Checks if a unix mount is mounted read only.
229 	 *
230 	 * Params:
231 	 *     mountEntry = a #GUnixMount.
232 	 *
233 	 * Return: %TRUE if @mount_entry is read only.
234 	 */
235 	public static bool isReadonly(GUnixMountEntry* mountEntry)
236 	{
237 		return g_unix_mount_is_readonly(mountEntry) != 0;
238 	}
239 
240 	/**
241 	 * Checks if a unix mount is a system path.
242 	 *
243 	 * Params:
244 	 *     mountEntry = a #GUnixMount.
245 	 *
246 	 * Return: %TRUE if the unix mount is for a system path.
247 	 */
248 	public static bool isSystemInternal(GUnixMountEntry* mountEntry)
249 	{
250 		return g_unix_mount_is_system_internal(mountEntry) != 0;
251 	}
252 
253 	/**
254 	 * Checks if the unix mount points have changed since a given unix time.
255 	 *
256 	 * Params:
257 	 *     time = guint64 to contain a timestamp.
258 	 *
259 	 * Return: %TRUE if the mount points have changed since @time.
260 	 */
261 	public static bool pointsChangedSince(ulong time)
262 	{
263 		return g_unix_mount_points_changed_since(time) != 0;
264 	}
265 
266 	/**
267 	 * Gets a #GList of #GUnixMountPoint containing the unix mount points.
268 	 * If @time_read is set, it will be filled with the mount timestamp,
269 	 * allowing for checking if the mounts have changed with
270 	 * g_unix_mount_points_changed_since().
271 	 *
272 	 * Params:
273 	 *     timeRead = guint64 to contain a timestamp.
274 	 *
275 	 * Return: a #GList of the UNIX mountpoints.
276 	 */
277 	public static ListG mountPointsGet(out ulong timeRead)
278 	{
279 		auto p = g_unix_mount_points_get(&timeRead);
280 		
281 		if(p is null)
282 		{
283 			return null;
284 		}
285 		
286 		return new ListG(cast(GList*) p, true);
287 	}
288 
289 	/**
290 	 * Checks if the unix mounts have changed since a given unix time.
291 	 *
292 	 * Params:
293 	 *     time = guint64 to contain a timestamp.
294 	 *
295 	 * Return: %TRUE if the mounts have changed since @time.
296 	 */
297 	public static bool mountsChangedSince(ulong time)
298 	{
299 		return g_unix_mounts_changed_since(time) != 0;
300 	}
301 
302 	/**
303 	 * Gets a #GList of #GUnixMountEntry containing the unix mounts.
304 	 * If @time_read is set, it will be filled with the mount
305 	 * timestamp, allowing for checking if the mounts have changed
306 	 * with g_unix_mounts_changed_since().
307 	 *
308 	 * Params:
309 	 *     timeRead = guint64 to contain a timestamp, or %NULL
310 	 *
311 	 * Return: a #GList of the UNIX mounts.
312 	 */
313 	public static ListG mountsGet(out ulong timeRead)
314 	{
315 		auto p = g_unix_mounts_get(&timeRead);
316 		
317 		if(p is null)
318 		{
319 			return null;
320 		}
321 		
322 		return new ListG(cast(GList*) p, true);
323 	}
324 }