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 * 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, or 262 * %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, or 298 * %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, or 313 * %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 */ 371 public string getContentType() 372 { 373 return Str.toString(g_file_info_get_content_type(gFileInfo)); 374 } 375 376 /** 377 * Returns the #GDateTime representing the deletion date of the file, as 378 * available in G_FILE_ATTRIBUTE_TRASH_DELETION_DATE. If the 379 * G_FILE_ATTRIBUTE_TRASH_DELETION_DATE attribute is unset, %NULL is returned. 380 * 381 * Returns: a #GDateTime, or %NULL. 382 * 383 * Since: 2.36 384 */ 385 public DateTime getDeletionDate() 386 { 387 auto __p = g_file_info_get_deletion_date(gFileInfo); 388 389 if(__p is null) 390 { 391 return null; 392 } 393 394 return new DateTime(cast(GDateTime*) __p, true); 395 } 396 397 /** 398 * Gets a display name for a file. 399 * 400 * Returns: a string containing the display name. 401 */ 402 public string getDisplayName() 403 { 404 return Str.toString(g_file_info_get_display_name(gFileInfo)); 405 } 406 407 /** 408 * Gets the edit name for a file. 409 * 410 * Returns: a string containing the edit name. 411 */ 412 public string getEditName() 413 { 414 return Str.toString(g_file_info_get_edit_name(gFileInfo)); 415 } 416 417 /** 418 * Gets the [entity tag][gfile-etag] for a given 419 * #GFileInfo. See %G_FILE_ATTRIBUTE_ETAG_VALUE. 420 * 421 * Returns: a string containing the value of the "etag:value" attribute. 422 */ 423 public string getEtag() 424 { 425 return Str.toString(g_file_info_get_etag(gFileInfo)); 426 } 427 428 /** 429 * Gets a file's type (whether it is a regular file, symlink, etc). 430 * This is different from the file's content type, see g_file_info_get_content_type(). 431 * 432 * Returns: a #GFileType for the given file. 433 */ 434 public GFileType getFileType() 435 { 436 return g_file_info_get_file_type(gFileInfo); 437 } 438 439 /** 440 * Gets the icon for a file. 441 * 442 * Returns: #GIcon for the given @info. 443 */ 444 public IconIF getIcon() 445 { 446 auto __p = g_file_info_get_icon(gFileInfo); 447 448 if(__p is null) 449 { 450 return null; 451 } 452 453 return ObjectG.getDObject!(IconIF)(cast(GIcon*) __p); 454 } 455 456 /** 457 * Checks if a file is a backup file. 458 * 459 * Returns: %TRUE if file is a backup file, %FALSE otherwise. 460 */ 461 public bool getIsBackup() 462 { 463 return g_file_info_get_is_backup(gFileInfo) != 0; 464 } 465 466 /** 467 * Checks if a file is hidden. 468 * 469 * Returns: %TRUE if the file is a hidden file, %FALSE otherwise. 470 */ 471 public bool getIsHidden() 472 { 473 return g_file_info_get_is_hidden(gFileInfo) != 0; 474 } 475 476 /** 477 * Checks if a file is a symlink. 478 * 479 * Returns: %TRUE if the given @info is a symlink. 480 */ 481 public bool getIsSymlink() 482 { 483 return g_file_info_get_is_symlink(gFileInfo) != 0; 484 } 485 486 /** 487 * Gets the modification time of the current @info and returns it as a 488 * #GDateTime. 489 * 490 * This requires the %G_FILE_ATTRIBUTE_TIME_MODIFIED attribute. If 491 * %G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC is provided, the resulting #GDateTime 492 * will have microsecond precision. 493 * 494 * Returns: modification time, or %NULL if unknown 495 * 496 * Since: 2.62 497 */ 498 public DateTime getModificationDateTime() 499 { 500 auto __p = g_file_info_get_modification_date_time(gFileInfo); 501 502 if(__p is null) 503 { 504 return null; 505 } 506 507 return new DateTime(cast(GDateTime*) __p, true); 508 } 509 510 /** 511 * Gets the modification time of the current @info and sets it 512 * in @result. 513 * 514 * Deprecated: Use g_file_info_get_modification_date_time() instead, as 515 * #GTimeVal is deprecated due to the year 2038 problem. 516 * 517 * Params: 518 * result = a #GTimeVal. 519 */ 520 public void getModificationTime(out TimeVal result) 521 { 522 GTimeVal* outresult = sliceNew!GTimeVal(); 523 524 g_file_info_get_modification_time(gFileInfo, outresult); 525 526 result = new TimeVal(outresult, true); 527 } 528 529 /** 530 * Gets the name for a file. 531 * 532 * Returns: a string containing the file name. 533 */ 534 public string getName() 535 { 536 return Str.toString(g_file_info_get_name(gFileInfo)); 537 } 538 539 /** 540 * Gets the file's size. 541 * 542 * Returns: a #goffset containing the file's size. 543 */ 544 public long getSize() 545 { 546 return g_file_info_get_size(gFileInfo); 547 } 548 549 /** 550 * Gets the value of the sort_order attribute from the #GFileInfo. 551 * See %G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER. 552 * 553 * Returns: a #gint32 containing the value of the "standard::sort_order" attribute. 554 */ 555 public int getSortOrder() 556 { 557 return g_file_info_get_sort_order(gFileInfo); 558 } 559 560 /** 561 * Gets the symbolic icon for a file. 562 * 563 * Returns: #GIcon for the given @info. 564 * 565 * Since: 2.34 566 */ 567 public IconIF getSymbolicIcon() 568 { 569 auto __p = g_file_info_get_symbolic_icon(gFileInfo); 570 571 if(__p is null) 572 { 573 return null; 574 } 575 576 return ObjectG.getDObject!(IconIF)(cast(GIcon*) __p); 577 } 578 579 /** 580 * Gets the symlink target for a given #GFileInfo. 581 * 582 * Returns: a string containing the symlink target. 583 */ 584 public string getSymlinkTarget() 585 { 586 return Str.toString(g_file_info_get_symlink_target(gFileInfo)); 587 } 588 589 /** 590 * Checks if a file info structure has an attribute named @attribute. 591 * 592 * Params: 593 * attribute = a file attribute key. 594 * 595 * Returns: %TRUE if @info has an attribute named @attribute, 596 * %FALSE otherwise. 597 */ 598 public bool hasAttribute(string attribute) 599 { 600 return g_file_info_has_attribute(gFileInfo, Str.toStringz(attribute)) != 0; 601 } 602 603 /** 604 * Checks if a file info structure has an attribute in the 605 * specified @name_space. 606 * 607 * Params: 608 * nameSpace = a file attribute namespace. 609 * 610 * Returns: %TRUE if @info has an attribute in @name_space, 611 * %FALSE otherwise. 612 * 613 * Since: 2.22 614 */ 615 public bool hasNamespace(string nameSpace) 616 { 617 return g_file_info_has_namespace(gFileInfo, Str.toStringz(nameSpace)) != 0; 618 } 619 620 /** 621 * Lists the file info structure's attributes. 622 * 623 * Params: 624 * nameSpace = a file attribute key's namespace, or %NULL to list 625 * all attributes. 626 * 627 * Returns: a 628 * null-terminated array of strings of all of the possible attribute 629 * types for the given @name_space, or %NULL on error. 630 */ 631 public string[] listAttributes(string nameSpace) 632 { 633 auto retStr = g_file_info_list_attributes(gFileInfo, Str.toStringz(nameSpace)); 634 635 scope(exit) Str.freeStringArray(retStr); 636 return Str.toStringArray(retStr); 637 } 638 639 /** 640 * Removes all cases of @attribute from @info if it exists. 641 * 642 * Params: 643 * attribute = a file attribute key. 644 */ 645 public void removeAttribute(string attribute) 646 { 647 g_file_info_remove_attribute(gFileInfo, Str.toStringz(attribute)); 648 } 649 650 /** 651 * Sets the @attribute to contain the given value, if possible. To unset the 652 * attribute, use %G_FILE_ATTRIBUTE_TYPE_INVALID for @type. 653 * 654 * Params: 655 * attribute = a file attribute key. 656 * type = a #GFileAttributeType 657 * valueP = pointer to the value 658 */ 659 public void setAttribute(string attribute, GFileAttributeType type, void* valueP) 660 { 661 g_file_info_set_attribute(gFileInfo, Str.toStringz(attribute), type, valueP); 662 } 663 664 /** 665 * Sets the @attribute to contain the given @attr_value, 666 * if possible. 667 * 668 * Params: 669 * attribute = a file attribute key. 670 * attrValue = a boolean value. 671 */ 672 public void setAttributeBoolean(string attribute, bool attrValue) 673 { 674 g_file_info_set_attribute_boolean(gFileInfo, Str.toStringz(attribute), attrValue); 675 } 676 677 /** 678 * Sets the @attribute to contain the given @attr_value, 679 * if possible. 680 * 681 * Params: 682 * attribute = a file attribute key. 683 * attrValue = a byte string. 684 */ 685 public void setAttributeByteString(string attribute, string attrValue) 686 { 687 g_file_info_set_attribute_byte_string(gFileInfo, Str.toStringz(attribute), Str.toStringz(attrValue)); 688 } 689 690 /** 691 * Sets the @attribute to contain the given @attr_value, 692 * if possible. 693 * 694 * Params: 695 * attribute = a file attribute key. 696 * attrValue = a signed 32-bit integer 697 */ 698 public void setAttributeInt32(string attribute, int attrValue) 699 { 700 g_file_info_set_attribute_int32(gFileInfo, Str.toStringz(attribute), attrValue); 701 } 702 703 /** 704 * Sets the @attribute to contain the given @attr_value, 705 * if possible. 706 * 707 * Params: 708 * attribute = attribute name to set. 709 * attrValue = int64 value to set attribute to. 710 */ 711 public void setAttributeInt64(string attribute, long attrValue) 712 { 713 g_file_info_set_attribute_int64(gFileInfo, Str.toStringz(attribute), attrValue); 714 } 715 716 /** 717 * Sets @mask on @info to match specific attribute types. 718 * 719 * Params: 720 * mask = a #GFileAttributeMatcher. 721 */ 722 public void setAttributeMask(FileAttributeMatcher mask) 723 { 724 g_file_info_set_attribute_mask(gFileInfo, (mask is null) ? null : mask.getFileAttributeMatcherStruct()); 725 } 726 727 /** 728 * Sets the @attribute to contain the given @attr_value, 729 * if possible. 730 * 731 * Params: 732 * attribute = a file attribute key. 733 * attrValue = a #GObject. 734 */ 735 public void setAttributeObject(string attribute, ObjectG attrValue) 736 { 737 g_file_info_set_attribute_object(gFileInfo, Str.toStringz(attribute), (attrValue is null) ? null : attrValue.getObjectGStruct()); 738 } 739 740 /** 741 * Sets the attribute status for an attribute key. This is only 742 * needed by external code that implement g_file_set_attributes_from_info() 743 * or similar functions. 744 * 745 * The attribute must exist in @info for this to work. Otherwise %FALSE 746 * is returned and @info is unchanged. 747 * 748 * Params: 749 * attribute = a file attribute key 750 * status = a #GFileAttributeStatus 751 * 752 * Returns: %TRUE if the status was changed, %FALSE if the key was not set. 753 * 754 * Since: 2.22 755 */ 756 public bool setAttributeStatus(string attribute, GFileAttributeStatus status) 757 { 758 return g_file_info_set_attribute_status(gFileInfo, Str.toStringz(attribute), status) != 0; 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 = a UTF-8 string. 768 */ 769 public void setAttributeString(string attribute, string attrValue) 770 { 771 g_file_info_set_attribute_string(gFileInfo, Str.toStringz(attribute), Str.toStringz(attrValue)); 772 } 773 774 /** 775 * Sets the @attribute to contain the given @attr_value, 776 * if possible. 777 * 778 * Sinze: 2.22 779 * 780 * Params: 781 * attribute = a file attribute key 782 * attrValue = a %NULL 783 * terminated array of UTF-8 strings. 784 */ 785 public void setAttributeStringv(string attribute, string[] attrValue) 786 { 787 g_file_info_set_attribute_stringv(gFileInfo, Str.toStringz(attribute), Str.toStringzArray(attrValue)); 788 } 789 790 /** 791 * Sets the @attribute to contain the given @attr_value, 792 * if possible. 793 * 794 * Params: 795 * attribute = a file attribute key. 796 * attrValue = an unsigned 32-bit integer. 797 */ 798 public void setAttributeUint32(string attribute, uint attrValue) 799 { 800 g_file_info_set_attribute_uint32(gFileInfo, Str.toStringz(attribute), attrValue); 801 } 802 803 /** 804 * Sets the @attribute to contain the given @attr_value, 805 * if possible. 806 * 807 * Params: 808 * attribute = a file attribute key. 809 * attrValue = an unsigned 64-bit integer. 810 */ 811 public void setAttributeUint64(string attribute, ulong attrValue) 812 { 813 g_file_info_set_attribute_uint64(gFileInfo, Str.toStringz(attribute), attrValue); 814 } 815 816 /** 817 * Sets the content type attribute for a given #GFileInfo. 818 * See %G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE. 819 * 820 * Params: 821 * contentType = a content type. See [GContentType][gio-GContentType] 822 */ 823 public void setContentType(string contentType) 824 { 825 g_file_info_set_content_type(gFileInfo, Str.toStringz(contentType)); 826 } 827 828 /** 829 * Sets the display name for the current #GFileInfo. 830 * See %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME. 831 * 832 * Params: 833 * displayName = a string containing a display name. 834 */ 835 public void setDisplayName(string displayName) 836 { 837 g_file_info_set_display_name(gFileInfo, Str.toStringz(displayName)); 838 } 839 840 /** 841 * Sets the edit name for the current file. 842 * See %G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME. 843 * 844 * Params: 845 * editName = a string containing an edit name. 846 */ 847 public void setEditName(string editName) 848 { 849 g_file_info_set_edit_name(gFileInfo, Str.toStringz(editName)); 850 } 851 852 /** 853 * Sets the file type in a #GFileInfo to @type. 854 * See %G_FILE_ATTRIBUTE_STANDARD_TYPE. 855 * 856 * Params: 857 * type = a #GFileType. 858 */ 859 public void setFileType(GFileType type) 860 { 861 g_file_info_set_file_type(gFileInfo, type); 862 } 863 864 /** 865 * Sets the icon for a given #GFileInfo. 866 * See %G_FILE_ATTRIBUTE_STANDARD_ICON. 867 * 868 * Params: 869 * icon = a #GIcon. 870 */ 871 public void setIcon(IconIF icon) 872 { 873 g_file_info_set_icon(gFileInfo, (icon is null) ? null : icon.getIconStruct()); 874 } 875 876 /** 877 * Sets the "is_hidden" attribute in a #GFileInfo according to @is_hidden. 878 * See %G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN. 879 * 880 * Params: 881 * isHidden = a #gboolean. 882 */ 883 public void setIsHidden(bool isHidden) 884 { 885 g_file_info_set_is_hidden(gFileInfo, isHidden); 886 } 887 888 /** 889 * Sets the "is_symlink" attribute in a #GFileInfo according to @is_symlink. 890 * See %G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK. 891 * 892 * Params: 893 * isSymlink = a #gboolean. 894 */ 895 public void setIsSymlink(bool isSymlink) 896 { 897 g_file_info_set_is_symlink(gFileInfo, isSymlink); 898 } 899 900 /** 901 * Sets the %G_FILE_ATTRIBUTE_TIME_MODIFIED and 902 * %G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC attributes in the file info to the 903 * given date/time value. 904 * 905 * Params: 906 * mtime = a #GDateTime. 907 * 908 * Since: 2.62 909 */ 910 public void setModificationDateTime(DateTime mtime) 911 { 912 g_file_info_set_modification_date_time(gFileInfo, (mtime is null) ? null : mtime.getDateTimeStruct()); 913 } 914 915 /** 916 * Sets the %G_FILE_ATTRIBUTE_TIME_MODIFIED and 917 * %G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC attributes in the file info to the 918 * given time value. 919 * 920 * Deprecated: Use g_file_info_set_modification_date_time() instead, as 921 * #GTimeVal is deprecated due to the year 2038 problem. 922 * 923 * Params: 924 * mtime = a #GTimeVal. 925 */ 926 public void setModificationTime(TimeVal mtime) 927 { 928 g_file_info_set_modification_time(gFileInfo, (mtime is null) ? null : mtime.getTimeValStruct()); 929 } 930 931 /** 932 * Sets the name attribute for the current #GFileInfo. 933 * See %G_FILE_ATTRIBUTE_STANDARD_NAME. 934 * 935 * Params: 936 * name = a string containing a name. 937 */ 938 public void setName(string name) 939 { 940 g_file_info_set_name(gFileInfo, Str.toStringz(name)); 941 } 942 943 /** 944 * Sets the %G_FILE_ATTRIBUTE_STANDARD_SIZE attribute in the file info 945 * to the given size. 946 * 947 * Params: 948 * size = a #goffset containing the file's size. 949 */ 950 public void setSize(long size) 951 { 952 g_file_info_set_size(gFileInfo, size); 953 } 954 955 /** 956 * Sets the sort order attribute in the file info structure. See 957 * %G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER. 958 * 959 * Params: 960 * sortOrder = a sort order integer. 961 */ 962 public void setSortOrder(int sortOrder) 963 { 964 g_file_info_set_sort_order(gFileInfo, sortOrder); 965 } 966 967 /** 968 * Sets the symbolic icon for a given #GFileInfo. 969 * See %G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON. 970 * 971 * Params: 972 * icon = a #GIcon. 973 * 974 * Since: 2.34 975 */ 976 public void setSymbolicIcon(IconIF icon) 977 { 978 g_file_info_set_symbolic_icon(gFileInfo, (icon is null) ? null : icon.getIconStruct()); 979 } 980 981 /** 982 * Sets the %G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET attribute in the file info 983 * to the given symlink target. 984 * 985 * Params: 986 * symlinkTarget = a static string containing a path to a symlink target. 987 */ 988 public void setSymlinkTarget(string symlinkTarget) 989 { 990 g_file_info_set_symlink_target(gFileInfo, Str.toStringz(symlinkTarget)); 991 } 992 993 /** 994 * Unsets a mask set by g_file_info_set_attribute_mask(), if one 995 * is set. 996 */ 997 public void unsetAttributeMask() 998 { 999 g_file_info_unset_attribute_mask(gFileInfo); 1000 } 1001 }