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