root/trunk/src/gio/UnixMountMonitor.d

Revision 951, 5.4 kB (checked in by Mike Wey, 2 weeks ago)

Merge github pull request 7.

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