[virt-tools-list] [libosinfo 1/4] Add InstallScript:expected-path-format

Zeeshan Ali (Khattak) zeeshanak at gnome.org
Mon Nov 12 14:55:56 UTC 2012


On Mon, Nov 12, 2012 at 11:37 AM, Christophe Fergeau
<cfergeau at redhat.com> wrote:
> On Sun, Nov 11, 2012 at 08:14:55PM +0100, Zeeshan Ali (Khattak) wrote:
>> From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>
>>
>> Inform the applications in which format the paths are expected by the
>> installer.
>> ---
>>  data/install-scripts/windows-cmd.xml      |  2 +-
>>  data/install-scripts/windows-reg.xml      |  2 +-
>>  data/install-scripts/windows-sif.xml      |  2 +-
>>  data/install-scripts/windows-unattend.xml |  4 ++--
>>  osinfo/libosinfo.syms                     |  4 ++++
>>  osinfo/osinfo_install_script.c            | 28 ++++++++++++++++++++++++++++
>>  osinfo/osinfo_install_script.h            | 22 +++++++++++++++++-----
>>  osinfo/osinfo_loader.c                    |  9 +++++++++
>>  8 files changed, 63 insertions(+), 10 deletions(-)
>>
>> diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c
>> index 2292aac..2133618 100644
>> --- a/osinfo/osinfo_install_script.c
>> +++ b/osinfo/osinfo_install_script.c
>> @@ -59,6 +59,7 @@ enum {
>>      PROP_TEMPLATE_DATA,
>>      PROP_PROFILE,
>>      PROP_PRODUCT_KEY_FORMAT,
>> +    PROP_EXPECTED_PATH_FORMAT,
>
> Not sure about the 'expected' part of the property name "path-format"
> should be enough?

IMO its much more descriptive yet short enough. Also, its more
consistent with the existing _get_expected_filename() method.

>>  };
>>
>>  typedef struct _OsinfoInstallScriptGenerateData OsinfoInstallScriptGenerateData;
>> @@ -136,6 +137,11 @@ osinfo_os_get_property(GObject    *object,
>>                             osinfo_install_script_get_product_key_format(script));
>>          break;
>>
>> +    case PROP_EXPECTED_PATH_FORMAT:
>> +        g_value_set_enum(value,
>> +                         osinfo_install_script_get_expected_path_format(script));
>> +        break;
>> +
>>      default:
>>          /* We don't have any other property... */
>>          G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
>> @@ -221,6 +227,19 @@ osinfo_install_script_class_init (OsinfoInstallScriptClass *klass)
>>                                      PROP_PRODUCT_KEY_FORMAT,
>>                                      pspec);
>>
>> +    pspec = g_param_spec_enum("expected-path-format",
>> +                              "Expected Path Format",
>> +                              _("Expected path format"),
>> +                              OSINFO_TYPE_PATH_FORMAT,
>> +                              OSINFO_PATH_FORMAT_UNIX /* default value */,
>> +                              G_PARAM_READABLE |
>> +                              G_PARAM_STATIC_NAME |
>> +                              G_PARAM_STATIC_NICK |
>> +                              G_PARAM_STATIC_BLURB);
>> +    g_object_class_install_property(g_klass,
>> +                                    PROP_EXPECTED_PATH_FORMAT,
>> +                                    pspec);
>> +
>>      g_type_class_add_private (klass, sizeof (OsinfoInstallScriptPrivate));
>>  }
>>
>> @@ -1010,6 +1029,15 @@ GFile *osinfo_install_script_generate_output(OsinfoInstallScript *script,
>>      return data.file;
>>  }
>>
>> +OsinfoPathFormat osinfo_install_script_get_expected_path_format(OsinfoInstallScript *script)
>> +{
>> +    return osinfo_entity_get_param_value_enum
>> +        (OSINFO_ENTITY(script),
>> +         OSINFO_INSTALL_SCRIPT_PROP_EXPECTED_PATH_FORMAT,
>> +         OSINFO_TYPE_PATH_FORMAT,
>> +         OSINFO_PATH_FORMAT_UNIX);
>> +}
>> +
>>  /*
>>   * Local variables:
>>   *  indent-tabs-mode: nil
>> diff --git a/osinfo/osinfo_install_script.h b/osinfo/osinfo_install_script.h
>> index 348dcdd..eba8192 100644
>> --- a/osinfo/osinfo_install_script.h
>> +++ b/osinfo/osinfo_install_script.h
>> @@ -46,11 +46,12 @@ typedef struct _OsinfoInstallScriptPrivate OsinfoInstallScriptPrivate;
>>  #define OSINFO_INSTALL_SCRIPT_PROFILE_JEOS    "jeos"
>>  #define OSINFO_INSTALL_SCRIPT_PROFILE_DESKTOP "desktop"
>>
>> -#define OSINFO_INSTALL_SCRIPT_PROP_TEMPLATE_URI       "template-uri"
>> -#define OSINFO_INSTALL_SCRIPT_PROP_TEMPLATE_DATA      "template-data"
>> -#define OSINFO_INSTALL_SCRIPT_PROP_PROFILE            "profile"
>> -#define OSINFO_INSTALL_SCRIPT_PROP_PRODUCT_KEY_FORMAT "product-key-format"
>> -#define OSINFO_INSTALL_SCRIPT_PROP_EXPECTED_FILENAME  "expected-filename"
>> +#define OSINFO_INSTALL_SCRIPT_PROP_TEMPLATE_URI         "template-uri"
>> +#define OSINFO_INSTALL_SCRIPT_PROP_TEMPLATE_DATA        "template-data"
>> +#define OSINFO_INSTALL_SCRIPT_PROP_PROFILE              "profile"
>> +#define OSINFO_INSTALL_SCRIPT_PROP_PRODUCT_KEY_FORMAT   "product-key-format"
>> +#define OSINFO_INSTALL_SCRIPT_PROP_EXPECTED_FILENAME    "expected-filename"
>> +#define OSINFO_INSTALL_SCRIPT_PROP_EXPECTED_PATH_FORMAT "expected-path-format"
>>
>>  /* object */
>>  struct _OsinfoInstallScript
>> @@ -71,6 +72,16 @@ struct _OsinfoInstallScriptClass
>>      /* class members */
>>  };
>>
>> +/**
>> + * OsinfoPathFormat:
>> + * OSINFO_PATH_FORMAT_UNIX: Unix/Linux path format, e.g /home/foo/bar.txt
>> + * OSINFO_PATH_FORMAT_DOS: DOS/Windows path format, e.g \My Documents\bar.txt
>
> Shouldn't this have a drive name as well? C:\My Documents\bar.txt

As you'll see in the following patches, we'll have different params
for disk/drive and path so that such API are as consistent as possible
for different OSs.


-- 
Regards,

Zeeshan Ali (Khattak)
FSF member#5124




More information about the virt-tools-list mailing list