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 77 public static GType getType() 78 { 79 return gtk_mount_operation_get_type(); 80 } 81 82 /** 83 * Creates a new #GtkMountOperation 84 * 85 * Params: 86 * parent = transient parent of the window, or %NULL 87 * 88 * Return: a new #GtkMountOperation 89 * 90 * Since: 2.14 91 * 92 * Throws: ConstructionException GTK+ fails to create the object. 93 */ 94 public this(Window parent) 95 { 96 auto p = gtk_mount_operation_new((parent is null) ? null : parent.getWindowStruct()); 97 98 if(p is null) 99 { 100 throw new ConstructionException("null returned by new"); 101 } 102 103 this(cast(GtkMountOperation*) p, true); 104 } 105 106 /** 107 * Gets the transient parent used by the #GtkMountOperation 108 * 109 * Return: the transient parent for windows shown by @op 110 * 111 * Since: 2.14 112 */ 113 public Window getParent() 114 { 115 auto p = gtk_mount_operation_get_parent(gtkMountOperation); 116 117 if(p is null) 118 { 119 return null; 120 } 121 122 return ObjectG.getDObject!(Window)(cast(GtkWindow*) p); 123 } 124 125 /** 126 * Gets the screen on which windows of the #GtkMountOperation 127 * will be shown. 128 * 129 * Return: the screen on which windows of @op are shown 130 * 131 * Since: 2.14 132 */ 133 public Screen getScreen() 134 { 135 auto p = gtk_mount_operation_get_screen(gtkMountOperation); 136 137 if(p is null) 138 { 139 return null; 140 } 141 142 return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p); 143 } 144 145 /** 146 * Returns whether the #GtkMountOperation is currently displaying 147 * a window. 148 * 149 * Return: %TRUE if @op is currently displaying a window 150 * 151 * Since: 2.14 152 */ 153 public bool isShowing() 154 { 155 return gtk_mount_operation_is_showing(gtkMountOperation) != 0; 156 } 157 158 /** 159 * Sets the transient parent for windows shown by the 160 * #GtkMountOperation. 161 * 162 * Params: 163 * parent = transient parent of the window, or %NULL 164 * 165 * Since: 2.14 166 */ 167 public void setParent(Window parent) 168 { 169 gtk_mount_operation_set_parent(gtkMountOperation, (parent is null) ? null : parent.getWindowStruct()); 170 } 171 172 /** 173 * Sets the screen to show windows of the #GtkMountOperation on. 174 * 175 * Params: 176 * screen = a #GdkScreen 177 * 178 * Since: 2.14 179 */ 180 public void setScreen(Screen screen) 181 { 182 gtk_mount_operation_set_screen(gtkMountOperation, (screen is null) ? null : screen.getScreenStruct()); 183 } 184 185 /** 186 * This is a convenience function for launching the default application 187 * to show the uri. The uri must be of a form understood by GIO (i.e. you 188 * need to install gvfs to get support for uri schemes such as http:// 189 * or ftp://, as only local files are handled by GIO itself). 190 * Typical examples are 191 * - `file:///home/gnome/pict.jpg` 192 * - `http://www.gnome.org` 193 * - `mailto:me@gnome.org` 194 * 195 * Ideally the timestamp is taken from the event triggering 196 * the gtk_show_uri() call. If timestamp is not known you can take 197 * %GDK_CURRENT_TIME. 198 * 199 * Params: 200 * screen = screen to show the uri on 201 * or %NULL for the default screen 202 * uri = the uri to show 203 * timestamp = a timestamp to prevent focus stealing 204 * 205 * Return: %TRUE on success, %FALSE on error 206 * 207 * Since: 2.14 208 * 209 * Throws: GException on failure. 210 */ 211 public static bool showUri(Screen screen, string uri, uint timestamp) 212 { 213 GError* err = null; 214 215 auto p = gtk_show_uri((screen is null) ? null : screen.getScreenStruct(), Str.toStringz(uri), timestamp, &err) != 0; 216 217 if (err !is null) 218 { 219 throw new GException( new ErrorG(err) ); 220 } 221 222 return p; 223 } 224 }