Index

Package: Action_Map

Description

package Glib.Action_Map is

The GActionMap interface is implemented by Glib.Action_Group.Gaction_Group implementations that operate by containing a number of named Glib.Action.Gaction instances, such as Glib.Simple_Action_Group.Gsimple_Action_Group.

One useful application of this interface is to map the names of actions from various action groups to unique, prefixed names (e.g. by prepending "app." or "win."). This is the motivation for the 'Map' part of the interface name.

Types

Gaction_Map

type Gaction_Map is new Glib.Types.GType_Interface;

GAction_Entry

type GAction_Entry is private;

GAction_Entry_Array

type GAction_Entry_Array is array (Natural range <>) of GAction_Entry;

Activate_Callback

type Activate_Callback is access procedure
     (Action    : access Glib.Simple_Action.Gsimple_Action;
      Parameter : Glib.Variant.Gvariant;
      Data      : System.Address);

Change_State_Callback

type Change_State_Callback is access procedure
     (Action    : access Glib.Simple_Action.Gsimple_Action;
      Parameter : Glib.Variant.Gvariant;
      Data      : System.Address);

Constants & Global variables

Null_Gaction_Map (Gaction_Map)

Null_Gaction_Map : constant Gaction_Map;

Subprograms & Entries

From_Object_Free

function From_Object_Free 
(B: access GAction_Entry) return GAction_Entry;

Get_Type

function Get_Type return Glib.GType;

Add_Action

procedure Add_Action 
(Self: Gaction_Map;
Action: Glib.Action.Gaction);

Add_Action_Entries

procedure Add_Action_Entries 
(Self: Gaction_Map;
Entries: GAction_Entry_Array;
User_Data: System.Address := System.Null_Address);
A convenience function for creating multiple Glib.Simple_Action.Gsimple_Action instances and adding them to a Glib.Action_Map.Gaction_Map. Each action is constructed as per one Glib.Action_Map.GAction_Entry. == Using Glib.Action_Map.Add_Action_Entries == static void activate_quit (GSimpleAction *simple, GVariant *parameter, gpointer user_data) { exit (0); } static void activate_print_string (GSimpleAction *simple, GVariant *parameter, gpointer user_data) { g_print ("%s\n", g_variant_get_string (parameter, NULL)); } static GActionGroup * create_action_group (void) { const GActionEntry entries[] = { { "quit", activate_quit }, { "print-string", activate_print_string, "s" } }; GSimpleActionGroup *group; group = g_simple_action_group_new (); g_action_map_add_action_entries (G_ACTION_MAP (group), entries, G_N_ELEMENTS (entries), NULL); return G_ACTION_GROUP (group); } Since: gtk+ 2.32 "entries": a pointer to the first item in an array of Glib.Action_Map.GAction_Entry structs "user_data": the user data for signal connections

Lookup_Action

function Lookup_Action 
(Self: Gaction_Map;
Action_Name: UTF8_String) return Glib.Action.Gaction;
Looks up the action with the name Action_Name in Action_Map. If no such action exists, returns null. Since: gtk+ 2.32 "action_name": the name of an action

Remove_Action

procedure Remove_Action 
(Self: Gaction_Map;
Action_Name: UTF8_String);
Removes the named action from the action map. If no action of this name is in the map then nothing happens. Since: gtk+ 2.32 "action_name": the name of the action

Build

function Build 
(Name: String;
Activate: Activate_Callback := null;
Parameter_Type: String := "";
State: String := "";
Change_State: Change_State_Callback := null) return GAction_Entry;
Return a newly allocation action entry. This will be freed by the the action_map when needed. Name is the name of the action. Activate is the callback to connect to the "activate" signal of the action. Parameter_Type is the type of the parameter that must be passed to the activate function for this action, given as a single Gvariant (or the empty string for no parameter). State is the initial state of this action, given in Gvariant text format. The state is parsed with no extra type information so type tags must be added to the string if they are necessary. Change_State is the callback for the "change-state" signal.

+

function "+" 
(W: Gaction_Map) return Gaction_Map;