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 = glib-Bookmark-file-parser.html 27 * outPack = glib 28 * outFile = BookmarkFile 29 * strct = GBookmarkFile 30 * realStrct= 31 * ctorStrct= 32 * clss = BookmarkFile 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - g_bookmark_file_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * - g_bookmark_file_set_groups 45 * omit signals: 46 * imports: 47 * - glib.ErrorG 48 * - glib.GException 49 * - glib.Str 50 * structWrap: 51 * module aliases: 52 * local aliases: 53 * overrides: 54 */ 55 56 module glib.BookmarkFile; 57 58 public import gtkc.glibtypes; 59 60 private import gtkc.glib; 61 private import glib.ConstructionException; 62 63 64 private import glib.ErrorG; 65 private import glib.GException; 66 private import glib.Str; 67 68 69 70 71 /** 72 * Description 73 * GBookmarkFile lets you parse, edit or create files containing bookmarks 74 * to URI, along with some meta-data about the resource pointed by the URI 75 * like its MIME type, the application that is registering the bookmark and 76 * the icon that should be used to represent the bookmark. The data is stored 77 * using the 78 * Desktop Bookmark 79 * Specification. 80 * The syntax of the bookmark files is described in detail inside the Desktop 81 * Bookmark Specification, here is a quick summary: bookmark files use a 82 * sub-class of the XML Bookmark Exchange Language 83 * specification, consisting of valid UTF-8 encoded XML, under the 84 * xbel root element; each bookmark is stored inside a 85 * bookmark element, using its URI: no relative paths can 86 * be used inside a bookmark file. The bookmark may have a user defined title 87 * and description, to be used instead of the URI. Under the 88 * metadata element, with its owner 89 * attribute set to http://freedesktop.org, is stored the 90 * meta-data about a resource pointed by its URI. The meta-data consists of 91 * the resource's MIME type; the applications that have registered a bookmark; 92 * the groups to which a bookmark belongs to; a visibility flag, used to set 93 * the bookmark as "private" to the applications and groups that has it 94 * registered; the URI and MIME type of an icon, to be used when displaying 95 * the bookmark inside a GUI. 96 * $(DDOC_COMMENT example) 97 * A bookmark file might contain more than one bookmark; each bookmark 98 * is accessed through its URI. 99 * The important caveat of bookmark files is that when you add a new 100 * bookmark you must also add the application that is registering it, using 101 * g_bookmark_file_add_application() or g_bookmark_file_set_app_info(). 102 * If a bookmark has no applications then it won't be dumped when creating 103 * the on disk representation, using g_bookmark_file_to_data() or 104 * g_bookmark_file_to_file(). 105 * The GBookmarkFile parser was added in GLib 2.12. 106 */ 107 public class BookmarkFile 108 { 109 110 /** the main Gtk struct */ 111 protected GBookmarkFile* gBookmarkFile; 112 113 114 public GBookmarkFile* getBookmarkFileStruct() 115 { 116 return gBookmarkFile; 117 } 118 119 120 /** the main Gtk struct as a void* */ 121 protected void* getStruct() 122 { 123 return cast(void*)gBookmarkFile; 124 } 125 126 /** 127 * Sets our main struct and passes it to the parent class 128 */ 129 public this (GBookmarkFile* gBookmarkFile) 130 { 131 this.gBookmarkFile = gBookmarkFile; 132 } 133 134 /** 135 * Sets a list of group names for the item with URI uri. Each previously 136 * set group name list is removed. 137 * If uri cannot be found then an item for it is created. 138 * Since 2.12 139 * Params: 140 * uri = an item's URI 141 * groups = an array of group names, or NULL to remove all groups 142 * length = number of group name values in groups 143 */ 144 public void setGroups(string uri, string[] groups, uint length) 145 { 146 // void g_bookmark_file_set_groups (GBookmarkFile *bookmark, const gchar *uri, const gchar **groups, gsize length); 147 g_bookmark_file_set_groups(gBookmarkFile, Str.toStringz(uri), Str.toStringzArray(groups), length); 148 } 149 150 /** 151 */ 152 153 /** 154 * Creates a new empty GBookmarkFile object. 155 * Use g_bookmark_file_load_from_file(), g_bookmark_file_load_from_data() 156 * or g_bookmark_file_load_from_data_dirs() to read an existing bookmark 157 * file. 158 * Since 2.12 159 * Throws: ConstructionException GTK+ fails to create the object. 160 */ 161 public this () 162 { 163 // GBookmarkFile * g_bookmark_file_new (void); 164 auto p = g_bookmark_file_new(); 165 if(p is null) 166 { 167 throw new ConstructionException("null returned by g_bookmark_file_new()"); 168 } 169 this(cast(GBookmarkFile*) p); 170 } 171 172 /** 173 * Frees a GBookmarkFile. 174 * Since 2.12 175 */ 176 public void free() 177 { 178 // void g_bookmark_file_free (GBookmarkFile *bookmark); 179 g_bookmark_file_free(gBookmarkFile); 180 } 181 182 /** 183 * Loads a desktop bookmark file into an empty GBookmarkFile structure. 184 * If the file could not be loaded then error is set to either a GFileError 185 * or GBookmarkFileError. 186 * Since 2.12 187 * Params: 188 * filename = the path of a filename to load, in the GLib file name encoding 189 * Returns: TRUE if a desktop bookmark file could be loaded 190 * Throws: GException on failure. 191 */ 192 public int loadFromFile(string filename) 193 { 194 // gboolean g_bookmark_file_load_from_file (GBookmarkFile *bookmark, const gchar *filename, GError **error); 195 GError* err = null; 196 197 auto p = g_bookmark_file_load_from_file(gBookmarkFile, Str.toStringz(filename), &err); 198 199 if (err !is null) 200 { 201 throw new GException( new ErrorG(err) ); 202 } 203 204 return p; 205 } 206 207 /** 208 * Loads a bookmark file from memory into an empty GBookmarkFile 209 * structure. If the object cannot be created then error is set to a 210 * GBookmarkFileError. 211 * Since 2.12 212 * Params: 213 * data = desktop bookmarks loaded in memory 214 * length = the length of data in bytes 215 * Returns: TRUE if a desktop bookmark could be loaded. 216 * Throws: GException on failure. 217 */ 218 public int loadFromData(string data, gsize length) 219 { 220 // gboolean g_bookmark_file_load_from_data (GBookmarkFile *bookmark, const gchar *data, gsize length, GError **error); 221 GError* err = null; 222 223 auto p = g_bookmark_file_load_from_data(gBookmarkFile, Str.toStringz(data), length, &err); 224 225 if (err !is null) 226 { 227 throw new GException( new ErrorG(err) ); 228 } 229 230 return p; 231 } 232 233 /** 234 * This function looks for a desktop bookmark file named file in the 235 * paths returned from g_get_user_data_dir() and g_get_system_data_dirs(), 236 * loads the file into bookmark and returns the file's full path in 237 * full_path. If the file could not be loaded then an error is 238 * set to either a GFileError or GBookmarkFileError. 239 * Since 2.12 240 * Params: 241 * file = a relative path to a filename to open and parse 242 * fullPath = return location for a string containing the full path 243 * of the file, or NULL 244 * Returns: TRUE if a key file could be loaded, FALSE othewise 245 * Throws: GException on failure. 246 */ 247 public int loadFromDataDirs(string file, out string fullPath) 248 { 249 // gboolean g_bookmark_file_load_from_data_dirs (GBookmarkFile *bookmark, const gchar *file, gchar **full_path, GError **error); 250 char* outfullPath = null; 251 GError* err = null; 252 253 auto p = g_bookmark_file_load_from_data_dirs(gBookmarkFile, Str.toStringz(file), &outfullPath, &err); 254 255 if (err !is null) 256 { 257 throw new GException( new ErrorG(err) ); 258 } 259 260 fullPath = Str.toString(outfullPath); 261 return p; 262 } 263 264 /** 265 * This function outputs bookmark as a string. 266 * Since 2.12 267 * Params: 268 * length = return location for the length of the returned string, or NULL 269 * Returns: a newly allocated string holding the contents of the GBookmarkFile 270 * Throws: GException on failure. 271 */ 272 public string toData(out gsize length) 273 { 274 // gchar * g_bookmark_file_to_data (GBookmarkFile *bookmark, gsize *length, GError **error); 275 GError* err = null; 276 277 auto p = g_bookmark_file_to_data(gBookmarkFile, &length, &err); 278 279 if (err !is null) 280 { 281 throw new GException( new ErrorG(err) ); 282 } 283 284 return Str.toString(p); 285 } 286 287 /** 288 * This function outputs bookmark into a file. The write process is 289 * guaranteed to be atomic by using g_file_set_contents() internally. 290 * Since 2.12 291 * Params: 292 * filename = path of the output file 293 * Returns: TRUE if the file was successfully written. 294 * Throws: GException on failure. 295 */ 296 public int toFile(string filename) 297 { 298 // gboolean g_bookmark_file_to_file (GBookmarkFile *bookmark, const gchar *filename, GError **error); 299 GError* err = null; 300 301 auto p = g_bookmark_file_to_file(gBookmarkFile, Str.toStringz(filename), &err); 302 303 if (err !is null) 304 { 305 throw new GException( new ErrorG(err) ); 306 } 307 308 return p; 309 } 310 311 /** 312 * Looks whether the desktop bookmark has an item with its URI set to uri. 313 * Since 2.12 314 * Params: 315 * uri = a valid URI 316 * Returns: TRUE if uri is inside bookmark, FALSE otherwise 317 */ 318 public int hasItem(string uri) 319 { 320 // gboolean g_bookmark_file_has_item (GBookmarkFile *bookmark, const gchar *uri); 321 return g_bookmark_file_has_item(gBookmarkFile, Str.toStringz(uri)); 322 } 323 324 /** 325 * Checks whether group appears in the list of groups to which 326 * the bookmark for uri belongs to. 327 * In the event the URI cannot be found, FALSE is returned and 328 * error is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. 329 * Since 2.12 330 * Params: 331 * uri = a valid URI 332 * group = the group name to be searched 333 * Returns: TRUE if group was found. 334 * Throws: GException on failure. 335 */ 336 public int hasGroup(string uri, string group) 337 { 338 // gboolean g_bookmark_file_has_group (GBookmarkFile *bookmark, const gchar *uri, const gchar *group, GError **error); 339 GError* err = null; 340 341 auto p = g_bookmark_file_has_group(gBookmarkFile, Str.toStringz(uri), Str.toStringz(group), &err); 342 343 if (err !is null) 344 { 345 throw new GException( new ErrorG(err) ); 346 } 347 348 return p; 349 } 350 351 /** 352 * Checks whether the bookmark for uri inside bookmark has been 353 * registered by application name. 354 * In the event the URI cannot be found, FALSE is returned and 355 * error is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. 356 * Since 2.12 357 * Params: 358 * uri = a valid URI 359 * name = the name of the application 360 * Returns: TRUE if the application name was found 361 * Throws: GException on failure. 362 */ 363 public int hasApplication(string uri, string name) 364 { 365 // gboolean g_bookmark_file_has_application (GBookmarkFile *bookmark, const gchar *uri, const gchar *name, GError **error); 366 GError* err = null; 367 368 auto p = g_bookmark_file_has_application(gBookmarkFile, Str.toStringz(uri), Str.toStringz(name), &err); 369 370 if (err !is null) 371 { 372 throw new GException( new ErrorG(err) ); 373 } 374 375 return p; 376 } 377 378 /** 379 * Gets the number of bookmarks inside bookmark. 380 * Since 2.12 381 * Returns: the number of bookmarks 382 */ 383 public int getSize() 384 { 385 // gint g_bookmark_file_get_size (GBookmarkFile *bookmark); 386 return g_bookmark_file_get_size(gBookmarkFile); 387 } 388 389 /** 390 * Returns all URIs of the bookmarks in the bookmark file bookmark. 391 * The array of returned URIs will be NULL-terminated, so length may 392 * optionally be NULL. 393 * Since 2.12 394 * Params: 395 * length = return location for the number of returned URIs, or NULL 396 * Returns: a newly allocated NULL-terminated array of strings. Use g_strfreev() to free it. 397 */ 398 public string[] getUris(out gsize length) 399 { 400 // gchar ** g_bookmark_file_get_uris (GBookmarkFile *bookmark, gsize *length); 401 return Str.toStringArray(g_bookmark_file_get_uris(gBookmarkFile, &length)); 402 } 403 404 /** 405 * Returns the title of the bookmark for uri. 406 * If uri is NULL, the title of bookmark is returned. 407 * In the event the URI cannot be found, NULL is returned and 408 * error is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. 409 * Since 2.12 410 * Params: 411 * uri = a valid URI or NULL 412 * Returns: a newly allocated string or NULL if the specified URI cannot be found. 413 * Throws: GException on failure. 414 */ 415 public string getTitle(string uri) 416 { 417 // gchar * g_bookmark_file_get_title (GBookmarkFile *bookmark, const gchar *uri, GError **error); 418 GError* err = null; 419 420 auto p = g_bookmark_file_get_title(gBookmarkFile, Str.toStringz(uri), &err); 421 422 if (err !is null) 423 { 424 throw new GException( new ErrorG(err) ); 425 } 426 427 return Str.toString(p); 428 } 429 430 /** 431 * Retrieves the description of the bookmark for uri. 432 * In the event the URI cannot be found, NULL is returned and 433 * error is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. 434 * Since 2.12 435 * Params: 436 * uri = a valid URI 437 * Returns: a newly allocated string or NULL if the specified URI cannot be found. 438 * Throws: GException on failure. 439 */ 440 public string getDescription(string uri) 441 { 442 // gchar * g_bookmark_file_get_description (GBookmarkFile *bookmark, const gchar *uri, GError **error); 443 GError* err = null; 444 445 auto p = g_bookmark_file_get_description(gBookmarkFile, Str.toStringz(uri), &err); 446 447 if (err !is null) 448 { 449 throw new GException( new ErrorG(err) ); 450 } 451 452 return Str.toString(p); 453 } 454 455 /** 456 * Retrieves the MIME type of the resource pointed by uri. 457 * In the event the URI cannot be found, NULL is returned and 458 * error is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the 459 * event that the MIME type cannot be found, NULL is returned and 460 * error is set to G_BOOKMARK_FILE_ERROR_INVALID_VALUE. 461 * Since 2.12 462 * Params: 463 * uri = a valid URI 464 * Returns: a newly allocated string or NULL if the specified URI cannot be found. 465 * Throws: GException on failure. 466 */ 467 public string getMimeType(string uri) 468 { 469 // gchar * g_bookmark_file_get_mime_type (GBookmarkFile *bookmark, const gchar *uri, GError **error); 470 GError* err = null; 471 472 auto p = g_bookmark_file_get_mime_type(gBookmarkFile, Str.toStringz(uri), &err); 473 474 if (err !is null) 475 { 476 throw new GException( new ErrorG(err) ); 477 } 478 479 return Str.toString(p); 480 } 481 482 /** 483 * Gets whether the private flag of the bookmark for uri is set. 484 * In the event the URI cannot be found, FALSE is returned and 485 * error is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the 486 * event that the private flag cannot be found, FALSE is returned and 487 * error is set to G_BOOKMARK_FILE_ERROR_INVALID_VALUE. 488 * Since 2.12 489 * Params: 490 * uri = a valid URI 491 * Returns: TRUE if the private flag is set, FALSE otherwise. 492 * Throws: GException on failure. 493 */ 494 public int getIsPrivate(string uri) 495 { 496 // gboolean g_bookmark_file_get_is_private (GBookmarkFile *bookmark, const gchar *uri, GError **error); 497 GError* err = null; 498 499 auto p = g_bookmark_file_get_is_private(gBookmarkFile, Str.toStringz(uri), &err); 500 501 if (err !is null) 502 { 503 throw new GException( new ErrorG(err) ); 504 } 505 506 return p; 507 } 508 509 /** 510 * Gets the icon of the bookmark for uri. 511 * In the event the URI cannot be found, FALSE is returned and 512 * error is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. 513 * Since 2.12 514 * Params: 515 * uri = a valid URI 516 * href = return location for the icon's location or NULL 517 * mimeType = return location for the icon's MIME type or NULL 518 * Returns: TRUE if the icon for the bookmark for the URI was found. You should free the returned strings. 519 * Throws: GException on failure. 520 */ 521 public int getIcon(string uri, out string href, out string mimeType) 522 { 523 // gboolean g_bookmark_file_get_icon (GBookmarkFile *bookmark, const gchar *uri, gchar **href, gchar **mime_type, GError **error); 524 char* outhref = null; 525 char* outmimeType = null; 526 GError* err = null; 527 528 auto p = g_bookmark_file_get_icon(gBookmarkFile, Str.toStringz(uri), &outhref, &outmimeType, &err); 529 530 if (err !is null) 531 { 532 throw new GException( new ErrorG(err) ); 533 } 534 535 href = Str.toString(outhref); 536 mimeType = Str.toString(outmimeType); 537 return p; 538 } 539 540 /** 541 * Gets the time the bookmark for uri was added to bookmark 542 * In the event the URI cannot be found, -1 is returned and 543 * error is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. 544 * Since 2.12 545 * Params: 546 * uri = a valid URI 547 * Returns: a timestamp 548 * Throws: GException on failure. 549 */ 550 public uint getAdded(string uri) 551 { 552 // time_t g_bookmark_file_get_added (GBookmarkFile *bookmark, const gchar *uri, GError **error); 553 GError* err = null; 554 555 auto p = g_bookmark_file_get_added(gBookmarkFile, Str.toStringz(uri), &err); 556 557 if (err !is null) 558 { 559 throw new GException( new ErrorG(err) ); 560 } 561 562 return p; 563 } 564 565 /** 566 * Gets the time when the bookmark for uri was last modified. 567 * In the event the URI cannot be found, -1 is returned and 568 * error is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. 569 * Since 2.12 570 * Params: 571 * uri = a valid URI 572 * Returns: a timestamp 573 * Throws: GException on failure. 574 */ 575 public uint getModified(string uri) 576 { 577 // time_t g_bookmark_file_get_modified (GBookmarkFile *bookmark, const gchar *uri, GError **error); 578 GError* err = null; 579 580 auto p = g_bookmark_file_get_modified(gBookmarkFile, Str.toStringz(uri), &err); 581 582 if (err !is null) 583 { 584 throw new GException( new ErrorG(err) ); 585 } 586 587 return p; 588 } 589 590 /** 591 * Gets the time the bookmark for uri was last visited. 592 * In the event the URI cannot be found, -1 is returned and 593 * error is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. 594 * Since 2.12 595 * Params: 596 * uri = a valid URI 597 * Returns: a timestamp. 598 * Throws: GException on failure. 599 */ 600 public uint getVisited(string uri) 601 { 602 // time_t g_bookmark_file_get_visited (GBookmarkFile *bookmark, const gchar *uri, GError **error); 603 GError* err = null; 604 605 auto p = g_bookmark_file_get_visited(gBookmarkFile, Str.toStringz(uri), &err); 606 607 if (err !is null) 608 { 609 throw new GException( new ErrorG(err) ); 610 } 611 612 return p; 613 } 614 615 /** 616 * Retrieves the list of group names of the bookmark for uri. 617 * In the event the URI cannot be found, NULL is returned and 618 * error is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. 619 * The returned array is NULL terminated, so length may optionally 620 * be NULL. 621 * Since 2.12 622 * Params: 623 * uri = a valid URI 624 * length = return location for the length of the returned string, or NULL 625 * Returns: a newly allocated NULL-terminated array of group names. Use g_strfreev() to free it. 626 * Throws: GException on failure. 627 */ 628 public string[] getGroups(string uri, out gsize length) 629 { 630 // gchar ** g_bookmark_file_get_groups (GBookmarkFile *bookmark, const gchar *uri, gsize *length, GError **error); 631 GError* err = null; 632 633 auto p = g_bookmark_file_get_groups(gBookmarkFile, Str.toStringz(uri), &length, &err); 634 635 if (err !is null) 636 { 637 throw new GException( new ErrorG(err) ); 638 } 639 640 return Str.toStringArray(p); 641 } 642 643 /** 644 * Retrieves the names of the applications that have registered the 645 * bookmark for uri. 646 * In the event the URI cannot be found, NULL is returned and 647 * error is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. 648 * Since 2.12 649 * Params: 650 * uri = a valid URI 651 * length = return location of the length of the returned list, or NULL 652 * Returns: a newly allocated NULL-terminated array of strings. Use g_strfreev() to free it. 653 * Throws: GException on failure. 654 */ 655 public string[] getApplications(string uri, out gsize length) 656 { 657 // gchar ** g_bookmark_file_get_applications (GBookmarkFile *bookmark, const gchar *uri, gsize *length, GError **error); 658 GError* err = null; 659 660 auto p = g_bookmark_file_get_applications(gBookmarkFile, Str.toStringz(uri), &length, &err); 661 662 if (err !is null) 663 { 664 throw new GException( new ErrorG(err) ); 665 } 666 667 return Str.toStringArray(p); 668 } 669 670 /** 671 * Gets the registration informations of app_name for the bookmark for 672 * uri. See g_bookmark_file_set_app_info() for more informations about 673 * the returned data. 674 * The string returned in app_exec must be freed. 675 * In the event the URI cannot be found, FALSE is returned and 676 * error is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the 677 * event that no application with name app_name has registered a bookmark 678 * for uri, FALSE is returned and error is set to 679 * G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED. In the event that unquoting 680 * the command line fails, an error of the G_SHELL_ERROR domain is 681 * set and FALSE is returned. 682 * Since 2.12 683 * Params: 684 * uri = a valid URI 685 * name = an application's name 686 * exec = location for the command line of the application, or NULL 687 * count = return location for the registration count, or NULL 688 * stamp = return location for the last registration time, or NULL 689 * Returns: TRUE on success. 690 * Throws: GException on failure. 691 */ 692 public int getAppInfo(string uri, string name, out string exec, out uint count, out uint stamp) 693 { 694 // gboolean g_bookmark_file_get_app_info (GBookmarkFile *bookmark, const gchar *uri, const gchar *name, gchar **exec, guint *count, time_t *stamp, GError **error); 695 char* outexec = null; 696 GError* err = null; 697 698 auto p = g_bookmark_file_get_app_info(gBookmarkFile, Str.toStringz(uri), Str.toStringz(name), &outexec, &count, &stamp, &err); 699 700 if (err !is null) 701 { 702 throw new GException( new ErrorG(err) ); 703 } 704 705 exec = Str.toString(outexec); 706 return p; 707 } 708 709 /** 710 * Sets title as the title of the bookmark for uri inside the 711 * bookmark file bookmark. 712 * If uri is NULL, the title of bookmark is set. 713 * If a bookmark for uri cannot be found then it is created. 714 * Since 2.12 715 * Params: 716 * uri = a valid URI or NULL 717 * title = a UTF-8 encoded string 718 */ 719 public void setTitle(string uri, string title) 720 { 721 // void g_bookmark_file_set_title (GBookmarkFile *bookmark, const gchar *uri, const gchar *title); 722 g_bookmark_file_set_title(gBookmarkFile, Str.toStringz(uri), Str.toStringz(title)); 723 } 724 725 /** 726 * Sets description as the description of the bookmark for uri. 727 * If uri is NULL, the description of bookmark is set. 728 * If a bookmark for uri cannot be found then it is created. 729 * Since 2.12 730 * Params: 731 * uri = a valid URI or NULL 732 * description = a string 733 */ 734 public void setDescription(string uri, string description) 735 { 736 // void g_bookmark_file_set_description (GBookmarkFile *bookmark, const gchar *uri, const gchar *description); 737 g_bookmark_file_set_description(gBookmarkFile, Str.toStringz(uri), Str.toStringz(description)); 738 } 739 740 /** 741 * Sets mime_type as the MIME type of the bookmark for uri. 742 * If a bookmark for uri cannot be found then it is created. 743 * Since 2.12 744 * Params: 745 * uri = a valid URI 746 * mimeType = a MIME type 747 */ 748 public void setMimeType(string uri, string mimeType) 749 { 750 // void g_bookmark_file_set_mime_type (GBookmarkFile *bookmark, const gchar *uri, const gchar *mime_type); 751 g_bookmark_file_set_mime_type(gBookmarkFile, Str.toStringz(uri), Str.toStringz(mimeType)); 752 } 753 754 /** 755 * Sets the private flag of the bookmark for uri. 756 * If a bookmark for uri cannot be found then it is created. 757 * Since 2.12 758 * Params: 759 * uri = a valid URI 760 * isPrivate = TRUE if the bookmark should be marked as private 761 */ 762 public void setIsPrivate(string uri, int isPrivate) 763 { 764 // void g_bookmark_file_set_is_private (GBookmarkFile *bookmark, const gchar *uri, gboolean is_private); 765 g_bookmark_file_set_is_private(gBookmarkFile, Str.toStringz(uri), isPrivate); 766 } 767 768 /** 769 * Sets the icon for the bookmark for uri. If href is NULL, unsets 770 * the currently set icon. href can either be a full URL for the icon 771 * file or the icon name following the Icon Naming specification. 772 * If no bookmark for uri is found one is created. 773 * Since 2.12 774 * Params: 775 * uri = a valid URI 776 * href = the URI of the icon for the bookmark, or NULL 777 * mimeType = the MIME type of the icon for the bookmark 778 */ 779 public void setIcon(string uri, string href, string mimeType) 780 { 781 // void g_bookmark_file_set_icon (GBookmarkFile *bookmark, const gchar *uri, const gchar *href, const gchar *mime_type); 782 g_bookmark_file_set_icon(gBookmarkFile, Str.toStringz(uri), Str.toStringz(href), Str.toStringz(mimeType)); 783 } 784 785 /** 786 * Sets the time the bookmark for uri was added into bookmark. 787 * If no bookmark for uri is found then it is created. 788 * Since 2.12 789 * Params: 790 * uri = a valid URI 791 * added = a timestamp or -1 to use the current time 792 */ 793 public void setAdded(string uri, uint added) 794 { 795 // void g_bookmark_file_set_added (GBookmarkFile *bookmark, const gchar *uri, time_t added); 796 g_bookmark_file_set_added(gBookmarkFile, Str.toStringz(uri), added); 797 } 798 799 /** 800 * Sets the last time the bookmark for uri was last modified. 801 * If no bookmark for uri is found then it is created. 802 * The "modified" time should only be set when the bookmark's meta-data 803 * was actually changed. Every function of GBookmarkFile that 804 * modifies a bookmark also changes the modification time, except for 805 * g_bookmark_file_set_visited(). 806 * Since 2.12 807 * Params: 808 * uri = a valid URI 809 * modified = a timestamp or -1 to use the current time 810 */ 811 public void setModified(string uri, uint modified) 812 { 813 // void g_bookmark_file_set_modified (GBookmarkFile *bookmark, const gchar *uri, time_t modified); 814 g_bookmark_file_set_modified(gBookmarkFile, Str.toStringz(uri), modified); 815 } 816 817 /** 818 * Sets the time the bookmark for uri was last visited. 819 * If no bookmark for uri is found then it is created. 820 * The "visited" time should only be set if the bookmark was launched, 821 * either using the command line retrieved by g_bookmark_file_get_app_info() 822 * or by the default application for the bookmark's MIME type, retrieved 823 * using g_bookmark_file_get_mime_type(). Changing the "visited" time 824 * does not affect the "modified" time. 825 * Since 2.12 826 * Params: 827 * uri = a valid URI 828 * visited = a timestamp or -1 to use the current time 829 */ 830 public void setVisited(string uri, uint visited) 831 { 832 // void g_bookmark_file_set_visited (GBookmarkFile *bookmark, const gchar *uri, time_t visited); 833 g_bookmark_file_set_visited(gBookmarkFile, Str.toStringz(uri), visited); 834 } 835 836 /** 837 * Sets the meta-data of application name inside the list of 838 * applications that have registered a bookmark for uri inside 839 * bookmark. 840 * You should rarely use this function; use g_bookmark_file_add_application() 841 * and g_bookmark_file_remove_application() instead. 842 * name can be any UTF-8 encoded string used to identify an 843 * application. 844 * exec can have one of these two modifiers: "f", which will 845 * be expanded as the local file name retrieved from the bookmark's 846 * URI; "u", which will be expanded as the bookmark's URI. 847 * The expansion is done automatically when retrieving the stored 848 * command line using the g_bookmark_file_get_app_info() function. 849 * count is the number of times the application has registered the 850 * bookmark; if is < 0, the current registration count will be increased 851 * by one, if is 0, the application with name will be removed from 852 * the list of registered applications. 853 * stamp is the Unix time of the last registration; if it is -1, the 854 * current time will be used. 855 * If you try to remove an application by setting its registration count to 856 * zero, and no bookmark for uri is found, FALSE is returned and 857 * error is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND; similarly, 858 * in the event that no application name has registered a bookmark 859 * for uri, FALSE is returned and error is set to 860 * G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED. Otherwise, if no bookmark 861 * for uri is found, one is created. 862 * Since 2.12 863 * Params: 864 * uri = a valid URI 865 * name = an application's name 866 * exec = an application's command line 867 * count = the number of registrations done for this application 868 * stamp = the time of the last registration for this application 869 * Returns: TRUE if the application's meta-data was successfully changed. 870 * Throws: GException on failure. 871 */ 872 public int setAppInfo(string uri, string name, string exec, int count, uint stamp) 873 { 874 // gboolean g_bookmark_file_set_app_info (GBookmarkFile *bookmark, const gchar *uri, const gchar *name, const gchar *exec, gint count, time_t stamp, GError **error); 875 GError* err = null; 876 877 auto p = g_bookmark_file_set_app_info(gBookmarkFile, Str.toStringz(uri), Str.toStringz(name), Str.toStringz(exec), count, stamp, &err); 878 879 if (err !is null) 880 { 881 throw new GException( new ErrorG(err) ); 882 } 883 884 return p; 885 } 886 887 /** 888 * Adds group to the list of groups to which the bookmark for uri 889 * belongs to. 890 * If no bookmark for uri is found then it is created. 891 * Since 2.12 892 * Params: 893 * uri = a valid URI 894 * group = the group name to be added 895 */ 896 public void addGroup(string uri, string group) 897 { 898 // void g_bookmark_file_add_group (GBookmarkFile *bookmark, const gchar *uri, const gchar *group); 899 g_bookmark_file_add_group(gBookmarkFile, Str.toStringz(uri), Str.toStringz(group)); 900 } 901 902 /** 903 * Adds the application with name and exec to the list of 904 * applications that have registered a bookmark for uri into 905 * bookmark. 906 * Every bookmark inside a GBookmarkFile must have at least an 907 * application registered. Each application must provide a name, a 908 * command line useful for launching the bookmark, the number of times 909 * the bookmark has been registered by the application and the last 910 * time the application registered this bookmark. 911 * If name is NULL, the name of the application will be the 912 * same returned by g_get_application_name(); if exec is NULL, the 913 * command line will be a composition of the program name as 914 * returned by g_get_prgname() and the "u" modifier, which will be 915 * expanded to the bookmark's URI. 916 * This function will automatically take care of updating the 917 * registrations count and timestamping in case an application 918 * with the same name had already registered a bookmark for 919 * uri inside bookmark. 920 * If no bookmark for uri is found, one is created. 921 * Since 2.12 922 * Params: 923 * uri = a valid URI 924 * name = the name of the application registering the bookmark 925 * or NULL 926 * exec = command line to be used to launch the bookmark or NULL 927 */ 928 public void addApplication(string uri, string name, string exec) 929 { 930 // void g_bookmark_file_add_application (GBookmarkFile *bookmark, const gchar *uri, const gchar *name, const gchar *exec); 931 g_bookmark_file_add_application(gBookmarkFile, Str.toStringz(uri), Str.toStringz(name), Str.toStringz(exec)); 932 } 933 934 /** 935 * Removes group from the list of groups to which the bookmark 936 * for uri belongs to. 937 * In the event the URI cannot be found, FALSE is returned and 938 * error is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. 939 * In the event no group was defined, FALSE is returned and 940 * error is set to G_BOOKMARK_FILE_ERROR_INVALID_VALUE. 941 * Since 2.12 942 * Params: 943 * uri = a valid URI 944 * group = the group name to be removed 945 * Returns: TRUE if group was successfully removed. 946 * Throws: GException on failure. 947 */ 948 public int removeGroup(string uri, string group) 949 { 950 // gboolean g_bookmark_file_remove_group (GBookmarkFile *bookmark, const gchar *uri, const gchar *group, GError **error); 951 GError* err = null; 952 953 auto p = g_bookmark_file_remove_group(gBookmarkFile, Str.toStringz(uri), Str.toStringz(group), &err); 954 955 if (err !is null) 956 { 957 throw new GException( new ErrorG(err) ); 958 } 959 960 return p; 961 } 962 963 /** 964 * Removes application registered with name from the list of applications 965 * that have registered a bookmark for uri inside bookmark. 966 * In the event the URI cannot be found, FALSE is returned and 967 * error is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. 968 * In the event that no application with name app_name has registered 969 * a bookmark for uri, FALSE is returned and error is set to 970 * G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED. 971 * Since 2.12 972 * Params: 973 * uri = a valid URI 974 * name = the name of the application 975 * Returns: TRUE if the application was successfully removed. 976 * Throws: GException on failure. 977 */ 978 public int removeApplication(string uri, string name) 979 { 980 // gboolean g_bookmark_file_remove_application (GBookmarkFile *bookmark, const gchar *uri, const gchar *name, GError **error); 981 GError* err = null; 982 983 auto p = g_bookmark_file_remove_application(gBookmarkFile, Str.toStringz(uri), Str.toStringz(name), &err); 984 985 if (err !is null) 986 { 987 throw new GException( new ErrorG(err) ); 988 } 989 990 return p; 991 } 992 993 /** 994 * Removes the bookmark for uri from the bookmark file bookmark. 995 * Since 2.12 996 * Params: 997 * uri = a valid URI 998 * Returns: TRUE if the bookmark was removed successfully. 999 * Throws: GException on failure. 1000 */ 1001 public int removeItem(string uri) 1002 { 1003 // gboolean g_bookmark_file_remove_item (GBookmarkFile *bookmark, const gchar *uri, GError **error); 1004 GError* err = null; 1005 1006 auto p = g_bookmark_file_remove_item(gBookmarkFile, Str.toStringz(uri), &err); 1007 1008 if (err !is null) 1009 { 1010 throw new GException( new ErrorG(err) ); 1011 } 1012 1013 return p; 1014 } 1015 1016 /** 1017 * Changes the URI of a bookmark item from old_uri to new_uri. Any 1018 * existing bookmark for new_uri will be overwritten. If new_uri is 1019 * NULL, then the bookmark is removed. 1020 * In the event the URI cannot be found, FALSE is returned and 1021 * error is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. 1022 * Since 2.12 1023 * Params: 1024 * oldUri = a valid URI 1025 * newUri = a valid URI, or NULL 1026 * Returns: TRUE if the URI was successfully changed 1027 * Throws: GException on failure. 1028 */ 1029 public int moveItem(string oldUri, string newUri) 1030 { 1031 // gboolean g_bookmark_file_move_item (GBookmarkFile *bookmark, const gchar *old_uri, const gchar *new_uri, GError **error); 1032 GError* err = null; 1033 1034 auto p = g_bookmark_file_move_item(gBookmarkFile, Str.toStringz(oldUri), Str.toStringz(newUri), &err); 1035 1036 if (err !is null) 1037 { 1038 throw new GException( new ErrorG(err) ); 1039 } 1040 1041 return p; 1042 } 1043 }