[Libosinfo] [PATCH 02/12] media: API to get/set ISO9660 volume size
Zeeshan Ali (Khattak)
zeeshanak at gnome.org
Sun Mar 15 16:21:58 UTC 2015
On Sun, Mar 15, 2015 at 4:18 PM, Fabiano Fidêncio <fabiano at fidencio.org> wrote:
> On Sun, Mar 15, 2015 at 5:04 PM, Zeeshan Ali (Khattak)
> <zeeshanak at gnome.org> wrote:
>> ---
>> osinfo/libosinfo.syms | 5 +++++
>> osinfo/osinfo_media.c | 43 +++++++++++++++++++++++++++++++++++++++++++
>> osinfo/osinfo_media.h | 2 ++
>> 3 files changed, 50 insertions(+)
>>
>> diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
>> index 5c423b9..2dba411 100644
>> --- a/osinfo/libosinfo.syms
>> +++ b/osinfo/libosinfo.syms
>> @@ -505,6 +505,11 @@ LIBOSINFO_0.2.11 {
>> osinfo_install_script_get_needs_internet;
>> } LIBOSINFO_0.2.10;
>>
>> +LIBOSINFO_0.2.12 {
>> + global:
>> + osinfo_media_get_volume_size;
>> +} LIBOSINFO_0.2.11;
>> +
>> /* Symbols in next release...
>>
>> LIBOSINFO_0.0.2 {
>> diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c
>> index 96f9603..e86df11 100644
>> --- a/osinfo/osinfo_media.c
>> +++ b/osinfo/osinfo_media.c
>> @@ -156,6 +156,7 @@ enum {
>> PROP_INSTALLER_REBOOTS,
>> PROP_OS,
>> PROP_LANGUAGES,
>> + PROP_VOLUME_SIZE
>> };
>>
>> static void
>> @@ -230,6 +231,11 @@ osinfo_media_get_property(GObject *object,
>> g_value_set_pointer(value, osinfo_media_get_languages(media));
>> break;
>>
>> + case PROP_VOLUME_SIZE:
>> + g_value_set_int64(value,
>> + osinfo_media_get_volume_size(media));
>> + break;
>> +
>> default:
>> /* We don't have any other property... */
>> G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
>> @@ -320,6 +326,12 @@ osinfo_media_set_property(GObject *object,
>> osinfo_media_set_languages(media, g_value_get_pointer(value));
>> break;
>>
>> + case PROP_VOLUME_SIZE:
>> + osinfo_entity_set_param_int64(OSINFO_ENTITY(media),
>> + OSINFO_MEDIA_PROP_VOLUME_SIZE,
>> + g_value_get_int64(value));
>> + break;
>> +
>> default:
>> /* We don't have any other property... */
>> G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
>> @@ -547,6 +559,21 @@ osinfo_media_class_init(OsinfoMediaClass *klass)
>> G_PARAM_READABLE |
>> G_PARAM_STATIC_STRINGS);
>> g_object_class_install_property(g_klass, PROP_LANGUAGES, pspec);
>> +
>> + /**
>> + * 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);
>> }
>>
>
> Hmmm. I'd go for -1 as a default value.
Oh nice catch. It is supposed to be -1.
--
Regards,
Zeeshan Ali (Khattak)
________________________________________
Befriend GNOME: http://www.gnome.org/friends/
More information about the Libosinfo
mailing list