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