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  = gtk-Filesystem-utilities.html
27  * outPack = gtk
28  * outFile = MountOperation
29  * strct   = GtkMountOperation
30  * realStrct=
31  * ctorStrct=GMountOperation
32  * clss    = MountOperation
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = GioMountOperation
38  * implements:
39  * prefixes:
40  * 	- gtk_mount_operation_
41  * 	- gtk_
42  * omit structs:
43  * omit prefixes:
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- glib.ErrorG
49  * 	- glib.GException
50  * 	- gtk.Window
51  * 	- gdk.Screen
52  * 	- gio.MountOperation : GioMountOperation = MountOperation
53  * structWrap:
54  * 	- GdkScreen* -> Screen
55  * 	- GtkWindow* -> Window
56  * module aliases:
57  * local aliases:
58  * overrides:
59  */
60 
61 module gtk.MountOperation;
62 
63 public  import gtkc.gtktypes;
64 
65 private import gtkc.gtk;
66 private import glib.ConstructionException;
67 private import gobject.ObjectG;
68 
69 
70 private import glib.Str;
71 private import glib.ErrorG;
72 private import glib.GException;
73 private import gtk.Window;
74 private import gdk.Screen;
75 private import gio.MountOperation : GioMountOperation = MountOperation;
76 
77 
78 
79 
80 /**
81  * Description
82  * The functions and objects described here make working with GTK+ and
83  * GIO more convenient.
84  * GtkMountOperation is needed when mounting volumes:
85  * It is an implementation of GMountOperation that can be used with
86  * GIO functions for mounting volumes such as
87  * g_file_mount_enclosing_volume(), g_file_mount_mountable(),
88  * g_volume_mount(), g_mount_unmount_with_operation() and others.
89  * When necessary, GtkMountOperation shows dialogs to ask for
90  * passwords, questions or show processes blocking unmount.
91  * gtk_show_uri() is a convenient way to launch applications for URIs.
92  * Another object that is worth mentioning in this context is
93  * GdkAppLaunchContext, which provides visual feedback when lauching
94  * applications.
95  */
96 public class MountOperation : GioMountOperation
97 {
98 	
99 	/** the main Gtk struct */
100 	protected GtkMountOperation* gtkMountOperation;
101 	
102 	
103 	public GtkMountOperation* getGtkMountOperationStruct()
104 	{
105 		return gtkMountOperation;
106 	}
107 	
108 	
109 	/** the main Gtk struct as a void* */
110 	protected override void* getStruct()
111 	{
112 		return cast(void*)gtkMountOperation;
113 	}
114 	
115 	/**
116 	 * Sets our main struct and passes it to the parent class
117 	 */
118 	public this (GtkMountOperation* gtkMountOperation)
119 	{
120 		super(cast(GMountOperation*)gtkMountOperation);
121 		this.gtkMountOperation = gtkMountOperation;
122 	}
123 	
124 	protected override void setStruct(GObject* obj)
125 	{
126 		super.setStruct(obj);
127 		gtkMountOperation = cast(GtkMountOperation*)obj;
128 	}
129 	
130 	/**
131 	 */
132 	
133 	/**
134 	 * Creates a new GtkMountOperation
135 	 * Since 2.14
136 	 * Params:
137 	 * parent = transient parent of the window, or NULL. [allow-none]
138 	 * Throws: ConstructionException GTK+ fails to create the object.
139 	 */
140 	public this (Window parent)
141 	{
142 		// GMountOperation * gtk_mount_operation_new (GtkWindow *parent);
143 		auto p = gtk_mount_operation_new((parent is null) ? null : parent.getWindowStruct());
144 		if(p is null)
145 		{
146 			throw new ConstructionException("null returned by gtk_mount_operation_new((parent is null) ? null : parent.getWindowStruct())");
147 		}
148 		this(cast(GtkMountOperation*) p);
149 	}
150 	
151 	/**
152 	 * Returns whether the GtkMountOperation is currently displaying
153 	 * a window.
154 	 * Since 2.14
155 	 * Returns: TRUE if op is currently displaying a window
156 	 */
157 	public int isShowing()
158 	{
159 		// gboolean gtk_mount_operation_is_showing (GtkMountOperation *op);
160 		return gtk_mount_operation_is_showing(gtkMountOperation);
161 	}
162 	
163 	/**
164 	 * Sets the transient parent for windows shown by the
165 	 * GtkMountOperation.
166 	 * Since 2.14
167 	 * Params:
168 	 * parent = transient parent of the window, or NULL. [allow-none]
169 	 */
170 	public void setParent(Window parent)
171 	{
172 		// void gtk_mount_operation_set_parent (GtkMountOperation *op,  GtkWindow *parent);
173 		gtk_mount_operation_set_parent(gtkMountOperation, (parent is null) ? null : parent.getWindowStruct());
174 	}
175 	
176 	/**
177 	 * Gets the transient parent used by the GtkMountOperation
178 	 * Since 2.14
179 	 * Returns: the transient parent for windows shown by op. [transfer none]
180 	 */
181 	public Window getParent()
182 	{
183 		// GtkWindow * gtk_mount_operation_get_parent (GtkMountOperation *op);
184 		auto p = gtk_mount_operation_get_parent(gtkMountOperation);
185 		
186 		if(p is null)
187 		{
188 			return null;
189 		}
190 		
191 		return ObjectG.getDObject!(Window)(cast(GtkWindow*) p);
192 	}
193 	
194 	/**
195 	 * Sets the screen to show windows of the GtkMountOperation on.
196 	 * Since 2.14
197 	 * Params:
198 	 * screen = a GdkScreen
199 	 */
200 	public void setScreen(Screen screen)
201 	{
202 		// void gtk_mount_operation_set_screen (GtkMountOperation *op,  GdkScreen *screen);
203 		gtk_mount_operation_set_screen(gtkMountOperation, (screen is null) ? null : screen.getScreenStruct());
204 	}
205 	
206 	/**
207 	 * Gets the screen on which windows of the GtkMountOperation
208 	 * will be shown.
209 	 * Since 2.14
210 	 * Returns: the screen on which windows of op are shown. [transfer none]
211 	 */
212 	public Screen getScreen()
213 	{
214 		// GdkScreen * gtk_mount_operation_get_screen (GtkMountOperation *op);
215 		auto p = gtk_mount_operation_get_screen(gtkMountOperation);
216 		
217 		if(p is null)
218 		{
219 			return null;
220 		}
221 		
222 		return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p);
223 	}
224 	
225 	/**
226 	 * This is a convenience function for launching the default application
227 	 * to show the uri. The uri must be of a form understood by GIO (i.e. you
228 	 * need to install gvfs to get support for uri schemes such as http://
229 	 * or ftp://, as only local files are handled by GIO itself).
230 	 * Typical examples are
231 	 * file:///home/gnome/pict.jpg
232 	 * http://www.gnome.org
233 	 * mailto:me@gnome.org
234 	 * Ideally the timestamp is taken from the event triggering
235 	 * the gtk_show_uri() call. If timestamp is not known you can take
236 	 * GDK_CURRENT_TIME.
237 	 * This function can be used as a replacement for gnome_vfs_url_show()
238 	 * and gnome_url_show().
239 	 * Since 2.14
240 	 * Params:
241 	 * screen = screen to show the uri on or NULL for the default screen. [allow-none]
242 	 * uri = the uri to show
243 	 * timestamp = a timestamp to prevent focus stealing.
244 	 * Returns: TRUE on success, FALSE on error.
245 	 * Throws: GException on failure.
246 	 */
247 	public static int showUri(Screen screen, string uri, uint timestamp)
248 	{
249 		// gboolean gtk_show_uri (GdkScreen *screen,  const gchar *uri,  guint32 timestamp,  GError **error);
250 		GError* err = null;
251 		
252 		auto p = gtk_show_uri((screen is null) ? null : screen.getScreenStruct(), Str.toStringz(uri), timestamp, &err);
253 		
254 		if (err !is null)
255 		{
256 			throw new GException( new ErrorG(err) );
257 		}
258 		
259 		return p;
260 	}
261 }