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