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 = GFileInfo.html 27 * outPack = gio 28 * outFile = FileInfo 29 * strct = GFileInfo 30 * realStrct= 31 * ctorStrct= 32 * clss = FileInfo 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = GObject 38 * implements: 39 * prefixes: 40 * - g_file_info_ 41 * omit structs: 42 * omit prefixes: 43 * - g_file_attribute_matcher_ 44 * omit code: 45 * omit signals: 46 * imports: 47 * - glib.Str 48 * - glib.DateTime 49 * - gobject.ObjectG 50 * - gio.Icon 51 * - gio.IconIF 52 * - gio.FileAttributeMatcher 53 * structWrap: 54 * - GDateTime* -> DateTime 55 * - GFileAttributeMatcher* -> FileAttributeMatcher 56 * - GFileInfo* -> FileInfo 57 * - GIcon* -> IconIF 58 * - GObject* -> ObjectG 59 * module aliases: 60 * local aliases: 61 * overrides: 62 */ 63 64 module gio.FileInfo; 65 66 public import gtkc.giotypes; 67 68 private import gtkc.gio; 69 private import glib.ConstructionException; 70 private import gobject.ObjectG; 71 72 73 private import glib.Str; 74 private import glib.DateTime; 75 private import gobject.ObjectG; 76 private import gio.Icon; 77 private import gio.IconIF; 78 private import gio.FileAttributeMatcher; 79 80 81 82 private import gobject.ObjectG; 83 84 /** 85 * Functionality for manipulating basic metadata for files. GFileInfo 86 * implements methods for getting information that all files should 87 * contain, and allows for manipulation of extended attributes. 88 * 89 * See GFileAttribute for more 90 * information on how GIO handles file attributes. 91 * 92 * To obtain a GFileInfo for a GFile, use g_file_query_info() (or its 93 * async variant). To obtain a GFileInfo for a file input or output 94 * stream, use g_file_input_stream_query_info() or 95 * g_file_output_stream_query_info() (or their async variants). 96 * 97 * To change the actual attributes of a file, you should then set the 98 * attribute in the GFileInfo and call g_file_set_attributes_from_info() 99 * or g_file_set_attributes_async() on a GFile. 100 * 101 * However, not all attributes can be changed in the file. For instance, 102 * the actual size of a file cannot be changed via g_file_info_set_size(). 103 * You may call g_file_query_settable_attributes() and 104 * g_file_query_writable_namespaces() to discover the settable attributes 105 * of a particular file at runtime. 106 * 107 * GFileAttributeMatcher allows for searching through a GFileInfo for 108 * attributes. 109 */ 110 public class FileInfo : ObjectG 111 { 112 113 /** the main Gtk struct */ 114 protected GFileInfo* gFileInfo; 115 116 117 public GFileInfo* getFileInfoStruct() 118 { 119 return gFileInfo; 120 } 121 122 123 /** the main Gtk struct as a void* */ 124 protected override void* getStruct() 125 { 126 return cast(void*)gFileInfo; 127 } 128 129 /** 130 * Sets our main struct and passes it to the parent class 131 */ 132 public this (GFileInfo* gFileInfo) 133 { 134 super(cast(GObject*)gFileInfo); 135 this.gFileInfo = gFileInfo; 136 } 137 138 protected override void setStruct(GObject* obj) 139 { 140 super.setStruct(obj); 141 gFileInfo = cast(GFileInfo*)obj; 142 } 143 144 /** 145 */ 146 147 /** 148 * Creates a new file info structure. 149 * Throws: ConstructionException GTK+ fails to create the object. 150 */ 151 public this () 152 { 153 // GFileInfo * g_file_info_new (void); 154 auto p = g_file_info_new(); 155 if(p is null) 156 { 157 throw new ConstructionException("null returned by g_file_info_new()"); 158 } 159 this(cast(GFileInfo*) p); 160 } 161 162 /** 163 * Duplicates a file info structure. 164 * Returns: a duplicate GFileInfo of other. [transfer full] 165 */ 166 public FileInfo dup() 167 { 168 // GFileInfo * g_file_info_dup (GFileInfo *other); 169 auto p = g_file_info_dup(gFileInfo); 170 171 if(p is null) 172 { 173 return null; 174 } 175 176 return ObjectG.getDObject!(FileInfo)(cast(GFileInfo*) p); 177 } 178 179 /** 180 * Copies all of the GFileAttributes 181 * from src_info to dest_info. 182 * Params: 183 * destInfo = destination to copy attributes to. 184 */ 185 public void copyInto(FileInfo destInfo) 186 { 187 // void g_file_info_copy_into (GFileInfo *src_info, GFileInfo *dest_info); 188 g_file_info_copy_into(gFileInfo, (destInfo is null) ? null : destInfo.getFileInfoStruct()); 189 } 190 191 /** 192 * Checks if a file info structure has an attribute named attribute. 193 * Params: 194 * attribute = a file attribute key. 195 * Returns: TRUE if Ginfo has an attribute named attribute, FALSE otherwise. 196 */ 197 public int hasAttribute(string attribute) 198 { 199 // gboolean g_file_info_has_attribute (GFileInfo *info, const char *attribute); 200 return g_file_info_has_attribute(gFileInfo, Str.toStringz(attribute)); 201 } 202 203 /** 204 * Checks if a file info structure has an attribute in the 205 * specified name_space. 206 * Since 2.22 207 * Params: 208 * nameSpace = a file attribute namespace. 209 * Returns: TRUE if Ginfo has an attribute in name_space, FALSE otherwise. 210 */ 211 public int hasNamespace(string nameSpace) 212 { 213 // gboolean g_file_info_has_namespace (GFileInfo *info, const char *name_space); 214 return g_file_info_has_namespace(gFileInfo, Str.toStringz(nameSpace)); 215 } 216 217 /** 218 * Lists the file info structure's attributes. 219 * Params: 220 * nameSpace = a file attribute key's namespace. 221 * Returns: a null-terminated array of strings of all of the possible attribute types for the given name_space, or NULL on error. [array zero-terminated=1][transfer full] 222 */ 223 public string[] listAttributes(string nameSpace) 224 { 225 // char ** g_file_info_list_attributes (GFileInfo *info, const char *name_space); 226 return Str.toStringArray(g_file_info_list_attributes(gFileInfo, Str.toStringz(nameSpace))); 227 } 228 229 /** 230 * Gets the attribute type for an attribute key. 231 * Params: 232 * attribute = a file attribute key. 233 * Returns: a GFileAttributeType for the given attribute, or G_FILE_ATTRIBUTE_TYPE_INVALID if the key is not set. 234 */ 235 public GFileAttributeType getAttributeType(string attribute) 236 { 237 // GFileAttributeType g_file_info_get_attribute_type (GFileInfo *info, const char *attribute); 238 return g_file_info_get_attribute_type(gFileInfo, Str.toStringz(attribute)); 239 } 240 241 /** 242 * Removes all cases of attribute from info if it exists. 243 * Params: 244 * attribute = a file attribute key. 245 */ 246 public void removeAttribute(string attribute) 247 { 248 // void g_file_info_remove_attribute (GFileInfo *info, const char *attribute); 249 g_file_info_remove_attribute(gFileInfo, Str.toStringz(attribute)); 250 } 251 252 /** 253 * Gets the value of a attribute, formated as a string. 254 * This escapes things as needed to make the string valid 255 * utf8. 256 * Params: 257 * attribute = a file attribute key. 258 * Returns: a UTF-8 string associated with the given attribute. When you're done with the string it must be freed with g_free(). 259 */ 260 public string getAttributeAsString(string attribute) 261 { 262 // char * g_file_info_get_attribute_as_string (GFileInfo *info, const char *attribute); 263 return Str.toString(g_file_info_get_attribute_as_string(gFileInfo, Str.toStringz(attribute))); 264 } 265 266 /** 267 * Gets the attribute type, value and status for an attribute key. 268 * Params: 269 * attribute = a file attribute key 270 * type = return location for the attribute type, or NULL. [out][allow-none] 271 * valuePp = return location for the attribute value, or NULL. [out][allow-none] 272 * status = return location for the attribute status, or NULL. [out][allow-none] 273 * Returns: TRUE if info has an attribute named attribute, FALSE otherwise. [transfer none] 274 */ 275 public int getAttributeData(string attribute, out GFileAttributeType type, out void* valuePp, out GFileAttributeStatus status) 276 { 277 // gboolean g_file_info_get_attribute_data (GFileInfo *info, const char *attribute, GFileAttributeType *type, gpointer *value_pp, GFileAttributeStatus *status); 278 return g_file_info_get_attribute_data(gFileInfo, Str.toStringz(attribute), &type, &valuePp, &status); 279 } 280 281 /** 282 * Gets the attribute status for an attribute key. 283 * Params: 284 * attribute = a file attribute key 285 * Returns: a GFileAttributeStatus for the given attribute, or G_FILE_ATTRIBUTE_STATUS_UNSET if the key is invalid. 286 */ 287 public GFileAttributeStatus getAttributeStatus(string attribute) 288 { 289 // GFileAttributeStatus g_file_info_get_attribute_status (GFileInfo *info, const char *attribute); 290 return g_file_info_get_attribute_status(gFileInfo, Str.toStringz(attribute)); 291 } 292 293 /** 294 * Gets the value of a string attribute. If the attribute does 295 * not contain a string, NULL will be returned. 296 * Params: 297 * attribute = a file attribute key. 298 * Returns: the contents of the attribute value as a UTF-8 string, or NULL otherwise. 299 */ 300 public string getAttributeString(string attribute) 301 { 302 // const char * g_file_info_get_attribute_string (GFileInfo *info, const char *attribute); 303 return Str.toString(g_file_info_get_attribute_string(gFileInfo, Str.toStringz(attribute))); 304 } 305 306 /** 307 * Gets the value of a stringv attribute. If the attribute does 308 * not contain a stringv, NULL will be returned. 309 * Since 2.22 310 * Params: 311 * attribute = a file attribute key. 312 * Returns: the contents of the attribute value as a stringv, or NULL otherwise. Do not free. These returned strings are UTF-8. [transfer none] 313 */ 314 public string[] getAttributeStringv(string attribute) 315 { 316 // char ** g_file_info_get_attribute_stringv (GFileInfo *info, const char *attribute); 317 return Str.toStringArray(g_file_info_get_attribute_stringv(gFileInfo, Str.toStringz(attribute))); 318 } 319 320 /** 321 * Gets the value of a byte string attribute. If the attribute does 322 * not contain a byte string, NULL will be returned. 323 * Params: 324 * attribute = a file attribute key. 325 * Returns: the contents of the attribute value as a byte string, or NULL otherwise. 326 */ 327 public string getAttributeByteString(string attribute) 328 { 329 // const char * g_file_info_get_attribute_byte_string (GFileInfo *info, const char *attribute); 330 return Str.toString(g_file_info_get_attribute_byte_string(gFileInfo, Str.toStringz(attribute))); 331 } 332 333 /** 334 * Gets the value of a boolean attribute. If the attribute does not 335 * contain a boolean value, FALSE will be returned. 336 * Params: 337 * attribute = a file attribute key. 338 * Returns: the boolean value contained within the attribute. 339 */ 340 public int getAttributeBoolean(string attribute) 341 { 342 // gboolean g_file_info_get_attribute_boolean (GFileInfo *info, const char *attribute); 343 return g_file_info_get_attribute_boolean(gFileInfo, Str.toStringz(attribute)); 344 } 345 346 /** 347 * Gets an unsigned 32-bit integer contained within the attribute. If the 348 * attribute does not contain an unsigned 32-bit integer, or is invalid, 349 * 0 will be returned. 350 * Params: 351 * attribute = a file attribute key. 352 * Returns: an unsigned 32-bit integer from the attribute. 353 */ 354 public uint getAttributeUint32(string attribute) 355 { 356 // guint32 g_file_info_get_attribute_uint32 (GFileInfo *info, const char *attribute); 357 return g_file_info_get_attribute_uint32(gFileInfo, Str.toStringz(attribute)); 358 } 359 360 /** 361 * Gets a signed 32-bit integer contained within the attribute. If the 362 * attribute does not contain a signed 32-bit integer, or is invalid, 363 * 0 will be returned. 364 * Params: 365 * attribute = a file attribute key. 366 * Returns: a signed 32-bit integer from the attribute. 367 */ 368 public int getAttributeInt32(string attribute) 369 { 370 // gint32 g_file_info_get_attribute_int32 (GFileInfo *info, const char *attribute); 371 return g_file_info_get_attribute_int32(gFileInfo, Str.toStringz(attribute)); 372 } 373 374 /** 375 * Gets a unsigned 64-bit integer contained within the attribute. If the 376 * attribute does not contain an unsigned 64-bit integer, or is invalid, 377 * 0 will be returned. 378 * Params: 379 * attribute = a file attribute key. 380 * Returns: a unsigned 64-bit integer from the attribute. 381 */ 382 public ulong getAttributeUint64(string attribute) 383 { 384 // guint64 g_file_info_get_attribute_uint64 (GFileInfo *info, const char *attribute); 385 return g_file_info_get_attribute_uint64(gFileInfo, Str.toStringz(attribute)); 386 } 387 388 /** 389 * Gets a signed 64-bit integer contained within the attribute. If the 390 * attribute does not contain an signed 64-bit integer, or is invalid, 391 * 0 will be returned. 392 * Params: 393 * attribute = a file attribute key. 394 * Returns: a signed 64-bit integer from the attribute. 395 */ 396 public long getAttributeInt64(string attribute) 397 { 398 // gint64 g_file_info_get_attribute_int64 (GFileInfo *info, const char *attribute); 399 return g_file_info_get_attribute_int64(gFileInfo, Str.toStringz(attribute)); 400 } 401 402 /** 403 * Gets the value of a GObject attribute. If the attribute does 404 * not contain a GObject, NULL will be returned. 405 * Params: 406 * attribute = a file attribute key. 407 * Returns: a GObject associated with the given attribute, or NULL otherwise. [transfer none] 408 */ 409 public ObjectG getAttributeObject(string attribute) 410 { 411 // GObject * g_file_info_get_attribute_object (GFileInfo *info, const char *attribute); 412 auto p = g_file_info_get_attribute_object(gFileInfo, Str.toStringz(attribute)); 413 414 if(p is null) 415 { 416 return null; 417 } 418 419 return ObjectG.getDObject!(ObjectG)(cast(GObject*) p); 420 } 421 422 /** 423 * Sets the attribute to contain the given value, if possible. To unset the 424 * attribute, use G_ATTRIBUTE_TYPE_INVALID for type. 425 * Params: 426 * attribute = a file attribute key. 427 * type = a GFileAttributeType 428 * valueP = pointer to the value 429 */ 430 public void setAttribute(string attribute, GFileAttributeType type, void* valueP) 431 { 432 // void g_file_info_set_attribute (GFileInfo *info, const char *attribute, GFileAttributeType type, gpointer value_p); 433 g_file_info_set_attribute(gFileInfo, Str.toStringz(attribute), type, valueP); 434 } 435 436 /** 437 * Sets the attribute status for an attribute key. This is only 438 * needed by external code that implement g_file_set_attributes_from_info() 439 * or similar functions. 440 * The attribute must exist in info for this to work. Otherwise FALSE 441 * is returned and info is unchanged. 442 * Since 2.22 443 * Params: 444 * attribute = a file attribute key 445 * status = a GFileAttributeStatus 446 * Returns: TRUE if the status was changed, FALSE if the key was not set. 447 */ 448 public int setAttributeStatus(string attribute, GFileAttributeStatus status) 449 { 450 // gboolean g_file_info_set_attribute_status (GFileInfo *info, const char *attribute, GFileAttributeStatus status); 451 return g_file_info_set_attribute_status(gFileInfo, Str.toStringz(attribute), status); 452 } 453 454 /** 455 * Sets the attribute to contain the given attr_value, 456 * if possible. 457 * Params: 458 * attribute = a file attribute key. 459 * attrValue = a UTF-8 string. 460 */ 461 public void setAttributeString(string attribute, string attrValue) 462 { 463 // void g_file_info_set_attribute_string (GFileInfo *info, const char *attribute, const char *attr_value); 464 g_file_info_set_attribute_string(gFileInfo, Str.toStringz(attribute), Str.toStringz(attrValue)); 465 } 466 467 /** 468 * Sets the attribute to contain the given attr_value, 469 * if possible. 470 * Sinze: 2.22 471 * Params: 472 * attribute = a file attribute key 473 * attrValue = a NULL terminated array of UTF-8 strings. [array][element-type utf8] 474 */ 475 public void setAttributeStringv(string attribute, string[] attrValue) 476 { 477 // void g_file_info_set_attribute_stringv (GFileInfo *info, const char *attribute, char **attr_value); 478 g_file_info_set_attribute_stringv(gFileInfo, Str.toStringz(attribute), Str.toStringzArray(attrValue)); 479 } 480 481 /** 482 * Sets the attribute to contain the given attr_value, 483 * if possible. 484 * Params: 485 * attribute = a file attribute key. 486 * attrValue = a byte string. 487 */ 488 public void setAttributeByteString(string attribute, string attrValue) 489 { 490 // void g_file_info_set_attribute_byte_string (GFileInfo *info, const char *attribute, const char *attr_value); 491 g_file_info_set_attribute_byte_string(gFileInfo, Str.toStringz(attribute), Str.toStringz(attrValue)); 492 } 493 494 /** 495 * Sets the attribute to contain the given attr_value, 496 * if possible. 497 * Params: 498 * attribute = a file attribute key. 499 * attrValue = a boolean value. 500 */ 501 public void setAttributeBoolean(string attribute, int attrValue) 502 { 503 // void g_file_info_set_attribute_boolean (GFileInfo *info, const char *attribute, gboolean attr_value); 504 g_file_info_set_attribute_boolean(gFileInfo, Str.toStringz(attribute), attrValue); 505 } 506 507 /** 508 * Sets the attribute to contain the given attr_value, 509 * if possible. 510 * Params: 511 * attribute = a file attribute key. 512 * attrValue = an unsigned 32-bit integer. 513 */ 514 public void setAttributeUint32(string attribute, uint attrValue) 515 { 516 // void g_file_info_set_attribute_uint32 (GFileInfo *info, const char *attribute, guint32 attr_value); 517 g_file_info_set_attribute_uint32(gFileInfo, Str.toStringz(attribute), attrValue); 518 } 519 520 /** 521 * Sets the attribute to contain the given attr_value, 522 * if possible. 523 * Params: 524 * attribute = a file attribute key. 525 * attrValue = a signed 32-bit integer 526 */ 527 public void setAttributeInt32(string attribute, int attrValue) 528 { 529 // void g_file_info_set_attribute_int32 (GFileInfo *info, const char *attribute, gint32 attr_value); 530 g_file_info_set_attribute_int32(gFileInfo, Str.toStringz(attribute), attrValue); 531 } 532 533 /** 534 * Sets the attribute to contain the given attr_value, 535 * if possible. 536 * Params: 537 * attribute = a file attribute key. 538 * attrValue = an unsigned 64-bit integer. 539 */ 540 public void setAttributeUint64(string attribute, ulong attrValue) 541 { 542 // void g_file_info_set_attribute_uint64 (GFileInfo *info, const char *attribute, guint64 attr_value); 543 g_file_info_set_attribute_uint64(gFileInfo, Str.toStringz(attribute), attrValue); 544 } 545 546 /** 547 * Sets the attribute to contain the given attr_value, 548 * if possible. 549 * Params: 550 * attribute = attribute name to set. 551 * attrValue = int64 value to set attribute to. 552 */ 553 public void setAttributeInt64(string attribute, long attrValue) 554 { 555 // void g_file_info_set_attribute_int64 (GFileInfo *info, const char *attribute, gint64 attr_value); 556 g_file_info_set_attribute_int64(gFileInfo, Str.toStringz(attribute), attrValue); 557 } 558 559 /** 560 * Sets the attribute to contain the given attr_value, 561 * if possible. 562 * Params: 563 * attribute = a file attribute key. 564 * attrValue = a GObject. 565 */ 566 public void setAttributeObject(string attribute, ObjectG attrValue) 567 { 568 // void g_file_info_set_attribute_object (GFileInfo *info, const char *attribute, GObject *attr_value); 569 g_file_info_set_attribute_object(gFileInfo, Str.toStringz(attribute), (attrValue is null) ? null : attrValue.getObjectGStruct()); 570 } 571 572 /** 573 * Clears the status information from info. 574 */ 575 public void clearStatus() 576 { 577 // void g_file_info_clear_status (GFileInfo *info); 578 g_file_info_clear_status(gFileInfo); 579 } 580 581 /** 582 * Gets a file's type (whether it is a regular file, symlink, etc). 583 * This is different from the file's content type, see g_file_info_get_content_type(). 584 * Returns: a GFileType for the given file. 585 */ 586 public GFileType getFileType() 587 { 588 // GFileType g_file_info_get_file_type (GFileInfo *info); 589 return g_file_info_get_file_type(gFileInfo); 590 } 591 592 /** 593 * Checks if a file is hidden. 594 * Returns: TRUE if the file is a hidden file, FALSE otherwise. 595 */ 596 public int getIsHidden() 597 { 598 // gboolean g_file_info_get_is_hidden (GFileInfo *info); 599 return g_file_info_get_is_hidden(gFileInfo); 600 } 601 602 /** 603 * Checks if a file is a backup file. 604 * Returns: TRUE if file is a backup file, FALSE otherwise. 605 */ 606 public int getIsBackup() 607 { 608 // gboolean g_file_info_get_is_backup (GFileInfo *info); 609 return g_file_info_get_is_backup(gFileInfo); 610 } 611 612 /** 613 * Checks if a file is a symlink. 614 * Returns: TRUE if the given info is a symlink. 615 */ 616 public int getIsSymlink() 617 { 618 // gboolean g_file_info_get_is_symlink (GFileInfo *info); 619 return g_file_info_get_is_symlink(gFileInfo); 620 } 621 622 /** 623 * Gets the name for a file. 624 * Returns: a string containing the file name. 625 */ 626 public string getName() 627 { 628 // const char * g_file_info_get_name (GFileInfo *info); 629 return Str.toString(g_file_info_get_name(gFileInfo)); 630 } 631 632 /** 633 * Gets a display name for a file. 634 * Returns: a string containing the display name. 635 */ 636 public string getDisplayName() 637 { 638 // const char * g_file_info_get_display_name (GFileInfo *info); 639 return Str.toString(g_file_info_get_display_name(gFileInfo)); 640 } 641 642 /** 643 * Gets the edit name for a file. 644 * Returns: a string containing the edit name. 645 */ 646 public string getEditName() 647 { 648 // const char * g_file_info_get_edit_name (GFileInfo *info); 649 return Str.toString(g_file_info_get_edit_name(gFileInfo)); 650 } 651 652 /** 653 * Gets the icon for a file. 654 * Returns: GIcon for the given info. [transfer none] 655 */ 656 public IconIF getIcon() 657 { 658 // GIcon * g_file_info_get_icon (GFileInfo *info); 659 auto p = g_file_info_get_icon(gFileInfo); 660 661 if(p is null) 662 { 663 return null; 664 } 665 666 return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p); 667 } 668 669 /** 670 * Gets the symbolic icon for a file. 671 * Since 2.34 672 * Returns: GIcon for the given info. [transfer none] 673 */ 674 public IconIF getSymbolicIcon() 675 { 676 // GIcon * g_file_info_get_symbolic_icon (GFileInfo *info); 677 auto p = g_file_info_get_symbolic_icon(gFileInfo); 678 679 if(p is null) 680 { 681 return null; 682 } 683 684 return ObjectG.getDObject!(Icon, IconIF)(cast(GIcon*) p); 685 } 686 687 /** 688 * Gets the file's content type. 689 * Returns: a string containing the file's content type. 690 */ 691 public string getContentType() 692 { 693 // const char * g_file_info_get_content_type (GFileInfo *info); 694 return Str.toString(g_file_info_get_content_type(gFileInfo)); 695 } 696 697 /** 698 * Gets the file's size. 699 * Returns: a goffset containing the file's size. 700 */ 701 public long getSize() 702 { 703 // goffset g_file_info_get_size (GFileInfo *info); 704 return g_file_info_get_size(gFileInfo); 705 } 706 707 /** 708 * Gets the modification time of the current info and sets it 709 * in result. 710 * Params: 711 * result = a GTimeVal. [out caller-allocates] 712 */ 713 public void getModificationTime(out GTimeVal result) 714 { 715 // void g_file_info_get_modification_time (GFileInfo *info, GTimeVal *result); 716 g_file_info_get_modification_time(gFileInfo, &result); 717 } 718 719 /** 720 * Gets the symlink target for a given GFileInfo. 721 * Returns: a string containing the symlink target. 722 */ 723 public string getSymlinkTarget() 724 { 725 // const char * g_file_info_get_symlink_target (GFileInfo *info); 726 return Str.toString(g_file_info_get_symlink_target(gFileInfo)); 727 } 728 729 /** 730 * Gets the entity tag for a given 731 * GFileInfo. See G_FILE_ATTRIBUTE_ETAG_VALUE. 732 * Returns: a string containing the value of the "etag:value" attribute. 733 */ 734 public string getEtag() 735 { 736 // const char * g_file_info_get_etag (GFileInfo *info); 737 return Str.toString(g_file_info_get_etag(gFileInfo)); 738 } 739 740 /** 741 * Gets the value of the sort_order attribute from the GFileInfo. 742 * See G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER. 743 * Returns: a gint32 containing the value of the "standard::sort_order" attribute. 744 */ 745 public int getSortOrder() 746 { 747 // gint32 g_file_info_get_sort_order (GFileInfo *info); 748 return g_file_info_get_sort_order(gFileInfo); 749 } 750 751 /** 752 * Returns the GDateTime representing the deletion date of the file, as 753 * available in G_FILE_ATTRIBUTE_TRASH_DELETION_DATE. If the 754 * G_FILE_ATTRIBUTE_TRASH_DELETION_DATE attribute is unset, NULL is returned. 755 * Since 2.36 756 * Returns: a GDateTime, or NULL. 757 */ 758 public DateTime getDeletionDate() 759 { 760 // GDateTime * g_file_info_get_deletion_date (GFileInfo *info); 761 auto p = g_file_info_get_deletion_date(gFileInfo); 762 763 if(p is null) 764 { 765 return null; 766 } 767 768 return ObjectG.getDObject!(DateTime)(cast(GDateTime*) p); 769 } 770 771 /** 772 * Sets mask on info to match specific attribute types. 773 * Params: 774 * mask = a GFileAttributeMatcher. 775 */ 776 public void setAttributeMask(FileAttributeMatcher mask) 777 { 778 // void g_file_info_set_attribute_mask (GFileInfo *info, GFileAttributeMatcher *mask); 779 g_file_info_set_attribute_mask(gFileInfo, (mask is null) ? null : mask.getFileAttributeMatcherStruct()); 780 } 781 782 /** 783 * Unsets a mask set by g_file_info_set_attribute_mask(), if one 784 * is set. 785 */ 786 public void unsetAttributeMask() 787 { 788 // void g_file_info_unset_attribute_mask (GFileInfo *info); 789 g_file_info_unset_attribute_mask(gFileInfo); 790 } 791 792 /** 793 * Sets the file type in a GFileInfo to type. 794 * See G_FILE_ATTRIBUTE_STANDARD_TYPE. 795 * Params: 796 * type = a GFileType. 797 */ 798 public void setFileType(GFileType type) 799 { 800 // void g_file_info_set_file_type (GFileInfo *info, GFileType type); 801 g_file_info_set_file_type(gFileInfo, type); 802 } 803 804 /** 805 * Sets the "is_hidden" attribute in a GFileInfo according to is_symlink. 806 * See G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN. 807 * Params: 808 * isHidden = a gboolean. 809 */ 810 public void setIsHidden(int isHidden) 811 { 812 // void g_file_info_set_is_hidden (GFileInfo *info, gboolean is_hidden); 813 g_file_info_set_is_hidden(gFileInfo, isHidden); 814 } 815 816 /** 817 * Sets the "is_symlink" attribute in a GFileInfo according to is_symlink. 818 * See G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK. 819 * Params: 820 * isSymlink = a gboolean. 821 */ 822 public void setIsSymlink(int isSymlink) 823 { 824 // void g_file_info_set_is_symlink (GFileInfo *info, gboolean is_symlink); 825 g_file_info_set_is_symlink(gFileInfo, isSymlink); 826 } 827 828 /** 829 * Sets the name attribute for the current GFileInfo. 830 * See G_FILE_ATTRIBUTE_STANDARD_NAME. 831 * Params: 832 * name = a string containing a name. 833 */ 834 public void setName(string name) 835 { 836 // void g_file_info_set_name (GFileInfo *info, const char *name); 837 g_file_info_set_name(gFileInfo, Str.toStringz(name)); 838 } 839 840 /** 841 * Sets the display name for the current GFileInfo. 842 * See G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME. 843 * Params: 844 * displayName = a string containing a display name. 845 */ 846 public void setDisplayName(string displayName) 847 { 848 // void g_file_info_set_display_name (GFileInfo *info, const char *display_name); 849 g_file_info_set_display_name(gFileInfo, Str.toStringz(displayName)); 850 } 851 852 /** 853 * Sets the edit name for the current file. 854 * See G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME. 855 * Params: 856 * editName = a string containing an edit name. 857 */ 858 public void setEditName(string editName) 859 { 860 // void g_file_info_set_edit_name (GFileInfo *info, const char *edit_name); 861 g_file_info_set_edit_name(gFileInfo, Str.toStringz(editName)); 862 } 863 864 /** 865 * Sets the icon for a given GFileInfo. 866 * See G_FILE_ATTRIBUTE_STANDARD_ICON. 867 * Params: 868 * icon = a GIcon. 869 */ 870 public void setIcon(IconIF icon) 871 { 872 // void g_file_info_set_icon (GFileInfo *info, GIcon *icon); 873 g_file_info_set_icon(gFileInfo, (icon is null) ? null : icon.getIconTStruct()); 874 } 875 876 /** 877 * Sets the symbolic icon for a given GFileInfo. 878 * See G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON. 879 * Since 2.34 880 * Params: 881 * icon = a GIcon. 882 */ 883 public void setSymbolicIcon(IconIF icon) 884 { 885 // void g_file_info_set_symbolic_icon (GFileInfo *info, GIcon *icon); 886 g_file_info_set_symbolic_icon(gFileInfo, (icon is null) ? null : icon.getIconTStruct()); 887 } 888 889 /** 890 * Sets the content type attribute for a given GFileInfo. 891 * See G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE. 892 * Params: 893 * contentType = a content type. See GContentType. 894 */ 895 public void setContentType(string contentType) 896 { 897 // void g_file_info_set_content_type (GFileInfo *info, const char *content_type); 898 g_file_info_set_content_type(gFileInfo, Str.toStringz(contentType)); 899 } 900 901 /** 902 * Sets the G_FILE_ATTRIBUTE_STANDARD_SIZE attribute in the file info 903 * to the given size. 904 * Params: 905 * size = a goffset containing the file's size. 906 */ 907 public void setSize(long size) 908 { 909 // void g_file_info_set_size (GFileInfo *info, goffset size); 910 g_file_info_set_size(gFileInfo, size); 911 } 912 913 /** 914 * Sets the G_FILE_ATTRIBUTE_TIME_MODIFIED attribute in the file 915 * info to the given time value. 916 * Params: 917 * mtime = a GTimeVal. 918 */ 919 public void setModificationTime(ref GTimeVal mtime) 920 { 921 // void g_file_info_set_modification_time (GFileInfo *info, GTimeVal *mtime); 922 g_file_info_set_modification_time(gFileInfo, &mtime); 923 } 924 925 /** 926 * Sets the G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET attribute in the file info 927 * to the given symlink target. 928 * Params: 929 * symlinkTarget = a static string containing a path to a symlink target. 930 */ 931 public void setSymlinkTarget(string symlinkTarget) 932 { 933 // void g_file_info_set_symlink_target (GFileInfo *info, const char *symlink_target); 934 g_file_info_set_symlink_target(gFileInfo, Str.toStringz(symlinkTarget)); 935 } 936 937 /** 938 * Sets the sort order attribute in the file info structure. See 939 * G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER. 940 * Params: 941 * sortOrder = a sort order integer. 942 */ 943 public void setSortOrder(int sortOrder) 944 { 945 // void g_file_info_set_sort_order (GFileInfo *info, gint32 sort_order); 946 g_file_info_set_sort_order(gFileInfo, sortOrder); 947 } 948 }