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.UnixMountMonitor;
26 
27 private import gio.c.functions;
28 public  import gio.c.types;
29 private import glib.ConstructionException;
30 private import gobject.ObjectG;
31 private import gobject.Signals;
32 public  import gtkc.giotypes;
33 private import std.algorithm;
34 
35 
36 /**
37  * Watches #GUnixMounts for changes.
38  */
39 public class UnixMountMonitor : ObjectG
40 {
41 	/** the main Gtk struct */
42 	protected GUnixMountMonitor* gUnixMountMonitor;
43 
44 	/** Get the main Gtk struct */
45 	public GUnixMountMonitor* getUnixMountMonitorStruct(bool transferOwnership = false)
46 	{
47 		if (transferOwnership)
48 			ownedRef = false;
49 		return gUnixMountMonitor;
50 	}
51 
52 	/** the main Gtk struct as a void* */
53 	protected override void* getStruct()
54 	{
55 		return cast(void*)gUnixMountMonitor;
56 	}
57 
58 	/**
59 	 * Sets our main struct and passes it to the parent class.
60 	 */
61 	public this (GUnixMountMonitor* gUnixMountMonitor, bool ownedRef = false)
62 	{
63 		this.gUnixMountMonitor = gUnixMountMonitor;
64 		super(cast(GObject*)gUnixMountMonitor, ownedRef);
65 	}
66 
67 
68 	/** */
69 	public static GType getType()
70 	{
71 		return g_unix_mount_monitor_get_type();
72 	}
73 
74 	/**
75 	 * Deprecated alias for g_unix_mount_monitor_get().
76 	 *
77 	 * This function was never a true constructor, which is why it was
78 	 * renamed.
79 	 *
80 	 * Deprecated: Use g_unix_mount_monitor_get() instead.
81 	 *
82 	 * Returns: a #GUnixMountMonitor.
83 	 *
84 	 * Throws: ConstructionException GTK+ fails to create the object.
85 	 */
86 	public this()
87 	{
88 		auto __p = g_unix_mount_monitor_new();
89 
90 		if(__p is null)
91 		{
92 			throw new ConstructionException("null returned by new");
93 		}
94 
95 		this(cast(GUnixMountMonitor*) __p, true);
96 	}
97 
98 	/**
99 	 * Gets the #GUnixMountMonitor for the current thread-default main
100 	 * context.
101 	 *
102 	 * The mount monitor can be used to monitor for changes to the list of
103 	 * mounted filesystems as well as the list of mount points (ie: fstab
104 	 * entries).
105 	 *
106 	 * You must only call g_object_unref() on the return value from under
107 	 * the same main context as you called this function.
108 	 *
109 	 * Returns: the #GUnixMountMonitor.
110 	 *
111 	 * Since: 2.44
112 	 */
113 	public static UnixMountMonitor get()
114 	{
115 		auto __p = g_unix_mount_monitor_get();
116 
117 		if(__p is null)
118 		{
119 			return null;
120 		}
121 
122 		return ObjectG.getDObject!(UnixMountMonitor)(cast(GUnixMountMonitor*) __p, true);
123 	}
124 
125 	/**
126 	 * This function does nothing.
127 	 *
128 	 * Before 2.44, this was a partially-effective way of controlling the
129 	 * rate at which events would be reported under some uncommon
130 	 * circumstances.  Since @mount_monitor is a singleton, it also meant
131 	 * that calling this function would have side effects for other users of
132 	 * the monitor.
133 	 *
134 	 * Deprecated: This function does nothing.  Don't call it.
135 	 *
136 	 * Params:
137 	 *     limitMsec = a integer with the limit in milliseconds to
138 	 *         poll for changes.
139 	 *
140 	 * Since: 2.18
141 	 */
142 	public void setRateLimit(int limitMsec)
143 	{
144 		g_unix_mount_monitor_set_rate_limit(gUnixMountMonitor, limitMsec);
145 	}
146 
147 	/**
148 	 * Emitted when the unix mount points have changed.
149 	 */
150 	gulong addOnMountpointsChanged(void delegate(UnixMountMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
151 	{
152 		return Signals.connect(this, "mountpoints-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
153 	}
154 
155 	/**
156 	 * Emitted when the unix mounts have changed.
157 	 */
158 	gulong addOnMountsChanged(void delegate(UnixMountMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
159 	{
160 		return Signals.connect(this, "mounts-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
161 	}
162 }