[gcr] gcr: mock-prompter: Stop using GParameter
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcr] gcr: mock-prompter: Stop using GParameter
- Date: Sat, 16 Jan 2021 09:50:31 +0000 (UTC)
commit 6d2b699483d24e9d3bab244dd9693bd9a002414c
Author: Niels De Graef <nielsdegraef gmail com>
Date: Sat Jan 16 10:49:08 2021 +0100
gcr: mock-prompter: Stop using GParameter
It's been deprecated for some time now and just gives us an extra load
of compiler warnings, so just define a little `MockProperty` struct with
the same layout.
gcr/gcr-mock-prompter.c | 35 ++++++++++++++++++++---------------
1 file changed, 20 insertions(+), 15 deletions(-)
---
diff --git a/gcr/gcr-mock-prompter.c b/gcr/gcr-mock-prompter.c
index cdc7db9e..60c5dc00 100644
--- a/gcr/gcr-mock-prompter.c
+++ b/gcr/gcr-mock-prompter.c
@@ -67,6 +67,11 @@ enum {
PROP_CANCEL_LABEL,
};
+typedef struct _MockProperty {
+ const char *name;
+ GValue value;
+} MockProperty;
+
struct _GcrMockPrompt {
GObject parent;
GHashTable *properties;
@@ -107,7 +112,7 @@ G_DEFINE_TYPE_WITH_CODE (GcrMockPrompt, _gcr_mock_prompt, G_TYPE_OBJECT,
static void
mock_property_free (gpointer data)
{
- GParameter *param = data;
+ MockProperty *param = data;
g_value_unset (¶m->value);
g_free (param);
}
@@ -129,9 +134,9 @@ static void
blank_string_property (GHashTable *properties,
const gchar *property)
{
- GParameter *param;
+ MockProperty *param;
- param = g_new0 (GParameter, 1);
+ param = g_new0 (MockProperty, 1);
param->name = property;
g_value_init (¶m->value, G_TYPE_STRING);
g_value_set_string (¶m->value, "");
@@ -143,9 +148,9 @@ static void
blank_boolean_property (GHashTable *properties,
const gchar *property)
{
- GParameter *param;
+ MockProperty *param;
- param = g_new0 (GParameter, 1);
+ param = g_new0 (MockProperty, 1);
param->name = property;
g_value_init (¶m->value, G_TYPE_BOOLEAN);
g_value_set_boolean (¶m->value, FALSE);
@@ -156,9 +161,9 @@ static void
blank_int_property (GHashTable *properties,
const gchar *property)
{
- GParameter *param;
+ MockProperty *param;
- param = g_new0 (GParameter, 1);
+ param = g_new0 (MockProperty, 1);
param->name = property;
g_value_init (¶m->value, G_TYPE_INT);
g_value_set_int (¶m->value, 0);
@@ -195,7 +200,7 @@ _gcr_mock_prompt_set_property (GObject *obj,
GParamSpec *pspec)
{
GcrMockPrompt *self = GCR_MOCK_PROMPT (obj);
- GParameter *param;
+ MockProperty *param;
switch (prop_id) {
case PROP_TITLE:
@@ -208,7 +213,7 @@ _gcr_mock_prompt_set_property (GObject *obj,
case PROP_CALLER_WINDOW:
case PROP_CONTINUE_LABEL:
case PROP_CANCEL_LABEL:
- param = g_new0 (GParameter, 1);
+ param = g_new0 (MockProperty, 1);
param->name = pspec->name;
g_value_init (¶m->value, pspec->value_type);
g_value_copy (value, ¶m->value);
@@ -228,7 +233,7 @@ _gcr_mock_prompt_get_property (GObject *obj,
GParamSpec *pspec)
{
GcrMockPrompt *self = GCR_MOCK_PROMPT (obj);
- GParameter *param;
+ MockProperty *param;
switch (prop_id) {
case PROP_TITLE:
@@ -322,7 +327,7 @@ prompt_set_or_check_properties (GcrMockPrompt *self,
{
GValue value = G_VALUE_INIT;
GObjectClass *object_class;
- GParameter *param;
+ MockProperty *param;
GParamSpec *spec;
GList *l;
@@ -471,11 +476,11 @@ static void
ensure_password_strength (GcrMockPrompt *self,
const gchar *password)
{
- GParameter *param;
+ MockProperty *param;
gint strength;
strength = strlen (password) > 0 ? 1 : 0;
- param = g_new0 (GParameter, 1);
+ param = g_new0 (MockProperty, 1);
param->name = "password-strength";
g_value_init (¶m->value, G_TYPE_INT);
g_value_set_int (¶m->value, strength);
@@ -574,7 +579,7 @@ build_properties (GObjectClass *object_class,
name = first_property;
while (name) {
GValue value = G_VALUE_INIT;
- GParameter *parameter;
+ MockProperty *parameter;
GParamSpec *spec;
gchar *error = NULL;
@@ -597,7 +602,7 @@ build_properties (GObjectClass *object_class,
break;
}
- parameter = g_new0 (GParameter, 1);
+ parameter = g_new0 (MockProperty, 1);
parameter->name = g_intern_string (name);
memcpy (¶meter->value, &value, sizeof (value));
result = g_list_prepend (result, parameter);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]