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