Gtk2::FileFilter(3)

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

πŸ’– Gtk2::FileFilter β€” the manual, but make it cute

okay so bestie, this is the user-contributed Perl documentation page for Gtk2::FileFilter β€” a lil wrapper for GtkFileFilter, aka the thing that decides which files get to show up in your file chooser and which ones get politely ghosted. πŸ‘‘ It ships in the Gtk2 Perl docs, so grab a strawberry πŸ“ and let's go.


✨ NAME ✨

Gtk2::FileFilter β€” wrapper for GtkFileFilter

it's giving "gatekeeper but make it a class" πŸ’…


🌈 HIERARCHY 🌈

Look at this family tree, she comes from good stock:

  Glib::Object
  +----Glib::InitiallyUnowned
       +----Gtk2::Object
            +----Gtk2::FileFilter

four generations deep and every single one of them ate 😭


πŸŽ€ METHODS πŸŽ€

filefilter = Gtk2::FileFilter->new

the main character constructor. Makes you a brand new Gtk2::FileFilter. ✨


$filter->add_custom ($needed, $func, $data=undef)

Add your own custom filter logic, iykyk. The args:

  • $needed β€” a Gtk2::FileFilterFlags (tell it what info your callback needs)
  • $func β€” a scalar (your function, bestie)
  • $data β€” a scalar, and it defaults to undef if you don't pass one

$filter->add_mime_type ($mime_type)

  • $mime_type β€” a string

drop a mime type in and let it cook 🧚


$filter->add_pattern ($pattern)

  • $pattern β€” a string

glob patterns, we love to see it πŸ’–


$filter->add_pixbuf_formats

Since: gtk+ 2.6 ⭐

not me adding every pixbuf format at once, no cap


boolean = $filter->filter ($filter_info)

  • $filter_info β€” a scalar

this one returns a boolean, so like… true or false, slay or nay πŸ’€


string = $filter->get_name

grab the filter's name, get that string back πŸŽ€


$filter->set_name ($name)

  • $name β€” a string

name your filter something iconic πŸ‘‘


filefilterflags = $filter->get_needed

returns a filefilterflags β€” the flags this filter asked for 🌸


πŸ¦‹ ENUMS AND FLAGS πŸ¦‹

flags Gtk2::FileFilterFlags

The vibe check menu, pick your faves:

  • 'filename' / 'GTK_FILE_FILTER_FILENAME'
  • 'uri' / 'GTK_FILE_FILTER_URI'
  • 'display-name' / 'GTK_FILE_FILTER_DISPLAY_NAME'
  • 'mime-type' / 'GTK_FILE_FILTER_MIME_TYPE'

yes the short name and the long GTK_ name both work, we stay flexible πŸ’…


πŸ‘€ SEE ALSO πŸ‘€

Go read these too, fr fr:

  • Gtk2
  • Glib::Object
  • Glib::InitiallyUnowned
  • Gtk2::Object

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

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

do NOT lose this part, bestie β€” license details are not optional, periodt. πŸ™ˆ

and that's the whole page!! this was generated with perl v5.42.0 on 2025-07-25 β€” bye babes, go filter some files πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

πŸ“¦ where this page comes from