void catch_task_set_value (CatchTask *task, const GValue *value) { g_return_if_fail(CATCH_IS_TASK(task)); g_return_if_fail(G_IS_VALUE(value)); if (task->priv->error) { g_clear_error(&task->priv->error); } g_value_unset(&task->priv->value); g_value_copy(value, &task->priv->value); }
void gegl_operation_context_set_property (GeglOperationContext *context, const gchar *property_name, const GValue *value) { GValue *storage; g_return_if_fail (context != NULL); g_return_if_fail (G_VALUE_TYPE (value) == GEGL_TYPE_BUFFER); /* if the value already exists in the context it will be reused */ storage = gegl_operation_context_add_value (context, property_name); g_value_copy (value, storage); }
static void thunar_preferences_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { ThunarPreferences *preferences = THUNAR_PREFERENCES (object); GValue *src; src = preferences->values + prop_id; if (G_IS_VALUE (src)) g_value_copy (src, value); else g_param_value_set_default (pspec, value); }
void gsf_doc_prop_glue_set_val (GsfDocProp *prop, GValue *value) { GValue prop_val; if (prop == NULL) return; if (value == NULL || !G_IS_VALUE (value)) return; g_value_init (&prop_val, G_VALUE_TYPE (value)); g_value_copy (value, &prop_val); gsf_doc_prop_set_val (prop, &prop_val); }
/** * lomo_stream_set_extended_metadata: * @self: A #LomoStream * @key: (transfer none): Key * @value: (transfer none): Value to store * * Adds (or replaces) the value for the extended metadata for key */ void lomo_stream_set_extended_metadata(LomoStream *self, const gchar *key, const GValue *value) { g_return_if_fail(LOMO_IS_STREAM(self)); g_return_if_fail(key != NULL); g_return_if_fail(G_IS_VALUE(value)); gchar *k = g_strconcat("x-lomo-extended-metadata-", key, NULL); GValue *v = g_new0(GValue, 1); g_value_copy(value, g_value_init(v, G_VALUE_TYPE(value))); g_object_set_data_full(G_OBJECT(self), k, v, (GDestroyNotify) destroy_gvalue); g_free(k); g_signal_emit(self, lomo_stream_signals[SIGNAL_EXTENDED_METADATA_UPDATED], 0, key); }
static void subclass_get_property (GObject *object, guint property_id, GValue *dst_value, GParamSpec *pspec) { ESourceCamel *extension; GArray *value_array; GValue *src_value; extension = E_SOURCE_CAMEL (object); value_array = extension->priv->value_array; src_value = &g_array_index (value_array, GValue, property_id - 1); g_value_copy (src_value, dst_value); }
gboolean property_context_set(PropertyContext * ctx, GValue * value) { if (ctx == NULL) { mkdg_log(WARN, "property_context_set(-): ctx is NULL"); return FALSE; } if (!G_IS_VALUE(value)) { mkdg_log(WARN, "property_context_set(%s): value is not GValue", ctx->spec->key); return FALSE; } mkdg_log(DEBUG, "property_context_set(%s,%s)", ctx->spec->key, mkdg_g_value_to_string(value)); g_value_copy(value, &(ctx->value)); return TRUE; }
static void __get_value (MidgardCRCoreQueryHolder *self, GValue *value) { g_return_if_fail (self != NULL); g_return_if_fail (self != NULL); MidgardCRCoreQueryValue *mqp = (MidgardCRCoreQueryValue *) self; if (G_IS_VALUE (value)) g_value_unset (value); g_value_init (value, G_VALUE_TYPE (&mqp->priv->value)); g_value_copy ((const GValue *) &mqp->priv->value, value); return; }
static void set_construct_properties (PeasExtensionSet *set, PeasParameterArray *array) { unsigned i; set->priv->n_parameters = array->n_parameters; set->priv->parameters = g_new0 (GParameter, array->n_parameters); for (i = 0; i < array->n_parameters; i++) { set->priv->parameters[i].name = g_intern_string (array->parameters[i].name); g_value_init (&set->priv->parameters[i].value, G_VALUE_TYPE (&array->parameters[i].value)); g_value_copy (&array->parameters[i].value, &set->priv->parameters[i].value); } }
static ShaderUniform * shader_uniform_new (const gchar *name, const GValue *value) { ShaderUniform *retval; retval = g_slice_new0 (ShaderUniform); retval->name = g_strdup (name); retval->type = G_VALUE_TYPE (value); retval->location = -1; g_value_init (&retval->value, retval->type); g_value_copy (value, &retval->value); return retval; }
static gboolean search_text_transform_from (GBinding *binding, const GValue *from_value, GValue *to_value, gpointer user_data) { g_assert (from_value != NULL); g_assert (to_value != NULL); if (g_value_get_string (from_value) == NULL) g_value_set_string (to_value, ""); else g_value_copy (from_value, to_value); return TRUE; }
static void gtk_css_custom_property_query (GtkStyleProperty *property, GValue *value, GtkStyleQueryFunc query_func, gpointer query_data) { GtkCssStyleProperty *style = GTK_CSS_STYLE_PROPERTY (property); GtkCssCustomProperty *custom = GTK_CSS_CUSTOM_PROPERTY (property); GtkCssValue *css_value; css_value = (* query_func) (_gtk_css_style_property_get_id (style), query_data); if (css_value == NULL) css_value = _gtk_css_style_property_get_initial_value (style); g_value_init (value, custom->pspec->value_type); g_value_copy (_gtk_css_typed_value_get (css_value), value); }
gboolean rb_signal_accumulator_object_handled (GSignalInvocationHint *hint, GValue *return_accu, const GValue *handler_return, gpointer dummy) { if (handler_return == NULL || !G_VALUE_HOLDS_OBJECT (handler_return) || g_value_get_object (handler_return) == NULL) return TRUE; g_value_unset (return_accu); g_value_init (return_accu, G_VALUE_TYPE (handler_return)); g_value_copy (handler_return, return_accu); return FALSE; }
static gboolean __set_value (MidgardQueryHolder *self, const GValue *value) { g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (value != NULL, FALSE); g_return_val_if_fail (G_VALUE_HOLDS_STRING (value), FALSE); MidgardQueryProperty *mqp = (MidgardQueryProperty *) self; if (G_IS_VALUE (&mqp->priv->value)) g_value_unset (&mqp->priv->value); g_value_init (&mqp->priv->value, G_TYPE_STRING); g_value_copy (value, &mqp->priv->value); return TRUE; }
static void anjuta_test_shell_add_value (AnjutaShell *shell, const char *name, const GValue *value, GError **error) { GValue *copy; AnjutaTestShell *window = ANJUTA_TEST_SHELL (shell); anjuta_shell_remove_value (shell, name, error); copy = g_new0 (GValue, 1); g_value_init (copy, value->g_type); g_value_copy (value, copy); g_hash_table_insert (window->values, g_strdup (name), copy); g_signal_emit_by_name (shell, "value_added", name, copy); }
static void test_gtype_value (void) { GType type; GValue value = { 0, }; GValue copy = { 0, }; g_value_init (&value, G_TYPE_GTYPE); g_value_set_gtype (&value, G_TYPE_BOXED); type = g_value_get_gtype (&value); g_assert (type == G_TYPE_BOXED); g_value_init (©, G_TYPE_GTYPE); g_value_copy (&value, ©); type = g_value_get_gtype (©); g_assert (type == G_TYPE_BOXED); }
void moto_variation_restore_param(MotoVariation *self, MotoParam *p) { MotoVariationPriv *priv = MOTO_VARIATION_GET_PRIVATE(self); guint id = moto_param_get_id(p); GValue *pv = moto_param_get_value(p); GHashTable *params = priv->params; GValue *v = (GValue *)g_hash_table_lookup(params, &id); if( ! v) { if(priv->parent) moto_variation_restore_param(priv->parent, p); return; } g_value_copy(v, pv); }
gboolean _midgard_dbobject_get_property (MidgardDBObject *self, const gchar *name, GValue *value) { g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (name != NULL, FALSE); g_return_val_if_fail (G_IS_VALUE (value), FALSE); if (!self->dbpriv->datamodel) return FALSE; GdaDataModel *model = GDA_DATA_MODEL (self->dbpriv->datamodel); if (!model || (model && !GDA_IS_DATA_MODEL (model))) return FALSE; gint col_idx = gda_data_model_get_column_index (model, name); if (col_idx == -1) return FALSE; const GValue *src_val = gda_data_model_get_value_at (model, col_idx, self->dbpriv->row, NULL); if (!src_val) return FALSE; if (!G_IS_VALUE (src_val) || (G_IS_VALUE (src_val) && G_VALUE_TYPE (src_val) == GDA_TYPE_NULL)) { /* NULL fetched from underlying field */ if (G_VALUE_HOLDS_STRING (value)) { g_value_set_string (value, ""); return TRUE; } g_warning ("Can not find value for given '%s' property \n", name); return FALSE; } if (G_VALUE_TYPE (src_val) != G_VALUE_TYPE (value)) g_value_transform (src_val, value); else g_value_copy (src_val, value); if (G_VALUE_HOLDS_STRING (value) && g_value_get_string (value) == NULL) g_value_set_string (value, ""); return TRUE; }
static void tp_chat_properties_changed_cb (TpProxy *proxy, const GPtrArray *properties, gpointer user_data, GObject *chat) { EmpathyTpChatPriv *priv = GET_PRIV (chat); guint i, j; if (priv->channel == NULL) return; if (!priv->had_properties_list || !properties) { return; } for (i = 0; i < properties->len; i++) { GValueArray *prop_struct; TpChatProperty *property; guint id; GValue *src_value; prop_struct = g_ptr_array_index (properties, i); id = g_value_get_uint (g_value_array_get_nth (prop_struct, 0)); src_value = g_value_get_boxed (g_value_array_get_nth (prop_struct, 1)); for (j = 0; j < priv->properties->len; j++) { property = g_ptr_array_index (priv->properties, j); if (property->id == id) { if (property->value) { g_value_copy (src_value, property->value); } else { property->value = tp_g_value_slice_dup (src_value); } DEBUG ("property %s changed", property->name); g_signal_emit (chat, signals[PROPERTY_CHANGED], 0, property->name, property->value); break; } } } }
static inline void clutter_actor_set_shader_param_internal (ClutterActor *self, const gchar *param, const GValue *value) { ShaderData *shader_data; GValue *var; shader_data = g_object_get_data (G_OBJECT (self), "-clutter-actor-shader-data"); if (shader_data == NULL) return; var = g_slice_new0 (GValue); g_value_init (var, G_VALUE_TYPE (value)); g_value_copy (value, var); g_hash_table_insert (shader_data->value_hash, g_strdup (param), var); clutter_actor_queue_redraw (self); }
static gboolean __set_value (MidgardCRCoreQueryHolder *self, const GValue *value) { g_return_val_if_fail (self != NULL, FALSE); g_return_val_if_fail (value != NULL, FALSE); MidgardCRCoreQueryValue *mqp = (MidgardCRCoreQueryValue *) self; if (!mqp->priv) return FALSE; if (G_IS_VALUE (&mqp->priv->value)) g_value_unset (&mqp->priv->value); g_value_init (&mqp->priv->value, G_VALUE_TYPE (value)); g_value_copy (value, &mqp->priv->value); return TRUE; }
/** * gda_sql_expr_copy * @expr: a #GdaSqlExpr * * Creates a new #GdaSqlExpr structure initiated with the values stored in @expr. * * Returns: a new #GdaSqlExpr structure. */ GdaSqlExpr * gda_sql_expr_copy (GdaSqlExpr *expr) { GdaSqlExpr *copy; if (!expr) return NULL; copy = gda_sql_expr_new (NULL); if (expr->value) { GValue *value; value = g_new0 (GValue, 1); g_value_init (value, G_VALUE_TYPE (expr->value)); g_value_copy (expr->value, value); copy->value = value; } copy->param_spec = gda_sql_param_spec_copy (expr->param_spec); copy->func = gda_sql_function_copy (expr->func); gda_sql_any_part_set_parent (copy->func, copy); copy->cond = gda_sql_operation_copy (expr->cond); gda_sql_any_part_set_parent (copy->cond, copy); if (expr->select) { if (GDA_SQL_ANY_PART (expr->select)->type == GDA_SQL_ANY_STMT_SELECT) copy->select = _gda_sql_statement_select_copy (expr->select); else if (GDA_SQL_ANY_PART (expr->select)->type == GDA_SQL_ANY_STMT_COMPOUND) copy->select = _gda_sql_statement_compound_copy (expr->select); else g_assert_not_reached (); gda_sql_any_part_set_parent (copy->select, copy); } copy->case_s = gda_sql_case_copy (expr->case_s); gda_sql_any_part_set_parent (copy->case_s, copy); if (expr->cast_as) copy->cast_as = g_strdup (expr->cast_as); copy->value_is_ident = expr->value_is_ident; return copy; }
static gboolean bind_with_closures_transform_from (GBinding *binding, const GValue *source, GValue *target, gpointer data) { TransformData *t_data = data; GValue params[3] = { G_VALUE_INIT, G_VALUE_INIT, G_VALUE_INIT }; GValue retval = G_VALUE_INIT; gboolean res; g_value_init (¶ms[0], G_TYPE_BINDING); g_value_set_object (¶ms[0], binding); g_value_init (¶ms[1], G_TYPE_VALUE); g_value_set_boxed (¶ms[1], source); g_value_init (¶ms[2], G_TYPE_VALUE); g_value_set_boxed (¶ms[2], target); g_value_init (&retval, G_TYPE_BOOLEAN); g_value_set_boolean (&retval, FALSE); g_closure_invoke (t_data->transform_from_closure, &retval, 3, params, NULL); res = g_value_get_boolean (&retval); if (res) { const GValue *out_value = g_value_get_boxed (¶ms[2]); g_assert (out_value != NULL); g_value_copy (out_value, target); } g_value_unset (¶ms[0]); g_value_unset (¶ms[1]); g_value_unset (¶ms[2]); g_value_unset (&retval); return res; }
/* EvaXmlValueFunc */ static void handle_value (const GValue *value, gpointer user_data) { EvaXmlValueRequest *request = EVA_XML_VALUE_REQUEST (user_data); EvaStream *stream = request->stream; GError *error = NULL; g_return_if_fail (value); g_return_if_fail (stream); g_return_if_fail (G_VALUE_TYPE (value)); g_value_init (&request->value_request.value, G_VALUE_TYPE (value)); g_value_copy (value, &request->value_request.value); if (!eva_io_read_shutdown (EVA_IO (stream), &error)) { if (error) eva_request_set_error (request, error); } eva_request_done (request); }
/** * lomo_em_art_search_set_result: * @search: The #LomoEMArtSearch * @result: (transfer none): Result * * Stores result into @search. * This functions is meant to by used by #LomoEMArtBackend implementations to * store result into #LomoEMArtSearch */ void lomo_em_art_search_set_result(LomoEMArtSearch *search, const GValue *result) { g_return_if_fail(LOMO_IS_EM_ART_SEARCH(search)); g_return_if_fail(G_IS_VALUE(result)); LomoEMArtSearchPrivate *priv = GET_PRIVATE(search); if (result && priv->result) { g_warning(_("Trying to set a result in search '%s' while it already has one, this is a bug and will be ignored"), lomo_em_art_search_stringify(search)); g_return_if_fail(priv->result == NULL); } priv->result = g_value_init(g_new0(GValue, 1), G_VALUE_TYPE(result)); g_value_copy(result, priv->result); g_object_notify(G_OBJECT(search), "result"); }
void bb_program_append_program (BbProgram *program, BbProgram *subprogram) { guint n = subprogram->n_instructions; BbInstruction *in = add_instructions_raw (program, n); guint i; for (i = 0; i < n; i++) { in[i].type = subprogram->instructions[i].type; switch (in[i].type) { case BB_INSTRUCTION_PUSH_PARAM: in[i].info.push_param = subprogram->instructions[i].info.push_param; break; case BB_INSTRUCTION_PUSH: memset (&in[i].info.push, 0, sizeof (GValue)); g_value_init (&in[i].info.push, G_VALUE_TYPE (&subprogram->instructions[i].info.push)); g_value_copy (&subprogram->instructions[i].info.push, &in[i].info.push); break; case BB_INSTRUCTION_PUSH_SPECIAL: in[i].info.push_special = subprogram->instructions[i].info.push_special; break; case BB_INSTRUCTION_POP: break; case BB_INSTRUCTION_BUILTIN: in[i].info.builtin = subprogram->instructions[i].info.builtin; break; case BB_INSTRUCTION_FUNCTION_ARG_START: break; case BB_INSTRUCTION_FUNCTION: in[i].info.function = bb_function_ref (subprogram->instructions[i].info.function); break; case BB_INSTRUCTION_LAZY_FUNCTION: in[i].info.lazy_function = g_strdup (subprogram->instructions[i].info.lazy_function); break; default: g_error ("bb_program_append_program: unknown instruction %u", subprogram->instructions[i].type); } } }
static void gst_test_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstTest *test = GST_TEST (object); if (prop_id == 0 || prop_id > 2 * TESTS_COUNT) { G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); return; } if (prop_id % 2) { /* real values can't be set */ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } else { /* expected values */ GST_OBJECT_LOCK (test); g_value_copy (value, &test->values[prop_id / 2 - 1]); GST_OBJECT_UNLOCK (test); } }
/** * tp_properties_mixin_change_value: * @obj: An object with the properties mixin * @prop_id: A property ID on which to act * @new_value: Property value * @props: either %NULL, or a pointer to a TpIntSet * * Change the value of the given property ID in response to a server state * change. * * If the old and new values match, nothing happens; no signal is emitted and * @props is ignored. Otherwise, the following applies: * * If @props is %NULL the PropertiesChanged signal is emitted for this one * property. * * Otherwise, the property ID is added to the set; the caller is responsible * for passing the set to tp_properties_mixin_emit_changed() once a batch of * properties have been changed. */ void tp_properties_mixin_change_value (GObject *obj, guint prop_id, const GValue *new_value, TpIntSet *props) { TpPropertiesMixin *mixin = TP_PROPERTIES_MIXIN (obj); TpPropertiesMixinClass *mixin_cls = TP_PROPERTIES_MIXIN_CLASS ( G_OBJECT_GET_CLASS (obj)); TpProperty *prop; g_assert (prop_id < mixin_cls->num_props); prop = &mixin->properties[prop_id]; if (prop->value) { if (values_are_equal (prop->value, new_value)) return; } else { prop->value = tp_g_value_slice_new (mixin_cls->signatures[prop_id].type); } g_value_copy (new_value, prop->value); if (props) { tp_intset_add (props, prop_id); } else { TpIntSet *changed_props = tp_intset_sized_new (prop_id + 1); tp_intset_add (changed_props, prop_id); tp_properties_mixin_emit_changed (obj, changed_props); tp_intset_destroy (changed_props); } }
static GList * glade_attr_list_copy (GList *attrs) { GList *ret = NULL, *list; GladeAttribute *attr, *dup_attr; for (list = attrs; list; list = list->next) { attr = list->data; dup_attr = g_new0 (GladeAttribute, 1); dup_attr->type = attr->type; dup_attr->start = attr->start; dup_attr->end = attr->end; g_value_init (&(dup_attr->value), G_VALUE_TYPE (&(attr->value))); g_value_copy (&(attr->value), &(dup_attr->value)); ret = g_list_prepend (ret, dup_attr); } return g_list_reverse (ret); }
static void thunar_preferences_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { ThunarPreferences *preferences = THUNAR_PREFERENCES (object); GValue *dst; dst = preferences->values + prop_id; if (G_UNLIKELY (!G_IS_VALUE (dst))) { g_value_init (dst, pspec->value_type); g_param_value_set_default (pspec, dst); } if (g_param_values_cmp (pspec, value, dst) != 0) { g_value_copy (value, dst); thunar_preferences_queue_store (preferences); } }