summaryrefslogtreecommitdiff
path: root/osinfo/osinfo_image.c
diff options
context:
space:
mode:
authorFabiano FidĂȘncio <fidencio@redhat.com>2020-01-06 15:14:41 +0100
committerFabiano FidĂȘncio <fidencio@redhat.com>2020-04-13 23:05:24 +0200
commitdc0dbdbffa8c0b0d1248dc56ba1c6c64124b06d3 (patch)
tree205b9b830b996c6d7bbe0d2720fb0f861039553e /osinfo/osinfo_image.c
parentc9a9ce189b37ee5f720deb4424cc62339b329248 (diff)
downloadlibosinfo-dc0dbdbffa8c0b0d1248dc56ba1c6c64124b06d3.tar.gz
Use g_object_class_install_properties()
Using _install_properties() helps to keep the code cleaner and also reduces the chance of having wrong props used. Signed-off-by: Fabiano FidĂȘncio <fidencio@redhat.com>
Diffstat (limited to 'osinfo/osinfo_image.c')
-rw-r--r--osinfo/osinfo_image.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/osinfo/osinfo_image.c b/osinfo/osinfo_image.c
index 913f003..ad0c8d9 100644
--- a/osinfo/osinfo_image.c
+++ b/osinfo/osinfo_image.c
@@ -47,7 +47,10 @@ enum {
PROP_FORMAT,
PROP_URL,
PROP_CLOUD_INIT,
+
+ LAST_PROP
};
+static GParamSpec *properties[LAST_PROP];
static void
osinfo_image_get_property(GObject *object,
@@ -142,7 +145,6 @@ static void
osinfo_image_class_init(OsinfoImageClass *klass)
{
GObjectClass *g_klass = G_OBJECT_CLASS(klass);
- GParamSpec *pspec;
g_klass->dispose = osinfo_image_dispose;
g_klass->finalize = osinfo_image_finalize;
@@ -154,52 +156,50 @@ osinfo_image_class_init(OsinfoImageClass *klass)
*
* The target hardware architecture of this image.
*/
- pspec = g_param_spec_string("architecture",
- "ARCHITECTURE",
- _("CPU Architecture"),
- NULL /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_ARCHITECTURE, pspec);
+ properties[PROP_ARCHITECTURE] = g_param_spec_string("architecture",
+ "ARCHITECTURE",
+ _("CPU Architecture"),
+ NULL /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoImage:format:
*
* The image format.
*/
- pspec = g_param_spec_string("format",
- "FORMAT",
- _("The image format"),
- NULL /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_FORMAT, pspec);
+ properties[PROP_FORMAT] = g_param_spec_string("format",
+ "FORMAT",
+ _("The image format"),
+ NULL /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoImage:url:
*
* The URL to this image.
*/
- pspec = g_param_spec_string("url",
- "URL",
- _("The URL to this image"),
- NULL /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_URL, pspec);
+ properties[PROP_URL] = g_param_spec_string("url",
+ "URL",
+ _("The URL to this image"),
+ NULL /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoImage:cloud-init:
*
* Whether the image supports cloud-init customizations or not.
*/
- pspec = g_param_spec_string("cloud-init",
- "CloudInit",
- _("Whether cloud-init customizations are supported or not"),
- FALSE /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_CLOUD_INIT, pspec);
+ properties[PROP_CLOUD_INIT] = g_param_spec_string("cloud-init",
+ "CloudInit",
+ _("Whether cloud-init customizations are supported or not"),
+ FALSE /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties(g_klass, LAST_PROP, properties);
}
static void