Commit 40a28eee4d6156b4e52caebaf06c7bbd79aaf078

libgve: Adding string param type
  
3535G_DEFINE_TYPE (GVEVideoEffect, gve_video_effect, G_TYPE_OBJECT);
3636
3737static GParamSpec *
38create_string_param (GKeyFile *key_file, const gchar *group_name, struct param_internal *config)
39{
40 gchar *default_value;
41 GError *error = NULL;
42 GParamSpec *pspec;
43
44 default_value = g_key_file_get_string (key_file, group_name, "Default", &error);
45 if (error != NULL)
46 {
47 g_warning ("Could not get 'Default': %s", error->message);
48 g_error_free (error);
49 error = NULL;
50 }
51 pspec = g_param_spec_string (config->name, config->name, config->comment,
52 default_value, G_PARAM_READABLE | G_PARAM_WRITABLE);
53 return pspec;
54}
55
56static GParamSpec *
3857create_bool_param (GKeyFile *key_file, const gchar *group_name, struct param_internal *config)
3958{
40 gint default_value;
59 gboolean default_value;
4160 GError *error = NULL;
4261 GParamSpec *pspec;
4362
44 default_value = g_key_file_get_integer (key_file, group_name, "Default", &error);
63 default_value = g_key_file_get_boolean (key_file, group_name, "Default", &error);
4564 if (error != NULL)
4665 {
4766 g_warning ("Could not get '%s': %s", "Default", error->message);
193193 pspec = create_double_param (key_file, group_name, &config);
194194 else if (!g_strcmp0 (type, "bool"))
195195 pspec = create_bool_param (key_file, group_name, &config);
196 else if (!g_strcmp0 (type, "string"))
197 pspec = create_string_param (key_file, group_name, &config);
196198 else
197199 g_warning ("Property '%s' type cannot be handled", config.name);
198200
341341 g_value_init (&value, G_TYPE_BOOLEAN);
342342 g_value_set_boolean (&value, G_PARAM_SPEC_BOOLEAN (pspec)->default_value);
343343 }
344 else if (G_IS_PARAM_SPEC_STRING (pspec))
345 {
346 g_value_init (&value, G_TYPE_STRING);
347 g_value_set_string (&value, G_PARAM_SPEC_STRING (pspec)->default_value);
348 }
344349 else
345350 {
346351 g_warning ("Could not set default value for %s: type mismatch", (char *)item->data);
386386 g_object_set (element, property_name, g_value_get_double (value), NULL);
387387 else if (G_VALUE_HOLDS_BOOLEAN (value))
388388 g_object_set (element, property_name, g_value_get_boolean (value), NULL);
389 else if (G_VALUE_HOLDS_STRING (value))
390 g_object_set (element, property_name, g_value_get_string (value), NULL);
389391 else
390392 g_warning ("Property '%s' was not set: Type mismatch", property);
391393}