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.UnixMountPoint;
26 
27 private import gio.IconIF;
28 private import gio.c.functions;
29 public  import gio.c.types;
30 private import glib.Str;
31 private import gobject.ObjectG;
32 public  import gtkc.giotypes;
33 private import gtkd.Loader;
34 
35 
36 /**
37  * Defines a Unix mount point (e.g. <filename>/dev</filename>).
38  * This corresponds roughly to a fstab entry.
39  */
40 public class UnixMountPoint
41 {
42 	/** the main Gtk struct */
43 	protected GUnixMountPoint* gUnixMountPoint;
44 	protected bool ownedRef;
45 
46 	/** Get the main Gtk struct */
47 	public GUnixMountPoint* getUnixMountPointStruct(bool transferOwnership = false)
48 	{
49 		if (transferOwnership)
50 			ownedRef = false;
51 		return gUnixMountPoint;
52 	}
53 
54 	/** the main Gtk struct as a void* */
55 	protected void* getStruct()
56 	{
57 		return cast(void*)gUnixMountPoint;
58 	}
59 
60 	/**
61 	 * Sets our main struct and passes it to the parent class.
62 	 */
63 	public this (GUnixMountPoint* gUnixMountPoint, bool ownedRef = false)
64 	{
65 		this.gUnixMountPoint = gUnixMountPoint;
66 		this.ownedRef = ownedRef;
67 	}
68 
69 	~this ()
70 	{
71 		if ( Linker.isLoaded(LIBRARY_GIO) && ownedRef )
72 			g_unix_mount_point_free(gUnixMountPoint);
73 	}
74 
75 
76 	/** */
77 	public static GType getType()
78 	{
79 		return g_unix_mount_point_get_type();
80 	}
81 
82 	/**
83 	 * Compares two unix mount points.
84 	 *
85 	 * Params:
86 	 *     mount2 = a #GUnixMount.
87 	 *
88 	 * Returns: 1, 0 or -1 if @mount1 is greater than, equal to,
89 	 *     or less than @mount2, respectively.
90 	 */
91 	public int compare(UnixMountPoint mount2)
92 	{
93 		return g_unix_mount_point_compare(gUnixMountPoint, (mount2 is null) ? null : mount2.getUnixMountPointStruct());
94 	}
95 
96 	/**
97 	 * Makes a copy of @mount_point.
98 	 *
99 	 * Returns: a new #GUnixMountPoint
100 	 *
101 	 * Since: 2.54
102 	 */
103 	public UnixMountPoint copy()
104 	{
105 		auto __p = g_unix_mount_point_copy(gUnixMountPoint);
106 
107 		if(__p is null)
108 		{
109 			return null;
110 		}
111 
112 		return ObjectG.getDObject!(UnixMountPoint)(cast(GUnixMountPoint*) __p, true);
113 	}
114 
115 	/**
116 	 * Frees a unix mount point.
117 	 */
118 	public void free()
119 	{
120 		g_unix_mount_point_free(gUnixMountPoint);
121 		ownedRef = false;
122 	}
123 
124 	/**
125 	 * Gets the device path for a unix mount point.
126 	 *
127 	 * Returns: a string containing the device path.
128 	 */
129 	public string getDevicePath()
130 	{
131 		return Str.toString(g_unix_mount_point_get_device_path(gUnixMountPoint));
132 	}
133 
134 	/**
135 	 * Gets the file system type for the mount point.
136 	 *
137 	 * Returns: a string containing the file system type.
138 	 */
139 	public string getFsType()
140 	{
141 		return Str.toString(g_unix_mount_point_get_fs_type(gUnixMountPoint));
142 	}
143 
144 	/**
145 	 * Gets the mount path for a unix mount point.
146 	 *
147 	 * Returns: a string containing the mount path.
148 	 */
149 	public string getMountPath()
150 	{
151 		return Str.toString(g_unix_mount_point_get_mount_path(gUnixMountPoint));
152 	}
153 
154 	/**
155 	 * Gets the options for the mount point.
156 	 *
157 	 * Returns: a string containing the options.
158 	 *
159 	 * Since: 2.32
160 	 */
161 	public string getOptions()
162 	{
163 		return Str.toString(g_unix_mount_point_get_options(gUnixMountPoint));
164 	}
165 
166 	/**
167 	 * Guesses whether a Unix mount point can be ejected.
168 	 *
169 	 * Returns: %TRUE if @mount_point is deemed to be ejectable.
170 	 */
171 	public bool guessCanEject()
172 	{
173 		return g_unix_mount_point_guess_can_eject(gUnixMountPoint) != 0;
174 	}
175 
176 	/**
177 	 * Guesses the icon of a Unix mount point.
178 	 *
179 	 * Returns: a #GIcon
180 	 */
181 	public IconIF guessIcon()
182 	{
183 		auto __p = g_unix_mount_point_guess_icon(gUnixMountPoint);
184 
185 		if(__p is null)
186 		{
187 			return null;
188 		}
189 
190 		return ObjectG.getDObject!(IconIF)(cast(GIcon*) __p, true);
191 	}
192 
193 	/**
194 	 * Guesses the name of a Unix mount point.
195 	 * The result is a translated string.
196 	 *
197 	 * Returns: A newly allocated string that must
198 	 *     be freed with g_free()
199 	 */
200 	public string guessName()
201 	{
202 		auto retStr = g_unix_mount_point_guess_name(gUnixMountPoint);
203 
204 		scope(exit) Str.freeString(retStr);
205 		return Str.toString(retStr);
206 	}
207 
208 	/**
209 	 * Guesses the symbolic icon of a Unix mount point.
210 	 *
211 	 * Returns: a #GIcon
212 	 *
213 	 * Since: 2.34
214 	 */
215 	public IconIF guessSymbolicIcon()
216 	{
217 		auto __p = g_unix_mount_point_guess_symbolic_icon(gUnixMountPoint);
218 
219 		if(__p is null)
220 		{
221 			return null;
222 		}
223 
224 		return ObjectG.getDObject!(IconIF)(cast(GIcon*) __p, true);
225 	}
226 
227 	/**
228 	 * Checks if a unix mount point is a loopback device.
229 	 *
230 	 * Returns: %TRUE if the mount point is a loopback. %FALSE otherwise.
231 	 */
232 	public bool isLoopback()
233 	{
234 		return g_unix_mount_point_is_loopback(gUnixMountPoint) != 0;
235 	}
236 
237 	/**
238 	 * Checks if a unix mount point is read only.
239 	 *
240 	 * Returns: %TRUE if a mount point is read only.
241 	 */
242 	public bool isReadonly()
243 	{
244 		return g_unix_mount_point_is_readonly(gUnixMountPoint) != 0;
245 	}
246 
247 	/**
248 	 * Checks if a unix mount point is mountable by the user.
249 	 *
250 	 * Returns: %TRUE if the mount point is user mountable.
251 	 */
252 	public bool isUserMountable()
253 	{
254 		return g_unix_mount_point_is_user_mountable(gUnixMountPoint) != 0;
255 	}
256 }