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