summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Pablo Ugarte <juanpablougarte@gmail.com>2020-06-10 17:27:23 -0300
committerJuan Pablo Ugarte <juanpablougarte@gmail.com>2020-06-10 17:27:23 -0300
commitdfefb0d3ae13686ca323d53afbc5c6ec48f546c3 (patch)
treed0dae69b37c8122d4eb37dd1ec5cad8d292ba8b8
parentf5e800eca8ffb277dcc31d293c76664990bba79c (diff)
downloadglade-dfefb0d3ae13686ca323d53afbc5c6ec48f546c3.tar.gz
Fix GValueArray deprecation warnings
-rw-r--r--gladeui/glade-editor-property.c6
-rw-r--r--gladeui/glade-property-def.c56
-rw-r--r--gladeui/glade-property.h2
-rw-r--r--gladeui/glade-widget-adaptor.c14
4 files changed, 42 insertions, 36 deletions
diff --git a/gladeui/glade-editor-property.c b/gladeui/glade-editor-property.c
index 34233871..aa911d7b 100644
--- a/gladeui/glade-editor-property.c
+++ b/gladeui/glade-editor-property.c
@@ -1917,7 +1917,7 @@ glade_eprop_text_load (GladeEditorProperty *eprop, GladeProperty *property)
/* Deprecated GValueArray */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- value_array_type = G_TYPE_VALUE_ARRAY;
+ value_array_type = g_value_array_get_type ();
G_GNUC_END_IGNORE_DEPRECATIONS;
buffer =
@@ -1973,7 +1973,7 @@ glade_eprop_text_changed_common (GladeEditorProperty *eprop,
/* Deprecated GValueArray */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- value_array_type = G_TYPE_VALUE_ARRAY;
+ value_array_type = g_value_array_get_type ();
G_GNUC_END_IGNORE_DEPRECATIONS;
pspec = glade_property_def_get_pspec (priv->property_def);
@@ -2432,7 +2432,7 @@ glade_eprop_text_create_input (GladeEditorProperty *eprop)
/* Deprecated GValueArray */
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- value_array_type = G_TYPE_VALUE_ARRAY;
+ value_array_type = g_value_array_get_type ();
G_GNUC_END_IGNORE_DEPRECATIONS;
property_def = priv->property_def;
diff --git a/gladeui/glade-property-def.c b/gladeui/glade-property-def.c
index d33dd4ea..1a3c8318 100644
--- a/gladeui/glade-property-def.c
+++ b/gladeui/glade-property-def.c
@@ -508,20 +508,10 @@ glade_property_def_make_string_from_gvalue (GladePropertyDef *
GdkRGBA *rgba;
GList *objects;
- if (G_IS_PARAM_SPEC_ENUM (property_def->pspec))
- {
- gint eval = g_value_get_enum (value);
- string = glade_property_def_make_string_from_enum
- (property_def->pspec->value_type, eval);
- }
- else if (G_IS_PARAM_SPEC_FLAGS (property_def->pspec))
- {
- guint flags = g_value_get_flags (value);
- string = glade_property_def_make_string_from_flags
- (property_def, flags, FALSE);
- }
- else if (G_IS_PARAM_SPEC_VALUE_ARRAY (property_def->pspec))
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+ if (DEPRECATED_IS_PARAM_SPEC_VALUE_ARRAY (property_def->pspec))
{
+ G_GNUC_END_IGNORE_DEPRECATIONS;
GValueArray *value_array = g_value_get_boxed (value);
if (value_array && value_array->n_values &&
@@ -540,6 +530,18 @@ glade_property_def_make_string_from_gvalue (GladePropertyDef *
g_string_free (gstring, FALSE);
}
}
+ else if (G_IS_PARAM_SPEC_ENUM (property_def->pspec))
+ {
+ gint eval = g_value_get_enum (value);
+ string = glade_property_def_make_string_from_enum
+ (property_def->pspec->value_type, eval);
+ }
+ else if (G_IS_PARAM_SPEC_FLAGS (property_def->pspec))
+ {
+ guint flags = g_value_get_flags (value);
+ string = glade_property_def_make_string_from_flags
+ (property_def, flags, FALSE);
+ }
else if (G_IS_PARAM_SPEC_BOXED (property_def->pspec))
{
if (property_def->pspec->value_type == GDK_TYPE_COLOR)
@@ -843,20 +845,10 @@ glade_property_def_make_gvalue_from_string (GladePropertyDef *property_def,
g_value_init (value, property_def->pspec->value_type);
- if (G_IS_PARAM_SPEC_ENUM (property_def->pspec))
- {
- gint eval = glade_property_def_make_enum_from_string
- (property_def->pspec->value_type, string);
- g_value_set_enum (value, eval);
- }
- else if (G_IS_PARAM_SPEC_FLAGS (property_def->pspec))
- {
- guint flags = glade_property_def_make_flags_from_string
- (property_def->pspec->value_type, string);
- g_value_set_flags (value, flags);
- }
- else if (G_IS_PARAM_SPEC_VALUE_ARRAY (property_def->pspec))
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+ if (DEPRECATED_IS_PARAM_SPEC_VALUE_ARRAY (property_def->pspec))
{
+ G_GNUC_END_IGNORE_DEPRECATIONS;
GValueArray *value_array;
GValue str_value = { 0, };
gint i;
@@ -880,6 +872,18 @@ glade_property_def_make_gvalue_from_string (GladePropertyDef *property_def,
g_value_take_boxed (value, value_array);
g_strfreev (strv);
}
+ else if (G_IS_PARAM_SPEC_ENUM (property_def->pspec))
+ {
+ gint eval = glade_property_def_make_enum_from_string
+ (property_def->pspec->value_type, string);
+ g_value_set_enum (value, eval);
+ }
+ else if (G_IS_PARAM_SPEC_FLAGS (property_def->pspec))
+ {
+ guint flags = glade_property_def_make_flags_from_string
+ (property_def->pspec->value_type, string);
+ g_value_set_flags (value, flags);
+ }
else if (G_IS_PARAM_SPEC_BOXED (property_def->pspec))
{
if (property_def->pspec->value_type == GDK_TYPE_COLOR)
diff --git a/gladeui/glade-property.h b/gladeui/glade-property.h
index b4ecf5c1..209ac695 100644
--- a/gladeui/glade-property.h
+++ b/gladeui/glade-property.h
@@ -12,6 +12,8 @@ G_BEGIN_DECLS
#define GLADE_IS_PROPERTY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GLADE_TYPE_PROPERTY))
#define GLADE_PROPERTY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GLADE_PROPERTY, GladePropertyClass))
+#define DEPRECATED_IS_PARAM_SPEC_VALUE_ARRAY(p) G_TYPE_CHECK_INSTANCE_TYPE (p, g_value_array_get_type())
+
typedef struct _GladePropertyClass GladePropertyClass;
typedef struct _GladePropertyPrivate GladePropertyPrivate;
diff --git a/gladeui/glade-widget-adaptor.c b/gladeui/glade-widget-adaptor.c
index d7e4d295..d7897d23 100644
--- a/gladeui/glade-widget-adaptor.c
+++ b/gladeui/glade-widget-adaptor.c
@@ -1239,18 +1239,18 @@ glade_widget_adaptor_get_eprop_type (GParamSpec *pspec)
{
GType type = 0;
- if (G_IS_PARAM_SPEC_ENUM (pspec))
- type = GLADE_TYPE_EPROP_ENUM;
- else if (G_IS_PARAM_SPEC_FLAGS (pspec))
- type = GLADE_TYPE_EPROP_FLAGS;
- else if (G_IS_PARAM_SPEC_VALUE_ARRAY (pspec))
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+ if (DEPRECATED_IS_PARAM_SPEC_VALUE_ARRAY (pspec))
{
/* Require deprecated code */
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
- if (pspec->value_type == G_TYPE_VALUE_ARRAY)
+ if (pspec->value_type == g_value_array_get_type ())
type = GLADE_TYPE_EPROP_TEXT;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
}
+ else if (G_IS_PARAM_SPEC_ENUM (pspec))
+ type = GLADE_TYPE_EPROP_ENUM;
+ else if (G_IS_PARAM_SPEC_FLAGS (pspec))
+ type = GLADE_TYPE_EPROP_FLAGS;
else if (G_IS_PARAM_SPEC_BOXED (pspec))
{
if (pspec->value_type == GDK_TYPE_COLOR ||