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 * Conversion parameters: 26 * inFile = gtk3-Filesystem-utilities.html 27 * outPack = gtk 28 * outFile = MountOperation 29 * strct = GtkMountOperation 30 * realStrct= 31 * ctorStrct=GMountOperation 32 * clss = MountOperation 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = GioMountOperation 38 * implements: 39 * prefixes: 40 * - gtk_mount_operation_ 41 * - gtk_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - glib.ErrorG 49 * - glib.GException 50 * - gio.MountOperation : GioMountOperation = MountOperation 51 * - gdk.Screen 52 * - gtk.Window 53 * structWrap: 54 * - GdkScreen* -> Screen 55 * - GtkWindow* -> Window 56 * module aliases: 57 * local aliases: 58 * overrides: 59 */ 60 61 module gtk.MountOperation; 62 63 public import gtkc.gtktypes; 64 65 private import gtkc.gtk; 66 private import glib.ConstructionException; 67 private import gobject.ObjectG; 68 69 private import glib.Str; 70 private import glib.ErrorG; 71 private import glib.GException; 72 private import gio.MountOperation : GioMountOperation = MountOperation; 73 private import gdk.Screen; 74 private import gtk.Window; 75 76 77 78 /** 79 * The functions and objects described here make working with GTK+ and 80 * GIO more convenient. 81 * 82 * GtkMountOperation is needed when mounting volumes: 83 * It is an implementation of GMountOperation that can be used with 84 * GIO functions for mounting volumes such as 85 * g_file_mount_enclosing_volume(), g_file_mount_mountable(), 86 * g_volume_mount(), g_mount_unmount_with_operation() and others. 87 * 88 * When necessary, GtkMountOperation shows dialogs to ask for 89 * passwords, questions or show processes blocking unmount. 90 * 91 * gtk_show_uri() is a convenient way to launch applications for URIs. 92 * 93 * Another object that is worth mentioning in this context is 94 * GdkAppLaunchContext, which provides visual feedback when lauching 95 * applications. 96 */ 97 public class MountOperation : GioMountOperation 98 { 99 100 /** the main Gtk struct */ 101 protected GtkMountOperation* gtkMountOperation; 102 103 104 /** Get the main Gtk struct */ 105 public GtkMountOperation* getGtkMountOperationStruct() 106 { 107 return gtkMountOperation; 108 } 109 110 111 /** the main Gtk struct as a void* */ 112 protected override void* getStruct() 113 { 114 return cast(void*)gtkMountOperation; 115 } 116 117 /** 118 * Sets our main struct and passes it to the parent class 119 */ 120 public this (GtkMountOperation* gtkMountOperation) 121 { 122 super(cast(GMountOperation*)gtkMountOperation); 123 this.gtkMountOperation = gtkMountOperation; 124 } 125 126 protected override void setStruct(GObject* obj) 127 { 128 super.setStruct(obj); 129 gtkMountOperation = cast(GtkMountOperation*)obj; 130 } 131 132 /** 133 */ 134 135 /** 136 * Creates a new GtkMountOperation 137 * Since 2.14 138 * Params: 139 * parent = transient parent of the window, or NULL. [allow-none] 140 * Throws: ConstructionException GTK+ fails to create the object. 141 */ 142 public this (Window parent) 143 { 144 // GMountOperation * gtk_mount_operation_new (GtkWindow *parent); 145 auto p = gtk_mount_operation_new((parent is null) ? null : parent.getWindowStruct()); 146 if(p is null) 147 { 148 throw new ConstructionException("null returned by gtk_mount_operation_new((parent is null) ? null : parent.getWindowStruct())"); 149 } 150 this(cast(GtkMountOperation*) p); 151 } 152 153 /** 154 * Returns whether the GtkMountOperation is currently displaying 155 * a window. 156 * Since 2.14 157 * Returns: TRUE if op is currently displaying a window 158 */ 159 public int isShowing() 160 { 161 // gboolean gtk_mount_operation_is_showing (GtkMountOperation *op); 162 return gtk_mount_operation_is_showing(gtkMountOperation); 163 } 164 165 /** 166 * Sets the transient parent for windows shown by the 167 * GtkMountOperation. 168 * Since 2.14 169 * Params: 170 * parent = transient parent of the window, or NULL. [allow-none] 171 */ 172 public void setParent(Window parent) 173 { 174 // void gtk_mount_operation_set_parent (GtkMountOperation *op, GtkWindow *parent); 175 gtk_mount_operation_set_parent(gtkMountOperation, (parent is null) ? null : parent.getWindowStruct()); 176 } 177 178 /** 179 * Gets the transient parent used by the GtkMountOperation 180 * Since 2.14 181 * Returns: the transient parent for windows shown by op. [transfer none] 182 */ 183 public Window getParent() 184 { 185 // GtkWindow * gtk_mount_operation_get_parent (GtkMountOperation *op); 186 auto p = gtk_mount_operation_get_parent(gtkMountOperation); 187 188 if(p is null) 189 { 190 return null; 191 } 192 193 return ObjectG.getDObject!(Window)(cast(GtkWindow*) p); 194 } 195 196 /** 197 * Sets the screen to show windows of the GtkMountOperation on. 198 * Since 2.14 199 * Params: 200 * screen = a GdkScreen 201 */ 202 public void setScreen(Screen screen) 203 { 204 // void gtk_mount_operation_set_screen (GtkMountOperation *op, GdkScreen *screen); 205 gtk_mount_operation_set_screen(gtkMountOperation, (screen is null) ? null : screen.getScreenStruct()); 206 } 207 208 /** 209 * Gets the screen on which windows of the GtkMountOperation 210 * will be shown. 211 * Since 2.14 212 * Returns: the screen on which windows of op are shown. [transfer none] 213 */ 214 public Screen getScreen() 215 { 216 // GdkScreen * gtk_mount_operation_get_screen (GtkMountOperation *op); 217 auto p = gtk_mount_operation_get_screen(gtkMountOperation); 218 219 if(p is null) 220 { 221 return null; 222 } 223 224 return ObjectG.getDObject!(Screen)(cast(GdkScreen*) p); 225 } 226 227 /** 228 * This is a convenience function for launching the default application 229 * to show the uri. The uri must be of a form understood by GIO (i.e. you 230 * need to install gvfs to get support for uri schemes such as http:// 231 * or ftp://, as only local files are handled by GIO itself). 232 * Typical examples are 233 * file:///home/gnome/pict.jpg 234 * http://www.gnome.org 235 * mailto:me@gnome.org 236 * Ideally the timestamp is taken from the event triggering 237 * the gtk_show_uri() call. If timestamp is not known you can take 238 * GDK_CURRENT_TIME. 239 * This function can be used as a replacement for gnome_vfs_url_show() 240 * and gnome_url_show(). 241 * Since 2.14 242 * Params: 243 * screen = screen to show the uri on 244 * or NULL for the default screen. [allow-none] 245 * uri = the uri to show 246 * timestamp = a timestamp to prevent focus stealing 247 * Returns: TRUE on success, FALSE on error 248 * Throws: GException on failure. 249 */ 250 public static int showUri(Screen screen, string uri, uint timestamp) 251 { 252 // gboolean gtk_show_uri (GdkScreen *screen, const gchar *uri, guint32 timestamp, GError **error); 253 GError* err = null; 254 255 auto p = gtk_show_uri((screen is null) ? null : screen.getScreenStruct(), Str.toStringz(uri), timestamp, &err); 256 257 if (err !is null) 258 { 259 throw new GException( new ErrorG(err) ); 260 } 261 262 return p; 263 } 264 }