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