Rename methods on GActionGroup to include 'action'
authorRyan Lortie <desrt@desrt.ca>
Mon, 11 Oct 2010 14:45:51 +0000 (10:45 -0400)
committerRyan Lortie <desrt@desrt.ca>
Mon, 18 Oct 2010 23:16:46 +0000 (01:16 +0200)
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()).

gio/gactiongroup.c
gio/gactiongroup.h
gio/gapplication.c
gio/gsimpleactiongroup.c
gio/tests/actions.c

index 1ee824f22cf8601488c6679b82f14dd35bd150dd..bbba77ebb8545384eb75e9cfecc53898dc0b8902 100644 (file)
@@ -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);
 }
 
 /**
index 590e9ae45b12a6431b10d230427ff7b3df05ed62..300d41520933c74b47e08fff488df4264d033b06 100644 (file)
@@ -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);
 
index e78edd1c5d1c7bd238caf620491380a88b45f47e..643cd203aa019bf29d53b28c76e2f90cb46ac930 100644 (file)
@@ -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 */
index dd170223edefb84620f7631b1186073f346f0c9d..1c40a267b223c6094b9771c7e6ea8bcbd0b910f3 100644 (file)
@@ -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;
 }
 
 /**
index 436b0e13e55e661eba860b98c81d47904d2166a8..9c8fbd549f1dce987d04d2b244aae6c4262b5cee 100644 (file)
@@ -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");