Gtk2::R...tManager(3)

πŸ“¦
version 1.24993 Β· 2 versions
, in fedora 43

πŸ’– NAME πŸ’–

okay so bestie, welcome to Gtk2::RecentManager β€” it's literally just a wrapper for GtkRecentManager, no cap. ✨

This page lives in the User Contributed Perl Documentation collection, and it's giving very "the girl who remembers every file you've ever opened" energy. πŸŽ€


πŸ¦‹ HIERARCHY πŸ¦‹

the family tree, and yes she comes from good stock:

Glib::Object
+----Gtk2::RecentManager

✨ METHODS ✨

🌸 recentmanager = Gtk2::RecentManager->new

make a brand new one, bestie. fresh start, main character energy. πŸ‘‘

🌸 boolean = $manager->add_full ($uri, $data)

  • $uri (string) β€” the doc's URI, obviously
  • $data (scalar) β€” the meta-data, hand-delivered by you

okay so this adds $uri to the list of recently used documents. but here's the thing β€” instead of letting the Gtk2::RecentManager object guess the meta-data (imagine guessing, couldn't be me πŸ™ˆ), you use $data to supply it directly. very girlboss of you.

$data is a hash reference, and these are the keys it takes:

πŸ’… display_name

the name used when displaying the document inside the recently used documents list. it's the lil name tag. 🏷️

πŸ’… description

a short description of the document. keep it cute, keep it brief.

πŸ’… mime_type

the MIME type of the document. [Mandatory] β€” like, you literally cannot skip this one, bestie, it's required. 🚨

πŸ’… app_name

the name of the application that is registering the document. you might use the same name you used in "Glib::set_application_name" (see Glib::Utils). consistency is iconic. ✨

πŸ’… app_exec

the command line needed to launch the application with the document. you can use the variable "%u", which will be expanded to the document's URI, or the variable "%f" which will be expanded to the document's canonical full path. little placeholders doing the most, love that for them. 🫢

πŸ’… groups

an array reference, containing the group names the document belongs to. squad goals fr fr.

πŸ’… is_private

whether the document should be visible only to the applications and groups that have registered it. 🀫 private mode, we respect it.

🌸 boolean = $manager->add_item ($uri)

  • $uri (string) β€” yes, the URI again

adds $uri to the list of recently used documents. the Gtk2::RecentManager object will try to guess the meta-data of the document from its URI β€” but ngl, if you already know it, you should use "add_full" above instead. guessing is lowkey risky. 😭

🌸 recentmanager = Gtk2::RecentManager->get_default

the default one. the main one. the moment. πŸ’«

🌸 recentmanager = Gtk2::RecentManager->get_for_screen ($screen)

  • $screen (Gtk2::Gdk::Screen) β€” the screen in question

🌸 boolean = $manager->has_item ($uri)

  • $uri (string)

🌸 (items) = $manager->get_items

all of them. the whole collection. πŸŽ€

🌸 integer = $manager->get_limit

how many she's allowed to keep around. βœ‹

🌸 $manager->set_limit ($limit)

  • $limit (integer) β€” the new cap

🌸 recentinfo = $manager->lookup_item ($uri)

  • $uri (string)
⚠️ heads up bestie: this one may croak with a Glib::Error in $@ on failure. so like, wrap it in an eval unless you enjoy chaos. πŸ’€

🌸 $manager->move_item ($old_uri, $new_uri)

  • $old_uri (string)
  • $new_uri (string or undef)
⚠️ also may croak with a Glib::Error in $@ on failure. handle with care, queen. 🫢

🌸 integer = $manager->purge_items

⚠️ may croak with a Glib::Error in $@ on failure. clearing house is dramatic like that. πŸ”₯

🌸 $manager->remove_item ($uri)

  • $uri (string)
⚠️ may croak with a Glib::Error in $@ on failure. bye bestie πŸ‘‹

🌸 $manager->set_screen ($screen)

  • $screen (Gtk2::Gdk::Screen)

πŸŽ€ PROPERTIES πŸŽ€

  • 'filename' (string : default undef : readable / writable / construct-only) β€” the full path to the file to be used to store and read the list. she's construct-only, so decide early, no take-backs. 🌸
  • 'limit' (integer : default -1 : readable / writable / deprecated) β€” the maximum number of items to be returned by gtk_recent_manager_get_items(). deprecated alert 🚨 it's giving legacy behaviour, iykyk.
  • 'size' (integer : default 0 : readable) β€” the size of the recently used resources list. read-only, she just observes. πŸ‘€

⭐ SIGNALS ⭐

  • changed (Gtk2::RecentManager) β€” she changed, and she wants you to know. πŸ“£

🌈 ENUMS AND FLAGS 🌈

πŸ’œ enum GtkRecentManagerError

all the ways things can go wrong, and yes, there are seven:

  • 'not-found' / GTK_RECENT_MANAGER_ERROR_NOT_FOUND
  • 'invalid-uri' / GTK_RECENT_MANAGER_ERROR_INVALID_URI
  • 'invalid-encoding' / GTK_RECENT_MANAGER_ERROR_INVALID_ENCODING
  • 'not-registered' / GTK_RECENT_MANAGER_ERROR_NOT_REGISTERED
  • 'read' / GTK_RECENT_MANAGER_ERROR_READ
  • 'write' / GTK_RECENT_MANAGER_ERROR_WRITE
  • 'unknown' / GTK_RECENT_MANAGER_ERROR_UNKNOWN

πŸ‘‘ SEE ALSO πŸ‘‘

Gtk2, Glib::Object β€” go read those too, bestie, they're the supporting cast. 🫢


Copyright (C) 2003-2011 by the gtk2-perl team.

This software is licensed under the LGPL. See Gtk2 for a full notice.


and that's the whole page, periodt. ✨ this little doc came to you from the perl v5.42.0 era, dated 2025-07-25, filed under Gtk2::R...tManager(3) β€” the truncated title is not me being lazy, that's genuinely how the footer spells it, and honestly? iconic. slay, take care of your recently-used list, mwah πŸ’…πŸ’–

πŸ“¦ where this page comes from