/** * gst_meta_api_type_register: * @api: an API to register * @tags: tags for @api * * Register and return a GType for the @api and associate it with * @tags. * * Returns: a unique GType for @api. */ GType gst_meta_api_type_register (const gchar * api, const gchar ** tags) { GType type; g_return_val_if_fail (api != NULL, 0); g_return_val_if_fail (tags != NULL, 0); GST_CAT_DEBUG (GST_CAT_META, "register API \"%s\"", api); type = g_pointer_type_register_static (api); if (type != 0) { gint i; for (i = 0; tags[i]; i++) { GST_CAT_DEBUG (GST_CAT_META, " adding tag \"%s\"", tags[i]); g_type_set_qdata (type, g_quark_from_string (tags[i]), GINT_TO_POINTER (TRUE)); } } g_type_set_qdata (type, g_quark_from_string ("tags"), g_strdupv ((gchar **) tags)); return type; }
/* * preset_get_paths: * @preset: a #GObject that implements #GstPreset * @preset_user_path: location for path or %NULL * @preset_system_path: location for path or %NULL * * Fetch the preset_path for user local and system wide settings. Don't free * after use. * * Returns: %FALSE if no paths could be found. */ static gboolean preset_get_paths (GstPreset * preset, const gchar ** preset_user_path, const gchar ** preset_system_path) { GType type = G_TYPE_FROM_INSTANCE (preset); gchar *preset_path; const gchar *element_name; /* we use the element name when we must contruct the paths */ element_name = G_OBJECT_TYPE_NAME (preset); GST_INFO_OBJECT (preset, "element_name: '%s'", element_name); if (preset_user_path) { /* preset user path requested, see if we have it cached in the qdata */ if (!(preset_path = g_type_get_qdata (type, preset_user_path_quark))) { gchar *preset_dir; /* user presets go in '$HOME/.gstreamer-0.10/presets/GstSimSyn.prs' */ preset_dir = g_build_filename (g_get_home_dir (), ".gstreamer-" GST_MAJORMINOR, "presets", NULL); GST_INFO_OBJECT (preset, "user_preset_dir: '%s'", preset_dir); preset_path = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s.prs", preset_dir, element_name); GST_INFO_OBJECT (preset, "user_preset_path: '%s'", preset_path); /* create dirs */ g_mkdir_with_parents (preset_dir, 0755); g_free (preset_dir); /* cache the preset path to the type */ g_type_set_qdata (type, preset_user_path_quark, preset_path); } *preset_user_path = preset_path; } if (preset_system_path) { /* preset system path requested, see if we have it cached in the qdata */ if (!(preset_path = g_type_get_qdata (type, preset_system_path_quark))) { gchar *preset_dir; /* system presets in '$GST_DATADIR/gstreamer-0.10/presets/GstAudioPanorama.prs' */ preset_dir = g_build_filename (GST_DATADIR, "gstreamer-" GST_MAJORMINOR, "presets", NULL); GST_INFO_OBJECT (preset, "system_preset_dir: '%s'", preset_dir); preset_path = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "%s.prs", preset_dir, element_name); GST_INFO_OBJECT (preset, "system_preset_path: '%s'", preset_path); /* create dirs */ g_mkdir_with_parents (preset_dir, 0755); g_free (preset_dir); /* cache the preset path to the type */ g_type_set_qdata (type, preset_system_path_quark, preset_path); } *preset_system_path = preset_path; } return TRUE; }
GType steadyflow_iapp_service_get_type (void) { static volatile gsize steadyflow_iapp_service_type_id__volatile = 0; if (g_once_init_enter (&steadyflow_iapp_service_type_id__volatile)) { static const GTypeInfo g_define_type_info = { sizeof (SteadyflowIAppServiceIface), (GBaseInitFunc) steadyflow_iapp_service_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL }; GType steadyflow_iapp_service_type_id; steadyflow_iapp_service_type_id = g_type_register_static (G_TYPE_INTERFACE, "SteadyflowIAppService", &g_define_type_info, 0); g_type_interface_add_prerequisite (steadyflow_iapp_service_type_id, G_TYPE_OBJECT); g_type_set_qdata (steadyflow_iapp_service_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) steadyflow_iapp_service_proxy_get_type); g_type_set_qdata (steadyflow_iapp_service_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "net.launchpad.steadyflow.App"); g_type_set_qdata (steadyflow_iapp_service_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) steadyflow_iapp_service_register_object); g_once_init_leave (&steadyflow_iapp_service_type_id__volatile, steadyflow_iapp_service_type_id); } return steadyflow_iapp_service_type_id__volatile; }
JSObject * gjs_gtype_create_gtype_wrapper (JSContext *context, GType gtype) { JSObject *object; JSObject *global; JS_BeginRequest(context); /* put constructor for GIRepositoryGType() in the global namespace */ global = gjs_get_import_global(context); gjs_gtype_create_proto(context, global, "GIRepositoryGType", NULL); object = g_type_get_qdata(gtype, gjs_get_gtype_wrapper_quark()); if (object != NULL) goto out; object = JS_NewObject(context, &gjs_gtype_class, NULL, NULL); if (object == NULL) goto out; JS_SetPrivate(context, object, GSIZE_TO_POINTER(gtype)); g_type_set_qdata(gtype, gjs_get_gtype_wrapper_quark(), object); out: JS_EndRequest(context); return object; }
static void gst_vtenc_register (GstPlugin * plugin, const GstVTEncoderDetails * codec_details) { GTypeInfo type_info = { sizeof (GstVTEncClass), (GBaseInitFunc) gst_vtenc_base_init, NULL, (GClassInitFunc) gst_vtenc_class_init, NULL, NULL, sizeof (GstVTEncClass), 0, (GInstanceInitFunc) gst_vtenc_init, }; gchar *type_name; GType type; gboolean result; type_name = g_strdup_printf ("vtenc_%s", codec_details->element_name); type = g_type_register_static (GST_TYPE_ELEMENT, type_name, &type_info, 0); g_type_set_qdata (type, GST_VTENC_CODEC_DETAILS_QDATA, (gpointer) codec_details); result = gst_element_register (plugin, type_name, GST_RANK_NONE, type); if (!result) { GST_ERROR_OBJECT (plugin, "failed to register element %s", type_name); } g_free (type_name); }
gboolean gst_lv2_filter_register_element (GstPlugin * plugin, const gchar * type_name, gpointer * lv2plugin) { GType type; GTypeInfo typeinfo = { sizeof (GstLV2FilterClass), (GBaseInitFunc) gst_lv2_filter_base_init, NULL, (GClassInitFunc) gst_lv2_filter_class_init, NULL, lv2plugin, sizeof (GstLV2Filter), 0, (GInstanceInitFunc) gst_lv2_filter_init, }; /* create the type */ type = g_type_register_static (GST_TYPE_AUDIO_FILTER, type_name, &typeinfo, 0); if (!parent_class) parent_class = g_type_class_ref (GST_TYPE_AUDIO_FILTER); /* FIXME: not needed anymore when we can add pad templates, etc in class_init * as class_data contains the LADSPA_Descriptor too */ g_type_set_qdata (type, descriptor_quark, lv2plugin); return gst_element_register (plugin, type_name, GST_RANK_NONE, type); }
gboolean dshow_vdec_register (GstPlugin * plugin) { GTypeInfo info = { sizeof (GstDshowVideoDecClass), (GBaseInitFunc) gst_dshowvideodec_base_init, NULL, (GClassInitFunc) gst_dshowvideodec_class_init, NULL, NULL, sizeof (GstDshowVideoDec), 0, (GInstanceInitFunc) gst_dshowvideodec_init, }; gint i; HRESULT hr; GST_DEBUG_CATEGORY_INIT (dshowvideodec_debug, "dshowvideodec", 0, "Directshow filter video decoder"); hr = CoInitialize (0); for (i = 0; i < sizeof (video_dec_codecs) / sizeof (VideoCodecEntry); i++) { GType type; CComPtr<IBaseFilter> filter; guint rank = GST_RANK_MARGINAL; filter = gst_dshow_find_filter ( video_dec_codecs[i].input_majortype, video_dec_codecs[i].input_subtype, video_dec_codecs[i].output_majortype, video_dec_codecs[i].output_subtype, video_dec_codecs[i].preferred_filters); if (filter != NULL) { if (video_dec_codecs[i].format == GST_MAKE_FOURCC ('W', 'V', 'C', '1')) { /* FFMPEG WVC1 decoder sucks, get higher priority for ours */ rank = GST_RANK_MARGINAL + 2; } GST_DEBUG ("Registering %s with rank %u", video_dec_codecs[i].element_name, rank); type = g_type_register_static (GST_TYPE_ELEMENT, video_dec_codecs[i].element_name, &info, (GTypeFlags)0); g_type_set_qdata (type, DSHOW_CODEC_QDATA, (gpointer) (video_dec_codecs + i)); if (!gst_element_register (plugin, video_dec_codecs[i].element_name, rank, type)) { return FALSE; } GST_DEBUG ("Registered %s", video_dec_codecs[i].element_name); } else { GST_DEBUG ("Element %s not registered " "(the format is not supported by the system)", video_dec_codecs[i].element_name); } } if (SUCCEEDED(hr)) CoUninitialize (); return TRUE; }
/** * pyg_register_interface: * @dict: a module dictionary. * @class_name: the class name for the wrapper class. * @gtype: the GType of the interface. * @type: the wrapper class for the interface. * * Registers a Python class as the wrapper for a GInterface. As a * convenience it will also place a reference to the wrapper class in * the provided module dictionary. */ void pyg_register_interface(PyObject *dict, const gchar *class_name, GType gtype, PyTypeObject *type) { PyObject *o; Py_TYPE(type) = &PyType_Type; type->tp_base = &PyGInterface_Type; if (PyType_Ready(type) < 0) { g_warning("could not ready `%s'", type->tp_name); return; } if (gtype) { o = pyg_type_wrapper_new(gtype); PyDict_SetItemString(type->tp_dict, "__gtype__", o); Py_DECREF(o); } g_type_set_qdata(gtype, pyginterface_type_key, type); PyDict_SetItemString(dict, (char *)class_name, (PyObject *)type); }
void tp_properties_mixin_init (GObject *obj, glong offset) { TpPropertiesMixinClass *mixin_cls; TpPropertiesMixin *mixin; TpPropertiesContext *ctx; g_assert (G_IS_OBJECT (obj)); g_assert (TP_IS_SVC_PROPERTIES_INTERFACE (obj)); g_type_set_qdata (G_OBJECT_TYPE (obj), TP_PROPERTIES_MIXIN_OFFSET_QUARK, GINT_TO_POINTER (offset)); mixin = TP_PROPERTIES_MIXIN (obj); mixin_cls = TP_PROPERTIES_MIXIN_CLASS (G_OBJECT_GET_CLASS (obj)); mixin->properties = g_new0 (TpProperty, mixin_cls->num_props); mixin->priv = g_slice_new0 (TpPropertiesMixinPrivate); mixin->priv->object = obj; ctx = &mixin->priv->context; ctx->mixin_cls = mixin_cls; ctx->mixin = mixin; ctx->values = g_new0 (GValue *, mixin_cls->num_props); }
gboolean dshow_adec_register (GstPlugin * plugin) { GTypeInfo info = { sizeof (GstDshowAudioDecClass), (GBaseInitFunc) gst_dshowaudiodec_base_init, NULL, (GClassInitFunc) gst_dshowaudiodec_class_init, NULL, NULL, sizeof (GstDshowAudioDec), 0, (GInstanceInitFunc) gst_dshowaudiodec_init, }; gint i; HRESULT hr; GST_DEBUG_CATEGORY_INIT (dshowaudiodec_debug, "dshowaudiodec", 0, "Directshow filter audio decoder"); hr = CoInitialize(0); for (i = 0; i < sizeof (audio_dec_codecs) / sizeof (AudioCodecEntry); i++) { GType type; CComPtr<IBaseFilter> filter; GUID insubtype = GUID_MEDIASUBTYPE_FROM_FOURCC (audio_dec_codecs[i].format); GUID outsubtype = GUID_MEDIASUBTYPE_FROM_FOURCC (WAVE_FORMAT_PCM); filter = gst_dshow_find_filter (MEDIATYPE_Audio, insubtype, MEDIATYPE_Audio, outsubtype, audio_dec_codecs[i].preferred_filters); if (filter) { GST_DEBUG ("Registering %s", audio_dec_codecs[i].element_name); type = g_type_register_static (GST_TYPE_ELEMENT, audio_dec_codecs[i].element_name, &info, (GTypeFlags)0); g_type_set_qdata (type, DSHOW_CODEC_QDATA, (gpointer) (audio_dec_codecs + i)); if (!gst_element_register (plugin, audio_dec_codecs[i].element_name, GST_RANK_MARGINAL, type)) { return FALSE; } GST_CAT_DEBUG (dshowaudiodec_debug, "Registered %s", audio_dec_codecs[i].element_name); } else { GST_DEBUG ("Element %s not registered " "(the format is not supported by the system)", audio_dec_codecs[i].element_name); } } if (SUCCEEDED(hr)) CoUninitialize (); return TRUE; }
gboolean gst_vaapidecode_register (GstPlugin * plugin, GArray * decoders) { gboolean ret = FALSE; guint i, codec, rank; gchar *type_name, *element_name; const gchar *name; GType type; GTypeInfo typeinfo = { sizeof (GstVaapiDecodeClass), NULL, NULL, (GClassInitFunc) gst_vaapidecode_class_init, NULL, NULL, sizeof (GstVaapiDecode), 0, (GInstanceInitFunc) gst_vaapidecode_init, }; for (i = 0; i < G_N_ELEMENTS (vaapi_decode_map); i++) { codec = vaapi_decode_map[i].codec; rank = vaapi_decode_map[i].rank; name = vaapi_decode_map[i].name; if (codec && !gst_vaapi_codecs_has_codec (decoders, codec)) continue; if (codec) { type_name = g_strdup_printf ("GstVaapiDecode_%s", name); element_name = g_strdup_printf ("vaapi%sdec", name); } else { type_name = g_strdup ("GstVaapiDecode"); element_name = g_strdup_printf ("vaapidecode"); } type = g_type_from_name (type_name); if (!type) { /* create the gtype now */ type = g_type_register_static (GST_TYPE_VIDEO_DECODER, type_name, &typeinfo, 0); gst_vaapi_plugin_base_init_interfaces (type); g_type_set_qdata (type, GST_VAAPI_DECODE_PARAMS_QDATA, (gpointer) & vaapi_decode_map[i]); } /* Register GstVaapiDecode as GObject type, but not in GStreamer, so * vaapidecodebin can use it internally, but no exposed as a plugin * feature */ if (codec) ret |= gst_element_register (plugin, element_name, rank, type); g_free (element_name); g_free (type_name); } return ret; }
static void plugin_store_remove (MooPlugin *plugin) { g_return_if_fail (plugin_store != NULL); g_return_if_fail (MOO_IS_PLUGIN (plugin)); plugin_store->list = g_slist_remove (plugin_store->list, plugin); g_hash_table_remove (plugin_store->names, moo_plugin_id (plugin)); g_type_set_qdata (G_OBJECT_TYPE (plugin), MOO_PLUGIN_QUARK, NULL); plugin_type_cleanup (G_OBJECT_TYPE (plugin)); }
static void gjs_gtype_finalize(JSContext *context, JSObject *obj) { GType gtype = GPOINTER_TO_SIZE(priv_from_js(context, obj)); /* proto doesn't have a private set */ if (G_UNLIKELY(gtype == 0)) return; g_type_set_qdata(gtype, gjs_get_gtype_wrapper_quark(), NULL); }
static gboolean plugin_init (GstPlugin *plugin) { GQuark library_name_quark; GQuark component_name_quark; GQuark component_role_quark; GST_DEBUG_CATEGORY_INIT (gstomx_debug, "omx", 0, "gst-openmax"); GST_DEBUG_CATEGORY_INIT (gstomx_util_debug, "omx_util", 0, "gst-openmax utility"); GST_DEBUG_CATEGORY_INIT (gstomx_ppm, "omx_ppm", 0, "gst-openmax performance"); library_name_quark = g_quark_from_static_string ("library-name"); component_name_quark = g_quark_from_static_string ("component-name"); component_role_quark = g_quark_from_static_string ("component-role"); g_omx_init (); { guint i; for (i = 0; element_table[i].name; i++) { TableItem *element; GType type; element = &element_table[i]; type = element->get_type (); g_type_set_qdata (type, library_name_quark, (gpointer) element->library_name); g_type_set_qdata (type, component_name_quark, (gpointer) element->component_name); g_type_set_qdata (type, component_role_quark, (gpointer) element->component_role); if (!gst_element_register (plugin, element->name, element->rank, type)) { g_warning ("failed registering '%s'", element->name); return FALSE; } } } return TRUE; }
static int _wrap_g_type_wrapper__set_pytype(PyGTypeWrapper *self, PyObject* value, void *closure) { GQuark key; PyObject *py_type; key = _pyg_type_key(self->type); py_type = g_type_get_qdata(self->type, key); Py_CLEAR(py_type); if (value == Py_None) g_type_set_qdata(self->type, key, NULL); else if (PyType_Check(value)) { Py_INCREF(value); g_type_set_qdata(self->type, key, value); } else { PyErr_SetString(PyExc_TypeError, "Value must be None or a type object"); return -1; } return 0; }
void moo_plugin_method_newv (const char *name, GType ptype, GClosure *closure, GClosureMarshal c_marshaller, GType return_type, guint n_params, const GType *param_types) { MooPluginMeth *m; GHashTable *meths; char *norm_name; g_return_if_fail (g_type_is_a (ptype, MOO_TYPE_PLUGIN)); g_return_if_fail (name != NULL); g_return_if_fail (closure != NULL); g_return_if_fail (c_marshaller != NULL); g_return_if_fail (!n_params || param_types); norm_name = g_strdelimit (g_strdup (name), "_", '-'); meths = g_type_get_qdata (ptype, MOO_PLUGIN_METHS_QUARK); if (meths) { if (g_hash_table_lookup (meths, norm_name) != NULL) { g_warning ("method '%s' is already registered for type '%s'", name, g_type_name (ptype)); g_free (norm_name); return; } } else { meths = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) meth_free); g_type_set_qdata (ptype, MOO_PLUGIN_METHS_QUARK, meths); } m = g_new0 (MooPluginMeth, 1); m->ptype = ptype; m->return_type = return_type; m->n_params = n_params; m->param_types = n_params ? g_memdup (param_types, n_params * sizeof (GType)) : NULL; m->closure = g_closure_ref (closure); g_closure_sink (closure); g_closure_set_marshal (closure, c_marshaller); g_hash_table_insert (meths, norm_name, m); }
void tp_contacts_mixin_class_init (GObjectClass *obj_cls, glong offset) { g_assert (G_IS_OBJECT_CLASS (obj_cls)); g_type_set_qdata (G_OBJECT_CLASS_TYPE (obj_cls), TP_CONTACTS_MIXIN_CLASS_OFFSET_QUARK, GINT_TO_POINTER (offset)); tp_dbus_properties_mixin_implement_interface (obj_cls, TP_IFACE_QUARK_CONNECTION_INTERFACE_CONTACTS, tp_presence_mixin_get_contacts_dbus_property, NULL, known_contacts_props); }
static void plugin_type_cleanup (GType type) { gpointer meths_table; g_assert (g_type_is_a (type, MOO_TYPE_PLUGIN)); meths_table = g_type_get_qdata (type, MOO_PLUGIN_METHS_QUARK); if (meths_table) { g_hash_table_destroy (meths_table); g_type_set_qdata (type, MOO_PLUGIN_METHS_QUARK, NULL); } }
void pyg_register_gtype_custom(GType gtype, fromvaluefunc from_func, tovaluefunc to_func) { PyGTypeMarshal *tm; if (!pyg_type_marshal_key) pyg_type_marshal_key = g_quark_from_static_string("PyGType::marshal"); tm = g_new(PyGTypeMarshal, 1); tm->fromvalue = from_func; tm->tovalue = to_func; g_type_set_qdata(gtype, pyg_type_marshal_key, tm); }
static void plugin_store_add (MooPlugin *plugin) { g_return_if_fail (MOO_IS_PLUGIN (plugin)); plugin_store_init (); g_return_if_fail (!g_hash_table_lookup (plugin_store->names, moo_plugin_id (plugin))); plugin_store->list = g_slist_append (plugin_store->list, plugin); g_hash_table_insert (plugin_store->names, g_strdup (moo_plugin_id (plugin)), plugin); g_type_set_qdata (G_OBJECT_TYPE (plugin), MOO_PLUGIN_QUARK, plugin); }
void mcd_dbus_init_interfaces (GType g_define_type_id, const McdInterfaceData *iface_data) { g_type_set_qdata (g_define_type_id, MCD_INTERFACES_QUARK, (gpointer)iface_data); while (iface_data->get_type) { GType type; type = iface_data->get_type(); G_IMPLEMENT_INTERFACE (type, iface_data->iface_init); iface_data++; } }
/* search the plugin path */ static gboolean lv2_plugin_discover (void) { unsigned i; SLV2Plugins plugins = slv2_world_get_all_plugins (world); for (i = 0; i < slv2_plugins_size (plugins); ++i) { SLV2Plugin lv2plugin = slv2_plugins_get_at (plugins, i); GTypeInfo typeinfo = { sizeof (GstLV2Class), (GBaseInitFunc) gst_lv2_base_init, NULL, (GClassInitFunc) gst_lv2_class_init, NULL, lv2plugin, sizeof (GstLV2), 0, (GInstanceInitFunc) gst_lv2_init, }; GType type; /* construct the type name from plugin URI */ gchar *type_name = g_strdup_printf ("%s", slv2_value_as_uri (slv2_plugin_get_uri (lv2plugin))); g_strcanon (type_name, G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-+", '-'); /* if it's already registered, drop it */ if (g_type_from_name (type_name)) goto next; /* create the type */ type = g_type_register_static (GST_TYPE_SIGNAL_PROCESSOR, type_name, &typeinfo, 0); /* FIXME: not needed anymore when we can add pad templates, etc in class_init * as class_data contains the LADSPA_Descriptor too */ g_type_set_qdata (type, GST_SLV2_PLUGIN_QDATA, (gpointer) lv2plugin); if (!gst_element_register (gst_lv2_plugin, type_name, GST_RANK_NONE, type)) goto next; next: g_free (type_name); } return TRUE; }
static void ladspa_describe_plugin (const char *pcFullFilename, void *pvPluginHandle, LADSPA_Descriptor_Function pfDescriptorFunction) { const LADSPA_Descriptor *desc; gint i; /* walk through all the plugins in this pluginlibrary */ i = 0; while ((desc = pfDescriptorFunction (i++))) { gchar *type_name; GTypeInfo typeinfo = { sizeof (GstLADSPAClass), (GBaseInitFunc) gst_ladspa_base_init, NULL, (GClassInitFunc) gst_ladspa_class_init, NULL, desc, sizeof (GstLADSPA), 0, (GInstanceInitFunc) gst_ladspa_init, }; GType type; /* construct the type */ type_name = g_strdup_printf ("ladspa-%s", desc->Label); g_strcanon (type_name, G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-+", '-'); /* if it's already registered, drop it */ if (g_type_from_name (type_name)) goto next; /* create the type now */ type = g_type_register_static (GST_TYPE_SIGNAL_PROCESSOR, type_name, &typeinfo, 0); /* FIXME: not needed anymore when we can add pad templates, etc in class_init * as class_data contains the LADSPA_Descriptor too */ g_type_set_qdata (type, GST_LADSPA_DESCRIPTOR_QDATA, (gpointer) desc); if (!gst_element_register (ladspa_plugin, type_name, GST_RANK_NONE, type)) goto next; next: g_free (type_name); } }
/** * tp_contacts_mixin_init: (skip) * @obj: An instance of the implementation that uses this mixin * @offset: The byte offset of the TpContactsMixin within the object structure * * Initialize the contacts mixin. Should be called from the implementation's * instance init function like so: * * <informalexample><programlisting> * tp_contacts_mixin_init ((GObject *) self, * G_STRUCT_OFFSET (SomeObject, contacts_mixin)); * </programlisting></informalexample> * * Since: 0.7.14 * */ void tp_contacts_mixin_init (GObject *obj, gsize offset) { TpContactsMixin *mixin; g_assert (G_IS_OBJECT (obj)); g_type_set_qdata (G_OBJECT_TYPE (obj), TP_CONTACTS_MIXIN_OFFSET_QUARK, GSIZE_TO_POINTER (offset)); mixin = TP_CONTACTS_MIXIN (obj); mixin->priv = g_slice_new0 (TpContactsMixinPrivate); mixin->priv->interfaces = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); }
static NMPropertiesChangedClassInfo * nm_properties_changed_signal_setup_type (GType type) { NMPropertiesChangedClassInfo *classinfo; NMPropertiesChangedClassInfo *parent_classinfo = NULL; GObjectClass *object_class; GType parent; classinfo = g_slice_new (NMPropertiesChangedClassInfo); g_type_set_qdata (type, nm_properties_changed_signal_quark (), classinfo); object_class = g_type_class_ref (type); object_class->notify = notify; g_type_class_unref (object_class); classinfo->exported_props = g_hash_table_new (g_str_hash, g_str_equal); /* See if we've already added the signal to a parent class. (We can't just use * g_signal_lookup() here because it prints a warning if the signal doesn't exist!) */ parent = g_type_parent (type); while (parent) { parent_classinfo = g_type_get_qdata (parent, nm_properties_changed_signal_quark ()); if (parent_classinfo) break; parent = g_type_parent (parent); } if (parent_classinfo) classinfo->signal_id = parent_classinfo->signal_id; else { classinfo->signal_id = g_signal_new ("properties-changed", type, G_SIGNAL_RUN_FIRST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOXED, G_TYPE_NONE, 1, DBUS_TYPE_G_MAP_OF_VARIANT); } return classinfo; }
void tp_properties_mixin_class_init (GObjectClass *obj_cls, glong offset, const TpPropertySignature *signatures, guint num_properties, TpPropertiesSetFunc set_func) { TpPropertiesMixinClass *mixin_cls; g_assert (G_IS_OBJECT_CLASS (obj_cls)); g_type_set_qdata (G_OBJECT_CLASS_TYPE (obj_cls), TP_PROPERTIES_MIXIN_CLASS_OFFSET_QUARK, GINT_TO_POINTER (offset)); mixin_cls = TP_PROPERTIES_MIXIN_CLASS (obj_cls); mixin_cls->signatures = signatures; mixin_cls->num_props = num_properties; mixin_cls->set_properties = set_func; }
void rbgobj_register_g2r_func(GType gtype, GValueToRValueFunc func) { g_type_set_qdata(gtype, qGValueToRValueFunc, func); }
void rbgobj_register_r2g_func(GType gtype, RValueToGValueFunc func) { g_type_set_qdata(gtype, qRValueToGValueFunc, func); }
static void implement_interface_methods (gpointer iface, GType proxy_type) { GType exten_type = G_TYPE_FROM_INTERFACE (iface); guint i; GArray *impls; g_debug ("Implementing interface '%s' for proxy type '%s'", g_type_name (exten_type), g_type_name (proxy_type)); impls = g_type_get_qdata (exten_type, method_impl_quark ()); if (impls == NULL) { GIInterfaceInfo *iface_info; guint n_vfuncs; iface_info = g_irepository_find_by_gtype (NULL, exten_type); g_return_if_fail (iface_info != NULL); g_return_if_fail (g_base_info_get_type (iface_info) == GI_INFO_TYPE_INTERFACE); n_vfuncs = g_interface_info_get_n_vfuncs (iface_info); impls = g_array_new (FALSE, TRUE, sizeof (MethodImpl)); g_array_set_size (impls, n_vfuncs); for (i = 0; i < n_vfuncs; i++) { GIVFuncInfo *vfunc_info; vfunc_info = g_interface_info_get_vfunc (iface_info, i); create_native_closure (exten_type, iface_info, vfunc_info, &g_array_index (impls, MethodImpl, i)); g_base_info_unref (vfunc_info); } g_type_set_qdata (exten_type, method_impl_quark (), impls); g_base_info_unref (iface_info); } for (i = 0; i < impls->len; i++) { MethodImpl *impl = &g_array_index (impls, MethodImpl, i); gpointer *method_ptr; if (impl->closure == NULL) continue; method_ptr = G_STRUCT_MEMBER_P (iface, impl->struct_offset); *method_ptr = impl->closure; g_debug ("Implemented '%s.%s' at %d (%p) with %p", g_type_name (exten_type), impl->method_name, impl->struct_offset, method_ptr, impl->closure); } g_debug ("Implemented interface '%s' for '%s' proxy", g_type_name (exten_type), g_type_name (proxy_type)); }
static void register_for_type (OOP oop, GType type) { _glib_vm_proxy->registerOOP (oop); g_type_set_qdata (type, q_gst_object, oop); }