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