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