• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ G_PARAM_SPEC_VALUE_TYPE函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中G_PARAM_SPEC_VALUE_TYPE函数的典型用法代码示例。如果您正苦于以下问题:C++ G_PARAM_SPEC_VALUE_TYPE函数的具体用法?C++ G_PARAM_SPEC_VALUE_TYPE怎么用?C++ G_PARAM_SPEC_VALUE_TYPE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了G_PARAM_SPEC_VALUE_TYPE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GOM_ASTRING_TO_GSTRING_RETURN

/* void setAttribute (in nsIAtom name, in AString newValue); */
NS_IMETHODIMP
xgGtkElement::SetAttribute (nsIAtom *name, const nsAString &newValue)
{
    GOM_ASTRING_TO_GSTRING_RETURN (value, newValue, NS_ERROR_INVALID_ARG);

    GParamSpec *spec;
    guint signal_id;
    if (!Resolve (name, &spec, &signal_id)) {
	return NS_ERROR_FAILURE;
    }
    if (!spec) {
	return NS_ERROR_FAILURE;
    }

    GError *error = NULL;
    GValue gval = { 0 };
    if (G_TYPE_FUNDAMENTAL (G_PARAM_SPEC_VALUE_TYPE (spec)) == G_TYPE_OBJECT) {
	g_warning (GOM_LOC ("Attribute %s.%s is a %s, which a string cannot be converted to"),
		   G_OBJECT_TYPE_NAME (mObject), spec->name,
		   g_type_name (G_PARAM_SPEC_VALUE_TYPE (spec)));
	return NS_ERROR_FAILURE;
    } else if (gtk_builder_value_from_string (NULL, spec, value, &gval, &error)) {
	g_object_set_property (mObject, spec->name, &gval);
	g_value_unset (&gval);
    } else {
	g_warning (GOM_LOC ("Could not get value from string: '%s'"), value);
	return NS_ERROR_FAILURE;
    }
    return NS_OK;
}
开发者ID:jberkman,项目名称:gom,代码行数:31,代码来源:xgGtkElement.cpp


示例2: e_bind_properties_transfer

static void
e_bind_properties_transfer (GObject *src_object,
                            GParamSpec *src_pspec,
                            GObject *dst_object,
                            GParamSpec *dst_pspec,
                            GlideBindingTransform  transform,
                            gpointer user_data)
{
	const gchar *src_name;
	const gchar *dst_name;
	gboolean result;
	GValue src_value = { 0, };
	GValue dst_value = { 0, };

	src_name = g_param_spec_get_name (src_pspec);
	dst_name = g_param_spec_get_name (dst_pspec);

	g_value_init (&src_value, G_PARAM_SPEC_VALUE_TYPE (src_pspec));
	g_object_get_property (src_object, src_name, &src_value);

	g_value_init (&dst_value, G_PARAM_SPEC_VALUE_TYPE (dst_pspec));
	result = (*transform) (&src_value, &dst_value, user_data);

	g_value_unset (&src_value);

	g_return_if_fail (result);

	g_param_value_validate (dst_pspec, &dst_value);
	g_object_set_property (dst_object, dst_name, &dst_value);
	g_value_unset (&dst_value);
}
开发者ID:GNOME,项目名称:glide,代码行数:31,代码来源:glide-binding.c


示例3: rg_set_child_property

static VALUE
rg_set_child_property(VALUE self, VALUE child,
                                      VALUE prop_name, VALUE val)
{
    GParamSpec* pspec;
    const char* name;

    if (SYMBOL_P(prop_name)) {
        name = rb_id2name(SYM2ID(prop_name));
    } else {
        StringValue(prop_name);
        name = StringValuePtr(prop_name);
    }
    pspec = goo_canvas_item_class_find_child_property(G_OBJECT_GET_CLASS(RVAL2GOBJ(self)), name);

    if (!pspec)
        rb_raise(rb_eRuntimeError, "No such child property: %s", name);

#define _SET_PROP_FOR_TYPE(gtype, ctype, val) \
    case gtype: \
        goo_canvas_item_set_child_properties(SELF(self), SELF(child), name, (ctype)(val), NULL); \
        break;

    switch (G_TYPE_FUNDAMENTAL(G_PARAM_SPEC_VALUE_TYPE(pspec))) {
        _SET_PROP_FOR_TYPE(G_TYPE_CHAR, gchar, NUM2INT(val));
        _SET_PROP_FOR_TYPE(G_TYPE_UCHAR, guchar, NUM2INT(val));
        _SET_PROP_FOR_TYPE(G_TYPE_BOOLEAN, gboolean, RTEST(val));
        _SET_PROP_FOR_TYPE(G_TYPE_INT, gint, NUM2INT(val));
        _SET_PROP_FOR_TYPE(G_TYPE_UINT, guint, NUM2UINT(val));
        _SET_PROP_FOR_TYPE(G_TYPE_LONG, glong, NUM2LONG(val));
        _SET_PROP_FOR_TYPE(G_TYPE_ULONG, gulong, NUM2ULONG(val));
        _SET_PROP_FOR_TYPE(G_TYPE_INT64, gint64, rbglib_num_to_int64(val));
        _SET_PROP_FOR_TYPE(G_TYPE_UINT64, guint64, rbglib_num_to_uint64(val));
        _SET_PROP_FOR_TYPE(G_TYPE_ENUM, gint, rbgobj_get_enum(val, G_PARAM_SPEC_VALUE_TYPE(pspec)));
        _SET_PROP_FOR_TYPE(G_TYPE_FLAGS, guint, rbgobj_get_flags(val, G_PARAM_SPEC_VALUE_TYPE(pspec)));
        _SET_PROP_FOR_TYPE(G_TYPE_FLOAT, gfloat, NUM2DBL(val));
        _SET_PROP_FOR_TYPE(G_TYPE_DOUBLE, gdouble, NUM2DBL(val));
      case G_TYPE_STRING:
        {
            if (SYMBOL_P(val))
                val = rb_funcall(val, rb_intern("to_s"), 0);
            goo_canvas_item_set_child_properties(SELF(self), SELF(child), name, StringValuePtr(val), NULL);
            break;
        }

      default:
        g_warning("rb_goo_canvas_item_set_child_property: unsupported type: %s\n", g_type_name(G_PARAM_SPEC_VALUE_TYPE(pspec)));
        return Qnil;
    }

#undef _SET_PROP_FOR_TYPE

    G_CHILD_ADD(child, val);

    return self;
}
开发者ID:msakai,项目名称:ruby-gnome2,代码行数:56,代码来源:rbgoocanvasitem.c


示例4: set_sysfs_uint

static void
set_sysfs_uint (const char *iface,
                GObject *obj,
                const char *obj_prop,
                const char *dir,
                const char *sysfs_prop,
                gboolean default_if_zero,
                gboolean user_hz_compensate)
{
	char *path, *s;
	GParamSpec *pspec;
	GValue val = { 0 };
	guint32 uval = 0;

	pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (obj), obj_prop);
	g_return_if_fail (pspec != NULL);

	/* Get the property's value */
	g_value_init (&val, G_PARAM_SPEC_VALUE_TYPE (pspec));
	g_object_get_property (obj, obj_prop, &val);
	if (G_VALUE_HOLDS_BOOLEAN (&val))
		uval = g_value_get_boolean (&val) ? 1 : 0;
	else if (G_VALUE_HOLDS_UINT (&val)) {
		uval = g_value_get_uint (&val);

		/* zero means "unspecified" for some NM properties but isn't in the
		 * allowed kernel range, so reset the property to the default value.
		 */
		if (default_if_zero && uval == 0) {
			g_value_unset (&val);
			g_value_init (&val, G_PARAM_SPEC_VALUE_TYPE (pspec));
			g_param_value_set_default (pspec, &val);
			uval = g_value_get_uint (&val);
		}
	} else
		g_assert_not_reached ();

	g_value_unset (&val);

	/* Linux kernel bridge interfaces use 'centiseconds' for time-based values.
	 * In reality it's not centiseconds, but depends on HZ and USER_HZ, which
	 * is almost always works out to be a multiplier of 100, so we can assume
	 * centiseconds.  See clock_t_to_jiffies().
	 */
	if (user_hz_compensate)
		uval *= 100;

	path = g_strdup_printf ("/sys/class/net/%s/%s/%s", iface, dir, sysfs_prop);
	s = g_strdup_printf ("%u", uval);
	/* FIXME: how should failure be handled? */
	nm_utils_do_sysctl (path, s);
	g_free (path);
	g_free (s);
}
开发者ID:T100012,项目名称:NetworkManager,代码行数:54,代码来源:nm-device-bridge.c


