- GVariantIter *iter;
- const gchar *name;
-
- g_variant_get_child (parameters, 0, "as", &iter);
- while (g_variant_iter_next (iter, "&s", &name))
- if (g_hash_table_remove (impl->actions, name))
- g_action_group_action_removed (action_group, name);
- g_variant_iter_free (iter);
- }
-
- else if (strcmp (signal_name, "EnabledChanged") == 0 &&
- g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(sb)")))
- {
- RemoteActionInfo *info;
- const gchar *name;
- gboolean enabled;
-
- g_variant_get (parameters, "(&sb)", &name, &enabled);
- info = g_hash_table_lookup (impl->actions, name);
-
- if (info && enabled != info->enabled)
- {
- info->enabled = enabled;
- g_action_group_action_enabled_changed (action_group,
- info->name,
- enabled);
- }
- }
-
- else if (strcmp (signal_name, "StateChanged") == 0 &&
- g_variant_is_of_type (parameters, G_VARIANT_TYPE ("(sv)")))
- {
- RemoteActionInfo *info;
- const gchar *name;
- GVariant *state;
-
- g_variant_get (parameters, "(&sv)", &name, &state);
- info = g_hash_table_lookup (impl->actions, name);
-
- if (info && info->state &&
- g_variant_is_of_type (state, g_variant_get_type (info->state)) &&
- !g_variant_equal (state, info->state))
- {
- g_variant_unref (info->state);
- info->state = g_variant_ref (state);
- g_action_group_action_state_changed (action_group,
- info->name,
- state);
- }
- g_variant_unref (state);
+ /* Removes */
+ {
+ GVariantIter *iter;
+ const gchar *name;
+
+ g_variant_get_child (parameters, 0, "as", &iter);
+ while (g_variant_iter_next (iter, "&s", &name))
+ {
+ if (g_hash_table_lookup (impl->actions, name))
+ {
+ g_hash_table_remove (impl->actions, name);
+ g_action_group_action_removed (action_group, name);
+ }
+ }
+ g_variant_iter_free (iter);
+ }
+
+ /* Enable changes */
+ {
+ GVariantIter *iter;
+ const gchar *name;
+ gboolean enabled;
+
+ g_variant_get_child (parameters, 1, "a{sb}", &iter);
+ while (g_variant_iter_next (iter, "{&sb}", &name, &enabled))
+ {
+ RemoteActionInfo *info;
+
+ info = g_hash_table_lookup (impl->actions, name);
+
+ if (info && info->enabled != enabled)
+ {
+ info->enabled = enabled;
+ g_action_group_action_enabled_changed (action_group,
+ name, enabled);
+ }
+ }
+ g_variant_iter_free (iter);
+ }
+
+ /* State changes */
+ {
+ GVariantIter *iter;
+ const gchar *name;
+ GVariant *state;
+
+ g_variant_get_child (parameters, 2, "a{sv}", &iter);
+ while (g_variant_iter_next (iter, "{&sv}", &name, &state))
+ {
+ RemoteActionInfo *info;
+
+ info = g_hash_table_lookup (impl->actions, name);
+
+ if (info && info->state && !g_variant_equal (state, info->state) &&
+ g_variant_is_of_type (state, g_variant_get_type (info->state)))
+ {
+ g_variant_unref (info->state);
+ info->state = g_variant_ref (state);
+
+ g_action_group_action_state_changed (action_group, name, state);
+ }
+
+ g_variant_unref (state);
+ }
+ g_variant_iter_free (iter);
+ }
+
+ /* Additions */
+ {
+ RemoteActionInfo *info;
+ GVariantIter *iter;
+
+ g_variant_get_child (parameters, 3, "a{s(bgav)}", &iter);
+ while ((info = remote_action_info_new_from_iter (iter)))
+ {
+ if (!g_hash_table_lookup (impl->actions, info->name))
+ g_hash_table_replace (impl->actions, info->name, info);
+ else
+ remote_action_info_free (info);
+ }
+ }