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