summaryrefslogtreecommitdiff
path: root/osinfo
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
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')
-rw-r--r--osinfo/osinfo_avatar_format.c72
-rw-r--r--osinfo/osinfo_deployment.c41
-rw-r--r--osinfo/osinfo_devicelink.c26
-rw-r--r--osinfo/osinfo_devicelinkfilter.c23
-rw-r--r--osinfo/osinfo_entity.c23
-rw-r--r--osinfo/osinfo_firmware.c32
-rw-r--r--osinfo/osinfo_image.c58
-rw-r--r--osinfo/osinfo_install_config_param.c59
-rw-r--r--osinfo/osinfo_install_script.c162
-rw-r--r--osinfo/osinfo_media.c222
-rw-r--r--osinfo/osinfo_os.c65
-rw-r--r--osinfo/osinfo_os_variant.c21
-rw-r--r--osinfo/osinfo_product.c84
-rw-r--r--osinfo/osinfo_resources.c85
-rw-r--r--osinfo/osinfo_tree.c149
15 files changed, 525 insertions, 597 deletions
diff --git a/osinfo/osinfo_avatar_format.c b/osinfo/osinfo_avatar_format.c
index 9880250..111a1ff 100644
--- a/osinfo/osinfo_avatar_format.c
+++ b/osinfo/osinfo_avatar_format.c
@@ -36,7 +36,10 @@ enum {
PROP_WIDTH,
PROP_HEIGHT,
PROP_ALPHA,
+
+ LAST_PROP
};
+static GParamSpec *properties[LAST_PROP];
static void
osinfo_avatar_format_get_property(GObject *object,
@@ -80,7 +83,6 @@ static void
osinfo_avatar_format_class_init(OsinfoAvatarFormatClass *klass)
{
GObjectClass *g_klass = G_OBJECT_CLASS(klass);
- GParamSpec *pspec;
g_klass->get_property = osinfo_avatar_format_get_property;
@@ -89,63 +91,53 @@ osinfo_avatar_format_class_init(OsinfoAvatarFormatClass *klass)
*
* The allowed mime-types for the avatar.
**/
- pspec = g_param_spec_pointer("mime-types",
- "MIME Types",
- _("The allowed mime-types for the avatar"),
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_MIME_TYPES,
- pspec);
+ properties[PROP_MIME_TYPES] = g_param_spec_pointer("mime-types",
+ "MIME Types",
+ _("The allowed mime-types for the avatar"),
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoAvatarFormat:width:
*
* The required width (in pixels) of the avatar.
**/
- pspec = g_param_spec_int("width",
- "Width",
- _("The required width (in pixels) of the avatar"),
- -1,
- G_MAXINT,
- -1,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_WIDTH,
- pspec);
+ properties[PROP_WIDTH] = g_param_spec_int("width",
+ "Width",
+ _("The required width (in pixels) of the avatar"),
+ -1,
+ G_MAXINT,
+ -1,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoAvatarFormat:height:
*
* The required height (in pixels) of the avatar.
**/
- pspec = g_param_spec_int("height",
- "Height",
- _("The required height (in pixels) of the avatar."),
- -1,
- G_MAXINT,
- -1,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_HEIGHT,
- pspec);
+ properties[PROP_HEIGHT] = g_param_spec_int("height",
+ "Height",
+ _("The required height (in pixels) of the avatar."),
+ -1,
+ G_MAXINT,
+ -1,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoAvatarFormat:alpha:
*
* Whether alpha channel is supported in the avatar.
**/
- pspec = g_param_spec_boolean("alpha",
- "Alpha",
- _("Whether alpha channel is supported in the avatar."),
- TRUE,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_ALPHA,
- pspec);
+ properties[PROP_ALPHA] = g_param_spec_boolean("alpha",
+ "Alpha",
+ _("Whether alpha channel is supported in the avatar."),
+ TRUE,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties(g_klass, LAST_PROP, properties);
}
static void
diff --git a/osinfo/osinfo_deployment.c b/osinfo/osinfo_deployment.c
index aa94613..817f047 100644
--- a/osinfo/osinfo_deployment.c
+++ b/osinfo/osinfo_deployment.c
@@ -46,8 +46,10 @@ enum {
PROP_OS,
PROP_PLATFORM,
-};
+ LAST_PROP
+};
+static GParamSpec *properties[LAST_PROP];
static void
osinfo_deployment_set_property(GObject *object,
@@ -124,7 +126,6 @@ static void
osinfo_deployment_class_init(OsinfoDeploymentClass *klass)
{
GObjectClass *g_klass = G_OBJECT_CLASS(klass);
- GParamSpec *pspec;
g_klass->set_property = osinfo_deployment_set_property;
g_klass->get_property = osinfo_deployment_get_property;
@@ -134,31 +135,27 @@ osinfo_deployment_class_init(OsinfoDeploymentClass *klass)
*
* The operating system to be deployed
*/
- pspec = g_param_spec_object("os",
- "Os",
- _("Operating system"),
- OSINFO_TYPE_OS,
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_OS,
- pspec);
+ properties[PROP_OS] = g_param_spec_object("os",
+ "Os",
+ _("Operating system"),
+ OSINFO_TYPE_OS,
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoDeployment:platform:
*
* The platform to deploy on
*/
- pspec = g_param_spec_object("platform",
- "Platform",
- _("Virtualization platform"),
- OSINFO_TYPE_PLATFORM,
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_PLATFORM,
- pspec);
+ properties[PROP_PLATFORM] = g_param_spec_object("platform",
+ "Platform",
+ _("Virtualization platform"),
+ OSINFO_TYPE_PLATFORM,
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties(g_klass, LAST_PROP, properties);
g_klass->finalize = osinfo_deployment_finalize;
}
diff --git a/osinfo/osinfo_devicelink.c b/osinfo/osinfo_devicelink.c
index c6faba3..b6dea77 100644
--- a/osinfo/osinfo_devicelink.c
+++ b/osinfo/osinfo_devicelink.c
@@ -41,8 +41,11 @@ G_DEFINE_TYPE_WITH_PRIVATE(OsinfoDeviceLink, osinfo_devicelink, OSINFO_TYPE_ENTI
enum {
PROP_0,
- PROP_TARGET
+ PROP_TARGET,
+
+ LAST_PROP
};
+static GParamSpec *properties[LAST_PROP];
static void
osinfo_devicelink_set_property(GObject *object,
@@ -106,7 +109,6 @@ static void
osinfo_devicelink_class_init(OsinfoDeviceLinkClass *klass)
{
GObjectClass *g_klass = G_OBJECT_CLASS(klass);
- GParamSpec *pspec;
g_klass->set_property = osinfo_devicelink_set_property;
g_klass->get_property = osinfo_devicelink_get_property;
@@ -116,17 +118,15 @@ osinfo_devicelink_class_init(OsinfoDeviceLinkClass *klass)
*
* The target of the device link.
*/
- pspec = g_param_spec_object("target",
- "Target",
- _("Target device"),
- OSINFO_TYPE_DEVICE,
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_TARGET,
- pspec);
-
+ properties[PROP_TARGET] = g_param_spec_object("target",
+ "Target",
+ _("Target device"),
+ OSINFO_TYPE_DEVICE,
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties(g_klass, LAST_PROP, properties);
g_klass->finalize = osinfo_devicelink_finalize;
}
diff --git a/osinfo/osinfo_devicelinkfilter.c b/osinfo/osinfo_devicelinkfilter.c
index e86d2b6..9943ec4 100644
--- a/osinfo/osinfo_devicelinkfilter.c
+++ b/osinfo/osinfo_devicelinkfilter.c
@@ -45,8 +45,10 @@ enum {
PROP_0,
PROP_TARGET_FILTER,
-};
+ LAST_PROP
+};
+static GParamSpec *properties[LAST_PROP];
static void
osinfo_devicelinkfilter_set_property(GObject *object,
@@ -110,7 +112,6 @@ osinfo_devicelinkfilter_class_init(OsinfoDeviceLinkFilterClass *klass)
{
GObjectClass *g_klass = G_OBJECT_CLASS(klass);
OsinfoFilterClass *filter_klass = OSINFO_FILTER_CLASS(klass);
- GParamSpec *pspec;
g_klass->finalize = osinfo_devicelinkfilter_finalize;
g_klass->set_property = osinfo_devicelinkfilter_set_property;
@@ -121,16 +122,14 @@ osinfo_devicelinkfilter_class_init(OsinfoDeviceLinkFilterClass *klass)
*
* The operating system to be deployed
*/
- pspec = g_param_spec_object("target-filter",
- "Target Filter",
- _("Device link target filter"),
- OSINFO_TYPE_FILTER,
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_TARGET_FILTER,
- pspec);
+ properties[PROP_TARGET_FILTER] = g_param_spec_object("target-filter",
+ "Target Filter",
+ _("Device link target filter"),
+ OSINFO_TYPE_FILTER,
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
+ g_object_class_install_properties(g_klass, LAST_PROP, properties);
filter_klass->matches = osinfo_devicelinkfilter_matches_default;
}
diff --git a/osinfo/osinfo_entity.c b/osinfo/osinfo_entity.c
index c4eddca..78b5f3c 100644
--- a/osinfo/osinfo_entity.c
+++ b/osinfo/osinfo_entity.c
@@ -50,7 +50,10 @@ enum {
PROP_0,
PROP_ID,
+
+ LAST_PROP
};
+static GParamSpec *properties[LAST_PROP];
static void
osinfo_entity_set_property(GObject *object,
@@ -110,7 +113,6 @@ static void
osinfo_entity_class_init(OsinfoEntityClass *klass)
{
GObjectClass *g_klass = G_OBJECT_CLASS(klass);
- GParamSpec *pspec;
g_klass->set_property = osinfo_entity_set_property;
g_klass->get_property = osinfo_entity_get_property;
@@ -123,16 +125,15 @@ osinfo_entity_class_init(OsinfoEntityClass *klass)
* This parameter must be set at time of construction as no
* default value is provided.
*/
- pspec = g_param_spec_string("id",
- "ID",
- _("Unique identifier"),
- NULL /* default value */,
- G_PARAM_CONSTRUCT |
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_ID,
- pspec);
+ properties[PROP_ID] = g_param_spec_string("id",
+ "ID",
+ _("Unique identifier"),
+ NULL /* default value */,
+ G_PARAM_CONSTRUCT |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties(g_klass, LAST_PROP, properties);
g_klass->finalize = osinfo_entity_finalize;
}
diff --git a/osinfo/osinfo_firmware.c b/osinfo/osinfo_firmware.c
index 53c47c7..c397c70 100644
--- a/osinfo/osinfo_firmware.c
+++ b/osinfo/osinfo_firmware.c
@@ -45,7 +45,10 @@ enum {
PROP_ARCHITECTURE,
PROP_FIRMWARE_TYPE,
+
+ LAST_PROP
};
+static GParamSpec *properties[LAST_PROP];
static void
osinfo_firmware_get_property(GObject *object,
@@ -111,7 +114,6 @@ static void
osinfo_firmware_class_init(OsinfoFirmwareClass *klass)
{
GObjectClass *g_klass = G_OBJECT_CLASS(klass);
- GParamSpec *pspec;
g_klass->finalize = osinfo_firmware_finalize;
g_klass->get_property = osinfo_firmware_get_property;
@@ -122,26 +124,26 @@ osinfo_firmware_class_init(OsinfoFirmwareClass *klass)
*
* The target hardware architecture of this firmware.
*/
- 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);
/**
* OsinfoFirmware:firmware-type:
*
* The firmware type.
*/
- pspec = g_param_spec_string("type",
- "TYPE",
- _("The firmware type"),
- NULL /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_FIRMWARE_TYPE, pspec);
+ properties[PROP_FIRMWARE_TYPE] = g_param_spec_string("type",
+ "TYPE",
+ _("The firmware type"),
+ NULL /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties(g_klass, LAST_PROP, properties);
}
static void
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
diff --git a/osinfo/osinfo_install_config_param.c b/osinfo/osinfo_install_config_param.c
index 43bfcf7..c8c2dda 100644
--- a/osinfo/osinfo_install_config_param.c
+++ b/osinfo/osinfo_install_config_param.c
@@ -45,8 +45,11 @@ enum {
PROP_NAME,
PROP_POLICY,
- PROP_VALUE_MAP
+ PROP_VALUE_MAP,
+
+ LAST_PROP
};
+static GParamSpec *properties[LAST_PROP];
static void
osinfo_install_config_param_set_property(GObject *object,
@@ -128,7 +131,6 @@ static void
osinfo_install_config_param_class_init(OsinfoInstallConfigParamClass *klass)
{
GObjectClass *g_klass = G_OBJECT_CLASS(klass);
- GParamSpec *pspec;
g_klass->set_property = osinfo_install_config_param_set_property;
g_klass->get_property = osinfo_install_config_param_get_property;
@@ -138,47 +140,40 @@ osinfo_install_config_param_class_init(OsinfoInstallConfigParamClass *klass)
*
* The name of the configuration parameter.
**/
- pspec = g_param_spec_string("name",
- "Name",
- _("Parameter name"),
- NULL,
- G_PARAM_WRITABLE |
- G_PARAM_READABLE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_NAME,
- pspec);
+ properties[PROP_NAME] = g_param_spec_string("name",
+ "Name",
+ _("Parameter name"),
+ NULL,
+ G_PARAM_WRITABLE |
+ G_PARAM_READABLE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoInstallConfigParam:policy:
*
* The policy of the configuration parameter.
**/
- pspec = g_param_spec_enum("policy",
- "Policy",
- _("Parameter policy"),
- OSINFO_TYPE_INSTALL_CONFIG_PARAM_POLICY,
- OSINFO_INSTALL_CONFIG_PARAM_POLICY_OPTIONAL,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_POLICY,
- pspec);
+ properties[PROP_POLICY] = g_param_spec_enum("policy",
+ "Policy",
+ _("Parameter policy"),
+ OSINFO_TYPE_INSTALL_CONFIG_PARAM_POLICY,
+ OSINFO_INSTALL_CONFIG_PARAM_POLICY_OPTIONAL,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoInstallConfigParam:value-map:
*
* The mapping between generic values and OS-specific values for this
* configuration parameter
**/
- pspec = g_param_spec_object("value-map",
- "Value Mapping",
- _("Parameter Value Mapping"),
- OSINFO_TYPE_DATAMAP,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_VALUE_MAP,
- pspec);
+ properties[PROP_VALUE_MAP] = g_param_spec_object("value-map",
+ "Value Mapping",
+ _("Parameter Value Mapping"),
+ OSINFO_TYPE_DATAMAP,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties(g_klass, LAST_PROP, properties);
g_klass->finalize = osinfo_install_config_param_finalize;
}
diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c
index 2cb0f8a..4ce4b10 100644
--- a/osinfo/osinfo_install_script.c
+++ b/osinfo/osinfo_install_script.c
@@ -58,8 +58,11 @@ enum {
PROP_PATH_FORMAT,
PROP_AVATAR_FORMAT,
PROP_PREFERRED_INJECTION_METHOD,
- PROP_INSTALLATION_SOURCE
+ PROP_INSTALLATION_SOURCE,
+
+ LAST_PROP
};
+static GParamSpec *properties[LAST_PROP];
typedef struct _OsinfoInstallScriptGenerateData OsinfoInstallScriptGenerateData;
typedef struct _OsinfoInstallScriptGenerateOutputData OsinfoInstallScriptGenerateOutputData;
@@ -196,101 +199,78 @@ static void
osinfo_install_script_class_init(OsinfoInstallScriptClass *klass)
{
GObjectClass *g_klass = G_OBJECT_CLASS(klass);
- GParamSpec *pspec;
g_klass->get_property = osinfo_install_script_get_property;
g_klass->set_property = osinfo_install_script_set_property;
g_klass->finalize = osinfo_install_script_finalize;
- pspec = g_param_spec_string("template-uri",
- "TemplateURI",
- _("URI for install script template"),
- NULL /* default value */,
- G_PARAM_READABLE |
- G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_TEMPLATE_URI,
- pspec);
-
- pspec = g_param_spec_string("template-data",
- "TemplateData",
- _("Data for install script template"),
- NULL /* default value */,
- G_PARAM_READABLE |
- G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_TEMPLATE_DATA,
- pspec);
-
- pspec = g_param_spec_string("profile",
- "Profile",
- _("Install script profile name"),
- NULL /* default value */,
- G_PARAM_READABLE |
- G_PARAM_WRITABLE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_PROFILE,
- pspec);
-
- pspec = g_param_spec_string("product-key-format",
- "Product Key Format",
- _("Product key format mask"),
- NULL /* default value */,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_PRODUCT_KEY_FORMAT,
- pspec);
-
- pspec = g_param_spec_enum("path-format",
- "Path Format",
- _("Expected path format"),
- OSINFO_TYPE_PATH_FORMAT,
- OSINFO_PATH_FORMAT_UNIX /* default value */,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_PATH_FORMAT,
- pspec);
-
- pspec = g_param_spec_object("avatar-format",
- "Avatar Format",
- _("Expected avatar format"),
- OSINFO_TYPE_AVATAR_FORMAT,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_AVATAR_FORMAT,
- pspec);
-
- pspec = g_param_spec_flags("preferred-injection-method",
- "Preferred Injection Method",
- _("The preferred injection method"),
- OSINFO_TYPE_INSTALL_SCRIPT_INJECTION_METHOD,
- OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_DISK, /* default value */
- G_PARAM_READABLE |
- G_PARAM_WRITABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_PREFERRED_INJECTION_METHOD,
- pspec);
-
- pspec = g_param_spec_enum("installation-source",
- "Installation Source",
- _("The installation source to be used"),
- OSINFO_TYPE_INSTALL_SCRIPT_INSTALLATION_SOURCE,
- OSINFO_INSTALL_SCRIPT_INSTALLATION_SOURCE_MEDIA,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_INSTALLATION_SOURCE,
- pspec);
+ properties[PROP_TEMPLATE_URI] = g_param_spec_string("template-uri",
+ "TemplateURI",
+ _("URI for install script template"),
+ NULL /* default value */,
+ G_PARAM_READABLE |
+ G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_TEMPLATE_DATA] = g_param_spec_string("template-data",
+ "TemplateData",
+ _("Data for install script template"),
+ NULL /* default value */,
+ G_PARAM_READABLE |
+ G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_PROFILE] = g_param_spec_string("profile",
+ "Profile",
+ _("Install script profile name"),
+ NULL /* default value */,
+ G_PARAM_READABLE |
+ G_PARAM_WRITABLE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_PRODUCT_KEY_FORMAT] = g_param_spec_string("product-key-format",
+ "Product Key Format",
+ _("Product key format mask"),
+ NULL /* default value */,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_PATH_FORMAT] = g_param_spec_enum("path-format",
+ "Path Format",
+ _("Expected path format"),
+ OSINFO_TYPE_PATH_FORMAT,
+ OSINFO_PATH_FORMAT_UNIX /* default value */,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_AVATAR_FORMAT] = g_param_spec_object("avatar-format",
+ "Avatar Format",
+ _("Expected avatar format"),
+ OSINFO_TYPE_AVATAR_FORMAT,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_PREFERRED_INJECTION_METHOD] = g_param_spec_flags("preferred-injection-method",
+ "Preferred Injection Method",
+ _("The preferred injection method"),
+ OSINFO_TYPE_INSTALL_SCRIPT_INJECTION_METHOD,
+ OSINFO_INSTALL_SCRIPT_INJECTION_METHOD_DISK, /* default value */
+ G_PARAM_READABLE |
+ G_PARAM_WRITABLE |
+ G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_INSTALLATION_SOURCE] = g_param_spec_enum("installation-source",
+ "Installation Source",
+ _("The installation source to be used"),
+ OSINFO_TYPE_INSTALL_SCRIPT_INSTALLATION_SOURCE,
+ OSINFO_INSTALL_SCRIPT_INSTALLATION_SOURCE_MEDIA,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties(g_klass, LAST_PROP, properties);
}
void osinfo_install_script_add_config_param(OsinfoInstallScript *script, OsinfoInstallConfigParam *param)
diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c
index 241c7fe..1cd63f8 100644
--- a/osinfo/osinfo_media.c
+++ b/osinfo/osinfo_media.c
@@ -224,8 +224,11 @@ enum {
PROP_LANGUAGES,
PROP_VOLUME_SIZE,
PROP_EJECT_AFTER_INSTALL,
- PROP_INSTALLER_SCRIPT
+ PROP_INSTALLER_SCRIPT,
+
+ LAST_PROP
};
+static GParamSpec *properties[LAST_PROP];
static void
osinfo_media_get_property(GObject *object,
@@ -455,7 +458,6 @@ static void
osinfo_media_class_init(OsinfoMediaClass *klass)
{
GObjectClass *g_klass = G_OBJECT_CLASS(klass);
- GParamSpec *pspec;
g_klass->dispose = osinfo_media_dispose;
g_klass->finalize = osinfo_media_finalize;
@@ -467,130 +469,120 @@ osinfo_media_class_init(OsinfoMediaClass *klass)
*
* The target hardware architecture of this media.
*/
- 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);
/**
* OsinfoMedia:url:
*
* The URL to this media.
*/
- pspec = g_param_spec_string("url",
- "URL",
- _("The URL to this media"),
- 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 media"),
+ NULL /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoMedia:volume-id:
*
* Expected volume ID (regular expression) for ISO9660 image/device.
*/
- pspec = g_param_spec_string("volume-id",
- "VolumeID",
- _("The expected ISO9660 volume ID"),
- NULL /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_VOLUME_ID, pspec);
+ properties[PROP_VOLUME_ID] = g_param_spec_string("volume-id",
+ "VolumeID",
+ _("The expected ISO9660 volume ID"),
+ NULL /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoMedia:publisher-id:
*
* Expected publisher ID (regular expression) for ISO9660 image/device.
*/
- pspec = g_param_spec_string("publisher-id",
- "PublisherID",
- _("The expected ISO9660 publisher ID"),
- NULL /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_PUBLISHER_ID, pspec);
+ properties[PROP_PUBLISHER_ID] = g_param_spec_string("publisher-id",
+ "PublisherID",
+ _("The expected ISO9660 publisher ID"),
+ NULL /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoMedia:application-id:
*
* Expected application ID (regular expression) for ISO9660 image/device.
*/
- pspec = g_param_spec_string("application-id",
- "ApplicationID",
- _("The expected ISO9660 application ID"),
- NULL /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_APPLICATION_ID, pspec);
+ properties[PROP_APPLICATION_ID] = g_param_spec_string("application-id",
+ "ApplicationID",
+ _("The expected ISO9660 application ID"),
+ NULL /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoMedia:system-id:
*
* Expected system ID (regular expression) for ISO9660 image/device.
*/
- pspec = g_param_spec_string("system-id",
- "SystemID",
- _("The expected ISO9660 system ID"),
- NULL /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_SYSTEM_ID, pspec);
+ properties[PROP_SYSTEM_ID] = g_param_spec_string("system-id",
+ "SystemID",
+ _("The expected ISO9660 system ID"),
+ NULL /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoMedia:kernel-path:
*
* The path to the kernel image in the install tree.
*/
- pspec = g_param_spec_string("kernel-path",
- "KernelPath",
- _("The path to the kernel image"),
- NULL /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_KERNEL_PATH, pspec);
+ properties[PROP_KERNEL_PATH] = g_param_spec_string("kernel-path",
+ "KernelPath",
+ _("The path to the kernel image"),
+ NULL /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoMedia:initrd-path:
*
* The path to the initrd image in the install tree.
*/
- pspec = g_param_spec_string("initrd-path",
- "InitrdPath",
- _("The path to the initrd image"),
- NULL /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_INITRD_PATH, pspec);
+ properties[PROP_INITRD_PATH] = g_param_spec_string("initrd-path",
+ "InitrdPath",
+ _("The path to the initrd image"),
+ NULL /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoMedia:installer:
*
* Whether media provides an installer for an OS.
*/
- pspec = g_param_spec_boolean("installer",
- "Installer",
- _("Media provides an installer"),
- TRUE /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_INSTALLER, pspec);
+ properties[PROP_INSTALLER] = g_param_spec_boolean("installer",
+ "Installer",
+ _("Media provides an installer"),
+ TRUE /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoMedia:live:
*
* Whether media can boot directly an OS without any installations.
*/
- pspec = g_param_spec_boolean("live",
- "Live",
- _("Media can boot directly w/o installation"),
- FALSE /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_LIVE, pspec);
+ properties[PROP_LIVE] = g_param_spec_boolean("live",
+ "Live",
+ _("Media can boot directly w/o installation"),
+ FALSE /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoMedia:installer-reboots:
@@ -606,15 +598,14 @@ osinfo_media_class_init(OsinfoMediaClass *klass)
* case number of reboots *alone* is not a reliable method for tracking
* installation.
*/
- pspec = g_param_spec_int("installer-reboots",
- "InstallerReboots",
- _("Number of installer reboots"),
- G_MININT,
- G_MAXINT,
- 1 /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_INSTALLER_REBOOTS, pspec);
+ properties[PROP_INSTALLER_REBOOTS] = g_param_spec_int("installer-reboots",
+ "InstallerReboots",
+ _("Number of installer reboots"),
+ G_MININT,
+ G_MAXINT,
+ 1 /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoMedia:os:
@@ -624,13 +615,12 @@ osinfo_media_class_init(OsinfoMediaClass *klass)
* the property will be filled after a successful call to
* osinfo_db_identify_media().
*/
- pspec = g_param_spec_object("os",
- "Os",
- _("Information about the operating system on this media"),
- OSINFO_TYPE_OS,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_OS, pspec);
+ properties[PROP_OS] = g_param_spec_object("os",
+ "Os",
+ _("Information about the operating system on this media"),
+ OSINFO_TYPE_OS,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoMedia:languages: (type GLib.List(utf8)) (transfer container):
@@ -643,27 +633,25 @@ osinfo_media_class_init(OsinfoMediaClass *klass)
* Use #osinfo_media_get_installer(or OsinfoMedia::installer) to know
* if the media is an installer or not.
*/
- pspec = g_param_spec_pointer("languages",
- "Languages",
- _("Supported languages"),
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_LANGUAGES, pspec);
+ properties[PROP_LANGUAGES] = g_param_spec_pointer("languages",
+ "Languages",
+ _("Supported languages"),
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoMedia:volume-size:
*
* Expected volume size, in bytes for ISO9660 image/device.
*/
- pspec = g_param_spec_int64("volume-size",
- "VolumeSize",
- _("Expected ISO9660 volume size, in bytes"),
- G_MININT,
- G_MAXINT64,
- -1 /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_VOLUME_SIZE, pspec);
+ properties[PROP_VOLUME_SIZE] = g_param_spec_int64("volume-size",
+ "VolumeSize",
+ _("Expected ISO9660 volume size, in bytes"),
+ G_MININT,
+ G_MAXINT64,
+ -1 /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoMedia:eject-after-install:
@@ -675,13 +663,12 @@ osinfo_media_class_init(OsinfoMediaClass *klass)
* reboot (which may cause the media to be ejected, depending on the
* application).
*/
- pspec = g_param_spec_boolean("eject-after-install",
- "EjectAfterInstall",
- _("Whether the media should be ejected after the installation process"),
- TRUE /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_EJECT_AFTER_INSTALL, pspec);
+ properties[PROP_EJECT_AFTER_INSTALL] = g_param_spec_boolean("eject-after-install",
+ "EjectAfterInstall",
+ _("Whether the media should be ejected after the installation process"),
+ TRUE /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoMedia:installer-script:
@@ -691,13 +678,14 @@ osinfo_media_class_init(OsinfoMediaClass *klass)
* Some distros provide a few different medias and not all the medias support
* installation via an install script.
*/
- pspec = g_param_spec_boolean("installer-script",
- "InstallerScript",
- _("Whether the media should be used for an installation using install scripts"),
- TRUE /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_INSTALLER_SCRIPT, pspec);
+ properties[PROP_INSTALLER_SCRIPT] = g_param_spec_boolean("installer-script",
+ "InstallerScript",
+ _("Whether the media should be used for an installation using install scripts"),
+ TRUE /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties(g_klass, LAST_PROP, properties);
}
static void
diff --git a/osinfo/osinfo_os.c b/osinfo/osinfo_os.c
index a838a71..b868503 100644
--- a/osinfo/osinfo_os.c
+++ b/osinfo/osinfo_os.c
@@ -70,7 +70,9 @@ enum {
PROP_DISTRO,
PROP_KERNEL_URL_ARGUMENT,
PROP_CLOUD_IMAGE_USERNAME,
+ LAST_PROP
};
+static GParamSpec *properties[LAST_PROP];
static void osinfo_os_finalize(GObject *object);
@@ -140,7 +142,6 @@ static void
osinfo_os_class_init(OsinfoOsClass *klass)
{
GObjectClass *g_klass = G_OBJECT_CLASS(klass);
- GParamSpec *pspec;
g_klass->get_property = osinfo_os_get_property;
g_klass->finalize = osinfo_os_finalize;
@@ -151,15 +152,12 @@ osinfo_os_class_init(OsinfoOsClass *klass)
* The generic family this OS belongs to, based upon its kernel,
* for example linux, winnt, solaris, freebsd etc.
*/
- pspec = g_param_spec_string("family",
- "Family",
- _("Generic Family"),
- NULL /* default value */,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_FAMILY,
- pspec);
+ properties[PROP_FAMILY] = g_param_spec_string("family",
+ "Family",
+ _("Generic Family"),
+ NULL /* default value */,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoOs:distro:
@@ -167,15 +165,12 @@ osinfo_os_class_init(OsinfoOsClass *klass)
* The generic distro this OS belongs to, for example fedora, windows,
* solaris, freebsd etc.
*/
- pspec = g_param_spec_string("distro",
- "Distro",
- _("Generic Distro"),
- NULL /* default value */,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_DISTRO,
- pspec);
+ properties[PROP_DISTRO] = g_param_spec_string("distro",
+ "Distro",
+ _("Generic Distro"),
+ NULL /* default value */,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoOs:kernel-url-argument:
@@ -183,30 +178,26 @@ osinfo_os_class_init(OsinfoOsClass *klass)
* The argument to be passed to kernel command line when performing a
* tree based installation of this OS.
*/
- pspec = g_param_spec_string("kernel-url-argument",
- "KernelURLArgument",
- _("Kernel URL Argument"),
- NULL /* default value */,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_KERNEL_URL_ARGUMENT,
- pspec);
+ properties[PROP_KERNEL_URL_ARGUMENT] = g_param_spec_string("kernel-url-argument",
+ "KernelURLArgument",
+ _("Kernel URL Argument"),
+ NULL /* default value */,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoOs:cloud-image-username:
*
* The username to be passed to the cloud-init program.
*/
- pspec = g_param_spec_string("cloud-image-username",
- "CloudImageUsername",
- _("Cloud image username"),
- NULL /* default value */,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_CLOUD_IMAGE_USERNAME,
- pspec);
+ properties[PROP_CLOUD_IMAGE_USERNAME] = g_param_spec_string("cloud-image-username",
+ "CloudImageUsername",
+ _("Cloud image username"),
+ NULL /* default value */,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties(g_klass, LAST_PROP, properties);
}
static void
diff --git a/osinfo/osinfo_os_variant.c b/osinfo/osinfo_os_variant.c
index faafc68..9099151 100644
--- a/osinfo/osinfo_os_variant.c
+++ b/osinfo/osinfo_os_variant.c
@@ -38,8 +38,11 @@ G_DEFINE_TYPE_WITH_PRIVATE(OsinfoOsVariant, osinfo_os_variant, OSINFO_TYPE_ENTIT
enum {
PROP_0,
- PROP_NAME
+ PROP_NAME,
+
+ LAST_PROP
};
+static GParamSpec *properties[LAST_PROP];
static void
osinfo_os_variant_get_property(GObject *object,
@@ -89,7 +92,6 @@ static void
osinfo_os_variant_class_init(OsinfoOsVariantClass *klass)
{
GObjectClass *g_klass = G_OBJECT_CLASS(klass);
- GParamSpec *pspec;
g_klass->get_property = osinfo_os_variant_get_property;
g_klass->set_property = osinfo_os_variant_set_property;
@@ -99,13 +101,14 @@ osinfo_os_variant_class_init(OsinfoOsVariantClass *klass)
*
* The name to this variant.
*/
- pspec = g_param_spec_string("name",
- "Name",
- _("The name to this variant"),
- NULL /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_NAME, pspec);
+ properties[PROP_NAME] = g_param_spec_string("name",
+ "Name",
+ _("The name to this variant"),
+ NULL /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties(g_klass, LAST_PROP, properties);
}
static void
diff --git a/osinfo/osinfo_product.c b/osinfo/osinfo_product.c
index c2b883f..7aae96e 100644
--- a/osinfo/osinfo_product.c
+++ b/osinfo/osinfo_product.c
@@ -72,7 +72,10 @@ enum {
PROP_VERSION,
PROP_CODENAME,
PROP_LOGO,
+
+ LAST_PROP
};
+static GParamSpec *properties[LAST_PROP];
static void osinfo_product_link_free(gpointer data)
{
@@ -144,7 +147,6 @@ static void
osinfo_product_class_init(OsinfoProductClass *klass)
{
GObjectClass *g_klass = G_OBJECT_CLASS(klass);
- GParamSpec *pspec;
g_klass->get_property = osinfo_product_get_property;
g_klass->finalize = osinfo_product_finalize;
@@ -154,78 +156,74 @@ osinfo_product_class_init(OsinfoProductClass *klass)
*
* The name of this product.
*/
- pspec = g_param_spec_string("name",
- "Name",
- _("Name"),
- NULL /* default value */,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_NAME, pspec);
+ properties[PROP_NAME] = g_param_spec_string("name",
+ "Name",
+ _("Name"),
+ NULL /* default value */,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoProduct:short-id:
*
* The short ID of this product.
*/
- pspec = g_param_spec_string("short-id",
- "ShortID",
- _("Short ID"),
- NULL /* default value */,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_SHORT_ID, pspec);
+ properties[PROP_SHORT_ID] = g_param_spec_string("short-id",
+ "ShortID",
+ _("Short ID"),
+ NULL /* default value */,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoProduct:vendor:
*
* The Vendor of this product.
*/
- pspec = g_param_spec_string("vendor",
- "Vendor",
- _("Vendor"),
- NULL /* default value */,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_VENDOR, pspec);
+ properties[PROP_VENDOR] = g_param_spec_string("vendor",
+ "Vendor",
+ _("Vendor"),
+ NULL /* default value */,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoProduct:version:
*
* The version of the product.
*/
- pspec = g_param_spec_string("version",
- "Version",
- _("Version"),
- NULL /* default value */,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_VERSION, pspec);
+ properties[PROP_VERSION] = g_param_spec_string("version",
+ "Version",
+ _("Version"),
+ NULL /* default value */,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoProduct:codename:
*
* The codename of this product.
*/
- pspec = g_param_spec_string("codename",
- "Codename",
- _("Codename"),
- NULL /* default value */,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_NAME, pspec);
+ properties[PROP_CODENAME] = g_param_spec_string("codename",
+ "Codename",
+ _("Codename"),
+ NULL /* default value */,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoProduct:logo:
*
* The URI of the logo of the product.
*/
- pspec = g_param_spec_string("logo",
- "Logo",
- _("URI of the logo"),
- NULL /* default value */,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_LOGO, pspec);
+ properties[PROP_LOGO] = g_param_spec_string("logo",
+ "Logo",
+ _("URI of the logo"),
+ NULL /* default value */,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties(g_klass, LAST_PROP, properties);
}
static void
diff --git a/osinfo/osinfo_resources.c b/osinfo/osinfo_resources.c
index eaed517..cae3f5b 100644
--- a/osinfo/osinfo_resources.c
+++ b/osinfo/osinfo_resources.c
@@ -33,7 +33,10 @@ enum {
PROP_N_CPUS,
PROP_RAM,
PROP_STORAGE,
+
+ LAST_PROP
};
+static GParamSpec *properties[LAST_PROP];
/**
* SECTION:osinfo_resources
@@ -142,7 +145,6 @@ static void
osinfo_resources_class_init(OsinfoResourcesClass *klass)
{
GObjectClass *g_klass = G_OBJECT_CLASS(klass);
- GParamSpec *pspec;
g_klass->get_property = osinfo_resources_get_property;
g_klass->set_property = osinfo_resources_set_property;
@@ -153,74 +155,62 @@ osinfo_resources_class_init(OsinfoResourcesClass *klass)
*
* The target hardware architecture to which these resources applies.
*/
- pspec = g_param_spec_string("architecture",
- "ARCHITECTURE",
- _("CPU Architecture"),
- NULL /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- 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_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoResources:cpu:
*
* The CPU frequency in hertz (Hz).
*/
- pspec = g_param_spec_int64("cpu",
- "CPU",
- _("CPU frequency in hertz (Hz)"),
- -1,
- G_MAXINT,
- -1,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_CPU,
- pspec);
+ properties[PROP_CPU] = g_param_spec_int64("cpu",
+ "CPU",
+ _("CPU frequency in hertz (Hz)"),
+ -1,
+ G_MAXINT,
+ -1,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoResources:n-cpus:
*
* The number of CPUs.
*/
- pspec = g_param_spec_int("n-cpus",
- "N-CPUs",
- _("Number of CPUs"),
- -1,
- G_MAXINT,
- -1,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_N_CPUS,
- pspec);
+ properties[PROP_N_CPUS] = g_param_spec_int("n-cpus",
+ "N-CPUs",
+ _("Number of CPUs"),
+ -1,
+ G_MAXINT,
+ -1,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoResources:ram:
*
* The amount of Random Access Memory (RAM) in bytes.
*/
- pspec = g_param_spec_int64("ram",
- "RAM",
- _("Amount of Random Access Memory (RAM) in bytes"),
- -1,
- G_MAXINT64,
- -1,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_RAM,
- pspec);
+ properties[PROP_RAM] = g_param_spec_int64("ram",
+ "RAM",
+ _("Amount of Random Access Memory (RAM) in bytes"),
+ -1,
+ G_MAXINT64,
+ -1,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoResources:storage:
*
* The amount of storage space in bytes.
*/
- pspec = g_param_spec_int64("storage",
+ properties[PROP_STORAGE] = g_param_spec_int64("storage",
"Storage",
_("Amount of storage space in bytes"),
-1,
@@ -228,9 +218,8 @@ osinfo_resources_class_init(OsinfoResourcesClass *klass)
-1,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass,
- PROP_STORAGE,
- pspec);
+
+ g_object_class_install_properties(g_klass, LAST_PROP, properties);
}
static void
diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c
index c8f6b36..bf35d11 100644
--- a/osinfo/osinfo_tree.c
+++ b/osinfo/osinfo_tree.c
@@ -114,7 +114,10 @@ enum {
PROP_BOOT_ISO_PATH,
PROP_HAS_TREEINFO,
PROP_OS,
+
+ LAST_PROP
};
+static GParamSpec *properties[LAST_PROP];
static void
osinfo_tree_get_property(GObject *object,
@@ -288,7 +291,6 @@ static void
osinfo_tree_class_init(OsinfoTreeClass *klass)
{
GObjectClass *g_klass = G_OBJECT_CLASS(klass);
- GParamSpec *pspec;
g_klass->dispose = osinfo_tree_dispose;
g_klass->finalize = osinfo_tree_finalize;
@@ -300,130 +302,120 @@ osinfo_tree_class_init(OsinfoTreeClass *klass)
*
* The target hardware architecture of this tree.
*/
- 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);
/**
* OsinfoTree:url:
*
* The URL to this tree.
*/
- pspec = g_param_spec_string("url",
- "URL",
- _("The URL to this tree"),
- 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 tree"),
+ NULL /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoTree:kernel-path:
*
* The path to the kernel image in the install tree.
*/
- pspec = g_param_spec_string("kernel-path",
- "KernelPath",
- _("The path to the kernel image"),
- NULL /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_KERNEL_PATH, pspec);
+ properties[PROP_KERNEL_PATH] = g_param_spec_string("kernel-path",
+ "KernelPath",
+ _("The path to the kernel image"),
+ NULL /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoTree:initrd-path:
*
* The path to the initrd image in the install tree.
*/
- pspec = g_param_spec_string("initrd-path",
- "InitrdPath",
- _("The path to the initrd image"),
- NULL /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_INITRD_PATH, pspec);
+ properties[PROP_INITRD_PATH] = g_param_spec_string("initrd-path",
+ "InitrdPath",
+ _("The path to the initrd image"),
+ NULL /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoTree:boot-iso-path:
*
* The path to the boot ISO in the install tree
*/
- pspec = g_param_spec_string("boot-iso-path",
- "BootISOPath",
- _("The path to the bootable ISO image"),
- NULL /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_BOOT_ISO_PATH, pspec);
+ properties[PROP_BOOT_ISO_PATH] = g_param_spec_string("boot-iso-path",
+ "BootISOPath",
+ _("The path to the bootable ISO image"),
+ NULL /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoTree:has-treeinfo
*
* Whether the tree has treeinfo or not
*/
- pspec = g_param_spec_boolean("has-treeinfo",
- "HasTreeinfo",
- _("Whether the tree has treeinfo"),
- FALSE /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_HAS_TREEINFO, pspec);
+ properties[PROP_HAS_TREEINFO] = g_param_spec_boolean("has-treeinfo",
+ "HasTreeinfo",
+ _("Whether the tree has treeinfo"),
+ FALSE /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoTree:treeinfo-family
*
* The treeinfo family
*/
- pspec = g_param_spec_string("treeinfo-family",
- "TreeInfoFamily",
- _("The treeinfo family"),
- NULL /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_TREEINFO_FAMILY, pspec);
+ properties[PROP_TREEINFO_FAMILY] = g_param_spec_string("treeinfo-family",
+ "TreeInfoFamily",
+ _("The treeinfo family"),
+ NULL /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoTree:treeinfo-variant
*
* The treeinfo variant
*/
- pspec = g_param_spec_string("treeinfo-variant",
- "TreeInfoVariant",
- _("The treeinfo variant"),
- NULL /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_TREEINFO_FAMILY, pspec);
+ properties[PROP_TREEINFO_VARIANT] = g_param_spec_string("treeinfo-variant",
+ "TreeInfoVariant",
+ _("The treeinfo variant"),
+ NULL /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoTree:treeinfo-version
*
* The treeinfo version
*/
- pspec = g_param_spec_string("treeinfo-version",
- "TreeInfoVersion",
- _("The treeinfo version"),
- NULL /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_TREEINFO_FAMILY, pspec);
+ properties[PROP_TREEINFO_VERSION] = g_param_spec_string("treeinfo-version",
+ "TreeInfoVersion",
+ _("The treeinfo version"),
+ NULL /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoTree:treeinfo-arch
*
* The treeinfo arch
*/
- pspec = g_param_spec_string("treeinfo-arch",
- "TreeInfoArch",
- _("The treeinfo architecture"),
- NULL /* default value */,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_TREEINFO_FAMILY, pspec);
+ properties[PROP_TREEINFO_ARCH] = g_param_spec_string("treeinfo-arch",
+ "TreeInfoArch",
+ _("The treeinfo architecture"),
+ NULL /* default value */,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
/**
* OsinfoTree:os:
@@ -433,13 +425,14 @@ osinfo_tree_class_init(OsinfoTreeClass *klass)
* the property will be filled after a successful call to
* osinfo_db_identify_tree().
*/
- pspec = g_param_spec_object("os",
- "Os",
- _("Information about the operating system on this tree"),
- OSINFO_TYPE_OS,
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
- g_object_class_install_property(g_klass, PROP_OS, pspec);
+ properties[PROP_OS] = g_param_spec_object("os",
+ "Os",
+ _("Information about the operating system on this tree"),
+ OSINFO_TYPE_OS,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties(g_klass, LAST_PROP, properties);
}
static void