Commit d6ac6c18 authored by Allison Karlitskaya's avatar Allison Karlitskaya

Rename methods on GActionGroup to include 'action'

Makes explicit the fact that you are interacting with the individual
action rather than the group and removes potential namespace conflicts
with classes implementing the interface (like g_application_activate()
vs g_application_activate_action()).
parent b2f942c1
......@@ -219,13 +219,13 @@ g_action_group_has_action (GActionGroup *action_group,
* Since: 2.26
**/
const GVariantType *
g_action_group_get_parameter_type (GActionGroup *action_group,
const gchar *action_name)
g_action_group_get_action_parameter_type (GActionGroup *action_group,
const gchar *action_name)
{
g_return_val_if_fail (G_IS_ACTION_GROUP (action_group), NULL);
return G_ACTION_GROUP_GET_IFACE (action_group)
->get_parameter_type (action_group, action_name);
->get_action_parameter_type (action_group, action_name);
}
/**
......@@ -254,13 +254,13 @@ g_action_group_get_parameter_type (GActionGroup *action_group,
* Since: 2.26
**/
const GVariantType *
g_action_group_get_state_type (GActionGroup *action_group,
const gchar *action_name)
g_action_group_get_action_state_type (GActionGroup *action_group,
const gchar *action_name)
{
g_return_val_if_fail (G_IS_ACTION_GROUP (action_group), NULL);
return G_ACTION_GROUP_GET_IFACE (action_group)
->get_state_type (action_group, action_name);
->get_action_state_type (action_group, action_name);
}
/**
......@@ -292,13 +292,13 @@ g_action_group_get_state_type (GActionGroup *action_group,
* Since: 2.26
**/
GVariant *
g_action_group_get_state_hint (GActionGroup *action_group,
const gchar *action_name)
g_action_group_get_action_state_hint (GActionGroup *action_group,
const gchar *action_name)
{
g_return_val_if_fail (G_IS_ACTION_GROUP (action_group), NULL);
return G_ACTION_GROUP_GET_IFACE (action_group)
->get_state_hint (action_group, action_name);
->get_action_state_hint (action_group, action_name);
}
/**
......@@ -316,13 +316,13 @@ g_action_group_get_state_hint (GActionGroup *action_group,
* Since: 2.26
**/
gboolean
g_action_group_get_enabled (GActionGroup *action_group,
const gchar *action_name)
g_action_group_get_action_enabled (GActionGroup *action_group,
const gchar *action_name)
{
g_return_val_if_fail (G_IS_ACTION_GROUP (action_group), FALSE);
return G_ACTION_GROUP_GET_IFACE (action_group)
->get_enabled (action_group, action_name);
->get_action_enabled (action_group, action_name);
}
/**
......@@ -344,13 +344,13 @@ g_action_group_get_enabled (GActionGroup *action_group,
* Since: 2.26
**/
GVariant *
g_action_group_get_state (GActionGroup *action_group,
const gchar *action_name)
g_action_group_get_action_state (GActionGroup *action_group,
const gchar *action_name)
{
g_return_val_if_fail (G_IS_ACTION_GROUP (action_group), NULL);
return G_ACTION_GROUP_GET_IFACE (action_group)
->get_state (action_group, action_name);
->get_action_state (action_group, action_name);
}
/**
......@@ -374,16 +374,16 @@ g_action_group_get_state (GActionGroup *action_group,
* Since: 2.26
**/
void
g_action_group_set_state (GActionGroup *action_group,
const gchar *action_name,
GVariant *value)
g_action_group_change_action_state (GActionGroup *action_group,
const gchar *action_name,
GVariant *value)
{
g_return_if_fail (G_IS_ACTION_GROUP (action_group));
g_return_if_fail (action_name != NULL);
g_return_if_fail (value != NULL);
G_ACTION_GROUP_GET_IFACE (action_group)
->set_state (action_group, action_name, value);
->change_action_state (action_group, action_name, value);
}
/**
......@@ -402,15 +402,15 @@ g_action_group_set_state (GActionGroup *action_group,
* Since: 2.26
**/
void
g_action_group_activate (GActionGroup *action_group,
const gchar *action_name,
GVariant *parameter)
g_action_group_activate_action (GActionGroup *action_group,
const gchar *action_name,
GVariant *parameter)
{
g_return_if_fail (G_IS_ACTION_GROUP (action_group));
g_return_if_fail (action_name != NULL);
G_ACTION_GROUP_GET_IFACE (action_group)
->activate (action_group, action_name, parameter);
->activate_action (action_group, action_name, parameter);
}
/**
......
......@@ -65,42 +65,42 @@ struct _GActionGroupInterface
GTypeInterface g_iface;
/* virtual functions */
gboolean (* has_action) (GActionGroup *action_group,
const gchar *action_name);
gboolean (* has_action) (GActionGroup *action_group,
const gchar *action_name);
gchar ** (* list_actions) (GActionGroup *action_group);
gchar ** (* list_actions) (GActionGroup *action_group);
gboolean (* get_enabled) (GActionGroup *action_group,
const gchar *action_name);
gboolean (* get_action_enabled) (GActionGroup *action_group,
const gchar *action_name);
const GVariantType * (* get_parameter_type) (GActionGroup *action_group,
const gchar *action_name);
const GVariantType * (* get_action_parameter_type) (GActionGroup *action_group,
const gchar *action_name);
const GVariantType * (* get_state_type) (GActionGroup *action_group,
const gchar *action_name);
const GVariantType * (* get_action_state_type) (GActionGroup *action_group,
const gchar *action_name);
GVariant * (* get_state_hint) (GActionGroup *action_group,
const gchar *action_name);
GVariant * (* get_action_state_hint) (GActionGroup *action_group,
const gchar *action_name);
GVariant * (* get_state) (GActionGroup *action_group,
const gchar *action_name);
GVariant * (* get_action_state) (GActionGroup *action_group,
const gchar *action_name);
void (* set_state) (GActionGroup *action_group,
const gchar *action_name,
GVariant *value);
void (* change_action_state) (GActionGroup *action_group,
const gchar *action_name,
GVariant *value);
void (* activate) (GActionGroup *action_group,
const gchar *action_name,
GVariant *parameter);
void (* activate_action) (GActionGroup *action_group,
const gchar *action_name,
GVariant *parameter);
/* signals */
void (* action_added) (GActionGroup *action_group,
const gchar *action_name);
void (* action_removed) (GActionGroup *action_group,
const gchar *action_name);
void (* action_enabled_changed) (GActionGroup *action_group,
const gchar *action_name,
gboolean enabled);
void (* action_added) (GActionGroup *action_group,
const gchar *action_name);
void (* action_removed) (GActionGroup *action_group,
const gchar *action_name);
void (* action_enabled_changed) (GActionGroup *action_group,
const gchar *action_name,
gboolean enabled);
void (* action_state_changed) (GActionGroup *action_group,
const gchar *action_name,
GVariant *value);
......@@ -112,23 +112,23 @@ gboolean g_action_group_has_action (GAction
const gchar *action_name);
gchar ** g_action_group_list_actions (GActionGroup *action_group);
const GVariantType * g_action_group_get_parameter_type (GActionGroup *action_group,
const GVariantType * g_action_group_get_action_parameter_type (GActionGroup *action_group,
const gchar *action_name);
const GVariantType * g_action_group_get_state_type (GActionGroup *action_group,
const GVariantType * g_action_group_get_action_state_type (GActionGroup *action_group,
const gchar *action_name);
GVariant * g_action_group_get_state_hint (GActionGroup *action_group,
GVariant * g_action_group_get_action_state_hint (GActionGroup *action_group,
const gchar *action_name);
gboolean g_action_group_get_enabled (GActionGroup *action_group,
gboolean g_action_group_get_action_enabled (GActionGroup *action_group,
const gchar *action_name);
GVariant * g_action_group_get_state (GActionGroup *action_group,
GVariant * g_action_group_get_action_state (GActionGroup *action_group,
const gchar *action_name);
void g_action_group_set_state (GActionGroup *action_group,
void g_action_group_change_action_state (GActionGroup *action_group,
const gchar *action_name,
GVariant *value);
void g_action_group_activate (GActionGroup *action_group,
void g_action_group_activate_action (GActionGroup *action_group,
const gchar *action_name,
GVariant *parameter);
......
......@@ -1147,13 +1147,13 @@ g_application_action_group_iface_init (GActionGroupInterface *iface)
iface->has_action = g_application_has_action;
iface->list_actions = g_application_list_actions;
iface->get_enabled = g_application_get_action_enabled;
iface->get_parameter_type = g_application_get_action_parameter_type;
iface->get_state_type = g_application_get_action_state_type;
iface->get_state_hint = g_application_get_action_state_hint;
iface->get_state = g_application_get_action_state;
iface->set_state = g_application_change_action_state;
iface->activate = g_application_activate_action;
iface->get_action_enabled = g_application_get_action_enabled;
iface->get_action_parameter_type = g_application_get_action_parameter_type;
iface->get_action_state_type = g_application_get_action_state_type;
iface->get_action_state_hint = g_application_get_action_state_hint;
iface->get_action_state = g_application_get_action_state;
iface->change_action_state = g_application_change_action_state;
iface->activate_action = g_application_activate_action;
}
/* Epilogue {{{1 */
......
......@@ -253,13 +253,13 @@ g_simple_action_group_iface_init (GActionGroupInterface *iface)
{
iface->list_actions = g_simple_action_group_list_actions;
iface->has_action = g_simple_action_group_has_action;
iface->get_parameter_type = g_simple_action_group_get_parameter_type;
iface->get_state_type = g_simple_action_group_get_state_type;
iface->get_state_hint = g_simple_action_group_get_state_hint;
iface->get_enabled = g_simple_action_group_get_enabled;
iface->get_state = g_simple_action_group_get_state;
iface->set_state = g_simple_action_group_set_state;
iface->activate = g_simple_action_group_activate;
iface->get_action_parameter_type = g_simple_action_group_get_parameter_type;
iface->get_action_state_type = g_simple_action_group_get_state_type;
iface->get_action_state_hint = g_simple_action_group_get_state_hint;
iface->get_action_enabled = g_simple_action_group_get_enabled;
iface->get_action_state = g_simple_action_group_get_state;
iface->change_action_state = g_simple_action_group_set_state;
iface->activate_action = g_simple_action_group_activate;
}
/**
......
......@@ -166,7 +166,7 @@ test_simple_group (void)
g_object_unref (simple);
g_assert (!a.did_run);
g_action_group_activate (G_ACTION_GROUP (group), "foo", NULL);
g_action_group_activate_action (G_ACTION_GROUP (group), "foo", NULL);
g_assert (a.did_run);
simple = g_simple_action_new_stateful ("bar", G_VARIANT_TYPE_STRING, g_variant_new_string ("hihi"));
......@@ -180,28 +180,28 @@ test_simple_group (void)
g_assert_cmpint (g_strv_length (actions), ==, 2);
g_assert (strv_set_equal (actions, "foo", "bar", NULL));
g_strfreev (actions);
g_assert (g_action_group_get_enabled (G_ACTION_GROUP (group), "foo"));
g_assert (g_action_group_get_enabled (G_ACTION_GROUP (group), "bar"));
g_assert (g_action_group_get_parameter_type (G_ACTION_GROUP (group), "foo") == NULL);
g_assert (g_variant_type_equal (g_action_group_get_parameter_type (G_ACTION_GROUP (group), "bar"), G_VARIANT_TYPE_STRING));
g_assert (g_action_group_get_state_type (G_ACTION_GROUP (group), "foo") == NULL);
g_assert (g_variant_type_equal (g_action_group_get_state_type (G_ACTION_GROUP (group), "bar"), G_VARIANT_TYPE_STRING));
g_assert (g_action_group_get_state_hint (G_ACTION_GROUP (group), "foo") == NULL);
g_assert (g_action_group_get_state_hint (G_ACTION_GROUP (group), "bar") == NULL);
g_assert (g_action_group_get_state (G_ACTION_GROUP (group), "foo") == NULL);
state = g_action_group_get_state (G_ACTION_GROUP (group), "bar");
g_assert (g_action_group_get_action_enabled (G_ACTION_GROUP (group), "foo"));
g_assert (g_action_group_get_action_enabled (G_ACTION_GROUP (group), "bar"));
g_assert (g_action_group_get_action_parameter_type (G_ACTION_GROUP (group), "foo") == NULL);
g_assert (g_variant_type_equal (g_action_group_get_action_parameter_type (G_ACTION_GROUP (group), "bar"), G_VARIANT_TYPE_STRING));
g_assert (g_action_group_get_action_state_type (G_ACTION_GROUP (group), "foo") == NULL);
g_assert (g_variant_type_equal (g_action_group_get_action_state_type (G_ACTION_GROUP (group), "bar"), G_VARIANT_TYPE_STRING));
g_assert (g_action_group_get_action_state_hint (G_ACTION_GROUP (group), "foo") == NULL);
g_assert (g_action_group_get_action_state_hint (G_ACTION_GROUP (group), "bar") == NULL);
g_assert (g_action_group_get_action_state (G_ACTION_GROUP (group), "foo") == NULL);
state = g_action_group_get_action_state (G_ACTION_GROUP (group), "bar");
g_assert (g_variant_type_equal (g_variant_get_type (state), G_VARIANT_TYPE_STRING));
g_assert_cmpstr (g_variant_get_string (state, NULL), ==, "hihi");
g_variant_unref (state);
g_action_group_set_state (G_ACTION_GROUP (group), "bar", g_variant_new_string ("boo"));
state = g_action_group_get_state (G_ACTION_GROUP (group), "bar");
g_action_group_change_action_state (G_ACTION_GROUP (group), "bar", g_variant_new_string ("boo"));
state = g_action_group_get_action_state (G_ACTION_GROUP (group), "bar");
g_assert_cmpstr (g_variant_get_string (state, NULL), ==, "boo");
g_variant_unref (state);
action = g_simple_action_group_lookup (group, "bar");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
g_assert (!g_action_group_get_enabled (G_ACTION_GROUP (group), "bar"));
g_assert (!g_action_group_get_action_enabled (G_ACTION_GROUP (group), "bar"));
g_simple_action_group_remove (group, "bar");
action = g_simple_action_group_lookup (group, "foo");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment