[gnome-builder/wip/chergert/gobjgen: 1/2] egg-state-machine: use GPropertyAction instead of EggStateMachineAction



commit b80c982d202958c3abb3e7d2006f15c3dccebb58
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jul 22 13:40:53 2016 -0700

    egg-state-machine: use GPropertyAction instead of EggStateMachineAction
    
    This can be vastly simplified by using GPropertyAction instead of our
    custom action.

 contrib/egg/Makefile.am                   |    2 -
 contrib/egg/egg-private.h                 |    1 -
 contrib/egg/egg-state-machine-action.c    |  268 -----------------------------
 contrib/egg/egg-state-machine-action.h    |   37 ----
 contrib/egg/egg-state-machine-buildable.c |   13 ++
 contrib/egg/egg-state-machine.c           |    3 +-
 6 files changed, 14 insertions(+), 310 deletions(-)
---
diff --git a/contrib/egg/Makefile.am b/contrib/egg/Makefile.am
index 1d0e8b3..e462473 100644
--- a/contrib/egg/Makefile.am
+++ b/contrib/egg/Makefile.am
@@ -34,7 +34,6 @@ headers_DATA = \
        egg-simple-label.h \
        egg-simple-popover.h \
        egg-slider.h \
-       egg-state-machine-action.h \
        egg-state-machine-buildable.h \
        egg-state-machine.h \
        egg-task-cache.h \
@@ -68,7 +67,6 @@ libegg_private_la_SOURCES = \
        egg-simple-label.c \
        egg-simple-popover.c \
        egg-slider.c \
-       egg-state-machine-action.c \
        egg-state-machine-buildable.c \
        egg-state-machine.c \
        egg-task-cache.c \
diff --git a/contrib/egg/egg-private.h b/contrib/egg/egg-private.h
index 19a0aeb..4d216fc 100644
--- a/contrib/egg/egg-private.h
+++ b/contrib/egg/egg-private.h
@@ -29,7 +29,6 @@ G_BEGIN_DECLS
 #include "egg-search-bar.h"
 #include "egg-settings-sandwich.h"
 #include "egg-signal-group.h"
-#include "egg-state-machine-action.h"
 #include "egg-state-machine-buildable.h"
 #include "egg-state-machine.h"
 #include "egg-task-cache.h"
diff --git a/contrib/egg/egg-state-machine-buildable.c b/contrib/egg/egg-state-machine-buildable.c
index 1113805..1789f83 100644
--- a/contrib/egg/egg-state-machine-buildable.c
+++ b/contrib/egg/egg-state-machine-buildable.c
@@ -460,6 +460,7 @@ states_parser_start_element (GMarkupParseContext  *context,
   else if (g_strcmp0 (element_name, "property") == 0)
     {
       const gchar *name = NULL;
+      const gchar *translatable = NULL;
       const gchar *bind_source = NULL;
       const gchar *bind_property = NULL;
       const gchar *bind_flags_str = NULL;
@@ -470,12 +471,24 @@ states_parser_start_element (GMarkupParseContext  *context,
 
       if (!g_markup_collect_attributes (element_name, attribute_names, attribute_values, error,
                                         G_MARKUP_COLLECT_STRING, "name", &name,
+                                        G_MARKUP_COLLECT_STRING|G_MARKUP_COLLECT_OPTIONAL, "translatable", 
&translatable,
                                         G_MARKUP_COLLECT_STRING|G_MARKUP_COLLECT_OPTIONAL, "bind-source", 
&bind_source,
                                         G_MARKUP_COLLECT_STRING|G_MARKUP_COLLECT_OPTIONAL, "bind-property", 
&bind_property,
                                         G_MARKUP_COLLECT_STRING|G_MARKUP_COLLECT_OPTIONAL, "bind-flags", 
&bind_flags_str,
                                         G_MARKUP_COLLECT_INVALID))
         return;
 
+      if (name != NULL)
+        {
+          if (g_strcmp0 (translatable, "yes") == 0)
+            {
+              const gchar *domain;
+
+              domain = gtk_builder_get_translation_domain (parser_data->builder);
+              name = dgettext (domain, name);
+            }
+        }
+
       if ((bind_flags_str != NULL) && !flags_from_string (G_TYPE_BINDING_FLAGS, bind_flags_str, &bind_flags, 
error))
         return;
 
diff --git a/contrib/egg/egg-state-machine.c b/contrib/egg/egg-state-machine.c
index a9d6830..989eccc 100644
--- a/contrib/egg/egg-state-machine.c
+++ b/contrib/egg/egg-state-machine.c
@@ -25,7 +25,6 @@
 #include "egg-signal-group.h"
 
 #include "egg-state-machine.h"
-#include "egg-state-machine-action.h"
 #include "egg-state-machine-buildable.h"
 
 G_DEFINE_QUARK (egg_state_machine_error, egg_state_machine_error)
@@ -532,7 +531,7 @@ egg_state_machine_create_action (EggStateMachine *self,
   g_return_val_if_fail (EGG_IS_STATE_MACHINE (self), NULL);
   g_return_val_if_fail (name != NULL, NULL);
 
-  return egg_state_machine_action_new (self, name);
+  return G_ACTION (g_property_action_new (name, self, "state"));
 }
 
 void


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