示例5: tidy_stylable_set_property_internal

static inline void
tidy_stylable_set_property_internal (TidyStylable       *stylable,
                                     GParamSpec         *pspec,
                                     const GValue       *value,
                                     GObjectNotifyQueue *nqueue)
{
  GValue tmp_value = { 0, };

  g_value_init (&tmp_value, G_PARAM_SPEC_VALUE_TYPE (pspec));

  if (!g_value_transform (value, &tmp_value))
    g_warning ("unable to set property `%s' of type `%s' from value of type `%s'",
               pspec->name,
               g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)),
               G_VALUE_TYPE_NAME (value));
  else if (g_param_value_validate (pspec, &tmp_value) &&
           !(pspec->flags & G_PARAM_LAX_VALIDATION))
    {
      gchar *contents = g_strdup_value_contents (value);

      g_warning ("value \"%s\" of type `%s' is invalid or out of range for property `%s' of type `%s'",
                 contents,
                 G_VALUE_TYPE_NAME (value),
                 pspec->name,
                 g_type_name (G_PARAM_SPEC_VALUE_TYPE (pspec)));
      g_free (contents);
    }
  else
    {
      TidyStyle *style = tidy_stylable_get_style (stylable);
      gchar *real_name;

      real_name = g_strconcat (g_param_spec_get_qdata (pspec, quark_real_owner),
                               "::",
                               pspec->name,
                               NULL);

      if (!tidy_style_has_property (style, real_name))
        tidy_style_add_property (style, real_name,
                                 G_PARAM_SPEC_VALUE_TYPE (pspec));

      tidy_style_set_property (style, real_name, &tmp_value);
      g_object_notify_queue_add (G_OBJECT (stylable), nqueue, pspec);

      g_free (real_name);
    }

  g_value_unset (&tmp_value);
}
开发者ID:ak2consulting,项目名称:tweet,代码行数:49,代码来源:tidy-stylable.c


示例6: gitg_data_binding_create

static GitgDataBinding *
gitg_data_binding_create(gpointer source, gchar const *source_property, 
						 gpointer dest, gchar const *dest_property, 
						 GitgDataBindingConversion source_to_dest,
						 GitgDataBindingConversion dest_to_source,
						 gpointer userdata,
						 GitgDataBindingFlags flags)
{
	g_return_val_if_fail(G_IS_OBJECT(source), NULL);
	g_return_val_if_fail(G_IS_OBJECT(dest), NULL);

	GObjectClass *sclass = G_OBJECT_GET_CLASS(source);
	GObjectClass *dclass = G_OBJECT_GET_CLASS(dest);

	GParamSpec *sspec = g_object_class_find_property(sclass, source_property);

	if (!sspec)
	{
		g_warning("No such source property found: %s", source_property);
		return NULL;
	}

	GParamSpec *dspec = g_object_class_find_property(dclass, dest_property);

	if (!dspec)
	{
		g_warning("No such dest property found: %s", dest_property);
		return NULL;
	}

	GitgDataBinding *binding = g_slice_new0(GitgDataBinding);

	binding->flags = flags;

	binding_fill(&binding->source, source, source_property, G_PARAM_SPEC_VALUE_TYPE(sspec), source_to_dest, userdata);
	binding_fill(&binding->dest, dest, dest_property, G_PARAM_SPEC_VALUE_TYPE(dspec), dest_to_source, userdata);

	binding_connect(binding, &binding->source);

	if (flags & GITG_DATA_BINDING_MUTUAL)
		binding_connect(binding, &binding->dest);

	g_object_weak_ref(binding->source.object, (GWeakNotify)on_data_binding_destroy, binding);
	g_object_weak_ref(binding->dest.object, (GWeakNotify)on_data_binding_destroy, binding);

	/* initial value */
	on_data_binding_changed(binding->source.object, NULL, binding);
	return binding;
}
开发者ID:epronk,项目名称:gitg,代码行数:49,代码来源:gitg-data-binding.c


