コード例 #1
0
GParamSpec*
g_param_spec_value_array (const gchar *name,
			  const gchar *nick,
			  const gchar *blurb,
			  GParamSpec  *element_spec,
			  GParamFlags  flags)
{
  GParamSpecValueArray *aspec;
  
  if (element_spec)
    g_return_val_if_fail (G_IS_PARAM_SPEC (element_spec), NULL);
  
  aspec = g_param_spec_internal (G_TYPE_PARAM_VALUE_ARRAY,
				 name,
				 nick,
				 blurb,
				 flags);
  if (element_spec)
    {
      aspec->element_spec = g_param_spec_ref (element_spec);
      g_param_spec_sink (element_spec);
    }

  return G_PARAM_SPEC (aspec);
}
コード例 #2
0
ファイル: bstskinconfig.c プロジェクト: whitelynx/beast
/* --- functions --- */
void
_bst_skin_config_init (void)
{
  BstSkinConfig *skin_config;
  GValue *value;
  SfiRec *rec;

  g_return_if_fail (global_skin_config == NULL);

  /* global config record description */
  pspec_skin_config = sfi_pspec_rec ("beast-skin-config-v1", NULL, NULL,
                                     bst_skin_config_fields, SFI_PARAM_STANDARD);
  g_param_spec_ref (pspec_skin_config);
  g_param_spec_sink (pspec_skin_config);
  /* create empty config record */
  rec = sfi_rec_new ();
  value = sfi_value_rec (rec);
  /* fill out missing values with defaults */
  g_param_value_validate (pspec_skin_config, value);
  /* install global config */
  skin_config = bst_skin_config_from_rec (rec);
  global_skin_config = skin_config;
  /* cleanup */
  sfi_value_free (value);
  sfi_rec_unref (rec);
}
コード例 #3
0
  static void
attach (GeglOperation *self)
{
  GeglOperation *operation = GEGL_OPERATION (self);
  GParamSpec    *pspec;

  pspec = g_param_spec_object ("output",
      "Output",
      "Output pad for generated image buffer.",
      GEGL_TYPE_BUFFER,
      G_PARAM_READABLE |
      GEGL_PARAM_PAD_OUTPUT);
  gegl_operation_create_pad (operation, pspec);
  g_param_spec_sink (pspec);

  pspec = g_param_spec_object ("input",
      "Input",
      "Input pad, for image buffer input.",
      GEGL_TYPE_BUFFER,
      G_PARAM_READWRITE |
      GEGL_PARAM_PAD_INPUT);
  gegl_operation_create_pad (operation, pspec);
  g_param_spec_sink (pspec);

  pspec = g_param_spec_object ("aux",
      "Aux",
      "Auxiliary image buffer input pad.",
      GEGL_TYPE_BUFFER,
      G_PARAM_READWRITE |
      GEGL_PARAM_PAD_INPUT);
  gegl_operation_create_pad (operation, pspec);
  g_param_spec_sink (pspec);

  pspec = g_param_spec_object ("aux2",
      "Aux2",
      "Second auxiliary image buffer input pad.",
      GEGL_TYPE_BUFFER,
      G_PARAM_READWRITE |
      GEGL_PARAM_PAD_INPUT);
  gegl_operation_create_pad (operation, pspec);
  g_param_spec_sink (pspec);
}
コード例 #4
0
void
rbgobj_param_spec_initialize(VALUE self, GParamSpec *pspec)
{
    pspec_holder* holder;
    Data_Get_Struct(self, pspec_holder, holder);

    pspec = g_param_spec_ref(pspec);
    g_param_spec_sink(pspec);

    holder->instance = pspec;
    holder->cinfo    = GTYPE2CINFO(G_PARAM_SPEC_TYPE(pspec));
    g_param_spec_set_qdata(pspec, qparamspec, (gpointer)self);
}
コード例 #5
0
ファイル: gimpprocedure.c プロジェクト: WilfR/Gimp-Matting
void
gimp_procedure_add_return_value (GimpProcedure *procedure,
                                 GParamSpec    *pspec)
{
  g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
  g_return_if_fail (G_IS_PARAM_SPEC (pspec));

  procedure->values = g_renew (GParamSpec *, procedure->values,
                               procedure->num_values + 1);

  procedure->values[procedure->num_values] = pspec;

  g_param_spec_ref (pspec);
  g_param_spec_sink (pspec);

  procedure->num_values++;
}
コード例 #6
0
/**
 * gst_param_spec_fraction:
 * @name: canonical name of the property specified
 * @nick: nick name for the property specified
 * @blurb: description of the property specified
 * @min_num: minimum value (fraction numerator)
 * @min_denom: minimum value (fraction denominator)
 * @max_num: maximum value (fraction numerator)
 * @max_denom: maximum value (fraction denominator)
 * @default_num: default value (fraction numerator)
 * @default_denom: default value (fraction denominator)
 * @flags: flags for the property specified
 *
 * This function creates a fraction GParamSpec for use by objects/elements
 * that want to expose properties of fraction type. This function is typically
 * used in connection with g_object_class_install_property() in a GObjects's
 * instance_init function.
 *
 * Returns: a newly created parameter specification
 *
 * Since: 0.10.14
 */
