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