RogersMine

 view release on metacpan or  search on metacpan

local/lib/perl5/x86_64-linux-thread-multi/Glib/BookmarkFile.pod  view on Meta::CPAN

=head1 NAME

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



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




=head1 METHODS

=head2 bookmarkfile = Glib::BookmarkFile-E<gt>B<new> 

=head2 $bookmark_file-E<gt>B<add_application> ($uri, $name, $exec)

=over

=item * $uri (string) 

=item * $name (string or undef) 

=item * $exec (string or undef) 

=back

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



( run in 0.684 second using v1.01-cache-2.11-cpan-39bf76dae61 )