[gnome-builder/wip/chergert/326redesign: 7/9] pnl: allow NULL parameters for boolean child properties
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/326redesign: 7/9] pnl: allow NULL parameters for boolean child properties
- Date: Mon, 8 May 2017 19:56:39 +0000 (UTC)
commit a1c44600259d871739f3e60f87475b58f91b0814
Author: Christian Hergert <chergert redhat com>
Date: Sat May 6 13:14:27 2017 -0700
pnl: allow NULL parameters for boolean child properties
contrib/pnl/pnl-child-property-action.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/contrib/pnl/pnl-child-property-action.c b/contrib/pnl/pnl-child-property-action.c
index e276099..6b8eef5 100644
--- a/contrib/pnl/pnl-child-property-action.c
+++ b/contrib/pnl/pnl-child-property-action.c
@@ -273,8 +273,7 @@ pnl_child_property_action_activate (GAction *action,
g_assert (PNL_IS_CHILD_PROPERTY_ACTION (self));
- if (parameter == NULL &&
- self->container != NULL &&
+ if (self->container != NULL &&
self->child != NULL &&
self->child_property_name != NULL)
{
@@ -305,25 +304,28 @@ pnl_child_property_action_activate (GAction *action,
g_value_set_boolean (&value, !g_value_get_boolean (&previous));
}
}
- else if (G_IS_PARAM_SPEC_INT (pspec))
+ else if (G_IS_PARAM_SPEC_INT (pspec) && parameter != NULL)
{
g_value_init (&value, G_TYPE_INT);
g_value_set_int (&value, g_variant_get_int32 (parameter));
}
- else if (G_IS_PARAM_SPEC_UINT (pspec))
+ else if (G_IS_PARAM_SPEC_UINT (pspec) && parameter != NULL)
{
g_value_init (&value, G_TYPE_UINT);
g_value_set_uint (&value, g_variant_get_uint32 (parameter));
}
- else if (G_IS_PARAM_SPEC_STRING (pspec))
+ else if (G_IS_PARAM_SPEC_STRING (pspec) && parameter != NULL)
{
g_value_init (&value, G_TYPE_STRING);
g_value_set_string (&value, g_variant_get_string (parameter, NULL));
}
else if (G_IS_PARAM_SPEC_DOUBLE (pspec) || G_IS_PARAM_SPEC_FLOAT (pspec))
{
- g_value_init (&value, G_TYPE_DOUBLE);
- g_value_set_double (&value, g_variant_get_double (parameter));
+ if (parameter != NULL)
+ {
+ g_value_init (&value, G_TYPE_DOUBLE);
+ g_value_set_double (&value, g_variant_get_double (parameter));
+ }
}
else
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]