aboutsummaryrefslogtreecommitdiffstats
path: root/src/interfaces
diff options
context:
space:
mode:
authorkremlin <ian@kremlin.cc>2014-07-15 12:51:11 +0800
committerkremlin <ian@kremlin.cc>2014-07-15 12:51:11 +0800
commit84e53e4b86f6e10fe0fc4d8a7cb92cf73ffe8b66 (patch)
tree4f1dc831df5ae71f226cbb5e3ed32712377bd920 /src/interfaces
parente0f1d46947781bc131012fc9a99b9c9f8c1b14c8 (diff)
downloadsystembsd-84e53e4b86f6e10fe0fc4d8a7cb92cf73ffe8b66.tar
systembsd-84e53e4b86f6e10fe0fc4d8a7cb92cf73ffe8b66.tar.gz
systembsd-84e53e4b86f6e10fe0fc4d8a7cb92cf73ffe8b66.tar.bz2
systembsd-84e53e4b86f6e10fe0fc4d8a7cb92cf73ffe8b66.tar.lz
systembsd-84e53e4b86f6e10fe0fc4d8a7cb92cf73ffe8b66.tar.xz
systembsd-84e53e4b86f6e10fe0fc4d8a7cb92cf73ffe8b66.tar.zst
systembsd-84e53e4b86f6e10fe0fc4d8a7cb92cf73ffe8b66.zip
untouched genfiles now work with linking system, revert localed-gen.c
previously you needed to edit genfiles as to not re-implement boilerplate methods. linking (instead of #include'ing) avoids this and allows genfiles to work without edit, as intended.
Diffstat (limited to 'src/interfaces')
-rw-r--r--src/interfaces/localed/localed-gen.c133
1 files changed, 133 insertions, 0 deletions
diff --git a/src/interfaces/localed/localed-gen.c b/src/interfaces/localed/localed-gen.c
index 2a1913f..bfb0f81 100644
--- a/src/interfaces/localed/localed-gen.c
+++ b/src/interfaces/localed/localed-gen.c
@@ -15,6 +15,139 @@
# include <gio/gunixfdlist.h>
#endif
+typedef struct
+{
+ GDBusArgInfo parent_struct;
+ gboolean use_gvariant;
+} _ExtendedGDBusArgInfo;
+
+typedef struct
+{
+ GDBusMethodInfo parent_struct;
+ const gchar *signal_name;
+ gboolean pass_fdlist;
+} _ExtendedGDBusMethodInfo;
+
+typedef struct
+{
+ GDBusSignalInfo parent_struct;
+ const gchar *signal_name;
+} _ExtendedGDBusSignalInfo;
+
+typedef struct
+{
+ GDBusPropertyInfo parent_struct;
+ const gchar *hyphen_name;
+ gboolean use_gvariant;
+} _ExtendedGDBusPropertyInfo;
+
+typedef struct
+{
+ GDBusInterfaceInfo parent_struct;
+ const gchar *hyphen_name;
+} _ExtendedGDBusInterfaceInfo;
+
+typedef struct
+{
+ const _ExtendedGDBusPropertyInfo *info;
+ guint prop_id;
+ GValue orig_value; /* the value before the change */
+} ChangedProperty;
+
+static void
+_changed_property_free (ChangedProperty *data)
+{
+ g_value_unset (&data->orig_value);
+ g_free (data);
+}
+
+static gboolean
+_g_strv_equal0 (gchar **a, gchar **b)
+{
+ gboolean ret = FALSE;
+ guint n;
+ if (a == NULL && b == NULL)
+ {
+ ret = TRUE;
+ goto out;
+ }
+ if (a == NULL || b == NULL)
+ goto out;
+ if (g_strv_length (a) != g_strv_length (b))
+ goto out;
+ for (n = 0; a[n] != NULL; n++)
+ if (g_strcmp0 (a[n], b[n]) != 0)
+ goto out;
+ ret = TRUE;
+out:
+ return ret;
+}
+
+static gboolean
+_g_variant_equal0 (GVariant *a, GVariant *b)
+{
+ gboolean ret = FALSE;
+ if (a == NULL && b == NULL)
+ {
+ ret = TRUE;
+ goto out;
+ }
+ if (a == NULL || b == NULL)
+ goto out;
+ ret = g_variant_equal (a, b);
+out:
+ return ret;
+}
+
+G_GNUC_UNUSED static gboolean
+_g_value_equal (const GValue *a, const GValue *b)
+{
+ gboolean ret = FALSE;
+ g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
+ switch (G_VALUE_TYPE (a))
+ {
+ case G_TYPE_BOOLEAN:
+ ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
+ break;
+ case G_TYPE_UCHAR:
+ ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
+ break;
+ case G_TYPE_INT:
+ ret = (g_value_get_int (a) == g_value_get_int (b));
+ break;
+ case G_TYPE_UINT:
+ ret = (g_value_get_uint (a) == g_value_get_uint (b));
+ break;
+ case G_TYPE_INT64:
+ ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
+ break;
+ case G_TYPE_UINT64:
+ ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
+ break;
+ case G_TYPE_DOUBLE:
+ {
+ /* Avoid -Wfloat-equal warnings by doing a direct bit compare */
+ gdouble da = g_value_get_double (a);
+ gdouble db = g_value_get_double (b);
+ ret = memcmp (&da, &db, sizeof (gdouble)) == 0;
+ }
+ break;
+ case G_TYPE_STRING:
+ ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
+ break;
+ case G_TYPE_VARIANT:
+ ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
+ break;
+ default:
+ if (G_VALUE_TYPE (a) == G_TYPE_STRV)
+ ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
+ else
+ g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
+ break;
+ }
+ return ret;
+}
+
/* ------------------------------------------------------------------------
* Code for interface org.freedesktop.locale1
* ------------------------------------------------------------------------