GParamSpec *
gst_param_spec_fraction (const gchar * name, const gchar * nick,
    const gchar * blurb, gint min_num, gint min_denom, gint max_num,
    gint max_denom, gint default_num, gint default_denom, GParamFlags flags)
{
  GstParamSpecFraction *fspec;
  GParamSpec *pspec;
  GValue default_val = { 0, };

  fspec =
      g_param_spec_internal (GST_TYPE_PARAM_FRACTION, name, nick, blurb, flags);

  fspec->min_num = min_num;
  fspec->min_den = min_denom;
  fspec->max_num = max_num;
  fspec->max_den = max_denom;
  fspec->def_num = default_num;
  fspec->def_den = default_denom;

  pspec = G_PARAM_SPEC (fspec);

  /* check that min <= default <= max */
  g_value_init (&default_val, GST_TYPE_FRACTION);
  gst_value_set_fraction (&default_val, default_num, default_denom);
  /* validate returns TRUE if the validation fails */
  if (_gst_param_fraction_validate (pspec, &default_val)) {
    g_critical ("GstParamSpec of type 'fraction' for property '%s' has a "
        "default value of %d/%d, which is not within the allowed range of "
        "%d/%d to %d/%d", name, default_num, default_denom, min_num,
        min_denom, max_num, max_denom);
    g_param_spec_ref (pspec);
    g_param_spec_sink (pspec);
    g_param_spec_unref (pspec);
    pspec = NULL;
  }
  g_value_unset (&default_val);

  return pspec;
}
コード例 #7
0
/**
 * gst_vaapi_param_spec_id:
 * @name: canonical name of the property specified
 * @nick: nick name for the property specified
 * @blurb: description of the property specified
 * @default_value: default value
 * @flags: flags for the property specified
 *
 * This function creates an ID GParamSpec for use by #GstVaapiObject
 * objects. This function is typically used in connection with
 * g_object_class_install_property() in a GObjects's instance_init
 * function.
 *
 * Return value: a newly created parameter specification
 */
GParamSpec *
gst_vaapi_param_spec_id(
    const gchar *name,
    const gchar *nick,
    const gchar *blurb,
    GstVaapiID   default_value,
    GParamFlags  flags
)
{
    GstVaapiParamSpecID *ispec;
    GParamSpec *pspec;
    GValue value = { 0, };

    ispec = g_param_spec_internal(
        GST_VAAPI_TYPE_PARAM_ID,
        name,
        nick,
        blurb,
        flags
    );
    if (!ispec)
        return NULL;

    ispec->default_value = default_value;
    pspec = G_PARAM_SPEC(ispec);

    /* Validate default value */
    g_value_init(&value, GST_VAAPI_TYPE_ID);
    gst_vaapi_value_set_id(&value, default_value);
    if (gst_vaapi_param_id_validate(pspec, &value)) {
        g_param_spec_ref(pspec);
        g_param_spec_sink(pspec);
        g_param_spec_unref(pspec);
        pspec = NULL;
    }
    g_value_unset(&value);

    return pspec;
}
コード例 #8
0
/**
 * goo_canvas_item_model_class_install_child_property:
 * @mclass: a #GObjectClass
 * @property_id: the id for the property
 * @pspec: the #GParamSpec for the property
 * 
 * This function is only intended to be used when implementing new canvas
 * item models, specifically layout container item models such as
 * #GooCanvasTableModel.
 *
 * It installs a child property on a canvas item class. 
 **/
void
goo_canvas_item_model_class_install_child_property (GObjectClass *mclass,
						    guint         property_id,
						    GParamSpec   *pspec)
{
  g_return_if_fail (G_IS_OBJECT_CLASS (mclass));
  g_return_if_fail (G_IS_PARAM_SPEC (pspec));
  g_return_if_fail (property_id > 0);

  if (g_param_spec_pool_lookup (_goo_canvas_item_model_child_property_pool,
				pspec->name, G_OBJECT_CLASS_TYPE (mclass),
				FALSE))
    {
      g_warning (G_STRLOC ": class `%s' already contains a child property named `%s'",
		 G_OBJECT_CLASS_NAME (mclass), pspec->name);
      return;
    }
  g_param_spec_ref (pspec);
  g_param_spec_sink (pspec);
  pspec->param_id = property_id;
  g_param_spec_pool_insert (_goo_canvas_item_model_child_property_pool, pspec,
			    G_OBJECT_CLASS_TYPE (mclass));
}
コード例 #9
0
ファイル: bstmsgabsorb.c プロジェクト: whitelynx/beast
/* --- functions --- */
void
_bst_msg_absorb_config_init (void)
{
  g_return_if_fail (global_msg_absorb_config == NULL);

  /* global config record description */
  pspec_msg_absorb_config = sfi_pspec_seq ("beast-msg-absorb-config-v1", NULL, NULL,
                                           sfi_pspec_rec ("mstring", NULL, NULL, bst_msg_absorb_string_fields, SFI_PARAM_STANDARD),
                                           SFI_PARAM_STANDARD);
  g_param_spec_ref (pspec_msg_absorb_config);
  g_param_spec_sink (pspec_msg_absorb_config);
  /* create empty config record */
  SfiSeq *seq = sfi_seq_new ();
  GValue *value = sfi_value_seq (seq);
  /* fill out missing values with defaults */
  g_param_value_validate (pspec_msg_absorb_config, value);
  /* install global config */
  BstMsgAbsorbStringSeq *mconfig = bst_msg_absorb_string_seq_from_seq (seq);
  global_msg_absorb_config = mconfig;
  /* cleanup */
  sfi_value_free (value);
  sfi_seq_unref (seq);
}