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 * Returns: 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 * Returns: 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 * Returns: 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 * Returns: %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 * A convenience function for launching the default application 186 * to show the uri. Like gtk_show_uri_on_window(), but takes a screen 187 * as transient parent instead of a window. 188 * 189 * Note that this function is deprecated as it does not pass the necessary 190 * information for helpers to parent their dialog properly, when run from 191 * sandboxed applications for example. 192 * 193 * Params: 194 * screen = screen to show the uri on 195 * or %NULL for the default screen 196 * uri = the uri to show 197 * timestamp = a timestamp to prevent focus stealing 198 * 199 * Returns: %TRUE on success, %FALSE on error 200 * 201 * Since: 2.14 202 * 203 * Throws: GException on failure. 204 */ 205 public static bool showUri(Screen screen, string uri, uint timestamp) 206 { 207 GError* err = null; 208 209 auto p = gtk_show_uri((screen is null) ? null : screen.getScreenStruct(), Str.toStringz(uri), timestamp, &err) != 0; 210 211 if (err !is null) 212 { 213 throw new GException( new ErrorG(err) ); 214 } 215 216 return p; 217 } 218 }