Gnome2::Program(3)

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

πŸ’– Gnome2::Program β€” bestie's guide to the GnomeProgram wrapper πŸ’–

okay so. welcome to Gnome2::Program, which is literally just a wrapper for GnomeProgram. that's it. that's the whole vibe. it's from the User Contributed Perl Documentation corner of the world and it is here to hold your app's identity, its directories, and its popt options like a lil emotional support struct. 🫢


🌸 HIERARCHY 🌸

so it sits in the family tree like this, very nepo baby of it:

  Glib::Object
  +----Gnome2::Program

Glib::Object is the parent, and Gnome2::Program is the main character inheriting all of it. periodt.


✨ METHODS ✨

string = $program->get_app_id

grabs the app id, returns a string. it's giving "who am i" but make it ✨code✨.

string = $program->get_app_version

returns the app version as a string. yes bestie, we love a self-aware application.

string = $program->get_human_readable_name

returns the human readable name β€” you know, the cute name you show to actual humans instead of the machine name. πŸŽ€

program = Gnome2::Program->init ($app_id, $app_version, $module_info=undef, ...)

the big one. the constructor. the moment. πŸ’…

args, in order:

  • $app_id (string)
  • $app_version (string)
  • $module_info (scalar)
  • ... (list)

and about that last one: the list argument is for property-value pairs. so you can hand it extra properties right there at init time. slay.

list = $program->locate_file ($domain, $file_name, $only_if_exists)

hunts down a file for you and returns a list of locations. a list!! plural!! it can find more than one spot, bestie, don't assume it's a single path. 🌈

args:

  • $domain (Gnome2::FileDomain) β€” see the enum down below for your options
  • $file_name (string)
  • $only_if_exists (boolean) β€” set this and it won't hand you imaginary files

Returns a list of locations.

moduleinfo = Gnome2::Program->module_load ($mod_name)

loads a module, takes $mod_name (string), hands you back a moduleinfo.

Gnome2::Program->module_register ($module_info)

registers a module. takes $module_info (scalar). returns nothing, it just Does The Thing. πŸ¦‹

boolean = Gnome2::Program->module_registered ($module_info)

asks "is this module registered tho?" β€” takes $module_info (scalar), returns a boolean. vibe check, but for modules. βœ…

program or undef = Gnome2::Program->get_program

returns the program... or undef. 😭 so like, always check before you go using it, bestie. undef will absolutely humble you.


πŸ‘‘ PROPERTIES πŸ‘‘

every single one, no skips, we don't do that here:

  • 'app-datadir' (string : default undef : readable / writable) β€” Data prefix where this application was installed
  • 'app-id' (string : default undef : readable) β€” ID string to use for this application
  • 'app-libdir' (string : default undef : readable / writable) β€” Library prefix where this application was installed
  • 'app-prefix' (string : default undef : readable / writable) β€” Prefix where this application was installed
  • 'app-sysconfdir' (string : default undef : readable / writable) β€” Configuration prefix where this application was installed
  • 'app-version' (string : default undef : readable) β€” Version of this application
  • 'create-directories' (boolean : default true : readable / writable / construct-only) β€” Create standard GNOME directories on startup
  • 'enable-sound' (boolean : default true : readable / writable) β€” Enable sound on startup
  • 'espeaker' (string : default undef : readable / writable) β€” How to connect to esd
  • 'gnome-datadir' (string : default "/usr/share" : readable / writable / construct-only) β€” Data prefix where GNOME was installed
  • 'gnome-libdir' (string : default "/usr/lib64" : readable / writable / construct-only) β€” Library prefix where GNOME was installed
  • 'gnome-path' (string : default undef : readable / writable / construct-only) β€” Path in which to look for installed files
  • 'gnome-prefix' (string : default "/usr" : readable / writable / construct-only) β€” Prefix where GNOME was installed
  • 'gnome-sysconfdir' (string : default "/etc" : readable / writable / construct-only) β€” Configuration prefix where GNOME was installed
  • 'goption-context' (gpointer : default 0 : readable / writable / construct-only) β€” The goption context pointer that GnomeProgram is using
  • 'human-readable-name' (string : default undef : readable / writable / construct-only) β€” Human readable name of this application
  • 'popt-context' (gpointer : default 0 : readable) β€” The popt context pointer that GnomeProgram is using
  • 'popt-flags' (integer : default 0 : writable / construct-only) β€” The flags to use for popt
  • 'popt-table' (gpointer : default 0 : writable / construct-only) β€” The table of options for popt
heads up bestie: the ones marked construct-only are one-shot. you set them when you build the thing and that's it. no take-backs. πŸ’€

🌟 ENUMS AND FLAGS 🌟

enum Gnome2::FileDomain

these are your $domain options for locate_file, and every one of them has a Perl-side name and a C-side name, because duality:

  • 'unknown' / GNOME_FILE_DOMAIN_UNKNOWN
  • 'libdir' / GNOME_FILE_DOMAIN_LIBDIR
  • 'datadir' / GNOME_FILE_DOMAIN_DATADIR
  • 'sound' / GNOME_FILE_DOMAIN_SOUND
  • 'pixmap' / GNOME_FILE_DOMAIN_PIXMAP
  • 'config' / GNOME_FILE_DOMAIN_CONFIG
  • 'help' / GNOME_FILE_DOMAIN_HELP
  • 'app-libdir' / GNOME_FILE_DOMAIN_APP_LIBDIR
  • 'app-datadir' / GNOME_FILE_DOMAIN_APP_DATADIR
  • 'app-sound' / GNOME_FILE_DOMAIN_APP_SOUND
  • 'app-pixmap' / GNOME_FILE_DOMAIN_APP_PIXMAP
  • 'app-config' / GNOME_FILE_DOMAIN_APP_CONFIG
  • 'app-help' / GNOME_FILE_DOMAIN_APP_HELP

the app-* ones are the app-specific versions of their non-app siblings, iykyk. 🧚


πŸ”₯ SEE ALSO πŸ”₯

go read these too, bestie, they're the lore:

  • Gnome2
  • Glib::Object

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

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


okay and one last lil sign-off from your fav: this page was rendered by perl v5.42.0 on 2025-07-25, and the doc itself lives under Gnome2::Program(3). mwah. go write some slay code. πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from