1 /* 2 * This file is part of libsecret-d. 3 * 4 * This Source Code Form is subject to the terms of the Mozilla Public 5 * License, v. 2.0. If a copy of the MPL was not distributed with this 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/ 7 */ 8 9 // generated automatically - do not change 10 // find conversion definition on APILookup.txt 11 12 13 module libsecret.Item; 14 15 private import gio.AsyncInitableIF; 16 private import gio.AsyncInitableT; 17 private import gio.AsyncResultIF; 18 private import gio.Cancellable; 19 private import gio.DBusInterfaceIF; 20 private import gio.DBusInterfaceT; 21 private import gio.DBusProxy; 22 private import gio.InitableIF; 23 private import gio.InitableT; 24 private import glib.ConstructionException; 25 private import glib.ErrorG; 26 private import glib.GException; 27 private import glib.HashTable; 28 private import glib.ListG; 29 private import glib.Str; 30 private import gobject.ObjectG; 31 private import libsecret.Collection; 32 private import libsecret.Schema; 33 private import libsecret.Service; 34 private import libsecret.Value; 35 private import libsecret.c.functions; 36 public import libsecret.c.types; 37 38 39 /** 40 * A proxy object representing a secret item in the Secret Service. 41 */ 42 public class Item : DBusProxy 43 { 44 /** the main Gtk struct */ 45 protected SecretItem* secretItem; 46 47 /** Get the main Gtk struct */ 48 public SecretItem* getItemStruct(bool transferOwnership = false) 49 { 50 if (transferOwnership) 51 ownedRef = false; 52 return secretItem; 53 } 54 55 /** the main Gtk struct as a void* */ 56 protected override void* getStruct() 57 { 58 return cast(void*)secretItem; 59 } 60 61 /** 62 * Sets our main struct and passes it to the parent class. 63 */ 64 public this (SecretItem* secretItem, bool ownedRef = false) 65 { 66 this.secretItem = secretItem; 67 super(cast(GDBusProxy*)secretItem, ownedRef); 68 } 69 70 alias getFlags = DBusProxy.getFlags; 71 72 /** 73 */ 74 75 /** */ 76 public static GType getType() 77 { 78 return secret_item_get_type(); 79 } 80 81 /** 82 * Finish asynchronous operation to get a new item proxy for a secret 83 * item in the secret service. 84 * 85 * Params: 86 * result = the asynchronous result passed to the callback 87 * 88 * Returns: the new item, which should be unreferenced 89 * with g_object_unref() 90 * 91 * Throws: GException on failure. 92 * Throws: ConstructionException GTK+ fails to create the object. 93 */ 94 public this(AsyncResultIF result) 95 { 96 GError* err = null; 97 98 auto p = secret_item_new_for_dbus_path_finish((result is null) ? null : result.getAsyncResultStruct(), &err); 99 100 if (err !is null) 101 { 102 throw new GException( new ErrorG(err) ); 103 } 104 105 if(p is null) 106 { 107 throw new ConstructionException("null returned by new_for_dbus_path_finish"); 108 } 109 110 this(cast(SecretItem*) p, true); 111 } 112 113 /** 114 * Get a new item proxy for a secret item in the secret service. 115 * 116 * If @service is NULL, then secret_service_get_sync() will be called to get 117 * the default #SecretService proxy. 118 * 119 * This method may block indefinitely and should not be used in user interface 120 * threads. 121 * 122 * Params: 123 * service = a secret service object 124 * itemPath = the D-Bus path of the item 125 * flags = initialization flags for the new item 126 * cancellable = optional cancellation object 127 * 128 * Returns: the new item, which should be unreferenced 129 * with g_object_unref() 130 * 131 * Throws: GException on failure. 132 * Throws: ConstructionException GTK+ fails to create the object. 133 */ 134 public this(Service service, string itemPath, SecretItemFlags flags, Cancellable cancellable) 135 { 136 GError* err = null; 137 138 auto p = secret_item_new_for_dbus_path_sync((service is null) ? null : service.getServiceStruct(), Str.toStringz(itemPath), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 139 140 if (err !is null) 141 { 142 throw new GException( new ErrorG(err) ); 143 } 144 145 if(p is null) 146 { 147 throw new ConstructionException("null returned by new_for_dbus_path_sync"); 148 } 149 150 this(cast(SecretItem*) p, true); 151 } 152 153 /** 154 * Create a new item in the secret service. 155 * 156 * If the @flags contains %SECRET_ITEM_CREATE_REPLACE, then the secret 157 * service will search for an item matching the @attributes, and update that item 158 * instead of creating a new one. 159 * 160 * This method may block indefinitely and should not be used in user interface 161 * threads. The secret service may prompt the user. secret_service_prompt() 162 * will be used to handle any prompts that are required. 163 * 164 * Params: 165 * collection = a secret collection to create this item in 166 * schema = the schema for the attributes 167 * attributes = attributes for the new item 168 * label = label for the new item 169 * value = secret value for the new item 170 * flags = flags for the creation of the new item 171 * cancellable = optional cancellation object 172 * callback = called when the operation completes 173 * userData = data to pass to the callback 174 */ 175 public static void create(Collection collection, Schema schema, HashTable attributes, string label, Value value, SecretItemCreateFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 176 { 177 secret_item_create((collection is null) ? null : collection.getCollectionStruct(), (schema is null) ? null : schema.getSchemaStruct(), (attributes is null) ? null : attributes.getHashTableStruct(), Str.toStringz(label), (value is null) ? null : value.getValueStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 178 } 179 180 /** 181 * Finish operation to create a new item in the secret service. 182 * 183 * Params: 184 * result = the asynchronous result passed to the callback 185 * 186 * Returns: the new item, which should be unreferenced 187 * with g_object_unref() 188 * 189 * Throws: GException on failure. 190 */ 191 public static Item createFinish(AsyncResultIF result) 192 { 193 GError* err = null; 194 195 auto p = secret_item_create_finish((result is null) ? null : result.getAsyncResultStruct(), &err); 196 197 if (err !is null) 198 { 199 throw new GException( new ErrorG(err) ); 200 } 201 202 if(p is null) 203 { 204 return null; 205 } 206 207 return ObjectG.getDObject!(Item)(cast(SecretItem*) p, true); 208 } 209 210 /** 211 * Create a new item in the secret service. 212 * 213 * If the @flags contains %SECRET_ITEM_CREATE_REPLACE, then the secret 214 * service will search for an item matching the @attributes, and update that item 215 * instead of creating a new one. 216 * 217 * This method may block indefinitely and should not be used in user interface 218 * threads. The secret service may prompt the user. secret_service_prompt() 219 * will be used to handle any prompts that are required. 220 * 221 * Params: 222 * collection = a secret collection to create this item in 223 * schema = the schema for the attributes 224 * attributes = attributes for the new item 225 * label = label for the new item 226 * value = secret value for the new item 227 * flags = flags for the creation of the new item 228 * cancellable = optional cancellation object 229 * 230 * Returns: the new item, which should be unreferenced 231 * with g_object_unref() 232 * 233 * Throws: GException on failure. 234 */ 235 public static Item createSync(Collection collection, Schema schema, HashTable attributes, string label, Value value, SecretItemCreateFlags flags, Cancellable cancellable) 236 { 237 GError* err = null; 238 239 auto p = secret_item_create_sync((collection is null) ? null : collection.getCollectionStruct(), (schema is null) ? null : schema.getSchemaStruct(), (attributes is null) ? null : attributes.getHashTableStruct(), Str.toStringz(label), (value is null) ? null : value.getValueStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 240 241 if (err !is null) 242 { 243 throw new GException( new ErrorG(err) ); 244 } 245 246 if(p is null) 247 { 248 return null; 249 } 250 251 return ObjectG.getDObject!(Item)(cast(SecretItem*) p, true); 252 } 253 254 /** 255 * Load the secret values for a secret item stored in the service. 256 * 257 * The @items must all have the same SecretItem::service property. 258 * 259 * This function returns immediately and completes asynchronously. 260 * 261 * Params: 262 * items = the items to retrieve secrets for 263 * cancellable = optional cancellation object 264 * callback = called when the operation completes 265 * userData = data to pass to the callback 266 */ 267 public static void loadSecrets(ListG items, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 268 { 269 secret_item_load_secrets((items is null) ? null : items.getListGStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 270 } 271 272 /** 273 * Complete asynchronous operation to load the secret values for 274 * secret items stored in the service. 275 * 276 * Items that are locked will not have their secrets loaded. 277 * 278 * Params: 279 * result = asynchronous result passed to callback 280 * 281 * Returns: whether the operation succeeded or not 282 * 283 * Throws: GException on failure. 284 */ 285 public static bool loadSecretsFinish(AsyncResultIF result) 286 { 287 GError* err = null; 288 289 auto p = secret_item_load_secrets_finish((result is null) ? null : result.getAsyncResultStruct(), &err) != 0; 290 291 if (err !is null) 292 { 293 throw new GException( new ErrorG(err) ); 294 } 295 296 return p; 297 } 298 299 /** 300 * Load the secret values for a secret item stored in the service. 301 * 302 * The @items must all have the same SecretItem::service property. 303 * 304 * This method may block indefinitely and should not be used in user interface 305 * threads. 306 * 307 * Items that are locked will not have their secrets loaded. 308 * 309 * Params: 310 * items = the items to retrieve secrets for 311 * cancellable = optional cancellation object 312 * 313 * Returns: whether the operation succeeded or not 314 * 315 * Throws: GException on failure. 316 */ 317 public static bool loadSecretsSync(ListG items, Cancellable cancellable) 318 { 319 GError* err = null; 320 321 auto p = secret_item_load_secrets_sync((items is null) ? null : items.getListGStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0; 322 323 if (err !is null) 324 { 325 throw new GException( new ErrorG(err) ); 326 } 327 328 return p; 329 } 330 331 /** 332 * Get a new item proxy for a secret item in the secret service. 333 * 334 * If @service is NULL, then secret_service_get() will be called to get 335 * the default #SecretService proxy. 336 * 337 * This method will return immediately and complete asynchronously. 338 * 339 * Params: 340 * service = a secret service object 341 * itemPath = the D-Bus path of the collection 342 * flags = initialization flags for the new item 343 * cancellable = optional cancellation object 344 * callback = called when the operation completes 345 * userData = data to be passed to the callback 346 */ 347 public static void newForDbusPath(Service service, string itemPath, SecretItemFlags flags, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 348 { 349 secret_item_new_for_dbus_path((service is null) ? null : service.getServiceStruct(), Str.toStringz(itemPath), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 350 } 351 352 /** 353 * Delete this item. 354 * 355 * This method returns immediately and completes asynchronously. The secret 356 * service may prompt the user. secret_service_prompt() will be used to handle 357 * any prompts that show up. 358 * 359 * Params: 360 * cancellable = optional cancellation object 361 * callback = called when the operation completes 362 * userData = data to pass to the callback 363 */ 364 public void delet(Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 365 { 366 secret_item_delete(secretItem, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 367 } 368 369 /** 370 * Complete asynchronous operation to delete the secret item. 371 * 372 * Params: 373 * result = asynchronous result passed to the callback 374 * 375 * Returns: whether the item was successfully deleted or not 376 * 377 * Throws: GException on failure. 378 */ 379 public bool deleteFinish(AsyncResultIF result) 380 { 381 GError* err = null; 382 383 auto p = secret_item_delete_finish(secretItem, (result is null) ? null : result.getAsyncResultStruct(), &err) != 0; 384 385 if (err !is null) 386 { 387 throw new GException( new ErrorG(err) ); 388 } 389 390 return p; 391 } 392 393 /** 394 * Delete this secret item. 395 * 396 * This method may block indefinitely and should not be used in user 397 * interface threads. The secret service may prompt the user. 398 * secret_service_prompt() will be used to handle any prompts that show up. 399 * 400 * Params: 401 * cancellable = optional cancellation object 402 * 403 * Returns: whether the item was successfully deleted or not 404 * 405 * Throws: GException on failure. 406 */ 407 public bool deleteSync(Cancellable cancellable) 408 { 409 GError* err = null; 410 411 auto p = secret_item_delete_sync(secretItem, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0; 412 413 if (err !is null) 414 { 415 throw new GException( new ErrorG(err) ); 416 } 417 418 return p; 419 } 420 421 /** 422 * Set the attributes of this item. 423 * 424 * The @attributes are a mapping of string keys to string values. 425 * Attributes are used to search for items. Attributes are not stored 426 * or transferred securely by the secret service. 427 * 428 * Do not modify the attributes returned by this method. Use 429 * secret_item_set_attributes() instead. 430 * 431 * Returns: a new reference 432 * to the attributes, which should not be modified, and 433 * released with g_hash_table_unref() 434 */ 435 public HashTable getAttributes() 436 { 437 auto p = secret_item_get_attributes(secretItem); 438 439 if(p is null) 440 { 441 return null; 442 } 443 444 return new HashTable(cast(GHashTable*) p, true); 445 } 446 447 /** 448 * Get the created date and time of the item. The return value is 449 * the number of seconds since the unix epoch, January 1st 1970. 450 * 451 * Returns: the created date and time 452 */ 453 public ulong getCreated() 454 { 455 return secret_item_get_created(secretItem); 456 } 457 458 /** 459 * Get the flags representing what features of the #SecretItem proxy 460 * have been initialized. 461 * 462 * Use secret_item_load_secret() to initialize further features 463 * and change the flags. 464 * 465 * Returns: the flags for features initialized 466 */ 467 public SecretItemFlags getFlags() 468 { 469 return secret_item_get_flags(secretItem); 470 } 471 472 /** 473 * Get the label of this item. 474 * 475 * Returns: the label, which should be freed with g_free() 476 */ 477 public string getLabel() 478 { 479 auto retStr = secret_item_get_label(secretItem); 480 481 scope(exit) Str.freeString(retStr); 482 return Str.toString(retStr); 483 } 484 485 /** 486 * Get whether the item is locked or not. 487 * 488 * Depending on the secret service an item may not be able to be locked 489 * independently from the collection that it is in. 490 * 491 * Returns: whether the item is locked or not 492 */ 493 public bool getLocked() 494 { 495 return secret_item_get_locked(secretItem) != 0; 496 } 497 498 /** 499 * Get the modified date and time of the item. The return value is 500 * the number of seconds since the unix epoch, January 1st 1970. 501 * 502 * Returns: the modified date and time 503 */ 504 public ulong getModified() 505 { 506 return secret_item_get_modified(secretItem); 507 } 508 509 /** 510 * Gets the name of the schema that this item was stored with. This is also 511 * available at the <literal>xdg:schema</literal> attribute. 512 * 513 * Returns: the schema name 514 */ 515 public string getSchemaName() 516 { 517 auto retStr = secret_item_get_schema_name(secretItem); 518 519 scope(exit) Str.freeString(retStr); 520 return Str.toString(retStr); 521 } 522 523 /** 524 * Get the secret value of this item. If this item is locked or the secret 525 * has not yet been loaded then this will return %NULL. 526 * 527 * To load the secret call the secret_item_load_secret() method. 528 * 529 * Returns: the secret value which should be 530 * released with secret_value_unref(), or %NULL 531 */ 532 public Value getSecret() 533 { 534 auto p = secret_item_get_secret(secretItem); 535 536 if(p is null) 537 { 538 return null; 539 } 540 541 return ObjectG.getDObject!(Value)(cast(SecretValue*) p, true); 542 } 543 544 /** 545 * Get the Secret Service object that this item was created with. 546 * 547 * Returns: the Secret Service object 548 */ 549 public Service getService() 550 { 551 auto p = secret_item_get_service(secretItem); 552 553 if(p is null) 554 { 555 return null; 556 } 557 558 return ObjectG.getDObject!(Service)(cast(SecretService*) p); 559 } 560 561 /** 562 * Load the secret value of this item. 563 * 564 * Each item has a single secret which might be a password or some 565 * other secret binary value. 566 * 567 * This function will fail if the secret item is locked. 568 * 569 * This function returns immediately and completes asynchronously. 570 * 571 * Params: 572 * cancellable = optional cancellation object 573 * callback = called when the operation completes 574 * userData = data to pass to the callback 575 */ 576 public void loadSecret(Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 577 { 578 secret_item_load_secret(secretItem, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 579 } 580 581 /** 582 * Complete asynchronous operation to load the secret value of this item. 583 * 584 * The newly loaded secret value can be accessed by calling 585 * secret_item_get_secret(). 586 * 587 * Params: 588 * result = asynchronous result passed to callback 589 * 590 * Returns: whether the secret item successfully loaded or not 591 * 592 * Throws: GException on failure. 593 */ 594 public bool loadSecretFinish(AsyncResultIF result) 595 { 596 GError* err = null; 597 598 auto p = secret_item_load_secret_finish(secretItem, (result is null) ? null : result.getAsyncResultStruct(), &err) != 0; 599 600 if (err !is null) 601 { 602 throw new GException( new ErrorG(err) ); 603 } 604 605 return p; 606 } 607 608 /** 609 * Load the secret value of this item. 610 * 611 * Each item has a single secret which might be a password or some 612 * other secret binary value. 613 * 614 * This function may block indefinitely. Use the asynchronous version 615 * in user interface threads. 616 * 617 * Params: 618 * cancellable = optional cancellation object 619 * 620 * Returns: whether the secret item successfully loaded or not 621 * 622 * Throws: GException on failure. 623 */ 624 public bool loadSecretSync(Cancellable cancellable) 625 { 626 GError* err = null; 627 628 auto p = secret_item_load_secret_sync(secretItem, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0; 629 630 if (err !is null) 631 { 632 throw new GException( new ErrorG(err) ); 633 } 634 635 return p; 636 } 637 638 /** 639 * Refresh the properties on this item. This fires off a request to 640 * refresh, and the properties will be updated later. 641 * 642 * Calling this method is not normally necessary, as the secret service 643 * will notify the client when properties change. 644 */ 645 public void refresh() 646 { 647 secret_item_refresh(secretItem); 648 } 649 650 /** 651 * Set the attributes of this item. 652 * 653 * The @attributes are a mapping of string keys to string values. 654 * Attributes are used to search for items. Attributes are not stored 655 * or transferred securely by the secret service. 656 * 657 * This function returns immediately and completes asynchronously. 658 * 659 * Params: 660 * schema = the schema for the attributes 661 * attributes = a new set of attributes 662 * cancellable = optional cancellation object 663 * callback = called when the asynchronous operation completes 664 * userData = data to pass to the callback 665 */ 666 public void setAttributes(Schema schema, HashTable attributes, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 667 { 668 secret_item_set_attributes(secretItem, (schema is null) ? null : schema.getSchemaStruct(), (attributes is null) ? null : attributes.getHashTableStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 669 } 670 671 /** 672 * Complete operation to set the attributes of this item. 673 * 674 * Params: 675 * result = asynchronous result passed to the callback 676 * 677 * Returns: whether the change was successful or not 678 * 679 * Throws: GException on failure. 680 */ 681 public bool setAttributesFinish(AsyncResultIF result) 682 { 683 GError* err = null; 684 685 auto p = secret_item_set_attributes_finish(secretItem, (result is null) ? null : result.getAsyncResultStruct(), &err) != 0; 686 687 if (err !is null) 688 { 689 throw new GException( new ErrorG(err) ); 690 } 691 692 return p; 693 } 694 695 /** 696 * Set the attributes of this item. 697 * 698 * The @attributes are a mapping of string keys to string values. 699 * Attributes are used to search for items. Attributes are not stored 700 * or transferred securely by the secret service. 701 * 702 * This function may block indefinitely. Use the asynchronous version 703 * in user interface threads. 704 * 705 * Params: 706 * schema = the schema for the attributes 707 * attributes = a new set of attributes 708 * cancellable = optional cancellation object 709 * 710 * Returns: whether the change was successful or not 711 * 712 * Throws: GException on failure. 713 */ 714 public bool setAttributesSync(Schema schema, HashTable attributes, Cancellable cancellable) 715 { 716 GError* err = null; 717 718 auto p = secret_item_set_attributes_sync(secretItem, (schema is null) ? null : schema.getSchemaStruct(), (attributes is null) ? null : attributes.getHashTableStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0; 719 720 if (err !is null) 721 { 722 throw new GException( new ErrorG(err) ); 723 } 724 725 return p; 726 } 727 728 /** 729 * Set the label of this item. 730 * 731 * This function returns immediately and completes asynchronously. 732 * 733 * Params: 734 * label = a new label 735 * cancellable = optional cancellation object 736 * callback = called when the operation completes 737 * userData = data to pass to the callback 738 */ 739 public void setLabel(string label, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 740 { 741 secret_item_set_label(secretItem, Str.toStringz(label), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 742 } 743 744 /** 745 * Complete asynchronous operation to set the label of this collection. 746 * 747 * Params: 748 * result = asynchronous result passed to callback 749 * 750 * Returns: whether the change was successful or not 751 * 752 * Throws: GException on failure. 753 */ 754 public bool setLabelFinish(AsyncResultIF result) 755 { 756 GError* err = null; 757 758 auto p = secret_item_set_label_finish(secretItem, (result is null) ? null : result.getAsyncResultStruct(), &err) != 0; 759 760 if (err !is null) 761 { 762 throw new GException( new ErrorG(err) ); 763 } 764 765 return p; 766 } 767 768 /** 769 * Set the label of this item. 770 * 771 * This function may block indefinitely. Use the asynchronous version 772 * in user interface threads. 773 * 774 * Params: 775 * label = a new label 776 * cancellable = optional cancellation object 777 * 778 * Returns: whether the change was successful or not 779 * 780 * Throws: GException on failure. 781 */ 782 public bool setLabelSync(string label, Cancellable cancellable) 783 { 784 GError* err = null; 785 786 auto p = secret_item_set_label_sync(secretItem, Str.toStringz(label), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0; 787 788 if (err !is null) 789 { 790 throw new GException( new ErrorG(err) ); 791 } 792 793 return p; 794 } 795 796 /** 797 * Set the secret value of this item. 798 * 799 * Each item has a single secret which might be a password or some 800 * other secret binary value. 801 * 802 * This function returns immediately and completes asynchronously. 803 * 804 * Params: 805 * value = a new secret value 806 * cancellable = optional cancellation object 807 * callback = called when the operation completes 808 * userData = data to pass to the callback 809 */ 810 public void setSecret(Value value, Cancellable cancellable, GAsyncReadyCallback callback, void* userData) 811 { 812 secret_item_set_secret(secretItem, (value is null) ? null : value.getValueStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 813 } 814 815 /** 816 * Complete asynchronous operation to set the secret value of this item. 817 * 818 * Params: 819 * result = asynchronous result passed to callback 820 * 821 * Returns: whether the change was successful or not 822 * 823 * Throws: GException on failure. 824 */ 825 public bool setSecretFinish(AsyncResultIF result) 826 { 827 GError* err = null; 828 829 auto p = secret_item_set_secret_finish(secretItem, (result is null) ? null : result.getAsyncResultStruct(), &err) != 0; 830 831 if (err !is null) 832 { 833 throw new GException( new ErrorG(err) ); 834 } 835 836 return p; 837 } 838 839 /** 840 * Set the secret value of this item. 841 * 842 * Each item has a single secret which might be a password or some 843 * other secret binary value. 844 * 845 * This function may block indefinitely. Use the asynchronous version 846 * in user interface threads. 847 * 848 * Params: 849 * value = a new secret value 850 * cancellable = optional cancellation object 851 * 852 * Returns: whether the change was successful or not 853 * 854 * Throws: GException on failure. 855 */ 856 public bool setSecretSync(Value value, Cancellable cancellable) 857 { 858 GError* err = null; 859 860 auto p = secret_item_set_secret_sync(secretItem, (value is null) ? null : value.getValueStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0; 861 862 if (err !is null) 863 { 864 throw new GException( new ErrorG(err) ); 865 } 866 867 return p; 868 } 869 }