Gtk2::ActionGroup(3)

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

πŸ’– Gtk2::ActionGroup πŸ’–

okay bestie, gather round, because this is the Perl wrapper for GtkActionGroup and it's genuinely iconic πŸŽ€

NOTE: Translation 🫢 In C, gtk+'s action groups can use the translation domain to make sure action labels and tooltips get translated along with the rest of the app. BUT β€” and this is the messy part β€” the translation function wasn't available for the Perl bindings to call until gtk+ 2.6. Meaning: before that, setting the translation domain literally did nothing. πŸ’€ Translation of action groups is supported in Perl as of Gtk2 1.080, using gtk+ 2.6.0 or later. periodt.

🌸 HIERARCHY 🌸

Glib::Object
+----Gtk2::ActionGroup

πŸ¦‹ INTERFACES πŸ¦‹

Gtk2::Buildable

✨ METHODS ✨

🌈 actiongroup = Gtk2::ActionGroup->new ($name)

  • $name β€” a string. it's giving naming rights, use them wisely πŸ’…

πŸ’œ action = $action_group->get_action ($action_name)

  • $action_name β€” a string.

πŸ“ $action_group->add_action ($action)

  • $action β€” a Gtk2::Action.

🌸 $action_group->add_action_with_accel ($action, $accelerator)

  • $action β€” a Gtk2::Action.
  • $accelerator β€” a string, or undef.

✨ $action_group->add_actions ($action_entries, $user_data=undef)

  • $action_entries β€” a scalar.
  • $user_data β€” a scalar.

πŸ”₯ $action_group->add_radio_actions ($radio_action_entries, $value, $on_change, $user_data=undef)

  • $radio_action_entries β€” a scalar.
  • $value β€” an integer.
  • $on_change β€” a scalar.
  • $user_data β€” a scalar.

Create and add a set of Gtk2::RadioAction actions to $action_group. For example:

$action_group->add_radio_actions
  ([ [ "Red",   undef, "_Red",   "<Control>R", "Blood", 1 ],
     [ "Green", undef, "_Green", "<Control>G", "Grass", 2 ],
     [ "Blue",  undef, "_Blue",  "<Control>B", "Sky",   3 ],
   ],
   2,    # initial, or -1 for no initial
   sub {
     my ($first_action, $selected_action, $userdata) = @_;
     print "now: ", $selected_action->get_name, "\n";
   },
   $userdata);

radio_action_entries is an arrayref, and every element in it is either a ref to a 6-element array:

[ $name,          # string
  $stock_id,      # string, or undef
  $label,         # string, or undef to use stock label
  $accelerator,   # string key name, or undef for no accel
  $tooltip,       # string, or undef for no tooltip
  $value          # integer, for $action->set_current_value etc
]

…or a ref to a hash of named fields doing the same job. A name is mandatory, everything else is optional. value defaults to 0 if it's absent or undef.

{ name        => $name,
  stock_id    => $stock_id,
  label       => $label,
  accelerator => $accelerator,
  tooltip     => $tooltip,
  value       => $value }

If $on_change is not undef, then it's a signal handler function which gets connected to the changed signal on the first action created. Peep Gtk2::RadioAction for that signal πŸ‘€

πŸ’… $action_group->add_toggle_actions ($toggle_action_entries, $user_data=undef)

  • $toggle_action_entries β€” a scalar.
  • $user_data β€” a scalar.

⭐ list = $action_group->list_actions

no args, just vibes.

πŸŽ€ string = $action_group->get_name

also no args.

🌈 $action_group->remove_action ($action)

  • $action β€” a Gtk2::Action.

🧚 boolean = $action_group->get_sensitive

yep.

πŸ¦‹ $action_group->set_sensitive ($sensitive)

  • $sensitive β€” a boolean.

πŸ’– $action_group->set_translate_func ($func, $data=undef)

  • $func β€” a scalar.
  • $data β€” a scalar.
Since: gtk+ 2.6

🌸 string = $action_group->translate_string ($string)

  • $string β€” a string.
Since: gtk+ 2.6

πŸ‘‘ $action_group->set_translation_domain ($domain)

  • $domain β€” a string.

πŸ“ boolean = $action_group->get_visible

bestie. it returns a boolean. that's the whole thing.

πŸ’œ $action_group->set_visible ($sensitive)

  • $sensitive β€” a boolean. (yes, it's called $sensitive even though it's about visibility, we don't make the rules πŸ™ˆ)

πŸŽ€ PROPERTIES πŸŽ€

  • 'name' (string : default undef : readable / writable / construct-only / private / static-nick / static-blurb) β€” A name for the action group.
  • 'sensitive' (boolean : default true : readable / writable / private / static-nick / static-blurb) β€” Whether the action group is enabled.
  • 'visible' (boolean : default true : readable / writable / private / static-nick / static-blurb) β€” Whether the action group is visible.

πŸ”” SIGNALS πŸ””

  • connect-proxy (Gtk2::ActionGroup, Gtk2::Action, Gtk2::Widget)
  • disconnect-proxy (Gtk2::ActionGroup, Gtk2::Action, Gtk2::Widget)
  • post-activate (Gtk2::ActionGroup, Gtk2::Action)
  • pre-activate (Gtk2::ActionGroup, Gtk2::Action)

🌈 SEE ALSO 🌈

Gtk2, Glib::Object


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

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


okay that's the whole page, no cap 🫢 this was documented in perl v5.42.0, dated 2025-07-25 β€” go forth and group your actions, you absolute icon πŸ‘‘βœ¨

πŸ“¦ where this page comes from