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