示例7: commit_option

static void
commit_option (NMDevice *device, NMSetting *setting, const Option *option, gboolean slave)
{
	int ifindex = nm_device_get_ifindex (device);
	GParamSpec *pspec;
	GValue val = G_VALUE_INIT;
	guint32 uval = 0;
	gs_free char *value = NULL;

	g_assert (setting);

	pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), option->name);
	g_assert (pspec);

	/* Get the property's value */
	g_value_init (&val, G_PARAM_SPEC_VALUE_TYPE (pspec));
	g_object_get_property ((GObject *) setting, option->name, &val);
	if (G_VALUE_HOLDS_BOOLEAN (&val))
		uval = g_value_get_boolean (&val) ? 1 : 0;
	else if (G_VALUE_HOLDS_UINT (&val)) {
		uval = g_value_get_uint (&val);

		/* zero means "unspecified" for some NM properties but isn't in the
		 * allowed kernel range, so reset the property to the default value.
		 */
		if (option->default_if_zero && uval == 0) {
			g_value_unset (&val);
			g_value_init (&val, G_PARAM_SPEC_VALUE_TYPE (pspec));
			g_param_value_set_default (pspec, &val);
			uval = g_value_get_uint (&val);
		}

		/* Linux kernel bridge interfaces use 'centiseconds' for time-based values.
		 * In reality it's not centiseconds, but depends on HZ and USER_HZ, which
		 * is almost always works out to be a multiplier of 100, so we can assume
		 * centiseconds.  See clock_t_to_jiffies().
		 */
		if (option->user_hz_compensate)
			uval *= 100;
	} else
		g_assert_not_reached ();
	g_value_unset (&val);

	value = g_strdup_printf ("%u", uval);
	if (slave)
		nm_platform_slave_set_option (ifindex, option->sysname, value);
	else
		nm_platform_master_set_option (ifindex, option->sysname, value);
}
开发者ID:heftig,项目名称:NetworkManager,代码行数:49,代码来源:nm-device-bridge.c


示例8: create_payloader_for_caps

static GstElement *
create_payloader_for_caps (const GstCaps * caps)
{
  GList *payloader_list, *filtered_list, *l;
  GstElementFactory *payloader_factory = NULL;
  GstElement *payloader = NULL;

  payloader_list =
      gst_element_factory_list_get_elements (GST_ELEMENT_FACTORY_TYPE_PAYLOADER,
      GST_RANK_NONE);
  filtered_list =
      gst_element_factory_list_filter (payloader_list, caps, GST_PAD_SRC,
      FALSE);

  for (l = filtered_list; l != NULL && payloader_factory == NULL; l = l->next) {
    payloader_factory = GST_ELEMENT_FACTORY (l->data);
    if (gst_element_factory_get_num_pad_templates (payloader_factory) != 2)
      payloader_factory = NULL;
  }

  if (payloader_factory != NULL) {
    payloader = gst_element_factory_create (payloader_factory, NULL);
  }

  if (payloader) {
    GParamSpec *pspec;

    pspec =
        g_object_class_find_property (G_OBJECT_GET_CLASS (payloader),
        "config-interval");
    if (pspec != NULL && G_PARAM_SPEC_VALUE_TYPE (pspec) == G_TYPE_UINT) {
      g_object_set (payloader, "config-interval", 1, NULL);
    }

    pspec =
        g_object_class_find_property (G_OBJECT_GET_CLASS (payloader),
        "picture-id-mode");
    if (pspec != NULL && G_TYPE_IS_ENUM (G_PARAM_SPEC_VALUE_TYPE (pspec))) {
      /* Set picture id so that remote peer can determine continuity if */
      /* there are lost FEC packets and if it has to NACK them */
      g_object_set (payloader, "picture-id-mode", PICTURE_ID_15_BIT, NULL);
    }
  }

  gst_plugin_feature_list_free (filtered_list);
  gst_plugin_feature_list_free (payloader_list);

  return payloader;
}
开发者ID:DavidYangfei,项目名称:kms-core,代码行数:49,代码来源:kmsrtppaytreebin.c


