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 
45 	/**
46 	 * Determines if @mount_path is considered an implementation of the
47 	 * OS. This is primarily used for hiding mountable and mounted volumes
48 	 * that only are used in the OS and has little to no relevance to the
49 	 * casual user.
50 	 *
51 	 * Params:
52 	 *     mountPath = a mount path, e.g. `/media/disk` or `/usr`
53 	 *
54 	 * Return: %TRUE if @mount_path is considered an implementation detail
55 	 *     of the OS.
56 	 */
57 	public static bool isMountPathSystemInternal(string mountPath)
58 	{
59 		return g_unix_is_mount_path_system_internal(Str.toStringz(mountPath)) != 0;
60 	}
61 
62 	/**
63 	 * Gets a #GUnixMountEntry for a given mount path. If @time_read
64 	 * is set, it will be filled with a unix timestamp for checking
65 	 * if the mounts have changed since with g_unix_mounts_changed_since().
66 	 *
67 	 * Params:
68 	 *     mountPath = path for a possible unix mount.
69 	 *     timeRead = guint64 to contain a timestamp.
70 	 *
71 	 * Return: a #GUnixMountEntry.
72 	 */
73 	public static GUnixMountEntry* at(string mountPath, out ulong timeRead)
74 	{
75 		return g_unix_mount_at(Str.toStringz(mountPath), &timeRead);
76 	}
77 
78 	/**
79 	 * Compares two unix mounts.
80 	 *
81 	 * Params:
82 	 *     mount1 = first #GUnixMountEntry to compare.
83 	 *     mount2 = second #GUnixMountEntry to compare.
84 	 *
85 	 * Return: 1, 0 or -1 if @mount1 is greater than, equal to,
86 	 *     or less than @mount2, respectively.
87 	 */
88 	public static int compare(GUnixMountEntry* mount1, GUnixMountEntry* mount2)
89 	{
90 		return g_unix_mount_compare(mount1, mount2);
91 	}
92 
93 	/**
94 	 * Frees a unix mount.
95 	 *
96 	 * Params:
97 	 *     mountEntry = a #GUnixMountEntry.
98 	 */
99 	public static void free(GUnixMountEntry* mountEntry)
100 	{
101 		g_unix_mount_free(mountEntry);
102 	}
103 
104 	/**
105 	 * Gets the device path for a unix mount.
106 	 *
107 	 * Params:
108 	 *     mountEntry = a #GUnixMount.
109 	 *
110 	 * Return: a string containing the device path.
111 	 */
112 	public static string getDevicePath(GUnixMountEntry* mountEntry)
113 	{
114 		return Str.toString(g_unix_mount_get_device_path(mountEntry));
115 	}
116 
117 	/**
118 	 * Gets the filesystem type for the unix mount.
119 	 *
120 	 * Params:
121 	 *     mountEntry = a #GUnixMount.
122 	 *
123 	 * Return: a string containing the file system type.
124 	 */
125 	public static string getFsType(GUnixMountEntry* mountEntry)
126 	{
127 		return Str.toString(g_unix_mount_get_fs_type(mountEntry));
128 	}
129 
130 	/**
131 	 * Gets the mount path for a unix mount.
132 	 *
133 	 * Params:
134 	 *     mountEntry = input #GUnixMountEntry to get the mount path for.
135 	 *
136 	 * Return: the mount path for @mount_entry.
137 	 */
138 	public static string getMountPath(GUnixMountEntry* mountEntry)
139 	{
140 		return Str.toString(g_unix_mount_get_mount_path(mountEntry));
141 	}
142 
143 	/**
144 	 * Guesses whether a Unix mount can be ejected.
145 	 *
146 	 * Params:
147 	 *     mountEntry = a #GUnixMountEntry
148 	 *
149 	 * Return: %TRUE if @mount_entry is deemed to be ejectable.
150 	 */
151 	public static bool guessCanEject(GUnixMountEntry* mountEntry)
152 	{
153 		return g_unix_mount_guess_can_eject(mountEntry) != 0;
154 	}
155 
156 	/**
157 	 * Guesses the icon of a Unix mount.
158 	 *
159 	 * Params:
160 	 *     mountEntry = a #GUnixMountEntry
161 	 *
162 	 * Return: a #GIcon
163 	 */
164 	public static IconIF guessIcon(GUnixMountEntry* mountEntry)
165 	{
166 		auto p = g_unix_mount_guess_icon(mountEntry);
167 		
168 		if(p is null)
169 		{
170 			return null;
171 		}
172 		
173 		return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p);
174 	}
175 
176 	/**
177 	 * Guesses the name of a Unix mount.
178 	 * The result is a translated string.
179 	 *
180 	 * Params:
181 	 *     mountEntry = a #GUnixMountEntry
182 	 *
183 	 * Return: A newly allocated string that must
184 	 *     be freed with g_free()
185 	 */
186 	public static string guessName(GUnixMountEntry* mountEntry)
187 	{
188 		return Str.toString(g_unix_mount_guess_name(mountEntry));
189 	}
190 
191 	/**
192 	 * Guesses whether a Unix mount should be displayed in the UI.
193 	 *
194 	 * Params:
195 	 *     mountEntry = a #GUnixMountEntry
196 	 *
197 	 * Return: %TRUE if @mount_entry is deemed to be displayable.
198 	 */
199 	public static bool guessShouldDisplay(GUnixMountEntry* mountEntry)
200 	{
201 		return g_unix_mount_guess_should_display(mountEntry) != 0;
202 	}
203 
204 	/**
205 	 * Guesses the symbolic icon of a Unix mount.
206 	 *
207 	 * Params:
208 	 *     mountEntry = a #GUnixMountEntry
209 	 *
210 	 * Return: a #GIcon
211 	 *
212 	 * Since: 2.34
213 	 */
214 	public static IconIF guessSymbolicIcon(GUnixMountEntry* mountEntry)
215 	{
216 		auto p = g_unix_mount_guess_symbolic_icon(mountEntry);
217 		
218 		if(p is null)
219 		{
220 			return null;
221 		}
222 		
223 		return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p);
224 	}
225 
226 	/**
227 	 * Checks if a unix mount is mounted read only.
228 	 *
229 	 * Params:
230 	 *     mountEntry = a #GUnixMount.
231 	 *
232 	 * Return: %TRUE if @mount_entry is read only.
233 	 */
234 	public static bool isReadonly(GUnixMountEntry* mountEntry)
235 	{
236 		return g_unix_mount_is_readonly(mountEntry) != 0;
237 	}
238 
239 	/**
240 	 * Checks if a unix mount is a system path.
241 	 *
242 	 * Params:
243 	 *     mountEntry = a #GUnixMount.
244 	 *
245 	 * Return: %TRUE if the unix mount is for a system path.
246 	 */
247 	public static bool isSystemInternal(GUnixMountEntry* mountEntry)
248 	{
249 		return g_unix_mount_is_system_internal(mountEntry) != 0;
250 	}
251 
252 	/**
253 	 * Checks if the unix mount points have changed since a given unix time.
254 	 *
255 	 * Params:
256 	 *     time = guint64 to contain a timestamp.
257 	 *
258 	 * Return: %TRUE if the mount points have changed since @time.
259 	 */
260 	public static bool pointsChangedSince(ulong time)
261 	{
262 		return g_unix_mount_points_changed_since(time) != 0;
263 	}
264 
265 	/**
266 	 * Gets a #GList of #GUnixMountPoint containing the unix mount points.
267 	 * If @time_read is set, it will be filled with the mount timestamp,
268 	 * allowing for checking if the mounts have changed with
269 	 * g_unix_mount_points_changed_since().
270 	 *
271 	 * Params:
272 	 *     timeRead = guint64 to contain a timestamp.
273 	 *
274 	 * Return: a #GList of the UNIX mountpoints.
275 	 */
276 	public static ListG mountPointsGet(out ulong timeRead)
277 	{
278 		auto p = g_unix_mount_points_get(&timeRead);
279 		
280 		if(p is null)
281 		{
282 			return null;
283 		}
284 		
285 		return new ListG(cast(GList*) p);
286 	}
287 
288 	/**
289 	 * Checks if the unix mounts have changed since a given unix time.
290 	 *
291 	 * Params:
292 	 *     time = guint64 to contain a timestamp.
293 	 *
294 	 * Return: %TRUE if the mounts have changed since @time.
295 	 */
296 	public static bool mountsChangedSince(ulong time)
297 	{
298 		return g_unix_mounts_changed_since(time) != 0;
299 	}
300 
301 	/**
302 	 * Gets a #GList of #GUnixMountEntry containing the unix mounts.
303 	 * If @time_read is set, it will be filled with the mount
304 	 * timestamp, allowing for checking if the mounts have changed
305 	 * with g_unix_mounts_changed_since().
306 	 *
307 	 * Params:
308 	 *     timeRead = guint64 to contain a timestamp, or %NULL
309 	 *
310 	 * Return: a #GList of the UNIX mounts.
311 	 */
312 	public static ListG mountsGet(out ulong timeRead)
313 	{
314 		auto p = g_unix_mounts_get(&timeRead);
315 		
316 		if(p is null)
317 		{
318 			return null;
319 		}
320 		
321 		return new ListG(cast(GList*) p);
322 	}
323 }