File: GBookmarkFile.xs

package info (click to toggle)
libglib-perl 3:1.329.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 1,320 kB
  • sloc: perl: 4,950; ansic: 923; makefile: 7
file content (726 lines) | stat: -rw-r--r-- 20,234 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
/*
 * Copyright (C) 2006,2012 by the gtk2-perl team (see the file AUTHORS for
 * the full list)
 *
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Library General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or (at your
 * option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */

#include "gperl.h"

SV *
newSVGBookmarkFile (GBookmarkFile * bookmark_file)
{
	HV * bookmark = newHV ();
	SV * sv;
	HV * stash;

	/* tie the key_file to our hash using some magic */
	_gperl_attach_mg ((SV *) bookmark, bookmark_file);

	/* wrap it, bless it, ship it. */
	sv = newRV_noinc ((SV *) bookmark);

	stash = gv_stashpv ("Glib::BookmarkFile", TRUE);
	sv_bless (sv, stash);

	return sv;
}

GBookmarkFile *
SvGBookmarkFile (SV * sv)
{
	MAGIC * mg;
	if (!gperl_sv_is_ref (sv) || !(mg = _gperl_find_mg (SvRV (sv))))
		return NULL;
	return (GBookmarkFile *) mg->mg_ptr;
}


MODULE = Glib::BookmarkFile	PACKAGE = Glib::BookmarkFile	PREFIX = g_bookmark_file_

=for object Glib::BookmarkFile Parser for bookmark files
=cut

=for position SYNOPSIS

=head1 SYNOPSIS

  use Glib;

  $date .= $_ while (<DATA>);

  $b = Glib::BookmarkFile->new;
  $b->load_from_data($data);
  $uri = 'file:///some/path/to/a/file.txt';
  if ($b->has_item($uri)) {
  	$title = $b->get_title($uri);
	$desc  = $b->get_description($uri);

	print "Bookmark for `$uri' ($title):\n";
	print "  $desc\n";
  }
  0;

  __DATA__
  <?xml version="1.0" encoding="UTF-8"?>
  <xbel version="1.0"
        xmlns:bookmark="http://www.freedesktop.org/standards/desktop-bookmarks"
        xmlns:mime="http://www.freedesktop.org/standards/shared-mime-info">
    <bookmark href="file:///tmp/test-file.txt" added="2006-03-22T18:54:00Z" modified="2006-03-22T18:54:00Z" visited="2006-03-22T18:54:00Z">
      <title>Test File</title>
      <desc>Some test file</desc>
      <info>
        <metadata owner="http://freedesktop.org">
          <mime:mime-type type="text/plain"/>
          <bookmark:applications>
            <bookmark:application name="Gedit" exec="gedit %u" timestamp="1143053640" count="1"/>
          </bookmark:applications>
        </metadata>
      </info>
    </bookmark>
  </xbel>

=for position DESCRIPTION

=head1 DESCRIPTION

B<Glib::BookmarkFile> lets you parse, edit or create files containing lists
of bookmarks to resources pointed to by URIs, with some meta-data bound to
them, following the Desktop Bookmark Specification.  The recent files support
inside GTK+ uses this type of files to store the list of recently used
files.

The syntax of bookmark files is described in detail in the Desktop Bookmarks
Specification, here is a quick summary: bookmark files use a subclass of the
XML Bookmark Exchange Language (XBEL) document format, defining meta-data
such as the MIME type of the resource pointed by a bookmark, the list of
applications that have registered the same URI and the visibility of the
bookmark.

=cut


void
DESTROY (GBookmarkFile *bookmark_file)
    CODE:
        g_bookmark_file_free (bookmark_file);

GBookmarkFile *
g_bookmark_file_new (class)
    C_ARGS:
        /* void */

# unneeded
# void g_bookmark_file_free (GBookmarkFile *bookmark);

=for apidoc __gerror__
Parses a bookmark file.
=cut
void
g_bookmark_file_load_from_file (bookmark_file, file)
	GBookmarkFile *bookmark_file
	GPerlFilename_const file
    PREINIT:
        GError *err = NULL;
    CODE:
        g_bookmark_file_load_from_file (bookmark_file, file, &err);
	if (err)
		gperl_croak_gerror (NULL, err);

=for apidoc __gerror__
Parses a string containing a bookmark file structure.
=cut
void
g_bookmark_file_load_from_data (bookmark_file, buf)
	GBookmarkFile *bookmark_file
	SV *buf
    PREINIT:
    	STRLEN length;
	GError *err = NULL;
	const gchar *data = (const gchar *) SvPV (buf, length);
    CODE:
        g_bookmark_file_load_from_data (bookmark_file, data, length, &err);
	if (err)
		gperl_croak_gerror (NULL, err);