示例9: _params_setup

static VALUE
_params_setup(VALUE arg, struct param_setup_arg *param_setup_arg)
{
    guint index;
    VALUE name, val;
    GParamSpec* pspec;

    index = param_setup_arg->index;
    if (index >= param_setup_arg->param_size)
       rb_raise(rb_eArgError, "too many parameters");

    name = rb_ary_entry(arg, 0);
    val  = rb_ary_entry(arg, 1);

    if (SYMBOL_P(name))
        param_setup_arg->params[index].name = rb_id2name(SYM2ID(name));
    else
        param_setup_arg->params[index].name = StringValuePtr(name);

    pspec = g_object_class_find_property(
        param_setup_arg->gclass,
        param_setup_arg->params[index].name);
    if (!pspec)
        rb_raise(rb_eArgError, "No such property: %s",
                 param_setup_arg->params[index].name);

    g_value_init(&(param_setup_arg->params[index].value),
                 G_PARAM_SPEC_VALUE_TYPE(pspec));
    rbgobj_rvalue_to_gvalue(val, &(param_setup_arg->params[index].value));

    param_setup_arg->index++;

    return Qnil;
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:34,代码来源:rbgobj_object.c


示例10: vo_get_optional_arg

/* Looking for construct-time optional output args. Append them to out.
 */
static void *
vo_get_optional_arg( const char *name, PElement *value, Vo *vo, PElement *out )
{
	GParamSpec *pspec;
	VipsArgumentClass *argument_class;
	VipsArgumentInstance *argument_instance;

	if( vips_object_get_argument( vo->object, name,
		&pspec, &argument_class, &argument_instance ) )
		return( NULL );

	if( !(argument_class->flags & VIPS_ARGUMENT_REQUIRED) &&
		(argument_class->flags & VIPS_ARGUMENT_OUTPUT) &&
		argument_instance->assigned ) {
		GType type = G_PARAM_SPEC_VALUE_TYPE( pspec );
		GValue gvalue = { 0 };
		PElement lhs;

		if( !heap_list_add( vo->rc->heap, out, &lhs ) )
			return( value );
		g_value_init( &gvalue, type );
		g_object_get_property( G_OBJECT( vo->object ), name, &gvalue );
		if( !heap_gvalue_to_ip( &gvalue, &lhs ) ) {
			g_value_unset( &gvalue );
			return( value );
		}
		g_value_unset( &gvalue );

		(void) heap_list_next( out );
	}

	return( NULL );
}
开发者ID:jcupitt,项目名称:nip2,代码行数:35,代码来源:vipsobject.c


示例11: vo_get_required_output

/* Looking for required output args ... append to out.
 */
static void *
vo_get_required_output( VipsObject *object, GParamSpec *pspec,
        VipsArgumentClass *argument_class, 
	VipsArgumentInstance *argument_instance, Vo *vo, PElement *out )
{
	if( (argument_class->flags & VIPS_ARGUMENT_REQUIRED) &&
		(argument_class->flags & VIPS_ARGUMENT_OUTPUT) &&
		argument_instance->assigned ) {
		const char *name = g_param_spec_get_name( pspec );
		GType type = G_PARAM_SPEC_VALUE_TYPE( pspec );
		PElement lhs;

		GValue value = { 0 };

		if( !heap_list_add( vo->rc->heap, out, &lhs ) )
			return( object );
		g_value_init( &value, type );
		g_object_get_property( G_OBJECT( object ), name, &value );
		if( !heap_gvalue_to_ip( &value, &lhs ) ) {
			g_value_unset( &value );
			return( object );
		}
		g_value_unset( &value );

		(void) heap_list_next( out );
	}

	return( NULL );
}
开发者ID:jcupitt,项目名称:nip2,代码行数:31,代码来源:vipsobject.c


示例12: rg_style_get_property

static VALUE
rg_style_get_property(VALUE self, VALUE prop_name)
{
    GParamSpec* pspec = NULL;
    const char* name;

    if (SYMBOL_P(prop_name)) {
        name = rb_id2name(SYM2ID(prop_name));
    } else {
        name = RVAL2CSTR(prop_name);
    }
    pspec = gtk_widget_class_find_style_property((GtkWidgetClass*)g_type_class_ref(RVAL2GTYPE(self)), name);

    if (!pspec)
        rb_raise(rb_eval_string("GLib::NoPropertyError"), "No such property: %s", name);
    else {
        // FIXME: use rb_ensure to call g_value_unset()
        GValue gval = G_VALUE_INIT;
        VALUE ret;
        g_value_init(&gval, G_PARAM_SPEC_VALUE_TYPE(pspec));
        gtk_widget_style_get_property(GTK_WIDGET(RVAL2GOBJ(self)), name, &gval);
        ret = GVAL2RVAL(&gval);
        g_value_unset(&gval);
        return ret;
    }
}
开发者ID:adamhooper,项目名称:ruby-gnome2,代码行数:26,代码来源:rbgtkwidget.c


示例13: gst_controlled_property_new

/*
 * gst_controlled_property_new:
 * @object: for which object the controlled property should be set up
 * @name: the name of the property to be controlled
 *
 * Private method which initializes the fields of a new controlled property
 * structure.
 *
 * Returns: a freshly allocated structure or %NULL
 */
static GstControlledProperty *
gst_controlled_property_new (GObject * object, const gchar * name)
{
  GstControlledProperty *prop = NULL;
  GParamSpec *pspec;

  GST_INFO ("trying to put property '%s' under control", name);

  /* check if the object has a property of that name */
  if ((pspec =
          g_object_class_find_property (G_OBJECT_GET_CLASS (object), name))) {
    GST_DEBUG ("  psec->flags : 0x%08x", pspec->flags);

    /* check if this param is witable && controlable && !construct-only */
    g_return_val_if_fail ((pspec->flags & (G_PARAM_WRITABLE |
                GST_PARAM_CONTROLLABLE | G_PARAM_CONSTRUCT_ONLY)) ==
        (G_PARAM_WRITABLE | GST_PARAM_CONTROLLABLE), NULL);

    if ((prop = g_slice_new (GstControlledProperty))) {
      prop->pspec = pspec;
      prop->name = pspec->name;
      prop->csource = NULL;
      prop->disabled = FALSE;
      memset (&prop->last_value, 0, sizeof (GValue));
      g_value_init (&prop->last_value, G_PARAM_SPEC_VALUE_TYPE (prop->pspec));
    }
  } else {
    GST_WARNING ("class '%s' has no property '%s'", G_OBJECT_TYPE_NAME (object),
        name);
  }
  return prop;
}
开发者ID:zsx,项目名称:ossbuild,代码行数:42,代码来源:gstcontroller.c


示例14: tidy_stylable_set_valist

static void
tidy_stylable_set_valist (TidyStylable *stylable,
                          const gchar  *first_property_name,
                          va_list       varargs)
{
  GObjectNotifyQueue *nqueue;
  const gchar *name;

  g_object_ref (stylable);

  nqueue = g_object_notify_queue_freeze (G_OBJECT (stylable),
                                         &property_notify_context);

  name = first_property_name;

  while (name)
    {
      GParamSpec *pspec;
      GValue value = { 0, };
      gchar *error;

      pspec = tidy_stylable_find_property (stylable, name);
      if (!pspec)
        {
          g_warning ("%s: no style property named `%s' found for class `%s'",
                     G_STRLOC,
                     name,
                     g_type_name (G_OBJECT_TYPE (stylable)));
          break;
        }

      if (!(pspec->flags & G_PARAM_WRITABLE) ||
          (pspec->flags & G_PARAM_CONSTRUCT_ONLY))
        {
          g_warning ("Style property `%s' of class `%s' is not writable",
                     pspec->name,
                     g_type_name (G_OBJECT_TYPE (stylable)));
          break;
        }

      g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));

      G_VALUE_COLLECT (&value, varargs, 0, &error);
      if (error)
        {
          g_warning ("%s: %s", G_STRLOC, error);
          g_free (error);
          g_value_unset (&value);
          break;
        }

      tidy_stylable_set_property_internal (stylable, pspec, &value, nqueue);
      g_value_unset (&value);

      name = va_arg (varargs, gchar*);
    }

  g_object_notify_queue_thaw (G_OBJECT (stylable), nqueue);
  g_object_unref (stylable);
}
开发者ID:ak2consulting,项目名称:tweet,代码行数:60,代码来源:tidy-stylable.c


