Method

GioActionMapadd_action_entries

since: 2.32

Declaration [src]

void
g_action_map_add_action_entries (
  GActionMap* action_map,
  const GActionEntry* entries,
  gint n_entries,
  gpointer user_data
)

Description [src]

A convenience function for creating multiple GSimpleAction instances and adding them to a GActionMap.

Each action is constructed as per one GActionEntry.

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);
}

Available since: 2.32

Parameters

entries

Type: An array of None

A pointer to the first item in an array of GActionEntry structs.

The length of the array is specified in the n_entries argument.
The data is owned by the caller of the method.
n_entries

Type: gint

The length of entries, or -1 if entries is NULL-terminated.

user_data

Type: gpointer

The user data for signal connections.

The argument can be NULL.
The data is owned by the caller of the method.