=for apidoc __gerror__
=signature ($full_path) = $bookmark_file->load_from_data_dirs ($file)

Parses a bookmark file, searching for it inside the data directories.
If a file is found, it returns the full path.
=cut
void
g_bookmark_file_load_from_data_dirs (bookmark_file, file)
	GBookmarkFile *bookmark_file
	GPerlFilename_const file
    PREINIT:
        GError *err = NULL;
	gchar *full_path;
    PPCODE:
        g_bookmark_file_load_from_data_dirs (bookmark_file, file,
					     &full_path,
					     &err);
	if (err)
		gperl_croak_gerror (NULL, err);
	if (full_path) {
		XPUSHs (sv_2mortal (newSVGChar (full_path)));
		g_free (full_path);
	}

=for apidoc __gerror__
Returns the bookmark file as a string.
=cut
gchar_own *
g_bookmark_file_to_data (bookmark_file)
	GBookmarkFile *bookmark_file
    PREINIT:
     	GError *err = NULL;
	gsize len;
    CODE:
        RETVAL = g_bookmark_file_to_data (bookmark_file, &len, &err);
	if (err)
		gperl_croak_gerror (NULL, err);
    OUTPUT:
    	RETVAL

=for apidoc __gerror__
Saves the contents of a bookmark file into a file.  The write operation
is guaranteed to be atomic by writing the contents of the bookmark file
to a temporary file and then moving the file to the target file.
=cut
void
g_bookmark_file_to_file (bookmark_file, file)
	GBookmarkFile *bookmark_file
	GPerlFilename_const file
    PREINIT:
        GError *err = NULL;
    CODE:
    	g_bookmark_file_to_file (bookmark_file, file, &err);
	if (err)
		gperl_croak_gerror (NULL, err);

=for apidoc
Looks whether the bookmark file has a bookmark for $uri.
=cut
gboolean
g_bookmark_file_has_item (GBookmarkFile *bookmark_file, const gchar *uri)

=for apidoc __gerror__
Removes the bookmark for $uri from the bookmark file.
=cut
void
g_bookmark_file_remove_item (GBookmarkFile *bookmark_file, const gchar *uri)
    PREINIT:
        GError *err = NULL;
    CODE:
        g_bookmark_file_remove_item (bookmark_file, uri, &err);
	if (err)
		gperl_croak_gerror (NULL, err);

=for apidoc __gerror__
Changes the URI of a bookmark item from $old_uri to $new_uri.  Any
existing bookmark for $new_uri will be overwritten.  If $new_uri is
undef, then the bookmark is removed.
=cut
void
g_bookmark_file_move_item (bookmark_file, old_uri, new_uri)
	GBookmarkFile *bookmark_file
	const gchar *old_uri
	const gchar_ornull *new_uri
    PREINIT:
        GError *err = NULL;
    CODE:
        g_bookmark_file_move_item (bookmark_file, old_uri, new_uri, &err);
	if (err)
		gperl_croak_gerror (NULL, err);

=for apidoc
Gets the number of bookmarks inside the bookmark file.
=cut
gint g_bookmark_file_get_size (GBookmarkFile *bookmark_file)

=for apidoc
=signature list = $bookmark_file->get_uris
Returns the URI of all the bookmarks in the bookmark file.
=cut
void
g_bookmark_file_get_uris (bookmark_file)
	GBookmarkFile *bookmark_file
    PREINIT:
    	gchar **uris;
	gsize len, i;
    PPCODE:
    	uris = g_bookmark_file_get_uris (bookmark_file, &len);
	if (len != 0) {
		for (i = 0; i < len; i++) {
			if (uris[i])
				XPUSHs (sv_2mortal (newSVGChar (uris[i])));
		}
	}
	g_strfreev (uris);

=for apidoc
Sets the title of the bookmark for $uri.  If no bookmark for $uri is found
one is created.
=cut
void
g_bookmark_file_set_title (GBookmarkFile *bookmark_file, const gchar *uri, const gchar *title)

=for apidoc __gerror__
=signature $bookmark_file->get_title ($uri, $title)
Gets the title of the bookmark for $uri.
=cut
gchar_own *
g_bookmark_file_get_title (bookmark_file, uri)
	GBookmarkFile *bookmark_file
	const gchar *uri
    PREINIT:
    	GError *err = NULL;
    CODE:
    	RETVAL = g_bookmark_file_get_title (bookmark_file, uri, &err);
	if (err)
		gperl_croak_gerror (NULL, err);
    OUTPUT:
    	RETVAL

