static void length_get_value (gpointer test, GValue * value) { LengthTest *t = test; g_value_set_int64 (value, t ? t->value : -1); }
gboolean stetic_param_spec_get_maximum (GParamSpec *pspec, GValue *value) { g_value_init (value, pspec->value_type); if (G_IS_PARAM_SPEC_CHAR (pspec)) g_value_set_char (value, G_PARAM_SPEC_CHAR (pspec)->maximum); else if (G_IS_PARAM_SPEC_UCHAR (pspec)) g_value_set_uchar (value, G_PARAM_SPEC_UCHAR (pspec)->maximum); else if (G_IS_PARAM_SPEC_INT (pspec)) g_value_set_int (value, G_PARAM_SPEC_INT (pspec)->maximum); else if (G_IS_PARAM_SPEC_UINT (pspec)) g_value_set_uint (value, G_PARAM_SPEC_UINT (pspec)->maximum); else if (G_IS_PARAM_SPEC_LONG (pspec)) g_value_set_long (value, G_PARAM_SPEC_LONG (pspec)->maximum); else if (G_IS_PARAM_SPEC_ULONG (pspec)) g_value_set_ulong (value, G_PARAM_SPEC_ULONG (pspec)->maximum); else if (G_IS_PARAM_SPEC_INT64 (pspec)) g_value_set_int64 (value, G_PARAM_SPEC_INT64 (pspec)->maximum); else if (G_IS_PARAM_SPEC_UINT64 (pspec)) g_value_set_uint64 (value, G_PARAM_SPEC_UINT64 (pspec)->maximum); else if (G_IS_PARAM_SPEC_FLOAT (pspec)) g_value_set_float (value, G_PARAM_SPEC_FLOAT (pspec)->maximum); else if (G_IS_PARAM_SPEC_DOUBLE (pspec)) g_value_set_double (value, G_PARAM_SPEC_DOUBLE (pspec)->maximum); else return FALSE; return TRUE; }
static void tpl_call_event_get_property (GObject *object, guint param_id, GValue *value, GParamSpec *pspec) { TplCallEventPriv *priv = TPL_CALL_EVENT (object)->priv; switch (param_id) { case PROP_DURATION: g_value_set_int64 (value, priv->duration); break; case PROP_END_ACTOR: g_value_set_object (value, priv->end_actor); break; case PROP_END_REASON: g_value_set_int (value, priv->end_reason); break; case PROP_DETAILED_END_REASON: g_value_set_string (value, priv->detailed_end_reason); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); break; } }
static void timedur_get_value (gpointer test, GValue * value) { TimeDurTest *t = test; g_value_set_int64 (value, t ? (t->diff / MAX (1, t->count)) : -1); }
static void rg_table_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { RgTable *self = (RgTable *)object; RgTablePrivate *priv = rg_table_get_instance_private (self); switch (prop_id) { case PROP_TIMESPAN: g_value_set_int64 (value, priv->timespan); break; case PROP_MAX_SAMPLES: g_value_set_uint (value, priv->max_samples); break; case PROP_VALUE_MAX: g_value_set_double (value, priv->value_max); break; case PROP_VALUE_MIN: g_value_set_double (value, priv->value_min); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } }
GValue* ghb_int_value_new(gint ival) { GValue *gval = ghb_value_new(G_TYPE_INT64); g_value_set_int64(gval, ival); return gval; }
gboolean stetic_param_spec_get_default (GParamSpec *pspec, GValue *value) { g_value_init (value, pspec->value_type); if (G_IS_PARAM_SPEC_CHAR (pspec)) g_value_set_char (value, G_PARAM_SPEC_CHAR (pspec)->default_value); else if (G_IS_PARAM_SPEC_UCHAR (pspec)) g_value_set_uchar (value, G_PARAM_SPEC_UCHAR (pspec)->default_value); else if (G_IS_PARAM_SPEC_INT (pspec)) g_value_set_int (value, G_PARAM_SPEC_INT (pspec)->default_value); else if (G_IS_PARAM_SPEC_UINT (pspec)) g_value_set_uint (value, G_PARAM_SPEC_UINT (pspec)->default_value); else if (G_IS_PARAM_SPEC_LONG (pspec)) g_value_set_long (value, G_PARAM_SPEC_LONG (pspec)->default_value); else if (G_IS_PARAM_SPEC_ULONG (pspec)) g_value_set_ulong (value, G_PARAM_SPEC_ULONG (pspec)->default_value); else if (G_IS_PARAM_SPEC_INT64 (pspec)) g_value_set_int64 (value, G_PARAM_SPEC_INT64 (pspec)->default_value); else if (G_IS_PARAM_SPEC_UINT64 (pspec)) g_value_set_uint64 (value, G_PARAM_SPEC_UINT64 (pspec)->default_value); else if (G_IS_PARAM_SPEC_FLOAT (pspec)) g_value_set_float (value, G_PARAM_SPEC_FLOAT (pspec)->default_value); else if (G_IS_PARAM_SPEC_DOUBLE (pspec)) g_value_set_double (value, G_PARAM_SPEC_DOUBLE (pspec)->default_value); else if (G_IS_PARAM_SPEC_BOOLEAN (pspec)) g_value_set_boolean (value, G_PARAM_SPEC_BOOLEAN (pspec)->default_value); else if (G_IS_PARAM_SPEC_UNICHAR (pspec)) g_value_set_uint (value, G_PARAM_SPEC_UNICHAR (pspec)->default_value); else if (G_IS_PARAM_SPEC_STRING (pspec)) g_value_set_static_string (value, G_PARAM_SPEC_STRING (pspec)->default_value); else return FALSE; return TRUE; }
static void _rygel_example_player_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { RygelMediaPlayer *base = RYGEL_MEDIA_PLAYER (object); switch (property_id) { case RYGEL_EXAMPLE_PLAYER_PLAYBACK_STATE: g_value_take_string (value, rygel_media_player_get_playback_state (base)); break; case RYGEL_EXAMPLE_PLAYER_URI: g_value_take_string (value, rygel_media_player_get_uri (base)); break; case RYGEL_EXAMPLE_PLAYER_MIME_TYPE: g_value_take_string (value, rygel_media_player_get_mime_type (base)); break; case RYGEL_EXAMPLE_PLAYER_METADATA: g_value_take_string (value, rygel_media_player_get_metadata (base)); break; case RYGEL_EXAMPLE_PLAYER_CONTENT_FEATURES: g_value_take_string (value, rygel_media_player_get_content_features (base)); break; case RYGEL_EXAMPLE_PLAYER_VOLUME: g_value_set_double (value, rygel_media_player_get_volume (base)); break; case RYGEL_EXAMPLE_PLAYER_DURATION: g_value_set_int64 (value, rygel_media_player_get_duration (base)); break; case RYGEL_EXAMPLE_PLAYER_POSITION: g_value_set_int64 (value, rygel_media_player_get_position (base)); break; case RYGEL_EXAMPLE_PLAYER_CAN_SEEK: g_value_set_boolean (value, rygel_media_player_get_can_seek (base)); break; case RYGEL_EXAMPLE_PLAYER_PLAYBACK_SPEED: g_value_take_string (value, rygel_media_player_get_playback_speed (base)); break; case RYGEL_EXAMPLE_PLAYER_ALLOWED_PLAYBACK_SPEEDS: { int length; g_value_take_boxed (value, rygel_media_player_get_allowed_playback_speeds (base, &length)); } break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
gboolean GN_value_set(int ARI, ei_x_buff *XBUF, char *B, int *I){ GValue* object; int type, len; gboolean v_boolean; gchar v_atom[MAXATOMLEN+1]; gchar* v_gchar; gint64 v_gint64; gdouble v_double; /* no return value */ if ( ! gn_check_arity(XBUF, 2, ARI) ) return FALSE; if ( ! gn_get_arg_struct(XBUF, B, I, "GValue", (void**)&object) ) return FALSE; if ( G_IS_VALUE(object) ) g_value_unset(object); ei_get_type(B,I,&type,&len); /* can't fail */ switch (type) { case ERL_ATOM_EXT: if ( ! ei_decode_boolean(B, I, (int*)&v_boolean) ){ g_value_init(object,G_TYPE_BOOLEAN); g_value_set_boolean(object, v_boolean); } else if ( gn_get_arg_gchar_fix(XBUF, B, I, v_atom) ){ g_value_init(object,G_TYPE_STRING); g_value_set_string(object,v_atom); } else { return FALSE; } break; case ERL_SMALL_INTEGER_EXT: case ERL_INTEGER_EXT: case ERL_SMALL_BIG_EXT: case ERL_LARGE_BIG_EXT: if ( ! gn_get_arg_gint64(XBUF, B, I, &v_gint64) ) return FALSE; g_value_init(object,G_TYPE_INT64); g_value_set_int64(object, v_gint64); break; case ERL_FLOAT_EXT: if ( ! gn_get_arg_gdouble(XBUF, B, I, &v_double) ) return FALSE; g_value_init(object,G_TYPE_DOUBLE); g_value_set_double(object, v_double); break; case ERL_NIL_EXT: case ERL_STRING_EXT: if ( ! gn_get_arg_gchar(XBUF, B, I, &v_gchar) ) return FALSE; g_value_init(object,G_TYPE_STRING); g_value_set_string(object,v_gchar); free(v_gchar); break; default: gn_enc_1_error(XBUF, "bad_erl_type"); return FALSE; break; } gn_put_void(XBUF); return TRUE; }
static void gimp_thumbnail_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { GimpThumbnail *thumbnail = GIMP_THUMBNAIL (object); switch (property_id) { case PROP_IMAGE_STATE: g_value_set_enum (value, thumbnail->image_state); break; case PROP_IMAGE_URI: g_value_set_string (value, thumbnail->image_uri); break; case PROP_IMAGE_MTIME: g_value_set_int64 (value, thumbnail->image_mtime); break; case PROP_IMAGE_FILESIZE: g_value_set_int64 (value, thumbnail->image_filesize); break; case PROP_IMAGE_MIMETYPE: g_value_set_string (value, thumbnail->image_mimetype); break; case PROP_IMAGE_WIDTH: g_value_set_int (value, thumbnail->image_width); break; case PROP_IMAGE_HEIGHT: g_value_set_int (value, thumbnail->image_height); break; case PROP_IMAGE_TYPE: g_value_set_string (value, thumbnail->image_type); break; case PROP_IMAGE_NUM_LAYERS: g_value_set_int (value, thumbnail->image_num_layers); break; case PROP_THUMB_STATE: g_value_set_enum (value, thumbnail->thumb_state); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
/** * tp_g_value_slice_new_int64: * @n: a 64-bit integer * * Slice-allocate and initialize a #GValue. This function is convenient to * use when constructing hash tables from string to #GValue, for example. * * Returns: a #GValue of type %G_TYPE_INT64 with value @n, to be freed with * tp_g_value_slice_free() or g_slice_free() * * Since: 0.7.27 */ GValue * tp_g_value_slice_new_int64 (gint64 n) { GValue *v = tp_g_value_slice_new (G_TYPE_INT64); g_value_set_int64 (v, n); return v; }
static void gnl_object_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { GnlObject *gnlobject = (GnlObject *) object; switch (prop_id) { case PROP_START: g_value_set_uint64 (value, gnlobject->start); break; case PROP_DURATION: g_value_set_int64 (value, gnlobject->duration); break; case PROP_STOP: g_value_set_uint64 (value, gnlobject->stop); break; case PROP_MEDIA_START: g_value_set_uint64 (value, gnlobject->media_start); break; case PROP_MEDIA_DURATION: g_value_set_int64 (value, gnlobject->media_duration); break; case PROP_MEDIA_STOP: g_value_set_uint64 (value, gnlobject->media_stop); break; case PROP_RATE: g_value_set_double (value, gnlobject->rate); break; case PROP_PRIORITY: g_value_set_uint (value, gnlobject->priority); break; case PROP_ACTIVE: g_value_set_boolean (value, gnlobject->active); break; case PROP_CAPS: gst_value_set_caps (value, gnlobject->caps); break; case PROP_EXPANDABLE: g_value_set_boolean (value, GNL_OBJECT_IS_EXPANDABLE (object)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
/* * cd_profile_get_property: */ static void cd_profile_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { CdProfile *profile = CD_PROFILE (object); CdProfilePrivate *priv = GET_PRIVATE (profile); switch (prop_id) { case PROP_OBJECT_PATH: g_value_set_string (value, priv->object_path); break; case PROP_CONNECTED: g_value_set_boolean (value, priv->proxy != NULL); break; case PROP_ID: g_value_set_string (value, priv->id); break; case PROP_FILENAME: g_value_set_string (value, priv->filename); break; case PROP_QUALIFIER: g_value_set_string (value, priv->qualifier); break; case PROP_FORMAT: g_value_set_string (value, priv->format); break; case PROP_TITLE: g_value_set_string (value, priv->title); break; case PROP_KIND: g_value_set_uint (value, priv->kind); break; case PROP_COLORSPACE: g_value_set_uint (value, priv->colorspace); break; case PROP_CREATED: g_value_set_int64 (value, priv->created); break; case PROP_HAS_VCGT: g_value_set_boolean (value, priv->has_vcgt); break; case PROP_IS_SYSTEM_WIDE: g_value_set_boolean (value, priv->is_system_wide); break; case PROP_SCOPE: g_value_set_uint (value, priv->scope); break; case PROP_OWNER: g_value_set_uint (value, priv->owner); break; case PROP_WARNINGS: g_value_set_boxed (value, priv->warnings); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
gboolean fb_data_load(FbData *fata) { const gchar *str; FbDataPrivate *priv; FbId id; gboolean ret = TRUE; guint i; guint64 uint; GValue val = G_VALUE_INIT; PurpleAccount *acct; g_return_val_if_fail(FB_IS_DATA(fata), FALSE); priv = fata->priv; acct = purple_connection_get_account(priv->gc); for (i = 0; i < G_N_ELEMENTS(fb_props_strs); i++) { str = purple_account_get_string(acct, fb_props_strs[i], NULL); if (str == NULL) { ret = FALSE; } g_value_init(&val, G_TYPE_STRING); g_value_set_string(&val, str); g_object_set_property(G_OBJECT(priv->api), fb_props_strs[i], &val); g_value_unset(&val); } str = purple_account_get_string(acct, "mid", NULL); if (str != NULL) { uint = g_ascii_strtoull(str, NULL, 10); g_value_init(&val, G_TYPE_UINT64); g_value_set_uint64(&val, uint); g_object_set_property(G_OBJECT(priv->api), "mid", &val); g_value_unset(&val); } else { ret = FALSE; } str = purple_account_get_string(acct, "uid", NULL); if (str != NULL) { id = FB_ID_FROM_STR(str); g_value_init(&val, FB_TYPE_ID); g_value_set_int64(&val, id); g_object_set_property(G_OBJECT(priv->api), "uid", &val); g_value_unset(&val); } else { ret = FALSE; } fb_api_rehash(priv->api); return ret; }
GValue* ghb_int_value(gint ival) { static GValue gval = {0,}; if (!G_IS_VALUE(&gval)) g_value_init(&gval, G_TYPE_INT64); g_value_set_int64(&gval, (gint64)ival); return &gval; }
static void _get_property (GObject *object, unsigned int property_id, GValue *value, GParamSpec *pspec) { MpdStorageDevicePrivate *priv = GET_PRIVATE (object); switch (property_id) { case PROP_AVAILABLE_SIZE: g_value_set_int64 (value, mpd_storage_device_get_available_size ( MPD_STORAGE_DEVICE (object))); break; case PROP_PATH: g_value_set_string (value, priv->path); break; case PROP_SIZE: g_value_set_int64 (value, mpd_storage_device_get_size ( MPD_STORAGE_DEVICE (object))); break; #if 0 case PROP_LABEL: g_value_set_string (value, mpd_storage_device_get_label ( MPD_STORAGE_DEVICE (object))); break; case PROP_MODEL: g_value_set_string (value, mpd_storage_device_get_model ( MPD_STORAGE_DEVICE (object))); break; case PROP_VENDOR: g_value_set_string (value, mpd_storage_device_get_vendor ( MPD_STORAGE_DEVICE (object))); break; #endif default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } }
static void xform_string_int64(const GValue *sval, GValue *ival) { gchar *end; const gchar *str = g_value_get_string(sval); gint64 val = g_strtod(str, &end); if (*end) val = (guint64)(~0L)>>1; g_value_set_int64(ival, val); }
/** * grl_related_keys_set_int64: * @relkeys: set of related keys to change * @key: (type GrlKeyID): key to change or add * @intvalue: the new value * * Sets the value associated with @key into @relkeys. @key must have been * registered as a int64-type key. Old value is replaced by the new one. * * Since: 0.2.12 **/ void grl_related_keys_set_int64 (GrlRelatedKeys *relkeys, GrlKeyID key, gint64 intvalue) { GValue value = { 0 }; g_return_if_fail (GRL_IS_RELATED_KEYS (relkeys)); g_value_init (&value, G_TYPE_INT64); g_value_set_int64 (&value, intvalue); grl_related_keys_set (relkeys, key, &value); }
static void gst_cmml_enc_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { GstCmmlEnc *enc = GST_CMML_ENC (object); switch (property_id) { case GST_CMML_ENC_GRANULERATE_N: g_value_set_int64 (value, enc->granulerate_n); break; case GST_CMML_ENC_GRANULERATE_D: g_value_set_int64 (value, enc->granulerate_d); break; case GST_CMML_ENC_GRANULESHIFT: g_value_set_uchar (value, enc->granuleshift); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } }
static void gst_audio_ringbuffer_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { GstAudioRingbuffer *ringbuffer; ringbuffer = GST_AUDIO_RINGBUFFER (object); switch (prop_id) { case PROP_BUFFER_TIME: g_value_set_int64 (value, ringbuffer->buffer_time); break; case PROP_SEGMENT_TIME: g_value_set_int64 (value, ringbuffer->segment_time); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void gst_srt_enc_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { GstSrtEnc *srtenc; srtenc = GST_SRT_ENC (object); switch (prop_id) { case ARG_TIMESTAMP: g_value_set_int64 (value, srtenc->timestamp); break; case ARG_DURATION: g_value_set_int64 (value, srtenc->duration); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void g_value_from_ffi_value (GValue *gvalue, const GIArgument *value) { switch (g_type_fundamental (G_VALUE_TYPE (gvalue))) { case G_TYPE_INT: g_value_set_int (gvalue, (gint)value->v_long); break; case G_TYPE_FLOAT: g_value_set_float (gvalue, (gfloat)value->v_float); break; case G_TYPE_DOUBLE: g_value_set_double (gvalue, (gdouble)value->v_double); break; case G_TYPE_BOOLEAN: g_value_set_boolean (gvalue, (gboolean)value->v_long); break; case G_TYPE_STRING: g_value_set_string (gvalue, (gchar*)value->v_pointer); break; case G_TYPE_CHAR: g_value_set_char (gvalue, (gchar)value->v_long); break; case G_TYPE_UCHAR: g_value_set_uchar (gvalue, (guchar)value->v_ulong); break; case G_TYPE_UINT: g_value_set_uint (gvalue, (guint)value->v_ulong); break; case G_TYPE_POINTER: g_value_set_pointer (gvalue, (gpointer)value->v_pointer); break; case G_TYPE_LONG: g_value_set_long (gvalue, (glong)value->v_long); break; case G_TYPE_ULONG: g_value_set_ulong (gvalue, (gulong)value->v_ulong); break; case G_TYPE_INT64: g_value_set_int64 (gvalue, (gint64)value->v_int64); break; case G_TYPE_UINT64: g_value_set_uint64 (gvalue, (guint64)value->v_uint64); break; case G_TYPE_BOXED: g_value_set_boxed (gvalue, (gpointer)value->v_pointer); break; default: g_warning ("Unsupported fundamental type: %s", g_type_name (g_type_fundamental (G_VALUE_TYPE (gvalue)))); } }
static void rygel_http_seek_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) { RygelHTTPSeek * self; self = RYGEL_HTTP_SEEK (object); switch (property_id) { case RYGEL_HTTP_SEEK_MSG: g_value_set_object (value, rygel_http_seek_get_msg (self)); break; case RYGEL_HTTP_SEEK_START: g_value_set_int64 (value, rygel_http_seek_get_start (self)); break; case RYGEL_HTTP_SEEK_STOP: g_value_set_int64 (value, rygel_http_seek_get_stop (self)); break; case RYGEL_HTTP_SEEK_LENGTH: g_value_set_int64 (value, rygel_http_seek_get_length (self)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
/*! * \brief Convert a QVariant to GValue * \param other QVariant to convert * \return a GValue holding the QVariant's content or an invalid GValue if it * could not be converted. */ GValue *qVariantToGValue(const QVariant &other) { GValue *gvalue = g_new0(GValue, 1); switch (other.type()) { case QVariant::Bool: g_value_init(gvalue, G_TYPE_BOOLEAN); g_value_set_boolean(gvalue, other.toBool() ? TRUE : FALSE); break; case QVariant::UInt: g_value_init(gvalue, G_TYPE_UINT); g_value_set_uint(gvalue, other.toUInt()); break; case QVariant::Int: g_value_init(gvalue, G_TYPE_INT); g_value_set_int(gvalue, other.toInt()); break; case QVariant::LongLong: g_value_init(gvalue, G_TYPE_INT64); g_value_set_int64(gvalue, other.toLongLong()); break; case QVariant::ULongLong: g_value_init(gvalue, G_TYPE_UINT64); g_value_set_int64(gvalue, other.toULongLong()); break; case QVariant::Double: g_value_init(gvalue, G_TYPE_DOUBLE); g_value_set_double(gvalue, other.toDouble()); break; case QVariant::String: g_value_init(gvalue, G_TYPE_STRING); g_value_set_string(gvalue, other.toString().toUtf8().constData()); break; default: // do nothing - probably assert or whatever break; } return gvalue; }
void ags_port_real_safe_read(AgsPort *port, GValue *value) { guint overall_size; gpointer data; overall_size = port->port_value_length * port->port_value_size; pthread_mutex_lock(&(port->mutex)); if(!port->port_value_is_pointer){ if(port->port_value_type == G_TYPE_BOOLEAN){ g_value_set_boolean(value, port->port_value.ags_port_boolean); }else if(port->port_value_type == G_TYPE_INT64){ g_value_set_int64(value, port->port_value.ags_port_int); }else if(port->port_value_type == G_TYPE_UINT64){ g_value_set_uint64(value, port->port_value.ags_port_uint); }else if(port->port_value_type == G_TYPE_FLOAT){ g_value_set_float(value, (gdouble) port->port_value.ags_port_float); }else if(port->port_value_type == G_TYPE_DOUBLE){ g_value_set_double(value, port->port_value.ags_port_double); } }else{ data = (gpointer) malloc(overall_size); if(port->port_value_type == G_TYPE_BOOLEAN){ memcpy(data, port->port_value.ags_port_boolean_ptr, overall_size); }else if(port->port_value_type == G_TYPE_INT64){ memcpy(data, port->port_value.ags_port_int_ptr, overall_size); }else if(port->port_value_type == G_TYPE_UINT64){ memcpy(data, port->port_value.ags_port_uint_ptr, overall_size); }else if(port->port_value_type == G_TYPE_FLOAT){ guint i; for(i = 0; i < port->port_value_length; i++){ port->port_value.ags_port_float_ptr[i] = ((gdouble *) data)[i]; } }else if(port->port_value_type == G_TYPE_DOUBLE){ memcpy(data, port->port_value.ags_port_double_ptr, overall_size); }else if(port->port_value_type == G_TYPE_POINTER){ data = port->port_value.ags_port_pointer; }else if(port->port_value_type == G_TYPE_OBJECT){ data = port->port_value.ags_port_object; } g_value_set_pointer(value, data); } pthread_mutex_unlock(&(port->mutex)); }
gboolean gom_resource_do_save (GomResource *resource, GomAdapter *adapter, GError **error) { gboolean ret = FALSE; gboolean is_insert; gint64 row_id = -1; GType resource_type; GList *cmds, *l; g_return_val_if_fail(GOM_IS_RESOURCE(resource), FALSE); g_return_val_if_fail(GOM_IS_ADAPTER(adapter), FALSE); resource_type = G_TYPE_FROM_INSTANCE(resource); g_assert(g_type_is_a(resource_type, GOM_TYPE_RESOURCE)); is_insert = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(resource), "is-insert")); cmds = g_object_get_data(G_OBJECT(resource), "save-commands"); for (l = cmds; l != NULL; l = l->next) { GomCommand *command = l->data; if (!gom_command_execute(command, NULL, error)) goto out; if (is_insert && row_id == -1 && gom_resource_has_dynamic_pkey(resource_type)) { sqlite3 *handle = gom_adapter_get_handle(adapter); GValue *value; row_id = sqlite3_last_insert_rowid(handle); value = g_new0 (GValue, 1); g_value_init(value, G_TYPE_INT64); g_value_set_int64(value, row_id); g_object_set_data_full(G_OBJECT(resource), "row-id", value, value_free); g_object_set_data (G_OBJECT(resource), "is-from-table", GINT_TO_POINTER(TRUE)); is_insert = FALSE; } } ret = TRUE; out: g_object_set_data (G_OBJECT (resource), "save-commands", NULL); g_object_set_data (G_OBJECT (resource), "is-insert", NULL); return ret; }
static void bookmark_resolve (GrlSourceResolveSpec *rs) { GomRepository *repository; GValue value = { 0, }; GomFilter *filter; GomResource *resource; GError *error = NULL; gint64 id; GrlTypeFilter type_filter; GRL_DEBUG (__FUNCTION__); repository = GRL_BOOKMARKS_SOURCE (rs->source)->priv->repository; id = g_ascii_strtoll (grl_media_get_id (rs->media), NULL, 0); if (!id) { /* Root category: special case */ grl_media_set_title (rs->media, GRL_ROOT_TITLE); rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, NULL); return; } g_value_init (&value, G_TYPE_INT64); g_value_set_int64 (&value, id); filter = gom_filter_new_eq (BOOKMARKS_TYPE_RESOURCE, "id", &value); g_value_unset (&value); resource = gom_repository_find_one_sync (repository, BOOKMARKS_TYPE_RESOURCE, filter, &error); g_object_unref (filter); if (!resource) { GRL_WARNING ("Failed to get bookmark: %s", error->message); g_error_free (error); error = g_error_new_literal (GRL_CORE_ERROR, GRL_CORE_ERROR_RESOLVE_FAILED, _("Failed to get bookmark metadata")); rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, error); g_error_free (error); return; } type_filter = grl_operation_options_get_type_filter (rs->options); build_media_from_resource (rs->media, resource, type_filter); g_object_unref (resource); rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, NULL); }
static void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { NMDeviceTun *device = NM_DEVICE_TUN (object); switch (prop_id) { case PROP_HW_ADDRESS: g_value_set_string (value, nm_device_tun_get_hw_address (device)); break; case PROP_MODE: g_value_set_string (value, nm_device_tun_get_mode (device)); break; case PROP_OWNER: g_value_set_int64 (value, nm_device_tun_get_owner (device)); break; case PROP_GROUP: g_value_set_int64 (value, nm_device_tun_get_group (device)); break; case PROP_NO_PI: g_value_set_boolean (value, nm_device_tun_get_no_pi (device)); break; case PROP_VNET_HDR: g_value_set_boolean (value, nm_device_tun_get_vnet_hdr (device)); break; case PROP_MULTI_QUEUE: g_value_set_boolean (value, nm_device_tun_get_multi_queue (device)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void gst_trigger_control_source_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { GstTriggerControlSource *self = GST_TRIGGER_CONTROL_SOURCE (object); switch (prop_id) { case PROP_TOLERANCE: g_value_set_int64 (value, self->priv->tolerance); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void gst_aggregator_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { GstAggregator *agg = GST_AGGREGATOR (object); switch (prop_id) { case PROP_TIMEOUT: g_value_set_int64 (value, gst_aggregator_get_timeout (agg)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }