Remove serialization code for EekKey, EekSection, and EekKeyboard.
This commit is contained in:
@ -37,7 +37,6 @@
|
||||
#include "eek-section.h"
|
||||
#include "eek-key.h"
|
||||
#include "eek-symbol.h"
|
||||
#include "eek-serializable.h"
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
@ -53,11 +52,7 @@ enum {
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0, };
|
||||
|
||||
static void eek_serializable_iface_init (EekSerializableIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (EekSection, eek_section, EEK_TYPE_CONTAINER,
|
||||
G_IMPLEMENT_INTERFACE (EEK_TYPE_SERIALIZABLE,
|
||||
eek_serializable_iface_init));
|
||||
G_DEFINE_TYPE (EekSection, eek_section, EEK_TYPE_CONTAINER);
|
||||
|
||||
#define EEK_SECTION_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_SECTION, EekSectionPrivate))
|
||||
@ -77,80 +72,6 @@ struct _EekSectionPrivate
|
||||
EekModifierType modifiers;
|
||||
};
|
||||
|
||||
static EekSerializableIface *eek_section_parent_serializable_iface;
|
||||
|
||||
static GVariant *
|
||||
_g_variant_new_row (EekRow *row)
|
||||
{
|
||||
GVariantBuilder builder;
|
||||
|
||||
g_variant_builder_init (&builder, G_VARIANT_TYPE ("(iu)"));
|
||||
g_variant_builder_add (&builder, "i", row->num_columns);
|
||||
g_variant_builder_add (&builder, "u", row->orientation);
|
||||
|
||||
return g_variant_builder_end (&builder);
|
||||
}
|
||||
|
||||
static EekRow *
|
||||
_g_variant_get_row (GVariant *variant)
|
||||
{
|
||||
EekRow *row = g_slice_new (EekRow);
|
||||
g_variant_get_child (variant, 0, "i", &row->num_columns);
|
||||
g_variant_get_child (variant, 1, "u", &row->orientation);
|
||||
return row;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_section_real_serialize (EekSerializable *self,
|
||||
GVariantBuilder *builder)
|
||||
{
|
||||
EekSectionPrivate *priv = EEK_SECTION_GET_PRIVATE(self);
|
||||
GSList *head;
|
||||
GVariantBuilder array;
|
||||
|
||||
eek_section_parent_serializable_iface->serialize (self, builder);
|
||||
|
||||
g_variant_builder_add (builder, "i", priv->angle);
|
||||
|
||||
g_variant_builder_init (&array, G_VARIANT_TYPE("av"));
|
||||
for (head = priv->rows; head; head = g_slist_next (head))
|
||||
g_variant_builder_add (&array, "v", _g_variant_new_row (head->data));
|
||||
g_variant_builder_add (builder, "v", g_variant_builder_end (&array));
|
||||
}
|
||||
|
||||
static gsize
|
||||
eek_section_real_deserialize (EekSerializable *self,
|
||||
GVariant *variant,
|
||||
gsize index)
|
||||
{
|
||||
EekSectionPrivate *priv = EEK_SECTION_GET_PRIVATE(self);
|
||||
GVariant *array, *child;
|
||||
GVariantIter iter;
|
||||
|
||||
index = eek_section_parent_serializable_iface->deserialize (self,
|
||||
variant,
|
||||
index);
|
||||
|
||||
g_variant_get_child (variant, index++, "i", &priv->angle);
|
||||
g_variant_get_child (variant, index++, "v", &array);
|
||||
g_variant_iter_init (&iter, array);
|
||||
while (g_variant_iter_next (&iter, "v", &child))
|
||||
priv->rows = g_slist_prepend (priv->rows, _g_variant_get_row (child));
|
||||
priv->rows = g_slist_reverse (priv->rows);
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_serializable_iface_init (EekSerializableIface *iface)
|
||||
{
|
||||
eek_section_parent_serializable_iface =
|
||||
g_type_interface_peek_parent (iface);
|
||||
|
||||
iface->serialize = eek_section_real_serialize;
|
||||
iface->deserialize = eek_section_real_deserialize;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_section_real_set_angle (EekSection *self,
|
||||
gint angle)
|
||||
|
||||
Reference in New Issue
Block a user