📄 objects.sgml
字号:
"type", GTK_WINDOW_POPUP, "child", menu, NULL), "signal::event", gtk_menu_window_event, menu, "signal::size_request", gtk_menu_window_size_request, menu, "signal::destroy", gtk_widget_destroyed, &menu->toplevel, NULL);</programlisting></informalexample>@object: a #GObject@signal_spec: the spec for the first signal@Varargs: #GCallback for the first signal, followed by data for the first signal, followed optionally by more signal spec/callback/data triples, followed by %NULL@Returns: @object<!-- ##### FUNCTION g_object_disconnect ##### --><para>A convenience function to disconnect multiple signals at once.</para><para>The signal specs expected by this function have the form "any_signal", whichmeans to disconnect any signal with matching callback and data, or "any_signal::signal_name", which only disconnects the signal named "signal_name". </para>@object: a #GObject@signal_spec: the spec for the first signal@Varargs: #GCallback for the first signal, followed by data for the first signal, followed optionally by more signal spec/callback/data triples, followed by %NULL<!-- ##### FUNCTION g_object_set ##### --><para>Sets properties on an object.</para>@object: a #GObject@first_property_name: name of the first property to set@Varargs: value for the first property, followed optionally by more name/value pairs, followed by %NULL<!-- ##### FUNCTION g_object_get ##### --><para>Gets properties of an object.</para><para>In general, a copy is made of the property contents and the caller isresponsible for freeing the memory in the appropriate manner for the type, for instance by calling g_free() or g_object_unref().</para><example><title>Using g_object_get(<!-- -->)</title><para>An example of using g_object_get() to get the contentsof three properties - one of type #G_TYPE_INT,one of type #G_TYPE_STRING, and one of type #G_TYPE_OBJECT:</para><programlisting> gint intval; gchar *strval; GObject *objval; g_object_get (my_object, "intproperty", &intval, "strproperty", &strval, "objproperty", &objval, NULL); /* Do something with intval, strval, objval */ g_free (strval); g_object_unref (objval);</programlisting></example>@object: a #GObject@first_property_name: name of the first property to get@Varargs: return location for the first property, followed optionally by more name/return location pairs, followed by %NULL<!-- ##### FUNCTION g_object_notify ##### --><para>Emits a "notify" signal for the property @property_name on @object. </para>@object: a #GObject@property_name: the name of a property installed on the class of @object.<!-- ##### FUNCTION g_object_freeze_notify ##### --><para>Stops emission of "notify" signals on @object. The signals arequeued until g_object_thaw_notify() is called on @object. </para><para>This is necessary for accessors that modify multiple properties to preventpremature notification while the object is still being modified.</para>@object: a #GObject<!-- ##### FUNCTION g_object_thaw_notify ##### --><para>Reverts the effect of a previous call to g_object_freeze_notify().This causes all queued "notify" signals on @object to be emitted.</para>@object: a #GObject<!-- ##### FUNCTION g_object_get_data ##### --><para>Gets a named field from the objects table of associations (see g_object_set_data()).</para>@object: #GObject containing the associations@key: name of the key for that association@Returns: the data if found, or %NULL if no such data exists.<!-- ##### FUNCTION g_object_set_data ##### --><para>Each object carries around a table of associations fromstrings to pointers. This function lets you set an association.</para><para>If the object already had an association with that name,the old association will be destroyed.</para>@object: #GObject containing the associations.@key: name of the key@data: data to associate with that key<!-- ##### FUNCTION g_object_set_data_full ##### --><para>Like g_object_set_data() except it adds notificationfor when the association is destroyed, either by setting it to a different value or when the object is destroyed.</para><para>Note that the @destroy callback is not called if @data is %NULL.</para>@object: #GObject containing the associations@key: name of the key@data: data to associate with that key@destroy: function to call when the association is destroyed<!-- ##### FUNCTION g_object_steal_data ##### --><para>Remove a specified datum from the object's data associations,without invoking the association's destroy handler.</para>@object: #GObject containing the associations@key: name of the key@Returns: the data if found, or %NULL if no such data exists.<!-- ##### FUNCTION g_object_get_qdata ##### --><para>This function gets back user data pointers stored viag_object_set_qdata().</para>@object: The GObject to get a stored user data pointer from@quark: A #GQuark, naming the user data pointer@Returns: The user data pointer set, or %NULL<!-- ##### FUNCTION g_object_set_qdata ##### --><para>This sets an opaque, named pointer on an object.The name is specified through a #GQuark (retrived e.g. viag_quark_from_static_string()), and the pointercan be gotten back from the @object with g_object_get_qdata()until the @object is finalized.Setting a previously set user data pointer, overrides (frees)the old pointer set, using #NULL as pointer essentiallyremoves the data stored.</para>@object: The GObject to set store a user data pointer@quark: A #GQuark, naming the user data pointer@data: An opaque user data pointer<!-- ##### FUNCTION g_object_set_qdata_full ##### --><para>This function works like g_object_set_qdata(), but in addition,a void (*destroy) (gpointer) function may be specified which iscalled with @data as argument when the @object is finalized, orthe data is being overwritten by a call to g_object_set_qdata()with the same @quark.</para>@object: The GObject to set store a user data pointer@quark: A #GQuark, naming the user data pointer@data: An opaque user data pointer@destroy: Function to invoke with @data as argument, when @data needs to be freed<!-- ##### FUNCTION g_object_steal_qdata ##### --><para>This function gets back user data pointers stored viag_object_set_qdata() and removes the @data from objectwithout invoking it's destroy() function (if any wasset).Usually, calling this function is only required to updateuser data pointers with a destroy notifier, for example:<programlisting>voidobject_add_to_user_list (GObject *object, const gchar *new_string){ /* the quark, naming the object data */ GQuark quark_string_list = g_quark_from_static_string ("my-string-list"); /* retrive the old string list */ GList *list = g_object_steal_qdata (object, quark_string_list); /* prepend new string */ list = g_list_prepend (list, g_strdup (new_string)); /* this changed 'list', so we need to set it again */ g_object_set_qdata_full (object, quark_string_list, list, free_string_list);}static voidfree_string_list (gpointer data){ GList *node, *list = data; for (node = list; node; node = node->next) g_free (node->data); g_list_free (list);}</programlisting>Using g_object_get_qdata() in the above example, instead of g_object_steal_qdata()would have left the destroy function set, and thus the partial string list wouldhave been freed upon g_object_set_qdata_full().</para>@object: The GObject to get a stored user data pointer from@quark: A #GQuark, naming the user data pointer@Returns: The user data pointer set, or %NULL<!-- ##### FUNCTION g_object_set_property ##### --><para>Sets a property on an object.</para>@object: a #GObject@property_name: the name of the property to set@value: the value<!-- ##### FUNCTION g_object_get_property ##### --><para>Gets a property of an object.</para><para>In general, a copy is made of the property contents and the caller isresponsible for freeing the memory by calling g_value_unset().</para><para>Note that g_object_get_property() is really intended for languagebindings, g_object_get() is much more convenient for C programming.</para>@object: a #GObject@property_name: the name of the property to get@value: return location for the property value<!-- ##### FUNCTION g_object_new_valist ##### --><para>Creates a new instance of a #GObject subtype and sets its properties.</para><para>Construction parameters (see #G_PARAM_CONSTRUCT, #G_PARAM_CONSTRUCT_ONLY) which are not explicitly specified are set to their default values.</para>@object_type: the type id of the #GObject subtype to instantiate@first_property_name: the name of the first property@var_args: the value of the first property, followed optionally by more name/value pairs, followed by %NULL@Returns: a new instance of @object_type<!-- ##### FUNCTION g_object_set_valist ##### --><para>Sets properties on an object.</para>@object: a #GObject@first_property_name: name of the first property to set@var_args: value for the first property, followed optionally by more name/value pairs, followed by %NULL<!-- ##### FUNCTION g_object_get_valist ##### --><para>Gets properties of an object. </para><para>In general, a copy is made of the property contents and the caller isresponsible for freeing the memory in the appropriate manner for the type, for instance by calling g_free() or g_object_unref().</para><para>See g_object_get().</para>@object: a #GObject@first_property_name: name of the first property to get@var_args: return location for the first property, followed optionally by more name/return location pairs, followed by %NULL<!-- ##### FUNCTION g_object_watch_closure ##### --><para>This function essentially limits the life time of the @closureto the life time of the object. That is, when the object is finalized,the @closure is invalidated by calling g_closure_invalidate() on it,in order to prevent invocations of the closure with a finalized (nonexisting) object. Also, g_object_ref() and g_object_unref() are addedas marshal guards to the @closure, to ensure that an extra referencecount is held on @object during invocation of the @closure.Usually, this function will be called on closures that use this @objectas closure data.</para>@object: GObject restricting lifetime of @closure@closure: GClosure to watch<!-- ##### FUNCTION g_object_run_dispose ##### --><para>Releases all references to other objects. This can be used to break reference cycles.</para><note><para>This functions should only be called from object system implementations.</para></note>@object: a #GObject<!-- ##### MACRO G_OBJECT_WARN_INVALID_PROPERTY_ID ##### --><para>This macro should be used to emit a standard warning about unexpected properties in set_property() and get_property() implementations.</para>@object: the #GObject on which set_property() or get_property() was called@property_id: the numeric id of the property@pspec: the #GParamSpec of the property
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -