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