mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 04:22:05 +00:00
Merge branch 'system-json-glib'
* system-json-glib: [script] Simplify the parser code Update JSON-GLib dependency
This commit is contained in:
commit
d0748b3b9b
@ -244,6 +244,9 @@ BUILT_GIRSOURCES =
|
|||||||
|
|
||||||
if LOCAL_JSON_GLIB
|
if LOCAL_JSON_GLIB
|
||||||
json_gir_include_path=--add-include-path=json
|
json_gir_include_path=--add-include-path=json
|
||||||
|
json_gir_include=--include=ClutterJson-@CLUTTER_API_VERSION@
|
||||||
|
else
|
||||||
|
json_gir_include=--include=Json-1.0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# We can't reference the list of COGL header files, since they are in a
|
# We can't reference the list of COGL header files, since they are in a
|
||||||
@ -261,7 +264,7 @@ Clutter-@CLUTTER_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libclutter-@CLUTTER_
|
|||||||
--include=Pango-1.0 \
|
--include=Pango-1.0 \
|
||||||
--include=PangoCairo-1.0 \
|
--include=PangoCairo-1.0 \
|
||||||
--include=Cogl-@CLUTTER_API_VERSION@ \
|
--include=Cogl-@CLUTTER_API_VERSION@ \
|
||||||
--include=ClutterJson-@CLUTTER_API_VERSION@ \
|
$(json_gir_include) \
|
||||||
--library=clutter-@CLUTTER_FLAVOUR@-@CLUTTER_API_VERSION@ \
|
--library=clutter-@CLUTTER_FLAVOUR@-@CLUTTER_API_VERSION@ \
|
||||||
--libtool="$(top_builddir)/libtool" \
|
--libtool="$(top_builddir)/libtool" \
|
||||||
--pkg gobject-2.0 \
|
--pkg gobject-2.0 \
|
||||||
|
@ -281,11 +281,7 @@ get_id_from_node (JsonNode *node)
|
|||||||
case JSON_NODE_OBJECT:
|
case JSON_NODE_OBJECT:
|
||||||
object = json_node_get_object (node);
|
object = json_node_get_object (node);
|
||||||
if (json_object_has_member (object, "id"))
|
if (json_object_has_member (object, "id"))
|
||||||
{
|
return json_object_get_string_member (object, "id");
|
||||||
JsonNode *id = json_object_get_member (object, "id");
|
|
||||||
|
|
||||||
return json_node_get_string (id);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JSON_NODE_VALUE:
|
case JSON_NODE_VALUE:
|
||||||
@ -372,11 +368,8 @@ parse_signals (ClutterScript *script,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
val = json_object_get_member (object, "name");
|
name = json_object_get_string_member (object, "name");
|
||||||
if ((JSON_NODE_TYPE (val) == JSON_NODE_VALUE) &&
|
if (!name)
|
||||||
json_node_get_string (val) != NULL)
|
|
||||||
name = json_node_get_string (val);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
warn_invalid_value (script, "name", "string", val);
|
warn_invalid_value (script, "name", "string", val);
|
||||||
continue;
|
continue;
|
||||||
@ -391,11 +384,8 @@ parse_signals (ClutterScript *script,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
val = json_object_get_member (object, "handler");
|
handler = json_object_get_string_member (object, "handler");
|
||||||
if ((JSON_NODE_TYPE (val) == JSON_NODE_VALUE) &&
|
if (!handler)
|
||||||
json_node_get_string (val) != NULL)
|
|
||||||
handler = json_node_get_string (val);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
warn_invalid_value (script, "handler", "string", val);
|
warn_invalid_value (script, "handler", "string", val);
|
||||||
continue;
|
continue;
|
||||||
@ -404,30 +394,21 @@ parse_signals (ClutterScript *script,
|
|||||||
|
|
||||||
/* optional: "object" */
|
/* optional: "object" */
|
||||||
if (json_object_has_member (object, "object"))
|
if (json_object_has_member (object, "object"))
|
||||||
{
|
connect = json_object_get_string_member (object, "object");
|
||||||
val = json_object_get_member (object, "object");
|
|
||||||
if ((JSON_NODE_TYPE (val) == JSON_NODE_VALUE) &&
|
|
||||||
json_node_get_string (val) != NULL)
|
|
||||||
connect = json_node_get_string (val);
|
|
||||||
else
|
|
||||||
connect = NULL;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
connect = NULL;
|
connect = NULL;
|
||||||
|
|
||||||
/* optional: "after" */
|
/* optional: "after" */
|
||||||
if (json_object_has_member (object, "after"))
|
if (json_object_has_member (object, "after"))
|
||||||
{
|
{
|
||||||
val = json_object_get_member (object, "after");
|
if (json_object_get_boolean_member (object, "after"))
|
||||||
if (json_node_get_boolean (val))
|
|
||||||
flags |= G_CONNECT_AFTER;
|
flags |= G_CONNECT_AFTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* optional: "swapped" */
|
/* optional: "swapped" */
|
||||||
if (json_object_has_member (object, "swapped"))
|
if (json_object_has_member (object, "swapped"))
|
||||||
{
|
{
|
||||||
val = json_object_get_member (object, "swapped");
|
if (json_object_get_boolean_member (object, "swapped"))
|
||||||
if (json_node_get_boolean (val))
|
|
||||||
flags |= G_CONNECT_SWAPPED;
|
flags |= G_CONNECT_SWAPPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -764,8 +745,8 @@ json_object_end (JsonParser *parser,
|
|||||||
if (strcmp (oinfo->class_name, "ClutterStage") == 0 &&
|
if (strcmp (oinfo->class_name, "ClutterStage") == 0 &&
|
||||||
json_object_has_member (object, "is-default"))
|
json_object_has_member (object, "is-default"))
|
||||||
{
|
{
|
||||||
val = json_object_get_member (object, "is-default");
|
oinfo->is_stage_default =
|
||||||
oinfo->is_stage_default = json_node_get_boolean (val);
|
json_object_get_boolean_member (object, "is-default");
|
||||||
|
|
||||||
json_object_remove_member (object, "is-default");
|
json_object_remove_member (object, "is-default");
|
||||||
}
|
}
|
||||||
|
46
configure.ac
46
configure.ac
@ -541,14 +541,15 @@ AM_CONDITIONAL(X11_TESTS, [test "x$x11_tests" = "xyes"])
|
|||||||
|
|
||||||
dnl === JSON parser check =====================================================
|
dnl === JSON parser check =====================================================
|
||||||
|
|
||||||
# allow building clutter with an external dependency on json-glib
|
# we allow building clutter with the internal copy of json-glib
|
||||||
# using the --with-json=check argument, but keep the default to
|
# for platforms without it, but by default we depend on the
|
||||||
# the internal version
|
# system copy
|
||||||
|
m4_define([default_json], [check])
|
||||||
AC_ARG_WITH([json],
|
AC_ARG_WITH([json],
|
||||||
AC_HELP_STRING([--with-json=@<:@internal/check@:>@],
|
AC_HELP_STRING([--with-json=@<:@internal/check/system@:>@],
|
||||||
[Select the JSON-GLib copy to use @<:@default=internal@:>@]),
|
[Select the JSON-GLib copy to use @<:@default=default_json@:>@]),
|
||||||
[],
|
[],
|
||||||
[with_json=internal])
|
[with_json=default_json])
|
||||||
|
|
||||||
AS_CASE([$with_json],
|
AS_CASE([$with_json],
|
||||||
|
|
||||||
@ -558,16 +559,41 @@ AS_CASE([$with_json],
|
|||||||
have_json=no
|
have_json=no
|
||||||
],
|
],
|
||||||
|
|
||||||
[check],
|
[system],
|
||||||
[
|
[
|
||||||
AC_MSG_CHECKING([for installed JSON-GLib])
|
AC_MSG_CHECKING([for installed JSON-GLib])
|
||||||
PKG_CHECK_EXISTS([json-glib-1.0], [have_json=yes], [have_json=no])
|
PKG_CHECK_EXISTS([json-glib-1.0 >= 0.7],
|
||||||
|
[have_json=yes],
|
||||||
|
[have_json=no])
|
||||||
AS_IF([test "x$have_json" = "xyes"],
|
AS_IF([test "x$have_json" = "xyes"],
|
||||||
[
|
[
|
||||||
JSON_PREFIX=json-glib
|
JSON_PREFIX=json-glib
|
||||||
JSON_GLIB_PC=json-glib-1.0
|
JSON_GLIB_PC="json-glib-1.0 >= 0.7"
|
||||||
|
|
||||||
AC_DEFINE(HAVE_JSON_GLIB, 1, [Have the JSON-GLib library installed])
|
AC_DEFINE([HAVE_JSON_GLIB],
|
||||||
|
[1],
|
||||||
|
[Have the JSON-GLib library installed])
|
||||||
|
|
||||||
|
AC_MSG_RESULT([found])
|
||||||
|
],
|
||||||
|
[AC_MSG_ERROR([not found])]
|
||||||
|
)
|
||||||
|
],
|
||||||
|
|
||||||
|
[check],
|
||||||
|
[
|
||||||
|
AC_MSG_CHECKING([for installed JSON-GLib])
|
||||||
|
PKG_CHECK_EXISTS([json-glib-1.0 >= 0.7],
|
||||||
|
[have_json=yes],
|
||||||
|
[have_json=no])
|
||||||
|
AS_IF([test "x$have_json" = "xyes"],
|
||||||
|
[
|
||||||
|
JSON_PREFIX=json-glib
|
||||||
|
JSON_GLIB_PC="json-glib-1.0 >= 0.7"
|
||||||
|
|
||||||
|
AC_DEFINE([HAVE_JSON_GLIB],
|
||||||
|
[1],
|
||||||
|
[Have the JSON-GLib library installed])
|
||||||
|
|
||||||
AC_MSG_RESULT([found])
|
AC_MSG_RESULT([found])
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user