static void webkit_dom_html_embed_element_get_property(GObject* object, guint propertyId, GValue* value, GParamSpec* pspec) { WebKitDOMHTMLEmbedElement* self = WEBKIT_DOM_HTML_EMBED_ELEMENT(object); switch (propertyId) { case PROP_ALIGN: g_value_take_string(value, webkit_dom_html_embed_element_get_align(self)); break; case PROP_HEIGHT: g_value_set_long(value, webkit_dom_html_embed_element_get_height(self)); break; case PROP_NAME: g_value_take_string(value, webkit_dom_html_embed_element_get_name(self)); break; case PROP_SRC: g_value_take_string(value, webkit_dom_html_embed_element_get_src(self)); break; case PROP_TYPE: g_value_take_string(value, webkit_dom_html_embed_element_get_type_attr(self)); break; case PROP_WIDTH: g_value_set_long(value, webkit_dom_html_embed_element_get_width(self)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec); break; } }
static void gs_manager_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { GSManager *self; self = GS_MANAGER (object); switch (prop_id) { case PROP_THROTTLED: g_value_set_boolean (value, self->priv->throttled); break; case PROP_LOCK_ENABLED: g_value_set_boolean (value, self->priv->lock_enabled); break; case PROP_LOCK_TIMEOUT: g_value_set_long (value, self->priv->lock_timeout); break; case PROP_LOGOUT_ENABLED: g_value_set_boolean (value, self->priv->logout_enabled); break; case PROP_KEYBOARD_ENABLED: g_value_set_boolean (value, self->priv->keyboard_enabled); break; case PROP_USER_SWITCH_ENABLED: g_value_set_boolean (value, self->priv->user_switch_enabled); break; case PROP_LOGOUT_TIMEOUT: g_value_set_long (value, self->priv->logout_timeout); break; case PROP_LOGOUT_COMMAND: g_value_set_string (value, self->priv->logout_command); break; case PROP_KEYBOARD_COMMAND: g_value_set_string (value, self->priv->keyboard_command); break; case PROP_STATUS_MESSAGE: g_value_set_string (value, self->priv->status_message); break; case PROP_CYCLE_TIMEOUT: g_value_set_long (value, self->priv->cycle_timeout); break; case PROP_ACTIVE: g_value_set_boolean (value, self->priv->active); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void gswat_session_get_property (GObject *object, guint id, GValue *value, GParamSpec *pspec) { GSwatSession* self = GSWAT_SESSION (object); char *str = NULL; switch (id) { case PROP_NAME: g_value_set_string (value, self->priv->name); break; case PROP_TARGET_TYPE: g_value_set_string (value, self->priv->target_type); break; case PROP_TARGET: g_value_set_string (value, self->priv->target); break; case PROP_WORKING_DIR: g_value_set_string (value, self->priv->working_dir); break; case PROP_ACCESS_TIME: g_value_set_long (value, self->priv->access_time); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, id, pspec); break; } if (str) { g_free (str); } }
void scp_tree_data_to_value(const ScpTreeData *data, GType type, GValue *value) { g_value_init(value, type); switch (scp_tree_data_get_fundamental_type(type)) { case G_TYPE_INT : g_value_set_int(value, data->v_int); break; case G_TYPE_UINT : g_value_set_uint(value, data->v_uint); break; case G_TYPE_STRING : g_value_set_string(value, data->v_string); break; case G_TYPE_BOOLEAN : g_value_set_boolean(value, data->v_int); break; case G_TYPE_LONG : g_value_set_long(value, data->v_long); break; case G_TYPE_ULONG : g_value_set_ulong(value, data->v_ulong); break; case G_TYPE_FLOAT : g_value_set_float(value, data->v_float); break; case G_TYPE_DOUBLE : g_value_set_double(value, data->v_double); break; #if GLIB_CHECK_VERSION(2, 32, 0) case G_TYPE_CHAR : g_value_set_schar(value, data->v_char); break; #else case G_TYPE_CHAR : g_value_set_char(value, data->v_char); break; #endif case G_TYPE_UCHAR : g_value_set_uchar(value, data->v_uchar); break; case G_TYPE_INT64 : g_value_set_int64(value, data->v_int64); break; case G_TYPE_UINT64 : g_value_set_uint64 (value, data->v_uint64); break; case G_TYPE_ENUM : g_value_set_enum(value, data->v_int); break; case G_TYPE_FLAGS : g_value_set_flags(value, data->v_uint); break; case G_TYPE_POINTER : g_value_set_pointer(value, data->v_pointer); break; case G_TYPE_OBJECT : g_value_set_object(value, (GObject *) data->v_pointer); break; case G_TYPE_BOXED : g_value_set_boxed(value, data->v_pointer); break; #if GLIB_CHECK_VERSION(2, 26, 0) case G_TYPE_VARIANT : g_value_set_variant(value, data->v_pointer); break; #endif default : scp_tree_data_warn_unsupported_type(G_STRFUNC, type); } }
static inline gboolean gtk_arg_static_to_value (GtkArg *arg, GValue *value) { switch (G_TYPE_FUNDAMENTAL (arg->type)) { case G_TYPE_CHAR: g_value_set_char (value, GTK_VALUE_CHAR (*arg)); break; case G_TYPE_UCHAR: g_value_set_uchar (value, GTK_VALUE_UCHAR (*arg)); break; case G_TYPE_BOOLEAN: g_value_set_boolean (value, GTK_VALUE_BOOL (*arg)); break; case G_TYPE_INT: g_value_set_int (value, GTK_VALUE_INT (*arg)); break; case G_TYPE_UINT: g_value_set_uint (value, GTK_VALUE_UINT (*arg)); break; case G_TYPE_LONG: g_value_set_long (value, GTK_VALUE_LONG (*arg)); break; case G_TYPE_ULONG: g_value_set_ulong (value, GTK_VALUE_ULONG (*arg)); break; case G_TYPE_ENUM: g_value_set_enum (value, GTK_VALUE_ENUM (*arg)); break; case G_TYPE_FLAGS: g_value_set_flags (value, GTK_VALUE_FLAGS (*arg)); break; case G_TYPE_FLOAT: g_value_set_float (value, GTK_VALUE_FLOAT (*arg)); break; case G_TYPE_DOUBLE: g_value_set_double (value, GTK_VALUE_DOUBLE (*arg)); break; case G_TYPE_STRING: g_value_set_static_string (value, GTK_VALUE_STRING (*arg)); break; case G_TYPE_BOXED: g_value_set_static_boxed (value, GTK_VALUE_BOXED (*arg)); break; case G_TYPE_POINTER: g_value_set_pointer (value, GTK_VALUE_POINTER (*arg)); break; case G_TYPE_OBJECT: g_value_set_object (value, GTK_VALUE_POINTER (*arg)); break; default: return FALSE; } return TRUE; }
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; }
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 psppire_data_editor_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { PsppireDataEditor *de = PSPPIRE_DATA_EDITOR (object); switch (prop_id) { case PROP_SPLIT_WINDOW: g_value_set_boolean (value, de->split); break; case PROP_DATA_WINDOW: g_value_set_pointer (value, de->data_window); break; case PROP_DATA_STORE: g_value_set_pointer (value, de->data_store); break; case PROP_VAR_STORE: g_value_set_pointer (value, de->var_store); break; case PROP_CURRENT_CASE: { gint row, column; psppire_sheet_get_active_cell (PSPPIRE_SHEET (de->data_sheet[0]), &row, &column); g_value_set_long (value, row); } break; case PROP_CURRENT_VAR: { gint row, column; psppire_sheet_get_active_cell (PSPPIRE_SHEET (de->data_sheet[0]), &row, &column); g_value_set_long (value, column); } break; case PROP_DATA_SELECTED: g_value_set_boolean (value, data_is_selected (de)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; }; }
static void bt_sequence_grid_model_tree_model_get_value (GtkTreeModel * tree_model, GtkTreeIter * iter, gint column, GValue * value) { BtSequenceGridModel *model = BT_SEQUENCE_GRID_MODEL (tree_model); guint track, tick; //GST_DEBUG("getting value for column=%d / (%d+%d)",column,N_COLUMNS,model->priv->tracks); g_return_if_fail (column < N_COLUMNS + model->priv->tracks); if (column < N_COLUMNS) g_value_init (value, model->priv->param_types[column]); else g_value_init (value, G_TYPE_STRING); tick = GPOINTER_TO_UINT (iter->user_data); switch (column) { case BT_SEQUENCE_GRID_MODEL_SHADE:{ guint shade = (tick % (model->priv->bars * 2)); if (shade == 0) { g_value_set_boolean (value, FALSE); } else { // we're only interested in shade==bars, but lets set the others too // even though we should not be called for those g_value_set_boolean (value, TRUE); } } break; case BT_SEQUENCE_GRID_MODEL_POS: g_value_set_long (value, tick); break; case BT_SEQUENCE_GRID_MODEL_POSSTR: g_value_set_string (value, format_position (model, tick)); break; case BT_SEQUENCE_GRID_MODEL_LABEL: if (tick < model->priv->length) { g_value_take_string (value, bt_sequence_get_label (model->priv->sequence, tick)); } break; default: if (tick < model->priv->length) { BtCmdPattern *pattern; track = column - N_COLUMNS; //GST_LOG("getting pattern name for tick=%u,track=%u",tick,track); if ((pattern = bt_sequence_get_pattern (model->priv->sequence, tick, track))) { g_object_get_property ((GObject *) pattern, "name", value); g_object_unref (pattern); } } } }
static void gst_rnd_buffer_size_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { GstRndBufferSize *self = GST_RND_BUFFER_SIZE (object); switch (prop_id) { case ARG_SEED: g_value_set_ulong (value, self->seed); break; case ARG_MINIMUM: g_value_set_long (value, self->min); break; case ARG_MAXIMUM: g_value_set_long (value, self->max); 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 gsk_http_response_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { GskHttpResponse *response = GSK_HTTP_RESPONSE (object); switch (property_id) { case PROP_RESPONSE_STATUS_CODE: g_value_set_enum (value, response->status_code); break; case PROP_RESPONSE_AGE: g_value_set_long (value, response->age); break; #if 0 case PROP_RESPONSE_CONTENT_ENCODING: g_value_set_string (value, response->content_encoding); break; #endif case PROP_RESPONSE_LOCATION: g_value_set_string (value, response->location); break; case PROP_RESPONSE_EXPIRES: g_value_set_long (value, response->expires); break; case PROP_RESPONSE_ETAG: g_value_set_string (value, response->etag); break; case PROP_RESPONSE_LAST_MODIFIED: g_value_set_long (value, response->last_modified); break; case PROP_RESPONSE_SERVER: g_value_set_string (value, response->server); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
static gboolean char_class_any_extract(const gunichar *s, gsize length, struct char_class_data *data, GValueArray *array) { long ret = 0; GValue value; ret = s[0] - data->c; memset(&value, 0, sizeof(value)); g_value_init(&value, G_TYPE_LONG); g_value_set_long(&value, ret - data->inc); g_value_array_append(array, &value); g_value_unset(&value); return TRUE; }
static void gkm_secret_object_get_property (GObject *obj, guint prop_id, GValue *value, GParamSpec *pspec) { GkmSecretObject *self = GKM_SECRET_OBJECT (obj); switch (prop_id) { case PROP_LABEL: g_value_set_string (value, gkm_secret_object_get_label (self)); break; case PROP_IDENTIFIER: g_value_set_string (value, gkm_secret_object_get_identifier (self)); break; case PROP_CREATED: g_value_set_long (value, gkm_secret_object_get_created (self)); break; case PROP_MODIFIED: g_value_set_long (value, gkm_secret_object_get_modified (self)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); break; } }
static gboolean char_class_multi_extract(const gunichar *s, gsize length, struct char_class_data *data, GValueArray *array) { long ret = 0; gsize i; GValue value; memset(&value, 0, sizeof(value)); g_value_init(&value, G_TYPE_LONG); for (i = 0; i < length; i++) { if (s[i] == ';') { g_value_set_long(&value, ret - data->inc); g_value_array_append(array, &value); ret = 0; } else { ret *= 10; ret += (s[i] - '0'); } } g_value_set_long(&value, ret - data->inc); g_value_array_append(array, &value); g_value_unset(&value); return TRUE; }
/** * shp_complextype_add_long: * @self: a #ShpComplextype * @name: data's field name * @val: value * * Add a new key-value pair to a #ShpComplextype, value is of type long */ void shp_complextype_add_long (ShpComplextype * self, const gchar * name, glong val) { ShpComplextypePrivate *priv; g_return_if_fail (IS_SHP_COMPLEXTYPE (self)); g_return_if_fail (name != NULL); priv = self->priv; _ShpValue *value = g_new0 (_ShpValue, 1); g_value_init (&value->value, G_TYPE_LONG); g_value_set_long (&value->value, val); g_hash_table_insert (priv->values, g_strdup (name), value); }
static void _vte_table_extract_char(GValueArray **array, struct _vte_table_arginfo *arginfo, long increment) { GValue value = {0,}; g_value_init(&value, G_TYPE_LONG); g_value_set_long(&value, *(arginfo->start) - increment); if (G_UNLIKELY (*array == NULL)) { *array = g_value_array_new(1); } g_value_array_append(*array, &value); g_value_unset(&value); }
/* builtin type: long */ DECLARE_PARSER (long) { glong v; char *end; PARSER_ENSURE_IS_TEXT ("long"); v = strtol ((char *) node->v_text.content, &end, 0); if (end == (char*)node->v_text.content || *end != '\0') { g_set_error (error, GSK_G_ERROR_DOMAIN, GSK_ERROR_BAD_FORMAT, "error parsing number for long"); return FALSE; } g_value_set_long (value, v); return TRUE; }
static void hd_incoming_event_window_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { HDIncomingEventWindowPrivate *priv = HD_INCOMING_EVENT_WINDOW (object)->priv; switch (prop_id) { case PROP_PREVIEW: g_value_set_boolean (value, priv->preview); break; case PROP_DESTINATION: g_value_set_string (value, priv->destination); break; case PROP_ICON: { const gchar *icon_name; gtk_image_get_icon_name (GTK_IMAGE (priv->icon), &icon_name, NULL); g_value_set_string (value, icon_name); } break; case PROP_TITLE: g_value_set_string (value, gtk_label_get_label (GTK_LABEL (priv->title))); break; case PROP_TIME: g_value_set_long (value, priv->time); break; case PROP_AMOUNT: g_value_set_ulong (value, priv->amount); break; case PROP_MESSAGE: g_value_set_string (value, gtk_label_get_label (GTK_LABEL (priv->message))); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); } }
static void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { SummerFeed *self = SUMMER_FEED (object); SummerFeedPrivate *priv; priv = self->priv; switch (prop_id) { case PROP_CACHE_DIR: g_value_set_string (value, priv->cache_dir); break; case PROP_FREQUENCY: g_value_set_int (value, priv->frequency); break; case PROP_URL: g_value_set_string (value, priv->url); break; case PROP_TITLE: g_value_set_string (value, priv->feed_data->title); break; case PROP_DESCRIPTION: g_value_set_string (value, priv->feed_data->description); break; case PROP_ID: if (priv->feed_data->id) g_value_set_string (value, priv->feed_data->id); else g_value_set_string (value, priv->feed_data->web_url); break; case PROP_WEB_URL: g_value_set_string (value, priv->feed_data->web_url); break; case PROP_AUTHOR: g_value_set_string (value, priv->feed_data->author); break; case PROP_UPDATED: g_value_set_long (value, priv->feed_data->updated); break; case PROP_ITEMS: g_value_set_pointer (value, priv->feed_data->items); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void webkit_dom_test_active_dom_object_get_property(GObject* object, guint propertyId, GValue* value, GParamSpec* pspec) { WebCore::JSMainThreadNullState state; WebKitDOMTestActiveDOMObject* self = WEBKIT_DOM_TEST_ACTIVE_DOM_OBJECT(object); WebCore::TestActiveDOMObject* coreSelf = WebKit::core(self); switch (propertyId) { case PROP_EXCITING_ATTR: { g_value_set_long(value, coreSelf->excitingAttr()); break; } default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec); break; } }
static void vik_slippy_map_source_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { VikSlippyMapSource *self = VIK_SLIPPY_MAP_SOURCE (object); VikSlippyMapSourcePrivate *priv = VIK_SLIPPY_MAP_SOURCE_PRIVATE (self); switch (property_id) { case PROP_HOSTNAME: g_value_set_string (value, priv->hostname); break; case PROP_URL: g_value_set_string (value, priv->url); break; case PROP_REFERER: g_value_set_string (value, priv->options.referer); break; case PROP_FOLLOW_LOCATION: g_value_set_long (value, priv->options.follow_location); break; case PROP_CHECK_FILE_SERVER_TIME: g_value_set_boolean (value, priv->options.check_file_server_time); break; case PROP_USE_ETAG: g_value_set_boolean (value, priv->options.use_etag); break; case PROP_IS_DIRECT_FILE_ACCESS: g_value_set_boolean (value, priv->is_direct_file_access); break; default: /* We don't have any other property... */ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
static gboolean char_class_digit_extract(const gunichar *s, gsize length, struct char_class_data *data, GValueArray *array) { long ret = 0; gsize i; GValue value; for (i = 0; i < length; i++) { ret *= 10; ret += g_unichar_digit_value(s[i]) == -1 ? 0 : g_unichar_digit_value(s[i]); } memset(&value, 0, sizeof(value)); g_value_init(&value, G_TYPE_LONG); g_value_set_long(&value, ret - data->inc); g_value_array_append(array, &value); g_value_unset(&value); return TRUE; }
static void _vte_table_extract_numbers(GValueArray **array, struct _vte_table_arginfo *arginfo) { GValue value = {0,}; GValue subvalue = {0,}; GValueArray *subarray = NULL; gssize i; if (G_UNLIKELY (*array == NULL)) { *array = g_value_array_new(1); } g_value_init(&value, G_TYPE_LONG); g_value_init(&subvalue, G_TYPE_VALUE_ARRAY); i = 0; do { long total = 0; for (; i < arginfo->length && arginfo->start[i] != ';' && arginfo->start[i] != ':'; i++) { gint v = g_unichar_digit_value (arginfo->start[i]); total *= 10; total += v == -1 ? 0 : v; } g_value_set_long(&value, CLAMP (total, 0, G_MAXUSHORT)); if (i < arginfo->length && arginfo->start[i] == ':') { if (subarray == NULL) { subarray = g_value_array_new(2); } g_value_array_append(subarray, &value); } else { if (subarray == NULL) { g_value_array_append(*array, &value); } else { g_value_array_append(subarray, &value); g_value_set_boxed(&subvalue, subarray); g_value_array_append(*array, &subvalue); subarray = NULL; } } } while (i++ < arginfo->length); g_value_unset(&value); }
static void add_integer_timestamp_to_message(gpointer _message, gpointer user_data) { GValueArray *message = (GValueArray *) _message; GHashTable *details = g_value_get_boxed(g_value_array_get_nth(message, 4)); GValue *value = g_hash_table_lookup(details, "timestamp"); time_t timestamp = 0; if (value) { const char *timestr = g_value_get_string(value); timestamp = time_stringtotimestamp(timestr); } else g_debug("could not find a timestamp in message data !!!"); // Insert integer timestamp into array value = g_slice_alloc0(sizeof(GValue)); g_value_init(value, G_TYPE_LONG); g_value_set_long(value, timestamp); g_hash_table_insert(details, strdup("timestamp_int"), value); }
static void gst_snapshot_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { GstSnapshot *snapshot; g_return_if_fail (GST_IS_SNAPSHOT (object)); snapshot = GST_SNAPSHOT (object); switch (prop_id) { case ARG_LOCATION: g_value_set_string (value, snapshot->location); break; case ARG_FRAME: g_value_set_long (value, snapshot->frame); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void _vte_table_extract_numbers(GValueArray **array, struct _vte_table_arginfo *arginfo, long increment) { GValue value = {0,}; gssize i; g_value_init(&value, G_TYPE_LONG); i = 0; do { long total = 0; for (; i < arginfo->length && arginfo->start[i] != ';'; i++) { gint v = g_unichar_digit_value (arginfo->start[i]); total *= 10; total += v == -1 ? 0 : v; } if (G_UNLIKELY (*array == NULL)) { *array = g_value_array_new(1); } g_value_set_long(&value, CLAMP (total, 0, G_MAXUSHORT)); g_value_array_append(*array, &value); } while (i++ < arginfo->length); g_value_unset(&value); }
static HaskellObj #ifdef GHC_RTS_USES_CAPABILITY gtk2hs_value_as_haskellobj(Capability *cap, const GValue *value) { #else gtk2hs_value_as_haskellobj(const GValue *value) { #endif switch (G_TYPE_FUNDAMENTAL(G_VALUE_TYPE(value))) { case G_TYPE_INTERFACE: if (g_type_is_a(G_VALUE_TYPE(value), G_TYPE_OBJECT)) return rts_mkPtr(CAP g_value_get_object(value)); else break; case G_TYPE_CHAR: return rts_mkChar(CAP g_value_get_schar(value)); case G_TYPE_UCHAR: return rts_mkChar(CAP g_value_get_uchar(value)); case G_TYPE_BOOLEAN: return rts_mkBool(CAP g_value_get_boolean(value)); case G_TYPE_INT: return rts_mkInt(CAP g_value_get_int(value)); case G_TYPE_UINT: return rts_mkWord(CAP g_value_get_uint(value)); case G_TYPE_LONG: return rts_mkInt(CAP g_value_get_long(value)); case G_TYPE_ULONG: return rts_mkWord(CAP g_value_get_ulong(value)); /* case G_TYPE_INT64: return rts_mkInt64(CAP g_value_get_int64(value)); case G_TYPE_UINT64: return rts_mkWord64(CAP g_value_get_uint64(value)); */ case G_TYPE_ENUM: return rts_mkInt(CAP g_value_get_enum(value)); case G_TYPE_FLAGS: return rts_mkWord(CAP g_value_get_enum(value)); case G_TYPE_FLOAT: return rts_mkFloat(CAP g_value_get_float(value)); case G_TYPE_DOUBLE: return rts_mkDouble(CAP g_value_get_double(value)); case G_TYPE_STRING: return rts_mkPtr(CAP (char *)g_value_get_string(value)); /* CHECKME: is the string freed? */ case G_TYPE_POINTER: return rts_mkPtr(CAP g_value_get_pointer(value)); case G_TYPE_BOXED: return rts_mkPtr(CAP g_value_get_boxed(value)); case G_TYPE_PARAM: return rts_mkPtr(CAP g_value_get_param(value)); case G_TYPE_OBJECT: return rts_mkPtr(CAP g_value_get_object(value)); } g_error("gtk2hs_value_as_haskellobj: unable to handle GValue with type %s\n" "please report this as a bug to [email protected]", g_type_name(G_VALUE_TYPE(value))); } void gtk2hs_value_from_haskellobj(GValue *value, HaskellObj obj) { switch (G_TYPE_FUNDAMENTAL(G_VALUE_TYPE(value))) { case G_TYPE_INVALID: case G_TYPE_NONE: return; case G_TYPE_INTERFACE: /* we only handle interface types that have a GObject prereq */ if (g_type_is_a(G_VALUE_TYPE(value), G_TYPE_OBJECT)) { g_value_set_object(value, rts_getPtr(obj)); } else { break; } return; case G_TYPE_CHAR: g_value_set_schar(value, rts_getChar(obj)); return; case G_TYPE_UCHAR: g_value_set_schar(value, rts_getChar(obj)); return; case G_TYPE_BOOLEAN: g_value_set_boolean(value, rts_getBool(obj)); return; case G_TYPE_INT: g_value_set_int(value, rts_getInt(obj)); return; case G_TYPE_UINT: g_value_set_uint(value, rts_getWord(obj)); return; case G_TYPE_LONG: g_value_set_long(value, rts_getInt(obj)); return; case G_TYPE_ULONG: g_value_set_ulong(value, rts_getWord(obj)); return; /* case G_TYPE_INT64: g_value_set_int64(value, rts_getInt64(obj)); return; case G_TYPE_UINT64: g_value_set_uint64(value, rts_getWord64(obj)); return; */ case G_TYPE_ENUM: g_value_set_enum(value, rts_getInt(obj)); return; case G_TYPE_FLAGS: g_value_set_flags(value, rts_getInt(obj)); return; case G_TYPE_FLOAT: g_value_set_float(value, rts_getFloat(obj)); return; case G_TYPE_DOUBLE: g_value_set_double(value, rts_getDouble(obj)); return; case G_TYPE_STRING: g_value_set_string(value, rts_getPtr(obj)); return; case G_TYPE_POINTER: g_value_set_pointer(value, rts_getPtr(obj)); return; /* case G_TYPE_BOXED: { g_value_set_boxed(value, obj); break; } case G_TYPE_PARAM: g_value_set_param(value, (obj)); break; */ case G_TYPE_OBJECT: g_value_set_object(value, rts_getPtr(obj)); return; } g_error("gtk2hs_value_from_haskellobj: unable to handle GValue with type %s\n" "please report this as a bug to [email protected]", g_type_name(G_VALUE_TYPE(value))); }
void _gtk_tree_data_list_node_to_value (GtkTreeDataList *list, GType type, GValue *value) { g_value_init (value, type); switch (get_fundamental_type (type)) { case G_TYPE_BOOLEAN: g_value_set_boolean (value, (gboolean) list->data.v_int); break; case G_TYPE_CHAR: g_value_set_schar (value, (gchar) list->data.v_char); break; case G_TYPE_UCHAR: g_value_set_uchar (value, (guchar) list->data.v_uchar); break; case G_TYPE_INT: g_value_set_int (value, (gint) list->data.v_int); break; case G_TYPE_UINT: g_value_set_uint (value, (guint) list->data.v_uint); break; case G_TYPE_LONG: g_value_set_long (value, list->data.v_long); break; case G_TYPE_ULONG: g_value_set_ulong (value, list->data.v_ulong); break; case G_TYPE_INT64: g_value_set_int64 (value, list->data.v_int64); break; case G_TYPE_UINT64: g_value_set_uint64 (value, list->data.v_uint64); break; case G_TYPE_ENUM: g_value_set_enum (value, list->data.v_int); break; case G_TYPE_FLAGS: g_value_set_flags (value, list->data.v_uint); break; case G_TYPE_FLOAT: g_value_set_float (value, (gfloat) list->data.v_float); break; case G_TYPE_DOUBLE: g_value_set_double (value, (gdouble) list->data.v_double); break; case G_TYPE_STRING: g_value_set_string (value, (gchar *) list->data.v_pointer); break; case G_TYPE_POINTER: g_value_set_pointer (value, (gpointer) list->data.v_pointer); break; case G_TYPE_BOXED: g_value_set_boxed (value, (gpointer) list->data.v_pointer); break; case G_TYPE_VARIANT: g_value_set_variant (value, (gpointer) list->data.v_pointer); break; case G_TYPE_OBJECT: g_value_set_object (value, (GObject *) list->data.v_pointer); break; default: g_warning ("%s: Unsupported type (%s) retrieved.", G_STRLOC, g_type_name (value->g_type)); break; } }
static void gst_motion_cells_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { GstMotioncells *filter = gst_motion_cells (object); GString *str; int i; switch (prop_id) { case PROP_GRID_X: g_value_set_int (value, filter->gridx); break; case PROP_GRID_Y: g_value_set_int (value, filter->gridy); break; case PROP_GAP: g_value_set_int (value, filter->gap); break; case PROP_POSTNOMOTION: g_value_set_int (value, filter->postnomotion); break; case PROP_MINIMUNMOTIONFRAMES: g_value_set_int (value, filter->minimum_motion_frames); break; case PROP_SENSITIVITY: g_value_set_double (value, filter->sensitivity); break; case PROP_THRESHOLD: g_value_set_double (value, filter->threshold); break; case PROP_DISPLAY: g_value_set_boolean (value, filter->display); break; case PROP_POSTALLMOTION: g_value_set_boolean (value, filter->postallmotion); break; case PROP_USEALPHA: g_value_set_boolean (value, filter->usealpha); break; case PROP_CALCULATEMOTION: g_value_set_boolean (value, filter->calculate_motion); break; case PROP_DATE: g_value_set_long (value, filter->starttime); break; case PROP_DATAFILE: g_value_set_string (value, filter->basename_datafile); break; case PROP_DATAFILE_EXT: g_value_set_string (value, filter->datafile_extension); break; case PROP_MOTIONMASKCOORD: str = g_string_new (""); for (i = 0; i < filter->motionmaskcoord_count; ++i) { if (i < filter->motionmaskcoord_count - 1) g_string_append_printf (str, "%d:%d:%d:%d,", filter->motionmaskcoords[i].upper_left_x, filter->motionmaskcoords[i].upper_left_y, filter->motionmaskcoords[i].lower_right_x, filter->motionmaskcoords[i].lower_right_y); else g_string_append_printf (str, "%d:%d:%d:%d", filter->motionmaskcoords[i].upper_left_x, filter->motionmaskcoords[i].upper_left_y, filter->motionmaskcoords[i].lower_right_x, filter->motionmaskcoords[i].lower_right_y); } g_value_set_string (value, str->str); g_string_free (str, TRUE); break; case PROP_MOTIONMASKCELLSPOS: str = g_string_new (""); for (i = 0; i < filter->motionmaskcells_count; ++i) { if (i < filter->motionmaskcells_count - 1) g_string_append_printf (str, "%d:%d,", filter->motionmaskcellsidx[i].lineidx, filter->motionmaskcellsidx[i].columnidx); else g_string_append_printf (str, "%d:%d", filter->motionmaskcellsidx[i].lineidx, filter->motionmaskcellsidx[i].columnidx); } g_value_set_string (value, str->str); g_string_free (str, TRUE); break; case PROP_CELLSCOLOR: str = g_string_new (""); g_string_printf (str, "%d,%d,%d", filter->motioncellscolor->R_channel_value, filter->motioncellscolor->G_channel_value, filter->motioncellscolor->B_channel_value); g_value_set_string (value, str->str); g_string_free (str, TRUE); break; case PROP_MOTIONCELLSIDX: str = g_string_new (""); for (i = 0; i < filter->motioncells_count; ++i) { if (i < filter->motioncells_count - 1) g_string_append_printf (str, "%d:%d,", filter->motioncellsidx[i].lineidx, filter->motioncellsidx[i].columnidx); else g_string_append_printf (str, "%d:%d", filter->motioncellsidx[i].lineidx, filter->motioncellsidx[i].columnidx); } g_value_set_string (value, str->str); g_string_free (str, TRUE); break; case PROP_MOTIONCELLTHICKNESS: g_value_set_int (value, filter->thickness); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }