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.Display;
28 private import gio.MountOperation : DGioMountOperation = MountOperation;
29 private import glib.ConstructionException;
30 private import gobject.ObjectG;
31 private import gtk.Window;
32 private import gtk.c.functions;
33 public  import gtk.c.types;
34 
35 
36 /**
37  * `GtkMountOperation` is an implementation of `GMountOperation`.
38  * 
39  * The functions and objects described here make working with GTK and
40  * GIO more convenient.
41  * 
42  * `GtkMountOperation` is needed when mounting volumes:
43  * It is an implementation of `GMountOperation` that can be used with
44  * GIO functions for mounting volumes such as
45  * g_file_mount_enclosing_volume(), g_file_mount_mountable(),
46  * g_volume_mount(), g_mount_unmount_with_operation() and others.
47  * 
48  * When necessary, `GtkMountOperation` shows dialogs to let the user
49  * enter passwords, ask questions or show processes blocking unmount.
50  */
51 public class MountOperation : DGioMountOperation
52 {
53 	/** the main Gtk struct */
54 	protected GtkMountOperation* gtkMountOperation;
55 
56 	/** Get the main Gtk struct */
57 	public GtkMountOperation* getGtkMountOperationStruct(bool transferOwnership = false)
58 	{
59 		if (transferOwnership)
60 			ownedRef = false;
61 		return gtkMountOperation;
62 	}
63 
64 	/** the main Gtk struct as a void* */
65 	protected override void* getStruct()
66 	{
67 		return cast(void*)gtkMountOperation;
68 	}
69 
70 	/**
71 	 * Sets our main struct and passes it to the parent class.
72 	 */
73 	public this (GtkMountOperation* gtkMountOperation, bool ownedRef = false)
74 	{
75 		this.gtkMountOperation = gtkMountOperation;
76 		super(cast(GMountOperation*)gtkMountOperation, ownedRef);
77 	}
78 
79 
80 	/** */
81 	public static GType getType()
82 	{
83 		return gtk_mount_operation_get_type();
84 	}
85 
86 	/**
87 	 * Creates a new `GtkMountOperation`.
88 	 *
89 	 * Params:
90 	 *     parent = transient parent of the window, or %NULL
91 	 *
92 	 * Returns: a new `GtkMountOperation`
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 display on which windows of the `GtkMountOperation`
110 	 * will be shown.
111 	 *
112 	 * Returns: the display on which windows of @op are shown
113 	 */
114 	public Display getDisplay()
115 	{
116 		auto __p = gtk_mount_operation_get_display(gtkMountOperation);
117 
118 		if(__p is null)
119 		{
120 			return null;
121 		}
122 
123 		return ObjectG.getDObject!(Display)(cast(GdkDisplay*) __p);
124 	}
125 
126 	/**
127 	 * Gets the transient parent used by the `GtkMountOperation`.
128 	 *
129 	 * Returns: the transient parent for windows shown by @op
130 	 */
131 	public Window getParent()
132 	{
133 		auto __p = gtk_mount_operation_get_parent(gtkMountOperation);
134 
135 		if(__p is null)
136 		{
137 			return null;
138 		}
139 
140 		return ObjectG.getDObject!(Window)(cast(GtkWindow*) __p);
141 	}
142 
143 	/**
144 	 * Returns whether the `GtkMountOperation` is currently displaying
145 	 * a window.
146 	 *
147 	 * Returns: %TRUE if @op is currently displaying a window
148 	 */
149 	public bool isShowing()
150 	{
151 		return gtk_mount_operation_is_showing(gtkMountOperation) != 0;
152 	}
153 
154 	/**
155 	 * Sets the display to show windows of the `GtkMountOperation` on.
156 	 *
157 	 * Params:
158 	 *     display = a `GdkDisplay`
159 	 */
160 	public void setDisplay(Display display)
161 	{
162 		gtk_mount_operation_set_display(gtkMountOperation, (display is null) ? null : display.getDisplayStruct());
163 	}
164 
165 	/**
166 	 * Sets the transient parent for windows shown by the
167 	 * `GtkMountOperation`.
168 	 *
169 	 * Params:
170 	 *     parent = transient parent of the window, or %NULL
171 	 */
172 	public void setParent(Window parent)
173 	{
174 		gtk_mount_operation_set_parent(gtkMountOperation, (parent is null) ? null : parent.getWindowStruct());
175 	}
176 }