=for apidoc
Sets the description of the bookmark for $uri.  If no bookmark for $uri
is found one is created.
=cut
void
g_bookmark_file_set_description (GBookmarkFile *bookmark_file, const gchar *uri, const gchar *description)

=for apidoc __gerror__
=signature $bookmark_file->get_description ($uri)
Gets the description of the bookmark for $uri.
=cut
gchar_own *
g_bookmark_file_get_description (bookmark_file, uri)
	GBookmarkFile *bookmark_file
	const gchar *uri
    PREINIT:
    	GError *err = NULL;
    CODE:
    	RETVAL = g_bookmark_file_get_description (bookmark_file, uri, &err);
	if (err)
		gperl_croak_gerror (NULL, err);
    OUTPUT:
    	RETVAL

=for apidoc
Sets the MIME type of the bookmark for $uri.  If no bookmark for $uri
is found one is created.
=cut
void
g_bookmark_file_set_mime_type (GBookmarkFile *bookmark_file, const gchar *uri, const gchar *mime_type)

=for apidoc __gerror__
Gets the MIME type of the bookmark for $uri.
=cut
gchar_own *
g_bookmark_file_get_mime_type (bookmark_file, uri)
	GBookmarkFile *bookmark_file
	const gchar *uri
    PREINIT:
    	GError *err = NULL;
    CODE:
    	RETVAL = g_bookmark_file_get_mime_type (bookmark_file, uri, &err);
	if (err)
		gperl_croak_gerror (NULL, err);
    OUTPUT:
    	RETVAL

=for apidoc
=for arg ... one or more group names
Sets a list of group names for the item with URI $uri.  Each previously
set group name list is removed.  If no bookmark for $uri is found one
is created.
=cut
void
g_bookmark_file_set_groups (GBookmarkFile *bookmark_file, const gchar *uri, ...)
    PREINIT:
        gchar **groups;
	gsize groups_len;
	int i;
    CODE:
        groups_len = (gsize) (items - 2);
	groups = g_new0 (gchar *, groups_len + 1);
	for (i = 2; i < items; i++)
		groups[i - 2] = SvPV_nolen (ST (i));
	g_bookmark_file_set_groups (bookmark_file, uri,
			            (const gchar **) groups,
				    groups_len);
	g_free (groups);

=for apidoc
Adds $group to the list of groups to which the bookmark for $uri
belongs to.  If no bookmark for $uri is found one is created.
=cut
void
g_bookmark_file_add_group (GBookmarkFile *bookmark_file, const gchar *uri, const gchar *group)

=for apidoc __gerror__
Checks whether $group appears in the list of groups to which
the bookmark for $uri belongs to.
=cut
gboolean
g_bookmark_file_has_group (bookmark_file, uri, group)
	GBookmarkFile *bookmark_file
	const gchar *uri
	const gchar *group
    PREINIT:
        GError *err = NULL;
    CODE:
        RETVAL = g_bookmark_file_has_group (bookmark_file, uri, group, &err);
	if (err)
		gperl_croak_gerror (NULL, err);
    OUTPUT:
        RETVAL

=for apidoc __gerror__
Retrieves the list of group names of the bookmark for $uri.
=cut
void
g_bookmark_file_get_groups (GBookmarkFile *bookmark_file, const gchar *uri)
    PREINIT:
        GError *err = NULL;
	gchar **groups;
	gsize len, i;
    PPCODE:
        groups = g_bookmark_file_get_groups (bookmark_file, uri, &len, &err);
	if (err)
		gperl_croak_gerror (NULL, err);
	if (len != 0) {
		for (i = 0; i < len; i++) {
			if (groups[i])
				XPUSHs (sv_2mortal (newSVGChar (groups[i])));
		}
	}
	g_strfreev (groups);

=for apidoc __gerror__
Removes $group from the list of groups to which the bookmark
for $uri belongs to.
=cut
void
g_bookmark_file_remove_group (bookmark_file, uri, group)
	GBookmarkFile *bookmark_file
	const gchar *uri
	const gchar *group
    PREINIT:
        GError *err = NULL;
    CODE:
        g_bookmark_file_remove_group (bookmark_file, uri, group, &err);
	if (err)
		gperl_croak_gerror (NULL, err);

=for apidoc
Adds the application with $name and $exec to the list of
applications that have registered a bookmark for $uri into
$bookmark_file.

Every bookmark inside a C<Glib::BookmarkFile> must have at least an
application registered.  Each application must provide a name, a
command line useful for launching the bookmark, the number of times
the bookmark has been registered by the application and the last
time the application registered this bookmark.

If $name is undef, the name of the application will be the
same returned by Glib::get_application_name(); if $exec is undef,
the command line will be a composition of the program name as
returned by Glib::get_prgname() and the "%u" modifier, which will
be expanded to the bookmark's URI.

This function will automatically take care of updating the
registrations count and timestamping in case an application
with the same $name had already registered a bookmark for
$uri inside the bookmark file.  If no bookmark for $uri is found
one is created.
=cut
void
g_bookmark_file_add_application (bookmark_file, uri, name, exec)
	GBookmarkFile *bookmark_file
	const gchar *uri
	const gchar_ornull *name
	const gchar_ornull *exec

=for apidoc __gerror__
Checks whether the bookmark for $uri inside $bookmark_file has
been registered by application $name.
=cut
gboolean
g_bookmark_file_has_application (bookmark_file, uri, name)
	GBookmarkFile *bookmark_file
	const gchar *uri
	const gchar *name
    PREINIT:
        GError *err = NULL;
    CODE:
    	RETVAL = g_bookmark_file_has_application (bookmark_file,
						  uri,
						  name,
						  &err);
	if (err)
		gperl_croak_gerror (NULL, err);
    OUTPUT:
        RETVAL

=for apidoc __gerror__
Removes application registered with $name from the list of applications
that have registered a bookmark for $uri inside $bookmark_file.
=cut
void
g_bookmark_file_remove_application (bookmark_file, uri, name)
	GBookmarkFile *bookmark_file
	const gchar *uri
	const gchar *name
    PREINIT:
        GError *err = NULL;
    CODE:
        g_bookmark_file_remove_application (bookmark_file, uri, name, &err);
	if (err)
		gperl_croak_gerror (NULL, err);

=for apidoc __gerror__
=signature list = $bookmark_file->get_applications ($uri)
Retrieves the names of the applications that have registered the
bookmark for $uri.
=cut
void
g_bookmark_file_get_applications (bookmark_file, uri)
	GBookmarkFile *bookmark_file
	const gchar *uri
    PREINIT:
    	gchar **apps;
	gsize len, i;
	GError *err = NULL;
    PPCODE:
    	apps = g_bookmark_file_get_applications (bookmark_file, uri, &len, &err);
	if (err)
		gperl_croak_gerror (NULL, err);
	if (len != 0) {
		for (i = 0; i < len; i++) {
			if (apps[i])
				XPUSHs (sv_2mortal (newSVGChar (apps[i])));
		}
	}
	g_strfreev (apps);

=for apidoc __gerror__
Sets the meta-data of application $name inside the list of
applications that have registered a bookmark for $uri inside
$bookmark_file.

You should rarely use this method; use Glib::BookmarkFile::add_application()
and Glib::BookmarkFile::remove_application() instead.

$name can be any UTF-8 encoded string used to identify an application.
$exec can have one of these two modifiers: "%f", which will be expanded
as the local file name retrieved from the bookmark's URI; "%u", which
will be expanded as the bookmark's URI. The expansion is done automatically
when retrieving the stored command line using the
Glib::BookmarkFile::get_app_info() method.
$count is the number of times the application has registered the
bookmark; if it is < 0, the current registration count will be increased
by one, if it is 0, the application with $name will be removed from
the list of registered applications.
$stamp is the Unix time of the last registration, as returned by time(); if
it is -1, the current time will be used.

If you try to remove an application by setting its registration count to
zero, and no bookmark for $uri is found, %FALSE is returned and an
exception is fired.
=cut
void
g_bookmark_file_set_app_info (bookmark_file, uri, name, exec, count, stamp)
	GBookmarkFile *bookmark_file
	const gchar *uri
	const gchar *name
	const gchar *exec
	gint count
	time_t stamp
    PREINIT:
    	GError *err = NULL;
    CODE:
    	g_bookmark_file_set_app_info (bookmark_file, uri, name,
				      exec,
				      count,
				      stamp,
				      &err);
	if (err)
		gperl_croak_gerror (NULL, err);

=for apidoc __gerror__
=signature ($exec, $count, $stamp) = $bookmark_file->get_app_info ($uri, $name)
Gets the registration information of $name for the bookmark for
$uri.  See Glib::BookmarkFile::set_app_info() for more information about
the returned data.
=cut
void
g_bookmark_file_get_app_info (bookmark_file, uri, name)
	GBookmarkFile *bookmark_file
	const gchar *uri
	const gchar *name
    PREINIT:
    	gchar *exec;
	guint count;
	time_t stamp;
        GError *err = NULL;
    PPCODE:
        g_bookmark_file_get_app_info (bookmark_file, uri, name,
				      &exec,
				      &count,
				      &stamp,
				      &err);
	if (err)
		gperl_croak_gerror (NULL, err);
	EXTEND (SP, 3);
	PUSHs (sv_2mortal (newSVGChar (exec)));
	PUSHs (sv_2mortal (newSViv (count)));
	PUSHs (sv_2mortal (newSViv (stamp)));
	g_free (exec);