示例15: gobj_mark

static void
gobj_mark(gpointer ptr)
{
    GObject* gobj = ptr;
    guint n_properties;
    GParamSpec** properties;
    GValue gval = {0,};
    guint i;

    properties = g_object_class_list_properties(G_OBJECT_GET_CLASS(gobj), &n_properties);

    for (i = 0; i < n_properties; i++) {
        GParamSpec* pspec = properties[i];
        GType value_type = G_PARAM_SPEC_VALUE_TYPE(pspec);
        if (G_TYPE_FUNDAMENTAL(value_type) != G_TYPE_OBJECT) continue;
        if (!(pspec->flags & G_PARAM_READABLE)) continue;
        /* FIXME: exclude types that doesn't have identity. */

        {
            g_value_init(&gval, value_type);
            g_object_get_property(gobj, pspec->name, &gval);
            rbgobj_gc_mark_gvalue(&gval);
            g_value_unset(&gval);
        }
    }

    g_free(properties);
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:28,代码来源:rbgobj_object.c


示例16: rbgio_gasyncinitiable_new_async_parameters_initialize

static VALUE
rbgio_gasyncinitiable_new_async_parameters_initialize(VALUE key_value,
                                                      struct rbgio_gasyncinitable_new_async_data *data)
{
        VALUE key, value;
        GParamSpec *spec;

        if (data->index >= data->n_parameters)
                rb_raise(rb_eArgError,
                         "too many parameters (%d >= %d)",
                         data->index, data->n_parameters);

        key = rb_ary_entry(key_value, 0);
        value = rb_ary_entry(key_value, 1);

        data->parameters[data->index].name = SYMBOL_P(key) ?
                rb_id2name(SYM2ID(key)) :
                StringValuePtr(key);
        spec = g_object_class_find_property(data->gclass,
                                            data->parameters[data->index].name);
        if (spec == NULL)
                rb_raise(rb_eArgError,
                         "%s: no such property",
                         data->parameters[data->index].name);
        g_value_init(&(data->parameters[data->index].value),
                     G_PARAM_SPEC_VALUE_TYPE(spec));
        rbgobj_rvalue_to_gvalue(value, &(data->parameters[data->index].value));

        data->index++;

        return Qnil;
}
开发者ID:geoffyoungs,项目名称:ruby-gnome2,代码行数:32,代码来源:gasyncinitable.c


示例17: json_object

json_t *json_gobject_serialize (GObject *gobject)
{
    json_t *object = json_object();
    GParamSpec **pspecs;
    guint n_pspecs, i;

    pspecs = g_object_class_list_properties (G_OBJECT_GET_CLASS (gobject), &n_pspecs);

    for (i=0; i!=n_pspecs; ++i) {
        json_t *node;
        GParamSpec *pspec = pspecs[i];
        GValue value = { 0, };

        g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));
        g_object_get_property(gobject, pspec->name, &value);
        node=json_serialize_pspec (&value);

        if (node)
            json_object_set_new (object, pspec->name, node);

        g_value_unset (&value);
    }

    g_free (pspecs);

    return object;

}
开发者ID:9thsector,项目名称:libsearpc,代码行数:28,代码来源:searpc-utils.c


