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