=for apidoc
=cut
void
g_bookmark_file_set_is_private (GBookmarkFile *bookmark_file, const gchar *uri, gboolean is_private)

=for apidoc __gerror__
=cut
gboolean
g_bookmark_file_get_is_private (GBookmarkFile *bookmark_file, const gchar *uri)
    PREINIT:
        GError *err = NULL;
    CODE:
    	RETVAL = g_bookmark_file_get_is_private (bookmark_file, uri, &err);
	if (err)
		gperl_croak_gerror (NULL, err);
    OUTPUT:
        RETVAL

=for apidoc
Sets the icon for the bookmark for $uri.  If $href is undef, unsets
the currently set icon.
=cut
void
g_bookmark_file_set_icon (bookmark_file, uri, href, mime_type)
	GBookmarkFile *bookmark_file
	const gchar *uri
	const gchar_ornull *href
	const gchar_ornull *mime_type

=for apidoc __gerror__
=signature ($href, $mime_type) = $bookmark_file->get_icon ($uri)
Gets the icon of the bookmark for $uri.
=cut
void
g_bookmark_file_get_icon (GBookmarkFile *bookmark_file, const gchar *uri)
    PREINIT:
        gchar *href, *mime_type;
        GError *err = NULL;
    PPCODE:
        g_bookmark_file_get_icon (bookmark_file, uri,
				  &href,
				  &mime_type,
				  &err);
	if (err)
		gperl_croak_gerror (NULL, err);
	EXTEND (SP, 2);
	PUSHs (sv_2mortal (newSVGChar (href)));
	PUSHs (sv_2mortal (newSVGChar (mime_type)));
	g_free (href);
	g_free (mime_type);

=for apidoc Glib::BookmarkFile::get_added
=for apidoc __gerror__
Gets the time the bookmark for $uri was added to $bookmark_file.
=cut

=for apidoc Glib::BookmarkFile::get_modified
=for apidoc __gerror__
Gets the time the bookmark for $uri was last modified.
=cut

=for apidoc Glib::BookmarkFile::get_visited
=for apidoc __gerror__
Gets the time the bookmark for $uri was last visited.
=cut

time_t
g_bookmark_file_get_added (bookmark_file, uri)
	GBookmarkFile *bookmark_file
	const gchar *uri
    ALIAS:
        Glib::BookmarkFile::get_modified = 1
	Glib::BookmarkFile::get_visited  = 2
    PREINIT:
        GError *err = NULL;
    CODE:
        switch (ix) {
	    case 0:
		RETVAL = g_bookmark_file_get_added    (bookmark_file, uri, &err);
		break;
	    case 1:
		RETVAL = g_bookmark_file_get_modified (bookmark_file, uri, &err);
		break;
	    case 2:
		RETVAL = g_bookmark_file_get_visited  (bookmark_file, uri, &err);
		break;
	    default:
		RETVAL = 0;
		g_assert_not_reached ();
		break;
	}
	if (err)
		gperl_croak_gerror (NULL, err);
    OUTPUT:
        RETVAL

=for apidoc Glib::BookmarkFile::set_added
Sets the time the bookmark for $uri was added.
If no bookmark for $uri is found one is created.
=cut

=for apidoc Glib::BookmarkFile::set_modified
Sets the time the bookmark for $uri was last modified.
If no bookmark for $uri is found one is created.
=cut

=for apidoc Glib::BookmarkFile::set_visited
Sets the time the bookmark for $uri was last visited.
If no bookmark for $uri is found one is created.
=cut

void
g_bookmark_file_set_added (bookmark_file, uri, value)
	GBookmarkFile *bookmark_file
	const gchar *uri
	time_t value
    ALIAS:
        Glib::BookmarkFile::set_modified = 1
	Glib::BookmarkFile::set_visited  = 2
    CODE:
        switch (ix) {
		case 0:
		g_bookmark_file_set_added    (bookmark_file, uri, value); break;
		case 1:
		g_bookmark_file_set_modified (bookmark_file, uri, value); break;
		case 2:
		g_bookmark_file_set_visited  (bookmark_file, uri, value); break;
		default:
			g_assert_not_reached ();
			break;
	}