示例18: gog_object_set_arg

void
gog_object_set_arg (char const *name, char const *val, GogObject *obj)
{
	GParamSpec *pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (obj), name);
	GType prop_type;
	GValue res = { 0 };
	gboolean success = TRUE;

	if (pspec == NULL) {
		g_warning ("unknown property `%s' for class `%s'",
			   name, G_OBJECT_TYPE_NAME (obj));
		return;
	}

	prop_type = G_PARAM_SPEC_VALUE_TYPE (pspec);
	if (val == NULL &&
	    G_TYPE_FUNDAMENTAL (prop_type) != G_TYPE_BOOLEAN) {
		g_warning ("could not convert NULL to type `%s' for property `%s'",
			   g_type_name (prop_type), pspec->name);
		return;
	}
	if (!gsf_xml_gvalue_from_str (&res, prop_type, val))
		success = FALSE;

	if (!success) {
		g_warning ("could not convert string to type `%s' for property `%s'",
			   g_type_name (prop_type), pspec->name);
	} else
		g_object_set_property (G_OBJECT (obj), name, &res);
	g_value_unset (&res);
}
开发者ID:GNOME,项目名称:goffice,代码行数:31,代码来源:gog-object-xml.c


示例19: vips_operation_class_usage_arg

static void *
vips_operation_class_usage_arg( VipsObjectClass *object_class, 
	GParamSpec *pspec, VipsArgumentClass *argument_class,
	VipsBuf *buf, VipsOperationClassUsage *usage )
{
	/* Only show construct args ... others are internal.
	 */
	if( usage->required == 
		((argument_class->flags & VIPS_ARGUMENT_REQUIRED) != 0) &&
		(argument_class->flags & VIPS_ARGUMENT_CONSTRUCT) &&
		!(argument_class->flags & VIPS_ARGUMENT_DEPRECATED) ) { 
		if( usage->message && usage->n == 0 ) 
			vips_buf_appendf( buf, "%s\n", usage->message );

		if( usage->oftype ) {
			vips_buf_appendf( buf, "   %-12s - %s, %s %s\n",
				g_param_spec_get_name( pspec ), 
				g_param_spec_get_blurb( pspec ), 
				(argument_class->flags & VIPS_ARGUMENT_INPUT) ?
					_( "input" ) : _( "output" ),
				g_type_name( 
					G_PARAM_SPEC_VALUE_TYPE( pspec ) ) );
		}
		else {
			if( usage->n > 0 )
				vips_buf_appends( buf, " " );
			vips_buf_appends( buf, g_param_spec_get_name( pspec ) );
		}

		usage->n += 1;
	}

	return( NULL );
}
开发者ID:binarytemple,项目名称:debian-vips,代码行数:34,代码来源:operation.c


示例20: gegl_operation_context_take_object

void
gegl_operation_context_take_object (GeglOperationContext *context,
                                    const gchar          *padname,
                                    GObject              *data)
{
  GParamSpec *pspec;

  /* FIXME: check that there isn't already an existing
   *        output object/value set?
   */

  pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (G_OBJECT (context->operation)), padname);

  if (pspec)
    {
      GValue value = {0, };
      g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec));

      g_value_take_object (&value, data);
      gegl_operation_context_set_property (context, padname, &value);

      g_value_unset (&value);
    }
  else
    {
      g_warning ("%s: No paramspec found for pad '%s' on \"%s\"\n",
                 G_STRFUNC,
                 padname,
                 gegl_operation_get_name (context->operation));
    }
}
开发者ID:joyoseller,项目名称:GEGL-OpenCL,代码行数:31,代码来源:gegl-operation-context.c



注:本文中的G_PARAM_SPEC_VALUE_TYPE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ G_PlayEffect函数代码示例发布时间:2022-05-30
下一篇:
C++ G_PARAM_SPEC函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap