1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use gio_sys; use glib; use glib::object::IsA; use glib::translate::*; use glib::GString; use std; use std::fmt; use FileAttributeMatcher; use FileAttributeStatus; use FileAttributeType; use FileType; use Icon; glib_wrapper! { /// Functionality for manipulating basic metadata for files. `FileInfo` /// implements methods for getting information that all files should /// contain, and allows for manipulation of extended attributes. /// /// See [GFileAttribute][gio-GFileAttribute] for more information on how /// GIO handles file attributes. /// /// To obtain a `FileInfo` for a `File`, use `File::query_info` (or its /// async variant). To obtain a `FileInfo` for a file input or output /// stream, use `FileInputStreamExt::query_info` or /// `FileOutputStreamExt::query_info` (or their async variants). /// /// To change the actual attributes of a file, you should then set the /// attribute in the `FileInfo` and call `File::set_attributes_from_info` /// or `File::set_attributes_async` on a GFile. /// /// However, not all attributes can be changed in the file. For instance, /// the actual size of a file cannot be changed via `FileInfo::set_size`. /// You may call `File::query_settable_attributes` and /// `File::query_writable_namespaces` to discover the settable attributes /// of a particular file at runtime. /// /// `FileAttributeMatcher` allows for searching through a `FileInfo` for /// attributes. /// /// # Implements /// /// [`glib::object::ObjectExt`](../glib/object/trait.ObjectExt.html) pub struct FileInfo(Object<gio_sys::GFileInfo, gio_sys::GFileInfoClass, FileInfoClass>); match fn { get_type => || gio_sys::g_file_info_get_type(), } } impl FileInfo { /// Creates a new file info structure. /// /// # Returns /// /// a `FileInfo`. pub fn new() -> FileInfo { unsafe { from_glib_full(gio_sys::g_file_info_new()) } } /// Clears the status information from `self`. pub fn clear_status(&self) { unsafe { gio_sys::g_file_info_clear_status(self.to_glib_none().0); } } /// First clears all of the [GFileAttribute][gio-GFileAttribute] of `dest_info`, /// and then copies all of the file attributes from `self` to `dest_info`. /// ## `dest_info` /// destination to copy attributes to. pub fn copy_into(&self, dest_info: &FileInfo) { unsafe { gio_sys::g_file_info_copy_into(self.to_glib_none().0, dest_info.to_glib_none().0); } } /// Duplicates a file info structure. /// /// # Returns /// /// a duplicate `FileInfo` of `self`. pub fn dup(&self) -> Option<FileInfo> { unsafe { from_glib_full(gio_sys::g_file_info_dup(self.to_glib_none().0)) } } /// Gets the value of a attribute, formated as a string. /// This escapes things as needed to make the string valid /// UTF-8. /// ## `attribute` /// a file attribute key. /// /// # Returns /// /// a UTF-8 string associated with the given `attribute`, or /// `None` if the attribute wasn’t set. /// When you're done with the string it must be freed with `g_free`. pub fn get_attribute_as_string(&self, attribute: &str) -> Option<GString> { unsafe { from_glib_full(gio_sys::g_file_info_get_attribute_as_string( self.to_glib_none().0, attribute.to_glib_none().0, )) } } /// Gets the value of a boolean attribute. If the attribute does not /// contain a boolean value, `false` will be returned. /// ## `attribute` /// a file attribute key. /// /// # Returns /// /// the boolean value contained within the attribute. pub fn get_attribute_boolean(&self, attribute: &str) -> bool { unsafe { from_glib(gio_sys::g_file_info_get_attribute_boolean( self.to_glib_none().0, attribute.to_glib_none().0, )) } } /// Gets the value of a byte string attribute. If the attribute does /// not contain a byte string, `None` will be returned. /// ## `attribute` /// a file attribute key. /// /// # Returns /// /// the contents of the `attribute` value as a byte string, or /// `None` otherwise. pub fn get_attribute_byte_string(&self, attribute: &str) -> Option<GString> { unsafe { from_glib_none(gio_sys::g_file_info_get_attribute_byte_string( self.to_glib_none().0, attribute.to_glib_none().0, )) } } //pub fn get_attribute_data(&self, attribute: &str, value_pp: /*Unimplemented*/&mut Fundamental: Pointer) -> Option<(FileAttributeType, FileAttributeStatus)> { // unsafe { TODO: call gio_sys:g_file_info_get_attribute_data() } //} /// Gets a signed 32-bit integer contained within the attribute. If the /// attribute does not contain a signed 32-bit integer, or is invalid, /// 0 will be returned. /// ## `attribute` /// a file attribute key. /// /// # Returns /// /// a signed 32-bit integer from the attribute. pub fn get_attribute_int32(&self, attribute: &str) -> i32 { unsafe { gio_sys::g_file_info_get_attribute_int32( self.to_glib_none().0, attribute.to_glib_none().0, ) } } /// Gets a signed 64-bit integer contained within the attribute. If the /// attribute does not contain an signed 64-bit integer, or is invalid, /// 0 will be returned. /// ## `attribute` /// a file attribute key. /// /// # Returns /// /// a signed 64-bit integer from the attribute. pub fn get_attribute_int64(&self, attribute: &str) -> i64 { unsafe { gio_sys::g_file_info_get_attribute_int64( self.to_glib_none().0, attribute.to_glib_none().0, ) } } /// Gets the value of a `gobject::Object` attribute. If the attribute does /// not contain a `gobject::Object`, `None` will be returned. /// ## `attribute` /// a file attribute key. /// /// # Returns /// /// a `gobject::Object` associated with the given `attribute`, or /// `None` otherwise. pub fn get_attribute_object(&self, attribute: &str) -> Option<glib::Object> { unsafe { from_glib_none(gio_sys::g_file_info_get_attribute_object( self.to_glib_none().0, attribute.to_glib_none().0, )) } } /// Gets the attribute status for an attribute key. /// ## `attribute` /// a file attribute key /// /// # Returns /// /// a `FileAttributeStatus` for the given `attribute`, or /// `FileAttributeStatus::Unset` if the key is invalid. pub fn get_attribute_status(&self, attribute: &str) -> FileAttributeStatus { unsafe { from_glib(gio_sys::g_file_info_get_attribute_status( self.to_glib_none().0, attribute.to_glib_none().0, )) } } /// Gets the value of a string attribute. If the attribute does /// not contain a string, `None` will be returned. /// ## `attribute` /// a file attribute key. /// /// # Returns /// /// the contents of the `attribute` value as a UTF-8 string, or /// `None` otherwise. pub fn get_attribute_string(&self, attribute: &str) -> Option<GString> { unsafe { from_glib_none(gio_sys::g_file_info_get_attribute_string( self.to_glib_none().0, attribute.to_glib_none().0, )) } } /// Gets the value of a stringv attribute. If the attribute does /// not contain a stringv, `None` will be returned. /// ## `attribute` /// a file attribute key. /// /// # Returns /// /// the contents of the `attribute` value as a stringv, or /// `None` otherwise. Do not free. These returned strings are UTF-8. pub fn get_attribute_stringv(&self, attribute: &str) -> Vec<GString> { unsafe { FromGlibPtrContainer::from_glib_none(gio_sys::g_file_info_get_attribute_stringv( self.to_glib_none().0, attribute.to_glib_none().0, )) } } /// Gets the attribute type for an attribute key. /// ## `attribute` /// a file attribute key. /// /// # Returns /// /// a `FileAttributeType` for the given `attribute`, or /// `FileAttributeType::Invalid` if the key is not set. pub fn get_attribute_type(&self, attribute: &str) -> FileAttributeType { unsafe { from_glib(gio_sys::g_file_info_get_attribute_type( self.to_glib_none().0, attribute.to_glib_none().0, )) } } /// Gets an unsigned 32-bit integer contained within the attribute. If the /// attribute does not contain an unsigned 32-bit integer, or is invalid, /// 0 will be returned. /// ## `attribute` /// a file attribute key. /// /// # Returns /// /// an unsigned 32-bit integer from the attribute. pub fn get_attribute_uint32(&self, attribute: &str) -> u32 { unsafe { gio_sys::g_file_info_get_attribute_uint32( self.to_glib_none().0, attribute.to_glib_none().0, ) } } /// Gets a unsigned 64-bit integer contained within the attribute. If the /// attribute does not contain an unsigned 64-bit integer, or is invalid, /// 0 will be returned. /// ## `attribute` /// a file attribute key. /// /// # Returns /// /// a unsigned 64-bit integer from the attribute. pub fn get_attribute_uint64(&self, attribute: &str) -> u64 { unsafe { gio_sys::g_file_info_get_attribute_uint64( self.to_glib_none().0, attribute.to_glib_none().0, ) } } /// Gets the file's content type. /// /// # Returns /// /// a string containing the file's content type. pub fn get_content_type(&self) -> Option<GString> { unsafe { from_glib_none(gio_sys::g_file_info_get_content_type(self.to_glib_none().0)) } } /// Returns the `glib::DateTime` representing the deletion date of the file, as /// available in G_FILE_ATTRIBUTE_TRASH_DELETION_DATE. If the /// G_FILE_ATTRIBUTE_TRASH_DELETION_DATE attribute is unset, `None` is returned. /// /// # Returns /// /// a `glib::DateTime`, or `None`. pub fn get_deletion_date(&self) -> Option<glib::DateTime> { unsafe { from_glib_full(gio_sys::g_file_info_get_deletion_date( self.to_glib_none().0, )) } } /// Gets a display name for a file. /// /// # Returns /// /// a string containing the display name. pub fn get_display_name(&self) -> Option<GString> { unsafe { from_glib_none(gio_sys::g_file_info_get_display_name(self.to_glib_none().0)) } } /// Gets the edit name for a file. /// /// # Returns /// /// a string containing the edit name. pub fn get_edit_name(&self) -> Option<GString> { unsafe { from_glib_none(gio_sys::g_file_info_get_edit_name(self.to_glib_none().0)) } } /// Gets the [entity tag][gfile-etag] for a given /// `FileInfo`. See `G_FILE_ATTRIBUTE_ETAG_VALUE`. /// /// # Returns /// /// a string containing the value of the "etag:value" attribute. pub fn get_etag(&self) -> Option<GString> { unsafe { from_glib_none(gio_sys::g_file_info_get_etag(self.to_glib_none().0)) } } /// Gets a file's type (whether it is a regular file, symlink, etc). /// This is different from the file's content type, see `FileInfo::get_content_type`. /// /// # Returns /// /// a `FileType` for the given file. pub fn get_file_type(&self) -> FileType { unsafe { from_glib(gio_sys::g_file_info_get_file_type(self.to_glib_none().0)) } } /// Gets the icon for a file. /// /// # Returns /// /// `Icon` for the given `self`. pub fn get_icon(&self) -> Option<Icon> { unsafe { from_glib_none(gio_sys::g_file_info_get_icon(self.to_glib_none().0)) } } /// Checks if a file is a backup file. /// /// # Returns /// /// `true` if file is a backup file, `false` otherwise. pub fn get_is_backup(&self) -> bool { unsafe { from_glib(gio_sys::g_file_info_get_is_backup(self.to_glib_none().0)) } } /// Checks if a file is hidden. /// /// # Returns /// /// `true` if the file is a hidden file, `false` otherwise. pub fn get_is_hidden(&self) -> bool { unsafe { from_glib(gio_sys::g_file_info_get_is_hidden(self.to_glib_none().0)) } } /// Checks if a file is a symlink. /// /// # Returns /// /// `true` if the given `self` is a symlink. pub fn get_is_symlink(&self) -> bool { unsafe { from_glib(gio_sys::g_file_info_get_is_symlink(self.to_glib_none().0)) } } /// Gets the modification time of the current `self` and returns it as a /// `glib::DateTime`. /// /// Feature: `v2_62` /// /// /// # Returns /// /// modification time, or `None` if unknown #[cfg(any(feature = "v2_62", feature = "dox"))] pub fn get_modification_date_time(&self) -> Option<glib::DateTime> { unsafe { from_glib_full(gio_sys::g_file_info_get_modification_date_time( self.to_glib_none().0, )) } } /// Gets the modification time of the current `self` and sets it /// in `result`. /// /// # Deprecated since 2.62 /// /// Use `FileInfo::get_modification_date_time` instead, as /// `glib::TimeVal` is deprecated due to the year 2038 problem. /// ## `result` /// a `glib::TimeVal`. #[cfg_attr(feature = "v2_62", deprecated)] pub fn get_modification_time(&self) -> glib::TimeVal { unsafe { let mut result = glib::TimeVal::uninitialized(); gio_sys::g_file_info_get_modification_time( self.to_glib_none().0, result.to_glib_none_mut().0, ); result } } /// Gets the name for a file. /// /// # Returns /// /// a string containing the file name. pub fn get_name(&self) -> Option<std::path::PathBuf> { unsafe { from_glib_none(gio_sys::g_file_info_get_name(self.to_glib_none().0)) } } /// Gets the file's size. /// /// # Returns /// /// a `goffset` containing the file's size. pub fn get_size(&self) -> i64 { unsafe { gio_sys::g_file_info_get_size(self.to_glib_none().0) } } /// Gets the value of the sort_order attribute from the `FileInfo`. /// See `G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER`. /// /// # Returns /// /// a `gint32` containing the value of the "standard::sort_order" attribute. pub fn get_sort_order(&self) -> i32 { unsafe { gio_sys::g_file_info_get_sort_order(self.to_glib_none().0) } } /// Gets the symbolic icon for a file. /// /// # Returns /// /// `Icon` for the given `self`. pub fn get_symbolic_icon(&self) -> Option<Icon> { unsafe { from_glib_none(gio_sys::g_file_info_get_symbolic_icon( self.to_glib_none().0, )) } } /// Gets the symlink target for a given `FileInfo`. /// /// # Returns /// /// a string containing the symlink target. pub fn get_symlink_target(&self) -> Option<GString> { unsafe { from_glib_none(gio_sys::g_file_info_get_symlink_target( self.to_glib_none().0, )) } } /// Checks if a file info structure has an attribute named `attribute`. /// ## `attribute` /// a file attribute key. /// /// # Returns /// /// `true` if `Ginfo` has an attribute named `attribute`, /// `false` otherwise. pub fn has_attribute(&self, attribute: &str) -> bool { unsafe { from_glib(gio_sys::g_file_info_has_attribute( self.to_glib_none().0, attribute.to_glib_none().0, )) } } /// Checks if a file info structure has an attribute in the /// specified `name_space`. /// ## `name_space` /// a file attribute namespace. /// /// # Returns /// /// `true` if `Ginfo` has an attribute in `name_space`, /// `false` otherwise. pub fn has_namespace(&self, name_space: &str) -> bool { unsafe { from_glib(gio_sys::g_file_info_has_namespace( self.to_glib_none().0, name_space.to_glib_none().0, )) } } /// Lists the file info structure's attributes. /// ## `name_space` /// a file attribute key's namespace, or `None` to list /// all attributes. /// /// # Returns /// /// a /// null-terminated array of strings of all of the possible attribute /// types for the given `name_space`, or `None` on error. pub fn list_attributes(&self, name_space: Option<&str>) -> Vec<GString> { unsafe { FromGlibPtrContainer::from_glib_full(gio_sys::g_file_info_list_attributes( self.to_glib_none().0, name_space.to_glib_none().0, )) } } /// Removes all cases of `attribute` from `self` if it exists. /// ## `attribute` /// a file attribute key. pub fn remove_attribute(&self, attribute: &str) { unsafe { gio_sys::g_file_info_remove_attribute( self.to_glib_none().0, attribute.to_glib_none().0, ); } } //pub fn set_attribute(&self, attribute: &str, type_: FileAttributeType, value_p: /*Unimplemented*/Fundamental: Pointer) { // unsafe { TODO: call gio_sys:g_file_info_set_attribute() } //} /// Sets the `attribute` to contain the given `attr_value`, /// if possible. /// ## `attribute` /// a file attribute key. /// ## `attr_value` /// a boolean value. pub fn set_attribute_boolean(&self, attribute: &str, attr_value: bool) { unsafe { gio_sys::g_file_info_set_attribute_boolean( self.to_glib_none().0, attribute.to_glib_none().0, attr_value.to_glib(), ); } } /// Sets the `attribute` to contain the given `attr_value`, /// if possible. /// ## `attribute` /// a file attribute key. /// ## `attr_value` /// a byte string. pub fn set_attribute_byte_string(&self, attribute: &str, attr_value: &str) { unsafe { gio_sys::g_file_info_set_attribute_byte_string( self.to_glib_none().0, attribute.to_glib_none().0, attr_value.to_glib_none().0, ); } } /// Sets the `attribute` to contain the given `attr_value`, /// if possible. /// ## `attribute` /// a file attribute key. /// ## `attr_value` /// a signed 32-bit integer pub fn set_attribute_int32(&self, attribute: &str, attr_value: i32) { unsafe { gio_sys::g_file_info_set_attribute_int32( self.to_glib_none().0, attribute.to_glib_none().0, attr_value, ); } } /// Sets the `attribute` to contain the given `attr_value`, /// if possible. /// ## `attribute` /// attribute name to set. /// ## `attr_value` /// int64 value to set attribute to. pub fn set_attribute_int64(&self, attribute: &str, attr_value: i64) { unsafe { gio_sys::g_file_info_set_attribute_int64( self.to_glib_none().0, attribute.to_glib_none().0, attr_value, ); } } /// Sets `mask` on `self` to match specific attribute types. /// ## `mask` /// a `FileAttributeMatcher`. pub fn set_attribute_mask(&self, mask: &FileAttributeMatcher) { unsafe { gio_sys::g_file_info_set_attribute_mask(self.to_glib_none().0, mask.to_glib_none().0); } } /// Sets the `attribute` to contain the given `attr_value`, /// if possible. /// ## `attribute` /// a file attribute key. /// ## `attr_value` /// a `gobject::Object`. pub fn set_attribute_object<P: IsA<glib::Object>>(&self, attribute: &str, attr_value: &P) { unsafe { gio_sys::g_file_info_set_attribute_object( self.to_glib_none().0, attribute.to_glib_none().0, attr_value.as_ref().to_glib_none().0, ); } } /// Sets the attribute status for an attribute key. This is only /// needed by external code that implement `File::set_attributes_from_info` /// or similar functions. /// /// The attribute must exist in `self` for this to work. Otherwise `false` /// is returned and `self` is unchanged. /// ## `attribute` /// a file attribute key /// ## `status` /// a `FileAttributeStatus` /// /// # Returns /// /// `true` if the status was changed, `false` if the key was not set. pub fn set_attribute_status(&self, attribute: &str, status: FileAttributeStatus) -> bool { unsafe { from_glib(gio_sys::g_file_info_set_attribute_status( self.to_glib_none().0, attribute.to_glib_none().0, status.to_glib(), )) } } /// Sets the `attribute` to contain the given `attr_value`, /// if possible. /// ## `attribute` /// a file attribute key. /// ## `attr_value` /// a UTF-8 string. pub fn set_attribute_string(&self, attribute: &str, attr_value: &str) { unsafe { gio_sys::g_file_info_set_attribute_string( self.to_glib_none().0, attribute.to_glib_none().0, attr_value.to_glib_none().0, ); } } /// Sets the `attribute` to contain the given `attr_value`, /// if possible. /// /// Sinze: 2.22 /// ## `attribute` /// a file attribute key /// ## `attr_value` /// a `None` /// terminated array of UTF-8 strings. pub fn set_attribute_stringv(&self, attribute: &str, attr_value: &[&str]) { unsafe { gio_sys::g_file_info_set_attribute_stringv( self.to_glib_none().0, attribute.to_glib_none().0, attr_value.to_glib_none().0, ); } } /// Sets the `attribute` to contain the given `attr_value`, /// if possible. /// ## `attribute` /// a file attribute key. /// ## `attr_value` /// an unsigned 32-bit integer. pub fn set_attribute_uint32(&self, attribute: &str, attr_value: u32) { unsafe { gio_sys::g_file_info_set_attribute_uint32( self.to_glib_none().0, attribute.to_glib_none().0, attr_value, ); } } /// Sets the `attribute` to contain the given `attr_value`, /// if possible. /// ## `attribute` /// a file attribute key. /// ## `attr_value` /// an unsigned 64-bit integer. pub fn set_attribute_uint64(&self, attribute: &str, attr_value: u64) { unsafe { gio_sys::g_file_info_set_attribute_uint64( self.to_glib_none().0, attribute.to_glib_none().0, attr_value, ); } } /// Sets the content type attribute for a given `FileInfo`. /// See `G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE`. /// ## `content_type` /// a content type. See [GContentType][gio-GContentType] pub fn set_content_type(&self, content_type: &str) { unsafe { gio_sys::g_file_info_set_content_type( self.to_glib_none().0, content_type.to_glib_none().0, ); } } /// Sets the display name for the current `FileInfo`. /// See `G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME`. /// ## `display_name` /// a string containing a display name. pub fn set_display_name(&self, display_name: &str) { unsafe { gio_sys::g_file_info_set_display_name( self.to_glib_none().0, display_name.to_glib_none().0, ); } } /// Sets the edit name for the current file. /// See `G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME`. /// ## `edit_name` /// a string containing an edit name. pub fn set_edit_name(&self, edit_name: &str) { unsafe { gio_sys::g_file_info_set_edit_name(self.to_glib_none().0, edit_name.to_glib_none().0); } } /// Sets the file type in a `FileInfo` to `type_`. /// See `G_FILE_ATTRIBUTE_STANDARD_TYPE`. /// ## `type_` /// a `FileType`. pub fn set_file_type(&self, type_: FileType) { unsafe { gio_sys::g_file_info_set_file_type(self.to_glib_none().0, type_.to_glib()); } } /// Sets the icon for a given `FileInfo`. /// See `G_FILE_ATTRIBUTE_STANDARD_ICON`. /// ## `icon` /// a `Icon`. pub fn set_icon<P: IsA<Icon>>(&self, icon: &P) { unsafe { gio_sys::g_file_info_set_icon(self.to_glib_none().0, icon.as_ref().to_glib_none().0); } } /// Sets the "is_hidden" attribute in a `FileInfo` according to `is_hidden`. /// See `G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN`. /// ## `is_hidden` /// a `gboolean`. pub fn set_is_hidden(&self, is_hidden: bool) { unsafe { gio_sys::g_file_info_set_is_hidden(self.to_glib_none().0, is_hidden.to_glib()); } } /// Sets the "is_symlink" attribute in a `FileInfo` according to `is_symlink`. /// See `G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK`. /// ## `is_symlink` /// a `gboolean`. pub fn set_is_symlink(&self, is_symlink: bool) { unsafe { gio_sys::g_file_info_set_is_symlink(self.to_glib_none().0, is_symlink.to_glib()); } } /// Sets the `G_FILE_ATTRIBUTE_TIME_MODIFIED` attribute in the file /// info to the given date/time value. /// /// Feature: `v2_62` /// /// ## `mtime` /// a `glib::DateTime`. #[cfg(any(feature = "v2_62", feature = "dox"))] pub fn set_modification_date_time(&self, mtime: &glib::DateTime) { unsafe { gio_sys::g_file_info_set_modification_date_time( self.to_glib_none().0, mtime.to_glib_none().0, ); } } /// Sets the `G_FILE_ATTRIBUTE_TIME_MODIFIED` attribute in the file /// info to the given time value. /// /// # Deprecated since 2.62 /// /// Use `FileInfo::set_modification_date_time` instead, as /// `glib::TimeVal` is deprecated due to the year 2038 problem. /// ## `mtime` /// a `glib::TimeVal`. #[cfg_attr(feature = "v2_62", deprecated)] pub fn set_modification_time(&self, mtime: &mut glib::TimeVal) { unsafe { gio_sys::g_file_info_set_modification_time( self.to_glib_none().0, mtime.to_glib_none_mut().0, ); } } /// Sets the name attribute for the current `FileInfo`. /// See `G_FILE_ATTRIBUTE_STANDARD_NAME`. /// ## `name` /// a string containing a name. pub fn set_name<P: AsRef<std::path::Path>>(&self, name: P) { unsafe { gio_sys::g_file_info_set_name(self.to_glib_none().0, name.as_ref().to_glib_none().0); } } /// Sets the `G_FILE_ATTRIBUTE_STANDARD_SIZE` attribute in the file info /// to the given size. /// ## `size` /// a `goffset` containing the file's size. pub fn set_size(&self, size: i64) { unsafe { gio_sys::g_file_info_set_size(self.to_glib_none().0, size); } } /// Sets the sort order attribute in the file info structure. See /// `G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER`. /// ## `sort_order` /// a sort order integer. pub fn set_sort_order(&self, sort_order: i32) { unsafe { gio_sys::g_file_info_set_sort_order(self.to_glib_none().0, sort_order); } } /// Sets the symbolic icon for a given `FileInfo`. /// See `G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON`. /// ## `icon` /// a `Icon`. pub fn set_symbolic_icon<P: IsA<Icon>>(&self, icon: &P) { unsafe { gio_sys::g_file_info_set_symbolic_icon( self.to_glib_none().0, icon.as_ref().to_glib_none().0, ); } } /// Sets the `G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET` attribute in the file info /// to the given symlink target. /// ## `symlink_target` /// a static string containing a path to a symlink target. pub fn set_symlink_target(&self, symlink_target: &str) { unsafe { gio_sys::g_file_info_set_symlink_target( self.to_glib_none().0, symlink_target.to_glib_none().0, ); } } /// Unsets a mask set by `FileInfo::set_attribute_mask`, if one /// is set. pub fn unset_attribute_mask(&self) { unsafe { gio_sys::g_file_info_unset_attribute_mask(self.to_glib_none().0); } } } impl Default for FileInfo { fn default() -> Self { Self::new() } } impl fmt::Display for FileInfo { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "FileInfo") } }