[libdazzle] action-group: set initial state for action



commit 2aad4470b0a02d57ba300216c9e76fcdd3fa2a78
Author: Christian Hergert <chergert redhat com>
Date:   Sat Feb 24 20:09:07 2018 -0800

    action-group: set initial state for action

 src/actions/dzl-action-group.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/src/actions/dzl-action-group.h b/src/actions/dzl-action-group.h
index 1cd45ab..35a1154 100644
--- a/src/actions/dzl-action-group.h
+++ b/src/actions/dzl-action-group.h
@@ -81,6 +81,16 @@ _##prefix##_get_action_info (GActionGroup *group,
     {                                                                             \
       info = g_slice_new0 (Type##ActionInfo);                                     \
       info->enabled = TRUE;                                                       \
+      for (guint i = 0; i < G_N_ELEMENTS(prefix##_actions); i++)                  \
+        {                                                                         \
+          if (g_strcmp0 (prefix##_actions[i].name, name) == 0)                    \
+            {                                                                     \
+              if (prefix##_actions[i].state != NULL)                              \
+                info->state = g_variant_take_ref (g_variant_parse (               \
+                  NULL, prefix##_actions[i].state, NULL, NULL, NULL));            \
+              break;                                                              \
+            }                                                                     \
+        }                                                                         \
       g_object_set_data_full (G_OBJECT (group), fullname, info,                   \
                               _##prefix##_action_info_free);                      \
     }                                                                             \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]