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  * Conversion parameters:
26  * inFile  = 
27  * outPack = gio
28  * outFile = UnixMountMonitor
29  * strct   = GUnixMountMonitor
30  * realStrct=
31  * ctorStrct=
32  * clss    = UnixMountMonitor
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_unix_mount_monitor_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * structWrap:
47  * module aliases:
48  * local aliases:
49  * overrides:
50  */
51 
52 module gio.UnixMountMonitor;
53 
54 public  import gtkc.giotypes;
55 
56 private import gtkc.gio;
57 private import glib.ConstructionException;
58 private import gobject.ObjectG;
59 
60 private import gobject.Signals;
61 public  import gtkc.gdktypes;
62 
63 
64 
65 
66 private import gobject.ObjectG;
67 
68 /**
69  * Routines for managing mounted UNIX mount points and paths.
70  *
71  * Note that <gio/gunixmounts.h> belongs to the
72  * UNIX-specific GIO interfaces, thus you have to use the
73  * gio-unix-2.0.pc pkg-config file when using it.
74  */
75 public class UnixMountMonitor : ObjectG
76 {
77 	
78 	/** the main Gtk struct */
79 	protected GUnixMountMonitor* gUnixMountMonitor;
80 	
81 	
82 	public GUnixMountMonitor* getUnixMountMonitorStruct()
83 	{
84 		return gUnixMountMonitor;
85 	}
86 	
87 	
88 	/** the main Gtk struct as a void* */
89 	protected override void* getStruct()
90 	{
91 		return cast(void*)gUnixMountMonitor;
92 	}
93 	
94 	/**
95 	 * Sets our main struct and passes it to the parent class
96 	 */
97 	public this (GUnixMountMonitor* gUnixMountMonitor)
98 	{
99 		super(cast(GObject*)gUnixMountMonitor);
100 		this.gUnixMountMonitor = gUnixMountMonitor;
101 	}
102 	
103 	protected override void setStruct(GObject* obj)
104 	{
105 		super.setStruct(obj);
106 		gUnixMountMonitor = cast(GUnixMountMonitor*)obj;
107 	}
108 	
109 	/**
110 	 */
111 	int[string] connectedSignals;
112 	
113 	void delegate(UnixMountMonitor)[] onMountpointsChangedListeners;
114 	/**
115 	 * Emitted when the unix mount points have changed.
116 	 */
117 	void addOnMountpointsChanged(void delegate(UnixMountMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
118 	{
119 		if ( !("mountpoints-changed" in connectedSignals) )
120 		{
121 			Signals.connectData(
122 			getStruct(),
123 			"mountpoints-changed",
124 			cast(GCallback)&callBackMountpointsChanged,
125 			cast(void*)this,
126 			null,
127 			connectFlags);
128 			connectedSignals["mountpoints-changed"] = 1;
129 		}
130 		onMountpointsChangedListeners ~= dlg;
131 	}
132 	extern(C) static void callBackMountpointsChanged(GUnixMountMonitor* monitorStruct, UnixMountMonitor _unixMountMonitor)
133 	{
134 		foreach ( void delegate(UnixMountMonitor) dlg ; _unixMountMonitor.onMountpointsChangedListeners )
135 		{
136 			dlg(_unixMountMonitor);
137 		}
138 	}
139 	
140 	void delegate(UnixMountMonitor)[] onMountsChangedListeners;
141 	/**
142 	 * Emitted when the unix mounts have changed.
143 	 */
144 	void addOnMountsChanged(void delegate(UnixMountMonitor) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
145 	{
146 		if ( !("mounts-changed" in connectedSignals) )
147 		{
148 			Signals.connectData(
149 			getStruct(),
150 			"mounts-changed",
151 			cast(GCallback)&callBackMountsChanged,
152 			cast(void*)this,
153 			null,
154 			connectFlags);
155 			connectedSignals["mounts-changed"] = 1;
156 		}
157 		onMountsChangedListeners ~= dlg;
158 	}
159 	extern(C) static void callBackMountsChanged(GUnixMountMonitor* monitorStruct, UnixMountMonitor _unixMountMonitor)
160 	{
161 		foreach ( void delegate(UnixMountMonitor) dlg ; _unixMountMonitor.onMountsChangedListeners )
162 		{
163 			dlg(_unixMountMonitor);
164 		}
165 	}
166 	
167 	
168 	/**
169 	 * Gets a new GUnixMountMonitor. The default rate limit for which the
170 	 * monitor will report consecutive changes for the mount and mount
171 	 * point entry files is the default for a GFileMonitor. Use
172 	 * g_unix_mount_monitor_set_rate_limit() to change this.
173 	 * Throws: ConstructionException GTK+ fails to create the object.
174 	 */
175 	public this ()
176 	{
177 		// GUnixMountMonitor * g_unix_mount_monitor_new (void);
178 		auto p = g_unix_mount_monitor_new();
179 		if(p is null)
180 		{
181 			throw new ConstructionException("null returned by g_unix_mount_monitor_new()");
182 		}
183 		this(cast(GUnixMountMonitor*) p);
184 	}
185 	
186 	/**
187 	 * Sets the rate limit to which the mount_monitor will report
188 	 * consecutive change events to the mount and mount point entry files.
189 	 * Since 2.18
190 	 * Params:
191 	 * limitMsec = a integer with the limit in milliseconds to
192 	 * poll for changes.
193 	 */
194 	public void setRateLimit(int limitMsec)
195 	{
196 		// void g_unix_mount_monitor_set_rate_limit (GUnixMountMonitor *mount_monitor,  int limit_msec);
197 		g_unix_mount_monitor_set_rate_limit(gUnixMountMonitor, limitMsec);
198 	}
199 }