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 module gtk.MountOperation;
26 
27 private import gdk.Screen;
28 private import gio.MountOperation : GioMountOperation = MountOperation;
29 private import glib.ConstructionException;
30 private import glib.ErrorG;
31 private import glib.GException;
32 private import glib.Str;
33 private import gobject.ObjectG;
34 private import gtk.Window;
35 private import gtkc.gtk;
36 public  import gtkc.gtktypes;
37 
38 
39 /**
40  * This should not be accessed directly. Use the accessor functions below.
41  */
42 public class MountOperation : GioMountOperation
43 {
44 	/** the main Gtk struct */
45 	protected GtkMountOperation* gtkMountOperation;
46 
47 	/** Get the main Gtk struct */
48 	public GtkMountOperation* getGtkMountOperationStruct()
49 	{
50 		return gtkMountOperation;
51 	}
52 
53 	/** the main Gtk struct as a void* */
54 	protected override void* getStruct()
55 	{
56 		return cast(void*)gtkMountOperation;
57 	}
58 
59 	protected override void setStruct(GObject* obj)
60 	{
61 		gtkMountOperation = cast(GtkMountOperation*)obj;
62 		super.setStruct(obj);
63 	}
64 
65 	/**
66 	 * Sets our main struct and passes it to the parent class.
67 	 */
68 	public this (GtkMountOperation* gtkMountOperation, bool ownedRef = false)
69 	{
70 		this.gtkMountOperation = gtkMountOperation;
71 		super(cast(GMountOperation*)gtkMountOperation, ownedRef);
72 	}
73 
74 
75 	/** */
76 	public static GType getType()
77 	{
78 		return gtk_mount_operation_get_type();
79 	}
80 
81 	/**
82 	 * Creates a new #GtkMountOperation
83 	 *
84 	 * Params:
85 	 *     parent = transient parent of the window, or %NULL
86 	 *
87 	 * Return: a new #GtkMountOperation
88 	 *
89 	 * Since: 2.14
90 	 *
91 	 * Throws: ConstructionException GTK+ fails to create the object.
92 	 */
93 	public this(Window parent)
94 	{
95 		auto p = gtk_mount_operation_new((parent is null) ? null : parent.getWindowStruct());
96 		
97 		if(p is null)
98 		{
99 			throw new ConstructionException("null returned by new");
100 		}
101 		
102 		this(cast(GtkMountOperation*) p, true);
103 	}
104 
105 	/**
106 	 * Gets the transient parent used by the #GtkMountOperation
107 	 *
108 	 * Return: the transient parent for windows shown by @op
109 	 *
110 	 * Since: 2.14
111 	 */
112 	public Window getParent()
113 	{
114 		auto p = gtk_mount_operation_get_parent(gtkMountOperation);
115 		
116 		if(p is null)
117 		{
118 			return null;
119 		}
120 		
121 		return ObjectG.getDObject!(Window)(cast(GtkWindow*) p);
122 	}
123 
124 	/**
125 	 * Gets the screen on which windows of the #GtkMountOperation
126 	 * will be shown.
127 	 *
128 	 * Return: the screen on which windows of @op are shown
129 	 *
130 	 * Since: 2.14
131 	 */
132 	public Screen getScreen()
133 	{
134 		auto p = gtk_mount_operation_get_screen(gtkMountOperation);
135 		
136 		if(p is null)
137 		{
138 			return null;
139 		}
140 		
141 		return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p);
142 	}
143 
144 	/**
145 	 * Returns whether the #GtkMountOperation is currently displaying
146 	 * a window.
147 	 *
148 	 * Return: %TRUE if @op is currently displaying a window
149 	 *
150 	 * Since: 2.14
151 	 */
152 	public bool isShowing()
153 	{
154 		return gtk_mount_operation_is_showing(gtkMountOperation) != 0;
155 	}
156 
157 	/**
158 	 * Sets the transient parent for windows shown by the
159 	 * #GtkMountOperation.
160 	 *
161 	 * Params:
162 	 *     parent = transient parent of the window, or %NULL
163 	 *
164 	 * Since: 2.14
165 	 */
166 	public void setParent(Window parent)
167 	{
168 		gtk_mount_operation_set_parent(gtkMountOperation, (parent is null) ? null : parent.getWindowStruct());
169 	}
170 
171 	/**
172 	 * Sets the screen to show windows of the #GtkMountOperation on.
173 	 *
174 	 * Params:
175 	 *     screen = a #GdkScreen
176 	 *
177 	 * Since: 2.14
178 	 */
179 	public void setScreen(Screen screen)
180 	{
181 		gtk_mount_operation_set_screen(gtkMountOperation, (screen is null) ? null : screen.getScreenStruct());
182 	}
183 
184 	/**
185 	 * This is a convenience function for launching the default application
186 	 * to show the uri. The uri must be of a form understood by GIO (i.e. you
187 	 * need to install gvfs to get support for uri schemes such as http://
188 	 * or ftp://, as only local files are handled by GIO itself).
189 	 * Typical examples are
190 	 * - `file:///home/gnome/pict.jpg`
191 	 * - `http://www.gnome.org`
192 	 * - `mailto:me@gnome.org`
193 	 *
194 	 * Ideally the timestamp is taken from the event triggering
195 	 * the gtk_show_uri() call. If timestamp is not known you can take
196 	 * %GDK_CURRENT_TIME.
197 	 *
198 	 * Params:
199 	 *     screen = screen to show the uri on
200 	 *         or %NULL for the default screen
201 	 *     uri = the uri to show
202 	 *     timestamp = a timestamp to prevent focus stealing
203 	 *
204 	 * Return: %TRUE on success, %FALSE on error
205 	 *
206 	 * Since: 2.14
207 	 *
208 	 * Throws: GException on failure.
209 	 */
210 	public static bool showUri(Screen screen, string uri, uint timestamp)
211 	{
212 		GError* err = null;
213 		
214 		auto p = gtk_show_uri((screen is null) ? null : screen.getScreenStruct(), Str.toStringz(uri), timestamp, &err) != 0;
215 		
216 		if (err !is null)
217 		{
218 			throw new GException( new ErrorG(err) );
219 		}
220 		
221 		return p;
222 	}
223 }