static void tidy_stylable_set_valist (TidyStylable *stylable, const gchar *first_property_name, va_list varargs) { GObjectNotifyQueue *nqueue; const gchar *name; g_object_ref (stylable); nqueue = g_object_notify_queue_freeze (G_OBJECT (stylable), &property_notify_context); name = first_property_name; while (name) { GParamSpec *pspec; GValue value = { 0, }; gchar *error; pspec = tidy_stylable_find_property (stylable, name); if (!pspec) { g_warning ("%s: no style property named `%s' found for class `%s'", G_STRLOC, name, g_type_name (G_OBJECT_TYPE (stylable))); break; } if (!(pspec->flags & G_PARAM_WRITABLE) || (pspec->flags & G_PARAM_CONSTRUCT_ONLY)) { g_warning ("Style property `%s' of class `%s' is not writable", pspec->name, g_type_name (G_OBJECT_TYPE (stylable))); break; } g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); G_VALUE_COLLECT (&value, varargs, 0, &error); if (error) { g_warning ("%s: %s", G_STRLOC, error); g_free (error); g_value_unset (&value); break; } tidy_stylable_set_property_internal (stylable, pspec, &value, nqueue); g_value_unset (&value); name = va_arg (varargs, gchar*); } g_object_notify_queue_thaw (G_OBJECT (stylable), nqueue); g_object_unref (stylable); }
/** * ags_parameter_grow: * @object_type: the #GType of the object's properties * @params: the #GParameter array * @n_params: location to store new size * @...: a %NULL-terminated list of properties name and value * * Grow parameter array of @object_type object. This function is mainly used to * prepare a #GParameter array to instantiate a new #GObject by using g_object_newv(). * * Returns: the resized GParameter array * * Since: 2.0.0 */ GParameter* ags_parameter_grow(GType object_type, GParameter *params, guint *n_params, ...) { //Thank you gimp GObjectClass *object_class; gchar *param_name; va_list ap; object_class = g_type_class_ref (object_type); va_start(ap, n_params); param_name = va_arg (ap, gchar *); while (param_name) { gchar *error; GParamSpec *pspec; error = NULL; pspec = g_object_class_find_property(object_class, param_name); if (! pspec) { g_warning ("%s: object class `%s' has no property named `%s'", G_STRFUNC, g_type_name (object_type), param_name); break; } if(params != NULL){ params = g_renew (GParameter, params, *n_params + 1); }else{ params = g_new(GParameter, 1); } params[*n_params].name = param_name; params[*n_params].value.g_type = 0; g_value_init (¶ms[*n_params].value, G_PARAM_SPEC_VALUE_TYPE (pspec)); G_VALUE_COLLECT (¶ms[*n_params].value, ap, 0, &error); if (error) { g_warning ("%s: %s", G_STRFUNC, error); g_free (error); g_value_unset (¶ms[*n_params].value); break; } *n_params = *n_params + 1; param_name = va_arg (ap, gchar *); } return(params); }
GParameter * gimp_parameters_append_valist (GType object_type, GParameter *params, gint *n_params, va_list args) { GObjectClass *object_class; gchar *param_name; g_return_val_if_fail (g_type_is_a (object_type, G_TYPE_OBJECT), NULL); g_return_val_if_fail (n_params != NULL, NULL); g_return_val_if_fail (params != NULL || *n_params == 0, NULL); object_class = g_type_class_ref (object_type); param_name = va_arg (args, gchar *); while (param_name) { gchar *error = NULL; GParamSpec *pspec = g_object_class_find_property (object_class, param_name); if (! pspec) { g_warning ("%s: object class `%s' has no property named `%s'", G_STRFUNC, g_type_name (object_type), param_name); break; } params = g_renew (GParameter, params, *n_params + 1); params[*n_params].name = param_name; params[*n_params].value.g_type = 0; g_value_init (¶ms[*n_params].value, G_PARAM_SPEC_VALUE_TYPE (pspec)); G_VALUE_COLLECT (¶ms[*n_params].value, args, 0, &error); if (error) { g_warning ("%s: %s", G_STRFUNC, error); g_free (error); g_value_unset (¶ms[*n_params].value); break; } *n_params = *n_params + 1; param_name = va_arg (args, gchar *); } g_type_class_unref (object_class); return params; }
static gchar * collect (GValue *value, ...) { gchar *error; va_list var_args; error = NULL; va_start (var_args, value); G_VALUE_COLLECT (value, var_args, 0, &error); va_end (var_args); return error; }
/** * anjuta_shell_add_valist: * @shell: A #AnjutaShell interface * @first_name: First value name * @first_type: First value type * @var_args: First value, Second value name, Second value type .... * * Adds a valist of values in the shell. The valist should be in the order - * value1, name2, type2, value2,... "value_added" signal will be emitted * for each of the value. */ void anjuta_shell_add_valist (AnjutaShell *shell, const char *first_name, GType first_type, va_list var_args) { const char *name; GType type; g_return_if_fail (shell != NULL); g_return_if_fail (ANJUTA_IS_SHELL (shell)); g_return_if_fail (first_name != NULL); name = first_name; type = first_type; while (name) { GValue value = {0, }; GError *err = NULL; char *error; g_value_init (&value, type); G_VALUE_COLLECT (&value, var_args, 0, &error); if (error) { g_warning ("%s: %s", G_STRLOC, error); g_free (error); break; } anjuta_shell_add_value (shell, name, &value, &err); g_value_unset (&value); if (err) { g_warning ("Could not set value: %s\n", err->message); g_error_free (err); break; } name = va_arg (var_args, char *); if (name) { type = va_arg (var_args, GType); } } }
void rb_value_array_append_data (GValueArray *array, GType type, ...) { GValue val = {0,}; va_list va; gchar *err = NULL; va_start (va, type); g_value_init (&val, type); G_VALUE_COLLECT (&val, va, 0, &err); g_value_array_append (array, &val); g_value_unset (&val); if (err) rb_debug ("unable to collect GValue: %s", err); va_end (va); }
EXPORT_C #endif void gst_tag_list_add_valist (GstTagList * list, GstTagMergeMode mode, const gchar * tag, va_list var_args) { GstTagInfo *info; GQuark quark; gchar *error = NULL; g_return_if_fail (GST_IS_TAG_LIST (list)); g_return_if_fail (GST_TAG_MODE_IS_VALID (mode)); g_return_if_fail (tag != NULL); while (tag != NULL) { GValue value = { 0, }; quark = g_quark_from_string (tag); info = gst_tag_lookup (quark); if (info == NULL) g_warning ("no GstTag for %s", tag); g_return_if_fail (info != NULL); g_value_init (&value, info->type); G_VALUE_COLLECT (&value, var_args, 0, &error); if (error) { g_warning ("%s: %s", G_STRLOC, error); g_free (error); /* we purposely leak the value here, it might not be * in a sane state if an error condition occoured */ return; } gst_tag_list_add_value_internal (list, mode, quark, &value); g_value_unset (&value); tag = va_arg (var_args, gchar *); } }
static void gegl_node_set_props (GeglNode *node, va_list var_args) { const char *property_name; g_object_freeze_notify (G_OBJECT (node)); property_name = va_arg (var_args, gchar *); while (property_name) { GValue value = { 0, }; GParamSpec *pspec = NULL; gchar *error = NULL; if (!strcmp (property_name, "name")) { pspec = g_object_class_find_property ( G_OBJECT_GET_CLASS (G_OBJECT (node)), property_name); g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); G_VALUE_COLLECT (&value, var_args, 0, &error); if (error) { g_warning ("%s: %s", G_STRFUNC, error); g_free (error); g_value_unset (&value); break; } g_object_set_property (G_OBJECT (node), property_name, &value); g_value_unset (&value); } else { if (node->operation) { pspec = g_object_class_find_property ( G_OBJECT_GET_CLASS (G_OBJECT (node->operation)), property_name); } if (!pspec) { g_warning ("%s:%s has no property named: '%s'", G_STRFUNC, gegl_node_get_debug_name (node), property_name); break; } if (!(pspec->flags & G_PARAM_WRITABLE)) { g_warning ("%s: property (%s of operation class '%s' is not writable", G_STRFUNC, pspec->name, G_OBJECT_TYPE_NAME (node->operation)); break; } g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); G_VALUE_COLLECT (&value, var_args, 0, &error); if (error) { g_warning ("%s: %s", G_STRFUNC, error); g_free (error); g_value_unset (&value); break; } g_object_set_property (G_OBJECT (node->operation), property_name, &value); g_value_unset (&value); } property_name = va_arg (var_args, gchar *); } g_object_thaw_notify (G_OBJECT (node)); }
GimpValueArray * gimp_pdb_execute_procedure_by_name (GimpPDB *pdb, GimpContext *context, GimpProgress *progress, GError **error, const gchar *name, ...) { GimpProcedure *procedure; GimpValueArray *args; GimpValueArray *return_vals; va_list va_args; gint i; g_return_val_if_fail (GIMP_IS_PDB (pdb), NULL); g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL); g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); g_return_val_if_fail (name != NULL, NULL); procedure = gimp_pdb_lookup_procedure (pdb, name); if (! procedure) { GError *pdb_error = g_error_new (GIMP_PDB_ERROR, GIMP_PDB_ERROR_PROCEDURE_NOT_FOUND, _("Procedure '%s' not found"), name); return_vals = gimp_procedure_get_return_values (NULL, FALSE, pdb_error); g_propagate_error (error, pdb_error); return return_vals; } args = gimp_procedure_get_arguments (procedure); va_start (va_args, name); for (i = 0; i < procedure->num_args; i++) { GValue *value; GType arg_type; gchar *error_msg = NULL; arg_type = va_arg (va_args, GType); if (arg_type == G_TYPE_NONE) break; value = gimp_value_array_index (args, i); if (arg_type != G_VALUE_TYPE (value)) { GError *pdb_error; const gchar *expected = g_type_name (G_VALUE_TYPE (value)); const gchar *got = g_type_name (arg_type); gimp_value_array_unref (args); pdb_error = g_error_new (GIMP_PDB_ERROR, GIMP_PDB_ERROR_INVALID_ARGUMENT, _("Procedure '%s' has been called with a " "wrong type for argument #%d. " "Expected %s, got %s."), gimp_object_get_name (procedure), i + 1, expected, got); return_vals = gimp_procedure_get_return_values (procedure, FALSE, pdb_error); g_propagate_error (error, pdb_error); va_end (va_args); return return_vals; } G_VALUE_COLLECT (value, va_args, G_VALUE_NOCOPY_CONTENTS, &error_msg); if (error_msg) { GError *pdb_error = g_error_new_literal (GIMP_PDB_ERROR, GIMP_PDB_ERROR_INTERNAL_ERROR, error_msg); g_warning ("%s: %s", G_STRFUNC, error_msg); g_free (error_msg); gimp_value_array_unref (args); return_vals = gimp_procedure_get_return_values (procedure, FALSE, pdb_error); g_propagate_error (error, pdb_error); va_end (va_args); return return_vals; } } va_end (va_args); return_vals = gimp_pdb_execute_procedure_by_name_args (pdb, context, progress, error, name, args); gimp_value_array_unref (args); return return_vals; }
static void transition_add_properties (AfTransition *transition, va_list args) { const gchar *property_name; GObject *object, *child; property_name = va_arg (args, const gchar *); object = transition->object; child = transition->child; while (property_name) { GParamSpec *pspec; GValue to = { 0, }; GValue func = { 0, }; gchar *error = NULL; if (!child) pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (object), property_name); else pspec = gtk_container_class_find_child_property (G_OBJECT_GET_CLASS (object), property_name); if (G_UNLIKELY (!pspec)) { g_warning ("Property '%s' does not exist on object of class '%s'", property_name, G_OBJECT_TYPE_NAME (object)); break; } g_value_init (&to, pspec->value_type); G_VALUE_COLLECT (&to, args, 0, &error); if (error) { g_warning (error); g_free (error); break; } g_value_init (&func, G_TYPE_POINTER); G_VALUE_COLLECT (&func, args, 0, &error); if (error) { g_warning (error); g_free (error); break; } transition_add_property (transition, pspec, &to, (AfTypeTransformationFunc)g_value_get_pointer (&func)); g_value_unset (&to); g_value_unset (&func); property_name = va_arg (args, const gchar *); } }
PpgAnimation* g_object_animatev (gpointer object, PpgAnimationMode mode, guint duration_msec, guint frame_rate, const gchar *first_property, va_list args) { PpgAnimation *animation; GObjectClass *klass; GObjectClass *pklass; const gchar *name; GParamSpec *pspec; GtkWidget *parent; GValue value = { 0 }; gchar *error = NULL; GType type; GType ptype; g_return_val_if_fail(first_property != NULL, NULL); g_return_val_if_fail(mode < PPG_ANIMATION_LAST, NULL); name = first_property; type = G_TYPE_FROM_INSTANCE(object); klass = G_OBJECT_GET_CLASS(object); animation = g_object_new(PPG_TYPE_ANIMATION, "duration", duration_msec, "frame-rate", frame_rate ? frame_rate : 60, "mode", mode, "target", object, NULL); do { /* * First check for the property on the object. If that does not exist * then check if the object has a parent and look at its child * properties (if its a GtkWidget). */ if (!(pspec = g_object_class_find_property(klass, name))) { if (!g_type_is_a(type, GTK_TYPE_WIDGET)) { g_critical("Failed to find property %s in %s", name, g_type_name(type)); goto failure; } if (!(parent = gtk_widget_get_parent(object))) { g_critical("Failed to find property %s in %s", name, g_type_name(type)); goto failure; } pklass = G_OBJECT_GET_CLASS(parent); ptype = G_TYPE_FROM_INSTANCE(parent); if (!(pspec = gtk_container_class_find_child_property(pklass, name))) { g_critical("Failed to find property %s in %s or parent %s", name, g_type_name(type), g_type_name(ptype)); goto failure; } } g_value_init(&value, pspec->value_type); G_VALUE_COLLECT(&value, args, 0, &error); if (error != NULL) { g_critical("Failed to retrieve va_list value: %s", error); g_free(error); goto failure; } ppg_animation_add_property(animation, pspec, &value); g_value_unset(&value); } while ((name = va_arg(args, const gchar *))); ppg_animation_start(animation); return animation; failure: g_object_ref_sink(animation); g_object_unref(animation); return NULL; }
/* * Two mock miners available but only 1 running */ gboolean dbus_g_proxy_call (DBusGProxy *proxy, const gchar *function_name, GError **error, GType first_arg_type, ...) { va_list args; GType arg_type; const gchar *running_services[] = { "org.gnome.Tomboy", "org.gnome.GConf", MOCK_MINER_1, "org.gnome.SessionManager", NULL}; va_start (args, first_arg_type); if (g_strcmp0 (function_name, "ListNames") == 0) { /* * G_TYPE_INVALID, * G_TYPE_STRV, &result, * G_TYPE_INVALID */ GValue value = { 0, }; gchar *local_error = NULL; arg_type = va_arg (args, GType); g_assert (arg_type == G_TYPE_STRV); g_value_init (&value, arg_type); g_value_set_boxed (&value, running_services); G_VALUE_LCOPY (&value, args, 0, &local_error); g_free (local_error); g_value_unset (&value); } else if (g_strcmp0 (function_name, "NameHasOwner") == 0) { /* * G_TYPE_STRING, miner, * G_TYPE_INVALID, * G_TYPE_BOOLEAN, &active, * G_TYPE_INVALID)) { */ GValue value = { 0, }; gchar *local_error = NULL; const gchar *miner_name; TrackerMinerMock *miner; gboolean active; g_value_init (&value, G_TYPE_STRING); G_VALUE_COLLECT (&value, args, 0, &local_error); g_free (local_error); miner_name = g_value_get_string (&value); miner = (TrackerMinerMock *)g_hash_table_lookup (miners, miner_name); active = !tracker_miner_mock_get_paused (miner); g_value_unset (&value); arg_type = va_arg (args, GType); g_assert (arg_type == G_TYPE_INVALID); arg_type = va_arg (args, GType); g_assert (arg_type == G_TYPE_BOOLEAN); g_value_init (&value, arg_type); g_value_set_boolean (&value, active); G_VALUE_LCOPY (&value, args, 0, &local_error); g_free (local_error); g_value_unset (&value); } else if (g_strcmp0 (function_name, "GetPauseDetails") == 0) { /* * G_TYPE_INVALID, * G_TYPE_STRV, &apps, * G_TYPE_STRV, &reasons, * G_TYPE_INVALID */ GValue value = { 0, }; gchar *local_error = NULL; gint amount; gchar **apps, **reasons; TrackerMinerMock *miner = (TrackerMinerMock *)proxy; arg_type = va_arg (args, GType); g_assert (arg_type == G_TYPE_STRV); g_value_init (&value, arg_type); apps = tracker_miner_mock_get_apps (miner, &amount); if (apps == NULL || amount == 0) { apps = g_new0 (gchar *, 1); }
void moo_plugin_call_method_valist (gpointer plugin, const char *name, va_list var_args) { MooPluginMeth *meth; GValue *plugin_and_args, *args, *freeme = NULL; GValue stack_params[MAX_STACK_VALUES]; guint i; g_return_if_fail (MOO_IS_PLUGIN (plugin)); g_return_if_fail (name != NULL); meth = moo_plugin_lookup_method (plugin, name); if (!meth) { g_warning ("plugin '%s' does not have method '%s'", moo_plugin_id (plugin), name); return; } g_assert (meth->ptype == G_OBJECT_TYPE (plugin)); if (meth->n_params < MAX_STACK_VALUES) plugin_and_args = stack_params; else plugin_and_args = freeme = g_new (GValue, meth->n_params + 1); args = plugin_and_args + 1; for (i = 0; i < meth->n_params; i++) { char *error; GType type = meth->param_types[i] & ~G_SIGNAL_TYPE_STATIC_SCOPE; gboolean static_scope = meth->param_types[i] & G_SIGNAL_TYPE_STATIC_SCOPE; args[i].g_type = 0; g_value_init (args + i, type); G_VALUE_COLLECT (args + i, var_args, static_scope ? G_VALUE_NOCOPY_CONTENTS : 0, &error); if (error) { g_warning ("%s", error); g_free (error); while (i--) g_value_unset (args + i); g_free (freeme); return; } } plugin_and_args->g_type = 0; g_value_init (plugin_and_args, G_OBJECT_TYPE (plugin)); g_value_set_object (plugin_and_args, plugin); if (meth->return_type == G_TYPE_NONE) { moo_plugin_call_methodv (plugin_and_args, name, NULL); } else { GValue return_val; char *error = NULL; GType type = meth->return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE; gboolean static_scope = meth->return_type & G_SIGNAL_TYPE_STATIC_SCOPE; return_val.g_type = 0; g_value_init (&return_val, type); moo_plugin_call_methodv (plugin_and_args, name, &return_val); G_VALUE_LCOPY (&return_val, var_args, static_scope ? G_VALUE_NOCOPY_CONTENTS : 0, &error); if (!error) { g_value_unset (&return_val); } else { g_warning ("%s", error); g_free (error); } } for (i = 0; i < meth->n_params + 1; i++) g_value_unset (plugin_and_args + i); g_free (freeme); }
/** * infc_request_manager_add_request_valist: * @manager: A #InfcRequestManager. * @request_type: The type of request to add, such as %INFC_TYPE_NODE_REQUEST. * @request_name: The name of the request, such as "explore-node" or * "subscribe-session" * @first_property_name: The first property name apart from name and seq to * set for the new request. * @arglist: The value of the first property, followed optionally by more * name/value pairs, followed by %NULL. * * Adds a request to the request manager. * * Return Value: The generated #InfcRequest (actually of type @request_type). */ InfcRequest* infc_request_manager_add_request_valist(InfcRequestManager* manager, GType request_type, const gchar* request_name, const gchar* first_property_name, va_list arglist) { InfcRequestManagerPrivate* priv; GObjectClass* request_class; InfcRequest* request; GParameter* params; const gchar* prop_name; gsize param_size; gsize param_alloc; guint seq; gchar* error; GParamSpec* pspec; guint i; g_return_val_if_fail(INFC_IS_REQUEST_MANAGER(manager), NULL); g_return_val_if_fail(request_name != NULL, NULL); request_class = g_type_class_ref(request_type); g_return_val_if_fail(request_class != NULL, NULL); priv = INFC_REQUEST_MANAGER_PRIVATE(manager); seq = priv->seq_counter; g_assert( g_hash_table_lookup(priv->requests, GUINT_TO_POINTER(seq)) == NULL ); param_size = 0; param_alloc = 16; params = g_malloc0(param_alloc * sizeof(GParameter)); params[param_size].name = "name"; g_value_init(¶ms[param_size].value, G_TYPE_STRING); g_value_set_static_string(¶ms[param_size].value, request_name); ++ param_size; params[param_size].name = "seq"; g_value_init(¶ms[param_size].value, G_TYPE_UINT); g_value_set_uint(¶ms[param_size].value, seq); ++ param_size; prop_name = first_property_name; error = NULL; while(prop_name != NULL) { pspec = g_object_class_find_property(request_class, prop_name); if(pspec == NULL) { g_warning( "%s: object class `%s' has no attribute named `%s'", G_STRFUNC, g_type_name(request_type), prop_name ); break; } if(param_size >= param_alloc) { param_alloc += 16; params = g_realloc(params, param_alloc * sizeof(GParameter)); } params[param_size].name = prop_name; g_value_init(¶ms[param_size].value, G_PARAM_SPEC_VALUE_TYPE(pspec)); G_VALUE_COLLECT(¶ms[param_size].value, arglist, 0, &error); if(error != NULL) { g_warning("%s: %s", G_STRFUNC, error); g_value_unset(¶ms[param_size].value); g_free(error); break; } ++ param_size; prop_name = va_arg(arglist, const gchar*); } if(prop_name == NULL) { request = INFC_REQUEST(g_object_newv(request_type, param_size, params)); g_hash_table_insert(priv->requests, GUINT_TO_POINTER(seq), request); ++ priv->seq_counter; } else { /* An error occured. We do not use GError here tough, because this is a * most likely a bug in someone's code (if not, it is one in infinote's * code). */ request = NULL; } for(i = 0; i < param_size; ++ i) g_value_unset(¶ms[i].value); g_free(params); g_type_class_unref(request_class); return request; }
/** * clutter_container_child_set: * @container: a #ClutterContainer * @actor: a #ClutterActor that is a child of @container. * @first_prop: name of the first property to be set. * @...: value for the first property, followed optionally by more name/value * pairs terminated with NULL. * * Sets container specific properties on the child of a container. * * Since: 0.8 */ void clutter_container_child_set (ClutterContainer *container, ClutterActor *actor, const gchar *first_prop, ...) { GObjectClass *klass; const gchar *name; va_list var_args; g_return_if_fail (CLUTTER_IS_CONTAINER (container)); g_return_if_fail (CLUTTER_IS_ACTOR (actor)); klass = G_OBJECT_GET_CLASS (container); va_start (var_args, first_prop); name = first_prop; while (name) { GValue value = { 0, }; gchar *error = NULL; GParamSpec *pspec; pspec = clutter_container_class_find_child_property (klass, name); if (!pspec) { g_warning ("%s: Containers of type '%s' have no child " "property named '%s'", G_STRLOC, G_OBJECT_TYPE_NAME (container), name); break; } if (!(pspec->flags & G_PARAM_WRITABLE)) { g_warning ("%s: Child property '%s' of the container '%s' " "is not writable", G_STRLOC, pspec->name, G_OBJECT_TYPE_NAME (container)); break; } #if GLIB_CHECK_VERSION (2, 23, 2) G_VALUE_COLLECT_INIT (&value, G_PARAM_SPEC_VALUE_TYPE (pspec), var_args, 0, &error); #else g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); G_VALUE_COLLECT (&value, var_args, 0, &error); #endif /* GLIB_CHECK_VERSION (2, 23, 2) */ if (error) { /* we intentionally leak the GValue because it might * be in an undefined state and calling g_value_unset() * on it might crash */ g_warning ("%s: %s", G_STRLOC, error); g_free (error); break; } container_set_child_property (container, actor, &value, pspec); g_value_unset (&value); name = va_arg (var_args, gchar*); } va_end (var_args); }
/** * clutter_layout_manager_child_set: * @manager: a #ClutterLayoutManager * @container: a #ClutterContainer using @manager * @actor: a #ClutterActor child of @container * @first_property: the first property name * @Varargs: a list of property name and value pairs * * Sets a list of properties and their values on the #ClutterLayoutMeta * associated by @manager to a child of @container * * Languages bindings should use clutter_layout_manager_child_set_property() * instead * * Since: 1.2 */ void clutter_layout_manager_child_set (ClutterLayoutManager *manager, ClutterContainer *container, ClutterActor *actor, const gchar *first_property, ...) { ClutterLayoutMeta *meta; GObjectClass *klass; const gchar *pname; va_list var_args; g_return_if_fail (CLUTTER_IS_LAYOUT_MANAGER (manager)); g_return_if_fail (CLUTTER_IS_CONTAINER (container)); g_return_if_fail (CLUTTER_IS_ACTOR (actor)); g_return_if_fail (first_property != NULL); meta = get_child_meta (manager, container, actor); if (meta == NULL) { g_warning ("Layout managers of type '%s' do not support " "layout metadata", g_type_name (G_OBJECT_TYPE (manager))); return; } klass = G_OBJECT_GET_CLASS (meta); va_start (var_args, first_property); pname = first_property; while (pname) { GValue value = { 0, }; GParamSpec *pspec; gchar *error; gboolean res; pspec = g_object_class_find_property (klass, pname); if (pspec == NULL) { g_warning ("%s: Layout managers of type '%s' have no layout " "property named '%s'", G_STRLOC, G_OBJECT_TYPE_NAME (manager), pname); break; } #if GLIB_CHECK_VERSION (2, 23, 2) G_VALUE_COLLECT_INIT (&value, G_PARAM_SPEC_VALUE_TYPE (pspec), var_args, 0, &error); #else g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); G_VALUE_COLLECT (&value, var_args, 0, &error); #endif /* GLIB_CHECK_VERSION (2, 23, 2) */ if (error) { g_warning ("%s: %s", G_STRLOC, error); g_free (error); break; } res = layout_set_property_internal (manager, G_OBJECT (meta), pspec, &value); g_value_unset (&value); if (!res) break; pname = va_arg (var_args, gchar*); } va_end (var_args); }