static void webkitVideoSinkGetProperty(GObject* object, guint propertyId, GValue* value, GParamSpec* parameterSpec)
{
    WebKitVideoSink* sink = WEBKIT_VIDEO_SINK(object);
    WebKitVideoSinkPrivate* priv = sink->priv;

    switch (propertyId) {
    case PROP_CAPS: {
        GstCaps* caps = priv->currentCaps;
        if (caps)
            gst_caps_ref(caps);
        g_value_take_boxed(value, caps);
        break;
    }
    default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, parameterSpec);
    }
}
示例#2
0
static gboolean 
font_description_value_parse (GtkCssParser *parser,
                              GFile        *base,
                              GValue       *value)
{
  PangoFontDescription *font_desc;
  char *str;

  str = _gtk_css_parser_read_value (parser);
  if (str == NULL)
    return FALSE;

  font_desc = pango_font_description_from_string (str);
  g_free (str);
  g_value_take_boxed (value, font_desc);
  return TRUE;
}
示例#3
0
/* TODO: make it more generic, with maybe some part in Ruby */
static VALUE
rg_set_fill_pattern(VALUE self, VALUE value)
{
    GValue gval = G_VALUE_INIT;
    cairo_pattern_t *pattern;

    g_value_init(&gval, GOO_TYPE_CAIRO_PATTERN);
    pattern = RVAL2CRPATTERN(value);
    g_value_take_boxed(&gval, pattern);
    goo_canvas_style_set_property(_SELF(self),
                                  goo_canvas_style_fill_pattern_id,
                                  &gval);
    g_value_unset(&gval);

    G_CHILD_SET(self, rb_intern("fill_pattern"), value);
    return self;
}
示例#4
0
static gboolean
shrink_font (GBinding     *binding,
             const GValue *value,
             GValue       *to_value,
             gpointer      user_data)
{
  PangoFontDescription *font_desc;

  g_assert (G_VALUE_HOLDS (value, PANGO_TYPE_FONT_DESCRIPTION));

  if ((font_desc = g_value_dup_boxed (value)))
    {
      pango_font_description_set_size (font_desc, 1 * PANGO_SCALE);
      g_value_take_boxed (to_value, font_desc);
    }

  return TRUE;
}
static gboolean
ip_addresses_with_prefix_from_strv (GBinding     *binding,
                                    const GValue *source_value,
                                    GValue       *target_value,
                                    gpointer      user_data)
{
	int family = GPOINTER_TO_INT (user_data);
	char **strings;
	GPtrArray *addrs;
	NMIPAddress *addr;
	char *addrstr;
	guint32 prefix;
	int i;

	strings = g_value_get_boxed (source_value);
	/* Fetch the original property value, so as to preserve their extra attributes */
	g_object_get (g_binding_get_source (binding),
	              g_binding_get_source_property (binding), &addrs,
	              NULL);

	for (i = 0; strings[i]; i++) {
		if (i >= addrs->len) {
			if (family == AF_INET)
				addr = nm_ip_address_new (AF_INET, "0.0.0.0", 32, NULL);
			else
				addr = nm_ip_address_new (AF_INET6, "::", 128, NULL);
			g_ptr_array_add (addrs, addr);
		} else
			addr = addrs->pdata[i];

		if (!parse_addr_prefix (strings[i], family, &addrstr, &prefix)) {
			g_ptr_array_unref (addrs);
			return FALSE;
		}

		nm_ip_address_set_address (addr, addrstr);
		nm_ip_address_set_prefix (addr, prefix);
		g_free (addrstr);
	}

	g_ptr_array_set_size (addrs, i);
	g_value_take_boxed (target_value, addrs);
	return TRUE;
}
static GTokenType
gimp_config_deserialize_value_array (GValue     *value,
                                     GimpConfig *config,
                                     GParamSpec *prop_spec,
                                     GScanner   *scanner)
{
  GParamSpecValueArray *array_spec;
  GValueArray          *array;
  GValue                array_value = { 0, };
  gint                  n_values;
  GTokenType            token;
  gint                  i;

  array_spec = G_PARAM_SPEC_VALUE_ARRAY (prop_spec);

  if (! gimp_scanner_parse_int (scanner, &n_values))
    return G_TOKEN_INT;

  array = g_value_array_new (n_values);

  for (i = 0; i < n_values; i++)
    {
      g_value_init (&array_value, array_spec->element_spec->value_type);

      token = gimp_config_deserialize_value (&array_value,
                                             config,
                                             array_spec->element_spec,
                                             scanner);

      if (token == G_TOKEN_RIGHT_PAREN)
        g_value_array_append (array, &array_value);

      g_value_unset (&array_value);

      if (token != G_TOKEN_RIGHT_PAREN)
        return token;
    }

  g_value_take_boxed (value, array);

  return G_TOKEN_RIGHT_PAREN;
}
示例#7
0
static void
schgui_drawing_cfg_get_property(GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
{
    SchGUIDrawingCfg *config = SCHGUI_DRAWING_CFG(object);

    if (config != NULL)
    {
        switch (property_id)
        {
            case SCHGUI_DRAWING_CFG_BACKGROUND:
                schgui_drawing_cfg_get_background(config, value);
                break;

            case SCHGUI_DRAWING_CFG_COLOR_BACKGROUND:
                g_value_take_boxed(value, schgui_drawing_cfg_get_color_background(config));
                break;

            case SCHGUI_DRAWING_CFG_FONT_STRING:
                g_value_take_string(value, schgui_drawing_cfg_get_font_string(config));
                break;

            case SCHGUI_DRAWING_CFG_LINE_WIDTH_BUS:
                g_value_set_double(value, schgui_drawing_cfg_get_line_width_bus(config));
                break;

            case SCHGUI_DRAWING_CFG_LINE_WIDTH_GRAPHIC_MIN:
                g_value_set_double(value, schgui_drawing_cfg_get_line_width_graphic_min(config));
                break;

            case SCHGUI_DRAWING_CFG_LINE_WIDTH_NET:
                g_value_set_double(value, schgui_drawing_cfg_get_line_width_net(config));
                break;

            case SCHGUI_DRAWING_CFG_LINE_WIDTH_PIN:
                g_value_set_double(value, schgui_drawing_cfg_get_line_width_pin(config));
                break;

            default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
        }
    }
}
static void
get_property (GObject *object, guint prop_id,
			  GValue *value, GParamSpec *pspec)
{
	NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (object);
	GPtrArray *devices;

	switch (prop_id) {
	case PROP_SERVICE_NAME:
		nm_active_connection_scope_to_value (priv->connection, value);
		break;
	case PROP_CONNECTION:
		g_value_set_boxed (value, nm_connection_get_path (priv->connection));
		break;
	case PROP_SPECIFIC_OBJECT:
		if (priv->specific_object)
			g_value_set_boxed (value, priv->specific_object);
		else
			g_value_set_boxed (value, "/");
		break;
	case PROP_DEVICES:
		devices = g_ptr_array_sized_new (1);
		g_ptr_array_add (devices, g_strdup (nm_device_get_path (priv->device)));
		g_value_take_boxed (value, devices);
		break;
	case PROP_STATE:
		g_value_set_uint (value, priv->state);
		break;
	case PROP_DEFAULT:
		g_value_set_boolean (value, priv->is_default);
		break;
	case PROP_DEFAULT6:
		g_value_set_boolean (value, priv->is_default6);
		break;
	case PROP_VPN:
		g_value_set_boolean (value, FALSE);
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
		break;
	}
}
static void
get_property (GObject *object, guint prop_id,
			  GValue *value, GParamSpec *pspec)
{
	NMDeviceWimax *self = NM_DEVICE_WIMAX (object);
	NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (self);
	GPtrArray *array;
	GSList *iter;

	switch (prop_id) {
	case PROP_NSPS:
		array = g_ptr_array_sized_new (4);
		for (iter = priv->nsp_list; iter; iter = g_slist_next (iter))
			g_ptr_array_add (array, g_strdup (nm_wimax_nsp_get_dbus_path (NM_WIMAX_NSP (iter->data))));
		g_value_take_boxed (value, array);
		break;
	case PROP_ACTIVE_NSP:
		if (priv->current_nsp)
			g_value_set_boxed (value, nm_wimax_nsp_get_dbus_path (priv->current_nsp));
		else
			g_value_set_boxed (value, "/");
		break;
	case PROP_CENTER_FREQ:
		g_value_set_uint (value, priv->center_freq);
		break;
	case PROP_RSSI:
		g_value_set_int (value, priv->rssi);
		break;
	case PROP_CINR:
		g_value_set_int (value, priv->cinr);
		break;
	case PROP_TX_POWER:
		g_value_set_int (value, priv->tx_power);
		break;
	case PROP_BSID:
		g_value_set_string (value, priv->bsid);
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
		break;
	}
}
/**
 * geoclue_accuracy_new:
 * @level: A #GeoclueAccuracyLevel
 * @horizontal_accuracy: Horizontal accuracy in meters
 * @vertical_accuracy: Vertical accuracy in meters
 *
 * Creates a new #GeoclueAccuracy with given values. Use 0 for
 * horizontal_accuracy and vertical_accuracy if @level is not
 * %GEOCLUE_ACCURACY_LEVEL_DETAILED.
 *
 * Return value: New #GeoclueAccuracy.
 */
GeoclueAccuracy *
geoclue_accuracy_new (GeoclueAccuracyLevel level,
		      double               horizontal_accuracy,
		      double               vertical_accuracy)
{
	GValue accuracy_struct = {0, };

	g_value_init (&accuracy_struct, GEOCLUE_ACCURACY_TYPE);
	g_value_take_boxed (&accuracy_struct,
			    dbus_g_type_specialized_construct
			    (GEOCLUE_ACCURACY_TYPE));

	dbus_g_type_struct_set (&accuracy_struct,
				0, level,
				1, horizontal_accuracy,
				2, vertical_accuracy,
				G_MAXUINT);

	return (GeoclueAccuracy *) g_value_get_boxed (&accuracy_struct);
}
示例#11
0
static void
nameservers_to_gvalue (GArray *array, GValue *value)
{
	GPtrArray *dns;
	guint i = 0;

	dns = g_ptr_array_new ();

	while (array && (i < array->len)) {
		struct in6_addr *addr;
		GByteArray *bytearray;
		addr = &g_array_index (array, struct in6_addr, i++);

		bytearray = g_byte_array_sized_new (16);
		g_byte_array_append (bytearray, (guint8 *) addr->s6_addr, 16);
		g_ptr_array_add (dns, bytearray);
	}

	g_value_take_boxed (value, dns);
}
示例#12
0
static gboolean
update_string_list_idle (GladeEditorProperty * eprop)
{
  GladeEPropStringList *eprop_string_list = GLADE_EPROP_STRING_LIST (eprop);
  GValue value = { 0, };

  eprop_string_list->want_focus = TRUE;

  g_value_init (&value, GLADE_TYPE_STRING_LIST);
  g_value_take_boxed (&value, eprop_string_list->pending_string_list);
  glade_editor_property_commit (eprop, &value);
  g_value_unset (&value);

  eprop_string_list->want_focus = FALSE;

  eprop_string_list->pending_string_list = NULL;
  eprop_string_list->update_id = 0;
    
  return FALSE;
}
GstFlowReturn GStreamerReader::AllocateVideoBufferFull(GstPad* aPad,
                                                       guint64 aOffset,
                                                       guint aSize,
                                                       GstCaps* aCaps,
                                                       GstBuffer** aBuf,
                                                       nsRefPtr<PlanarYCbCrImage>& aImage)
{
  /* allocate an image using the container */
  ImageContainer* container = mDecoder->GetImageContainer();
  ImageFormat format = PLANAR_YCBCR;
  PlanarYCbCrImage* img = reinterpret_cast<PlanarYCbCrImage*>(container->CreateImage(&format, 1).get());
  nsRefPtr<PlanarYCbCrImage> image = dont_AddRef(img);

  /* prepare a GstBuffer pointing to the underlying PlanarYCbCrImage buffer */
  GstBuffer* buf = gst_buffer_new();
  GST_BUFFER_SIZE(buf) = aSize;
  /* allocate the actual YUV buffer */
  GST_BUFFER_DATA(buf) = image->AllocateAndGetNewBuffer(aSize);

  aImage = image;

#if GST_VERSION_MICRO >= 36
  /* create a GBoxed handle to hold the image */
  BufferData* data = new BufferData(image);

  /* store it in a GValue so we can put it in a GstStructure */
  GValue value = {0,};
  g_value_init(&value, buffer_data_get_type());
  g_value_take_boxed(&value, data);

  /* store the value in the structure */
  GstStructure* structure = gst_structure_new("moz-reader-data", nullptr);
  gst_structure_take_value(structure, "image", &value);

  /* and attach the structure to the buffer */
  gst_buffer_set_qdata(buf, g_quark_from_string("moz-reader-data"), structure);
#endif

  *aBuf = buf;
  return GST_FLOW_OK;
}
/**
 * nm_device_wifi_get_active_access_point:
 * @device: a #NMDeviceWifi
 *
 * Gets the active #NMAccessPoint.
 *
 * Returns: the access point or %NULL if none is active
 **/
NMAccessPoint *
nm_device_wifi_get_active_access_point (NMDeviceWifi *device)
{
	NMDeviceWifiPrivate *priv;
	NMDeviceState state;
	char *path;
	GValue value = { 0, };

	g_return_val_if_fail (NM_IS_DEVICE_WIFI (device), NULL);

	state = nm_device_get_state (NM_DEVICE (device));
	switch (state) {
	case NM_DEVICE_STATE_PREPARE:
	case NM_DEVICE_STATE_CONFIG:
	case NM_DEVICE_STATE_NEED_AUTH:
	case NM_DEVICE_STATE_IP_CONFIG:
	case NM_DEVICE_STATE_ACTIVATED:
		break;
	default:
		return NULL;
		break;
	}

	priv = NM_DEVICE_WIFI_GET_PRIVATE (device);
	if (priv->active_ap)
		return priv->active_ap;
	if (priv->null_active_ap)
		return NULL;

	path = _nm_object_get_object_path_property (NM_OBJECT (device),
	                                           NM_DBUS_INTERFACE_DEVICE_WIRELESS,
	                                           DBUS_PROP_ACTIVE_ACCESS_POINT);
	if (path) {
		g_value_init (&value, DBUS_TYPE_G_OBJECT_PATH);
		g_value_take_boxed (&value, path);
		demarshal_active_ap (NM_OBJECT (device), NULL, &value, &priv->active_ap);
		g_value_unset (&value);
	}

	return priv->active_ap;
}
static void
get_property (GObject *object, guint prop_id,
			  GValue *value, GParamSpec *pspec)
{
	NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object);
	GPtrArray *devices;

	switch (prop_id) {
	case PROP_CONNECTION:
		g_value_set_boxed (value, nm_connection_get_path (priv->connection));
		break;
	case PROP_UUID:
		g_value_set_string (value, nm_connection_get_uuid (priv->connection));
		break;
	case PROP_SPECIFIC_OBJECT:
		g_value_set_boxed (value, priv->specific_object ? priv->specific_object : "/");
		break;
	case PROP_DEVICES:
		devices = g_ptr_array_sized_new (1);
		g_ptr_array_add (devices, g_strdup (priv->device_path));
		g_value_take_boxed (value, devices);
		break;
	case PROP_STATE:
		g_value_set_uint (value, priv->state);
		break;
	case PROP_DEFAULT:
		g_value_set_boolean (value, priv->is_default);
		break;
	case PROP_DEFAULT6:
		g_value_set_boolean (value, priv->is_default6);
		break;
	case PROP_VPN:
		g_value_set_boolean (value, priv->vpn);
		break;
	case PROP_MASTER:
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
		break;
	}
}
示例#16
0
static void
gcr_key_renderer_get_property (GObject *obj, guint prop_id, GValue *value,
                               GParamSpec *pspec)
{
	GcrKeyRenderer *self = GCR_KEY_RENDERER (obj);

	switch (prop_id) {
	case PROP_LABEL:
		g_value_take_string (value, calculate_label (self));
		break;
	case PROP_ATTRIBUTES:
		g_value_take_boxed (value, calculate_attrs (self));
		break;
	case PROP_OBJECT:
		g_value_set_object (value, self->pv->object);
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
		break;
	}
}
static void midgard_timestamp_transform_from_string(const GValue *src, GValue *dst) 
{
	g_return_if_fail(G_VALUE_HOLDS_STRING(src) &&
			G_VALUE_HOLDS(dst, MGD_TYPE_TIMESTAMP));

	const gchar *time = g_value_get_string(src);
	g_return_if_fail(time != NULL);

        MidgardTimestamp *mt = (MidgardTimestamp *) g_value_get_boxed(dst);

	if(mt == NULL) {
		
		mt = midgard_timestamp_new();
		g_value_take_boxed(dst, mt);
	}	

	gint rv = caltime_scan(time, mt);

	if (rv != 0)
		g_warning ("Failed to transform given datetime string (%s) to MidgardTimestamp", time);
}
示例#18
0
static void
kms_base_rtp_session_get_property (GObject * object, guint property_id,
    GValue * value, GParamSpec * pspec)
{
  KmsBaseRtpSession *self = KMS_BASE_RTP_SESSION (object);

  KMS_SDP_SESSION_LOCK (self);

  switch (property_id) {
    case PROP_CONNECTION_STATE:
      g_value_set_enum (value, self->conn_state);
      break;
    case PROP_STATS:{
      gchar *struct_name, *obj_name;
      GstStructure *s;

      obj_name = gst_element_get_name (self);
      struct_name = g_strdup_printf ("%s-stats", obj_name);
      g_free (obj_name);

      /* Video and audio latencies are avery small values in */
      /* nano seconds so there is no harm in casting them to */
      /* uint64 even we might lose a bit of preccision.      */

      s = gst_structure_new (struct_name, "video-e2e-latency",
          G_TYPE_UINT64, (guint64) self->stats->vi, "audio-e2e-latency",
          G_TYPE_UINT64, (guint64) self->stats->ai, NULL);

      g_free (struct_name);
      g_value_take_boxed (value, s);

      break;
    }
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
      break;
  }

  KMS_SDP_SESSION_UNLOCK (self);
}
示例#19
0
static void
get_property (GObject *object, guint prop_id,
              GValue *value, GParamSpec *pspec)
{
	GPtrArray *slaves;
	GSList *list, *iter;

	switch (prop_id) {
		break;
	case PROP_SLAVES:
		slaves = g_ptr_array_new ();
		list = nm_device_master_get_slaves (NM_DEVICE (object));
		for (iter = list; iter; iter = iter->next)
			g_ptr_array_add (slaves, g_strdup (nm_device_get_path (NM_DEVICE (iter->data))));
		g_slist_free (list);
		g_value_take_boxed (value, slaves);
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
		break;
	}
}
示例#20
0
static gboolean
update_data_tree_idle (GladeEditorProperty * eprop)
{
  GladeEPropModelData *eprop_data = GLADE_EPROP_MODEL_DATA (eprop);
  GladeProperty       *property = glade_editor_property_get_property (eprop);
  GValue value = { 0, };

  g_value_init (&value, GLADE_TYPE_MODEL_DATA_TREE);
  g_value_take_boxed (&value, eprop_data->pending_data_tree);

  /* Only commit the value if it changed, otherwise this
   * can trigger a load.. which we dont handle well in this
   * editor 
   */
  if (!glade_property_equals_value (property, &value))
    glade_editor_property_commit (eprop, &value);

  g_value_unset (&value);

  eprop_data->pending_data_tree = NULL;
  return FALSE;
}
static void
get_property (GObject *object,
              guint prop_id,
              GValue *value,
              GParamSpec *pspec)
{
	NMDeviceWimax *self = NM_DEVICE_WIMAX (object);

	switch (prop_id) {
	case PROP_HW_ADDRESS:
		g_value_set_string (value, nm_device_wimax_get_hw_address (self));
		break;
	case PROP_ACTIVE_NSP:
		g_value_set_object (value, nm_device_wimax_get_active_nsp (self));
		break;
	case PROP_CENTER_FREQ:
		g_value_set_uint (value, nm_device_wimax_get_center_frequency (self));
		break;
	case PROP_RSSI:
		g_value_set_int (value, nm_device_wimax_get_rssi (self));
		break;
	case PROP_CINR:
		g_value_set_int (value, nm_device_wimax_get_cinr (self));
		break;
	case PROP_TX_POWER:
		g_value_set_int (value, nm_device_wimax_get_tx_power (self));
		break;
	case PROP_BSID:
		g_value_set_string (value, nm_device_wimax_get_bsid (self));
		break;
	case PROP_NSPS:
		g_value_take_boxed (value, _nm_utils_copy_object_array (nm_device_wimax_get_nsps (self)));
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
		break;
	}
}
示例#22
0
文件: gtkcssnode.c 项目: GYGit/gtk
static void
gtk_css_node_get_property (GObject    *object,
                           guint       property_id,
                           GValue     *value,
                           GParamSpec *pspec)
{
  GtkCssNode *cssnode = GTK_CSS_NODE (object);

  switch (property_id)
    {
    case PROP_CLASSES:
      g_value_take_boxed (value, gtk_css_node_get_classes (cssnode));
      break;

    case PROP_ID:
      g_value_set_string (value, gtk_css_node_get_id (cssnode));
      break;

    case PROP_NAME:
      g_value_set_string (value, gtk_css_node_get_name (cssnode));
      break;

    case PROP_STATE:
      g_value_set_flags (value, gtk_css_node_get_state (cssnode));
      break;

    case PROP_VISIBLE:
      g_value_set_boolean (value, gtk_css_node_get_visible (cssnode));
      break;

    case PROP_WIDGET_TYPE:
      g_value_set_gtype (value, gtk_css_node_get_widget_type (cssnode));
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
    }
}
示例#23
0
static gboolean 
bindings_value_parse (GtkCssParser *parser,
                      GFile        *base,
                      GValue       *value)
{
  GPtrArray *array;
  GtkBindingSet *binding_set;
  char *name;

  array = g_ptr_array_new ();

  do {
      name = _gtk_css_parser_try_ident (parser, TRUE);
      if (name == NULL)
        {
          _gtk_css_parser_error (parser, "Not a valid binding name");
          g_ptr_array_free (array, TRUE);
          return FALSE;
        }

      binding_set = gtk_binding_set_find (name);

      if (!binding_set)
        {
          _gtk_css_parser_error (parser, "No binding set named '%s'", name);
          g_free (name);
          continue;
        }

      g_ptr_array_add (array, binding_set);
      g_free (name);
    }
  while (_gtk_css_parser_try (parser, ",", TRUE));

  g_value_take_boxed (value, array);

  return TRUE;
}
示例#24
0
static void
get_property (GObject *object,
              guint prop_id,
              GValue *value,
              GParamSpec *pspec)
{
	NMDeviceBridge *device = NM_DEVICE_BRIDGE (object);

	switch (prop_id) {
	case PROP_HW_ADDRESS:
		g_value_set_string (value, nm_device_bridge_get_hw_address (device));
		break;
	case PROP_CARRIER:
		g_value_set_boolean (value, nm_device_bridge_get_carrier (device));
		break;
	case PROP_SLAVES:
		g_value_take_boxed (value, _nm_utils_copy_object_array (nm_device_bridge_get_slaves (device)));
		break;
	default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
		break;
	}
}
示例#25
0
static gboolean 
font_description_value_parse (GtkCssParser *parser,
                              GValue       *value)
{
  PangoFontDescription *font_desc;
  guint mask;
  char *str;

  str = _gtk_css_parser_read_value (parser);
  if (str == NULL)
    return FALSE;

  font_desc = pango_font_description_from_string (str);
  mask = pango_font_description_get_set_fields (font_desc);
  /* These values are not really correct,
   * but the fields must be set, so we set them to something */
  if ((mask & PANGO_FONT_MASK_FAMILY) == 0)
    pango_font_description_set_family_static (font_desc, "Sans");
  if ((mask & PANGO_FONT_MASK_SIZE) == 0)
    pango_font_description_set_size (font_desc, 10 * PANGO_SCALE);
  g_free (str);
  g_value_take_boxed (value, font_desc);
  return TRUE;
}
示例#26
0
static gboolean 
animation_description_value_parse (GtkCssParser *parser,
                                   GFile        *base,
                                   GValue       *value)
{
  GtkAnimationDescription *desc;
  char *str;

  str = _gtk_css_parser_read_value (parser);
  if (str == NULL)
    return FALSE;

  desc = _gtk_animation_description_from_string (str);
  g_free (str);

  if (desc == NULL)
    {
      _gtk_css_parser_error (parser, "Invalid animation description");
      return FALSE;
    }
  
  g_value_take_boxed (value, desc);
  return TRUE;
}
static void
gst_device_get_property (GObject * object, guint prop_id,
    GValue * value, GParamSpec * pspec)
{
  GstDevice *gstdevice;

  gstdevice = GST_DEVICE_CAST (object);

  switch (prop_id) {
    case PROP_DISPLAY_NAME:
      g_value_take_string (value, gst_device_get_display_name (gstdevice));
      break;
    case PROP_CAPS:
      if (gstdevice->priv->caps)
        g_value_take_boxed (value, gst_device_get_caps (gstdevice));
      break;
    case PROP_DEVICE_CLASS:
      g_value_take_string (value, gst_device_get_device_class (gstdevice));
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
  }
}
示例#28
0
static DonnaTaskState
closer (DonnaTask       *task,
        gint             rc,
        DonnaTaskState   state,
        struct data     *data)
{
    if (state != DONNA_TASK_DONE)
        return state;
    else if (data->has_error)
    {
        donna_task_set_error (task, DONNA_TASK_PROCESS_ERROR,
                DONNA_TASK_PROCESS_ERROR_OTHER,
                "Answer to confirmation too long");
        return DONNA_TASK_FAILED;
    }
    else if (rc != 0)
    {
        donna_task_set_error (task, DONNA_TASK_PROCESS_ERROR,
                DONNA_TASK_PROCESS_ERROR_OTHER,
                "Process ended with return code %d",
                rc);
        return DONNA_TASK_FAILED;
    }
    else
    {
        GValue *value;

        value = donna_task_grab_return_value (task);
        g_value_init (value, G_TYPE_PTR_ARRAY);
        g_value_take_boxed (value, data->ret_nodes);
        donna_task_release_return_value (task);

        data->ret_nodes = NULL;
        return DONNA_TASK_DONE;
    }
}
static gboolean
same_clock_rate_fold (const GValue * item, GValue * ret, gpointer user_data)
{
  GstPad *mypad = user_data;
  GstPad *pad = g_value_get_object (item);
  GstCaps *peercaps;
  GstCaps *accumcaps;

  if (pad == mypad)
    return TRUE;

  accumcaps = g_value_get_boxed (ret);
  peercaps = gst_pad_peer_query_caps (pad, accumcaps);
  if (!peercaps) {
    g_warning ("no peercaps");
    return TRUE;
  }
  peercaps = gst_caps_make_writable (peercaps);
  clear_caps (peercaps, TRUE);

  g_value_take_boxed (ret, peercaps);

  return !gst_caps_is_empty (peercaps);
}
示例#30
0
/**
 * grl_related_keys_set_binary:
 * @relkeys: set of related keys to change
 * @key: (type GrlKeyID): key to change or add
 * @buf: buffer holding the relkeys
 * @size: size of the buffer
 *
 * Sets the value associated with @key into @relkeys. @key must have been
 * registered as a binary-type key. Old value is replaced by the new one.
 *
 * Since: 0.1.10
 **/
void
grl_related_keys_set_binary (GrlRelatedKeys *relkeys,
                             GrlKeyID key,
                             const guint8 *buf,
                             gsize size)
{
  GValue v = { 0 };
  GByteArray *array;

  g_return_if_fail (GRL_IS_RELATED_KEYS (relkeys));

  if (!buf || !size) {
    return;
  }

  array = g_byte_array_append (g_byte_array_sized_new(size),
                               buf,
                               size);

  g_value_init (&v, g_byte_array_get_type ());
  g_value_take_boxed (&v, array);
  grl_related_keys_set (relkeys, key, &v);
  g_value_unset (&v);
}