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