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  = gio-GIOScheduler.html
27  * outPack = gio
28  * outFile = IOSchedulerJob
29  * strct   = GIOSchedulerJob
30  * realStrct=
31  * ctorStrct=
32  * clss    = IOSchedulerJob
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_io_scheduler_job_
41  * 	- g_io_scheduler_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- gio.Cancellable
48  * structWrap:
49  * 	- GCancellable* -> Cancellable
50  * module aliases:
51  * local aliases:
52  * overrides:
53  */
54 
55 module gio.IOSchedulerJob;
56 
57 public  import gtkc.giotypes;
58 
59 private import gtkc.gio;
60 private import glib.ConstructionException;
61 private import gobject.ObjectG;
62 
63 
64 private import gio.Cancellable;
65 
66 
67 
68 
69 /**
70  * Note
71  *
72  *  As of GLib 2.36, the g_io_scheduler methods
73  *  are deprecated in favor of GThreadPool and GTask.
74  *
75  * Schedules asynchronous I/O operations. GIOScheduler integrates
76  * into the main event loop (GMainLoop) and uses threads.
77  */
78 public class IOSchedulerJob
79 {
80 	
81 	/** the main Gtk struct */
82 	protected GIOSchedulerJob* gIOSchedulerJob;
83 	
84 	
85 	public GIOSchedulerJob* getIOSchedulerJobStruct()
86 	{
87 		return gIOSchedulerJob;
88 	}
89 	
90 	
91 	/** the main Gtk struct as a void* */
92 	protected void* getStruct()
93 	{
94 		return cast(void*)gIOSchedulerJob;
95 	}
96 	
97 	/**
98 	 * Sets our main struct and passes it to the parent class
99 	 */
100 	public this (GIOSchedulerJob* gIOSchedulerJob)
101 	{
102 		this.gIOSchedulerJob = gIOSchedulerJob;
103 	}
104 	
105 	/**
106 	 */
107 	
108 	/**
109 	 * Warning
110 	 * g_io_scheduler_push_job is deprecated and should not be used in newly-written code. use GThreadPool or g_task_run_in_thread()
111 	 * Schedules the I/O job to run in another thread.
112 	 * notify will be called on user_data after job_func has returned,
113 	 * regardless whether the job was cancelled or has run to completion.
114 	 * If cancellable is not NULL, it can be used to cancel the I/O job
115 	 * by calling g_cancellable_cancel() or by calling
116 	 * g_io_scheduler_cancel_all_jobs().
117 	 * Params:
118 	 * jobFunc = a GIOSchedulerJobFunc.
119 	 * userData = data to pass to job_func
120 	 * notify = a GDestroyNotify for user_data, or NULL. [allow-none]
121 	 * ioPriority = the I/O priority
122 	 * of the request.
123 	 * cancellable = optional GCancellable object, NULL to ignore.
124 	 */
125 	public static void pushJob(GIOSchedulerJobFunc jobFunc, void* userData, GDestroyNotify notify, int ioPriority, Cancellable cancellable)
126 	{
127 		// void g_io_scheduler_push_job (GIOSchedulerJobFunc job_func,  gpointer user_data,  GDestroyNotify notify,  gint io_priority,  GCancellable *cancellable);
128 		g_io_scheduler_push_job(jobFunc, userData, notify, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct());
129 	}
130 	
131 	/**
132 	 * Warning
133 	 * g_io_scheduler_cancel_all_jobs is deprecated and should not be used in newly-written code. You should never call this function, since you don't
134 	 * know how other libraries in your program might be making use of
135 	 * gioscheduler.
136 	 * Cancels all cancellable I/O jobs.
137 	 * A job is cancellable if a GCancellable was passed into
138 	 * g_io_scheduler_push_job().
139 	 */
140 	public static void cancelAllJobs()
141 	{
142 		// void g_io_scheduler_cancel_all_jobs (void);
143 		g_io_scheduler_cancel_all_jobs();
144 	}
145 	
146 	/**
147 	 * Warning
148 	 * g_io_scheduler_job_send_to_mainloop is deprecated and should not be used in newly-written code. Use g_main_context_invoke().
149 	 * Used from an I/O job to send a callback to be run in the thread
150 	 * that the job was started from, waiting for the result (and thus
151 	 * blocking the I/O job).
152 	 * Params:
153 	 * func = a GSourceFunc callback that will be called in the original thread
154 	 * userData = data to pass to func
155 	 * notify = a GDestroyNotify for user_data, or NULL. [allow-none]
156 	 * Returns: The return value of func
157 	 */
158 	public int sendToMainloop(GSourceFunc func, void* userData, GDestroyNotify notify)
159 	{
160 		// gboolean g_io_scheduler_job_send_to_mainloop (GIOSchedulerJob *job,  GSourceFunc func,  gpointer user_data,  GDestroyNotify notify);
161 		return g_io_scheduler_job_send_to_mainloop(gIOSchedulerJob, func, userData, notify);
162 	}
163 	
164 	/**
165 	 * Warning
166 	 * g_io_scheduler_job_send_to_mainloop_async is deprecated and should not be used in newly-written code. Use g_main_context_invoke().
167 	 * Used from an I/O job to send a callback to be run asynchronously in
168 	 * the thread that the job was started from. The callback will be run
169 	 * when the main loop is available, but at that time the I/O job might
170 	 * have finished. The return value from the callback is ignored.
171 	 * Note that if you are passing the user_data from g_io_scheduler_push_job()
172 	 * on to this function you have to ensure that it is not freed before
173 	 * func is called, either by passing NULL as notify to
174 	 * g_io_scheduler_push_job() or by using refcounting for user_data.
175 	 * Params:
176 	 * func = a GSourceFunc callback that will be called in the original thread
177 	 * userData = data to pass to func
178 	 * notify = a GDestroyNotify for user_data, or NULL. [allow-none]
179 	 */
180 	public void sendToMainloopAsync(GSourceFunc func, void* userData, GDestroyNotify notify)
181 	{
182 		// void g_io_scheduler_job_send_to_mainloop_async  (GIOSchedulerJob *job,  GSourceFunc func,  gpointer user_data,  GDestroyNotify notify);
183 		g_io_scheduler_job_send_to_mainloop_async(gIOSchedulerJob, func, userData, notify);
184 	}
185 }