Class GObject.ObjectClass
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
AlertDialog.AlertDialogClass,Annotation.AnnotationClass,AnnotationProvider.AnnotationProviderClass,Annotations.AnnotationsClass,AppLaunchContext.AppLaunchContextClass,Application.ApplicationClass,ApplicationCommandLine.ApplicationCommandLineClass,Auth.AuthClass,AuthDomain.AuthDomainClass,AuthenticationRequest.AuthenticationRequestClass,AuthManager.AuthManagerClass,AutomationSession.AutomationSessionClass,BackForwardList.BackForwardListClass,BookmarkList.BookmarkListClass,Breakpoint.BreakpointClass,BuilderCScope.BuilderCScopeClass,Cache.CacheClass,Cancellable.CancellableClass,CellAreaContext.CellAreaContextClass,CharsetConverter.CharsetConverterClass,Class.ClassClass,ClipboardPermissionRequest.ClipboardPermissionRequestClass,ColorBalanceChannel.ColorBalanceChannelClass,ColorChooserRequest.ColorChooserRequestClass,ColorDialog.ColorDialogClass,Completion.CompletionClass,CompletionContext.CompletionContextClass,CompletionSnippets.CompletionSnippetsClass,CompletionWords.CompletionWordsClass,Constraint.ConstraintClass,ConstraintGuide.ConstraintGuideClass,ContentDecoder.ContentDecoderClass,ContentProvider.ContentProviderClass,ContentSniffer.ContentSnifferClass,Context.ContextClass,ContextMenu.ContextMenuClass,ContextMenu.ContextMenuClass,CookieJar.CookieJarClass,CookieManager.CookieManagerClass,DataQueue.DataQueueClass,DBusInterfaceSkeleton.DBusInterfaceSkeletonClass,DBusObjectManagerClient.DBusObjectManagerClientClass,DBusObjectManagerServer.DBusObjectManagerServerClass,DBusObjectProxy.DBusObjectProxyClass,DBusObjectSkeleton.DBusObjectSkeletonClass,DBusProxy.DBusProxyClass,DebugControllerDBus.DebugControllerDBusClass,DeviceInfoPermissionRequest.DeviceInfoPermissionRequestClass,DirectoryList.DirectoryListClass,Discoverer.DiscovererClass,DiscovererAudioInfoClass,DiscovererContainerInfoClass,DiscovererInfoClass,DiscovererStreamInfoClass,DiscovererSubtitleInfoClass,DiscovererVideoInfoClass,Download.DownloadClass,EditorState.EditorStateClass,EmblemedIcon.EmblemedIconClass,EncodingTargetClass,EntryBuffer.EntryBufferClass,EnumListItem.EnumListItemClass,EnumListModel.EnumListModelClass,Exception.ExceptionClass,FaviconDatabase.FaviconDatabaseClass,File.FileClass,FileChooserRequest.FileChooserRequestClass,FileDialog.FileDialogClass,FileEnumerator.FileEnumeratorClass,FileLauncher.FileLauncherClass,FileLoader.FileLoaderClass,FileMonitor.FileMonitorClass,FilenameCompleter.FilenameCompleterClass,FileSaver.FileSaverClass,Filter.FilterClass,FilterListModel.FilterListModelClass,FindController.FindControllerClass,FlattenListModel.FlattenListModelClass,Font.FontClass,FontDialog.FontDialogClass,FontFace.FontFaceClass,FontFamily.FontFamilyClass,FontMap.FontMapClass,Fontset.FontsetClass,FormSubmissionRequest.FormSubmissionRequestClass,Frame.FrameClass,GeolocationManager.GeolocationManagerClass,GeolocationPermissionRequest.GeolocationPermissionRequestClass,GLShader.GLShaderClass,GutterLines.GutterLinesClass,Handle.HandleClass,HitTestResult.HitTestResultClass,HitTestResult.HitTestResultClass,Hover.HoverClass,HoverContext.HoverContextClass,HSTSEnforcer.HSTSEnforcerClass,IconPaintable.IconPaintableClass,IMContext.IMContextClass,InetAddress.InetAddressClass,InetAddressMask.InetAddressMaskClass,InitiallyUnowned.InitiallyUnownedClass,InputMethodContext.InputMethodContextClass,InputStream.InputStreamClass,IOStream.IOStreamClass,Language.LanguageClass,LanguageManager.LanguageManagerClass,Layout.LayoutClass,LayoutChild.LayoutChildClass,LayoutManager.LayoutManagerClass,LeafletPage.LeafletPageClass,ListStore.ListStoreClass,ListStore.ListStoreClass,Logger.LoggerClass,MapListModel.MapListModelClass,MarkAttributes.MarkAttributesClass,MediaKeySystemPermissionRequest.MediaKeySystemPermissionRequestClass,MediaStream.MediaStreamClass,MenuAttributeIter.MenuAttributeIterClass,MenuLinkIter.MenuLinkIterClass,MenuModel.MenuModelClass,Message.MessageClass,MountOperation.MountOperationClass,MultiSelection.MultiSelectionClass,NativeDialog.NativeDialogClass,NetworkAddress.NetworkAddressClass,NetworkService.NetworkServiceClass,NetworkSession.NetworkSessionClass,NoSelection.NoSelectionClass,Notification.NotificationClass,NotificationPermissionRequest.NotificationPermissionRequestClass,OptionMenu.OptionMenuClass,OsxAppInfo.OsxAppInfoClass,OutputStream.OutputStreamClass,Permission.PermissionClass,PixbufAnimation.PixbufAnimationClass,PixbufAnimationIter.PixbufAnimationIterClass,PixbufLoader.PixbufLoaderClass,PointerLockPermissionRequest.PointerLockPermissionRequestClass,PolicyDecision.PolicyDecisionClass,PrintCompositor.PrintCompositorClass,PrintDialog.PrintDialogClass,PrintOperation.PrintOperationClass,PrintOperation.PrintOperationClass,RecentManager.RecentManagerClass,Region.RegionClass,Renderer.RendererClass,Resolver.ResolverClass,ScriptWorld.ScriptWorldClass,SearchContext.SearchContextClass,SearchSettings.SearchSettingsClass,SecurityManager.SecurityManagerClass,SelectionFilterModel.SelectionFilterModelClass,Server.ServerClass,ServerMessage.ServerMessageClass,Session.SessionClass,Settings.SettingsClass,Settings.SettingsClass,SettingsBackend.SettingsBackendClass,Shortcut.ShortcutClass,ShortcutsItem.ShortcutsItemClass,ShortcutsSection.ShortcutsSectionClass,SimpleActionGroup.SimpleActionGroupClass,SimpleProxyResolver.SimpleProxyResolverClass,SingleSelection.SingleSelectionClass,SliceListModel.SliceListModelClass,Snippet.SnippetClass,SnippetContext.SnippetContextClass,SnippetManager.SnippetManagerClass,Socket.SocketClass,SocketAddress.SocketAddressClass,SocketAddressEnumerator.SocketAddressEnumeratorClass,SocketClient.SocketClientClass,SocketControlMessage.SocketControlMessageClass,SocketListener.SocketListenerClass,Sorter.SorterClass,SortListModel.SortListModelClass,SpaceDrawer.SpaceDrawerClass,SpinnerPaintable.SpinnerPaintableClass,SqueezerPage.SqueezerPageClass,StringList.StringListClass,StringObject.StringObjectClass,Style.StyleClass,StyleContext.StyleContextClass,StyleManager.StyleManagerClass,StyleScheme.StyleSchemeClass,StyleSchemeManager.StyleSchemeManagerClass,SwipeTracker.SwipeTrackerClass,TabPage.TabPageClass,TextBuffer.TextBufferClass,TextChildAnchor.TextChildAnchorClass,TextMark.TextMarkClass,TextTag.TextTagClass,TlsCertificate.TlsCertificateClass,TlsDatabase.TlsDatabaseClass,TlsInteraction.TlsInteractionClass,TlsPassword.TlsPasswordClass,Toast.ToastClass,Toggle.ToggleClass,TreeListModel.TreeListModelClass,TreeListRow.TreeListRowClass,TreeModelFilter.TreeModelFilterClass,TreeModelSort.TreeModelSortClass,TreeStore.TreeStoreClass,TypeModule.TypeModuleClass,UnixFDList.UnixFDListClass,UriLauncher.UriLauncherClass,URIRequest.URIRequestClass,URIRequest.URIRequestClass,URIResponse.URIResponseClass,URIResponse.URIResponseClass,URISchemeRequest.URISchemeRequestClass,URISchemeResponse.URISchemeResponseClass,UserContentFilterStore.UserContentFilterStoreClass,UserContentManager.UserContentManagerClass,UserMediaPermissionRequest.UserMediaPermissionRequestClass,Value.ValueClass,Vfs.VfsClass,ViewStackPage.ViewStackPageClass,ViewStackPages.ViewStackPagesClass,VirtualMachine.VirtualMachineClass,VolumeMonitor.VolumeMonitorClass,WeakValue.WeakValueClass,WebContext.WebContextClass,WebEditor.WebEditorClass,WebFormManager.WebFormManagerClass,WebHitTestResult.WebHitTestResultClass,WebInspector.WebInspectorClass,WebPage.WebPageClass,WebProcessExtension.WebProcessExtensionClass,WebResource.WebResourceClass,WebsiteDataAccessPermissionRequest.WebsiteDataAccessPermissionRequestClass,WebsiteDataManager.WebsiteDataManagerClass,WebsitePolicies.WebsitePoliciesClass,WebsocketConnection.WebsocketConnectionClass,WebsocketExtension.WebsocketExtensionClass,WebsocketExtensionManager.WebsocketExtensionManagerClass,WidgetPaintable.WidgetPaintableClass,WindowGroup.WindowGroupClass,WindowProperties.WindowPropertiesClass,ZlibCompressor.ZlibCompressorClass,ZlibDecompressor.ZlibDecompressorClass
- Enclosing class:
GObject
// Example of implementing a singleton using a constructor.
static MySingleton *the_singleton = NULL;
static GObject*
my_singleton_constructor (GType type,
guint n_construct_params,
GObjectConstructParam *construct_params)
{
GObject *object;
if (!the_singleton)
{
object = G_OBJECT_CLASS (parent_class)->constructor (type,
n_construct_params,
construct_params);
the_singleton = MY_SINGLETON (object);
}
else
object = g_object_ref (G_OBJECT (the_singleton));
return object;
}
-
Constructor Summary
ConstructorsConstructorDescriptionObjectClass(MemorySegment address) Create a ObjectClass proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionfindProperty(String propertyName) Looks up theGParamSpecfor a property of a class.static MemoryLayoutThe memory layout of the native struct.voidinstallProperties(@Nullable ParamSpec @Nullable [] pspecs) Installs new properties from an array ofGParamSpecs.voidinstallProperty(int propertyId, ParamSpec pspec) Installs a new property.Get an array ofGParamSpec* for all properties of a class.voidoverrideConstructed(Arena arena, @Nullable Method method) Override virtual methodconstructed.voidoverrideConstructor(Arena arena, @Nullable Method method) Override virtual methodconstructor.voidoverrideDispatchPropertiesChanged(Arena arena, @Nullable Method method) Override virtual methoddispatch_properties_changed.voidoverrideDispose(Arena arena, @Nullable Method method) Override virtual methoddispose.voidoverrideFinalize(Arena arena, @Nullable Method method) Override virtual methodfinalize.voidoverrideGetProperty(Arena arena, @Nullable Method method) Override virtual methodget_property.voidoverrideNotify(Arena arena, @Nullable Method method) Override virtual methodnotify.voidoverrideProperty(int propertyId, String name) RegisterspropertyIdas referring to a property with the namenamein a parent class or in an interface implemented byoclass.This allows this class to "override" a property implementation in a parent class or to provide the implementation of a property from an interface.voidoverrideSetProperty(Arena arena, @Nullable Method method) Override virtual methodset_property.Read the value of the fieldconstruct_properties.longRead the value of the fieldflags.longRead the value of the fieldn_construct_properties.longRead the value of the fieldn_pspecs.@Nullable MemorySegment @Nullable []Read the value of the fieldpdummy.Read the value of the fieldpspecs.voidwriteConstructProperties(SList<MemorySegment> constructProperties) Write a value in the fieldconstruct_properties.voidwriteFlags(long flags) Write a value in the fieldflags.voidwriteNConstructProperties(long nConstructProperties) Write a value in the fieldn_construct_properties.voidwriteNPspecs(long nPspecs) Write a value in the fieldn_pspecs.voidwritePdummy(@Nullable MemorySegment @Nullable [] pdummy, Arena _arena) Write a value in the fieldpdummy.voidwritePspecs(MemorySegment pspecs) Write a value in the fieldpspecs.Methods inherited from class org.gnome.gobject.TypeClass
addPrivate, adjustPrivateOffset, get, getInstancePrivateOffset, getPrivate, peek, peekParent, peekStatic, readGType, ref, unref, unrefUncached, writeGTypeMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
ObjectClass
Create a ObjectClass proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
-
Method Details
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readConstructProperties
Read the value of the fieldconstruct_properties.- Returns:
- The value of the field
construct_properties
-
writeConstructProperties
Write a value in the fieldconstruct_properties.- Parameters:
constructProperties- The new value for the fieldconstruct_properties
-
overrideConstructor
-
overrideSetProperty
-
overrideGetProperty
-
overrideDispose
-
overrideFinalize
-
overrideDispatchPropertiesChanged
-
overrideNotify
-
overrideConstructed
-
readFlags
public long readFlags()Read the value of the fieldflags.- Returns:
- The value of the field
flags
-
writeFlags
public void writeFlags(long flags) Write a value in the fieldflags.- Parameters:
flags- The new value for the fieldflags
-
readNConstructProperties
public long readNConstructProperties()Read the value of the fieldn_construct_properties.- Returns:
- The value of the field
n_construct_properties
-
writeNConstructProperties
public void writeNConstructProperties(long nConstructProperties) Write a value in the fieldn_construct_properties.- Parameters:
nConstructProperties- The new value for the fieldn_construct_properties
-
readPspecs
Read the value of the fieldpspecs.- Returns:
- The value of the field
pspecs
-
writePspecs
Write a value in the fieldpspecs.- Parameters:
pspecs- The new value for the fieldpspecs
-
readNPspecs
public long readNPspecs()Read the value of the fieldn_pspecs.- Returns:
- The value of the field
n_pspecs
-
writeNPspecs
public void writeNPspecs(long nPspecs) Write a value in the fieldn_pspecs.- Parameters:
nPspecs- The new value for the fieldn_pspecs
-
readPdummy
Read the value of the fieldpdummy.- Returns:
- The value of the field
pdummy
-
writePdummy
Write a value in the fieldpdummy.- Parameters:
pdummy- The new value for the fieldpdummy
-
findProperty
-
installProperties
Installs new properties from an array ofGParamSpecs.All properties should be installed during the class initializer. It is possible to install properties after that, but doing so is not recommend, and specifically, is not guaranteed to be thread-safe vs. use of properties on the same type on other threads.
The property id of each property is the index of each
GParamSpecin thepspecsarray.The property id of 0 is treated specially by
GObjectand it should not be used to store aGParamSpec.This function should be used if you plan to use a static array of
GParamSpecsand g_object_notify_by_pspec(). For instance, this class initialization:typedef enum { PROP_FOO = 1, PROP_BAR, N_PROPERTIES } MyObjectProperty; static GParamSpec *obj_properties[N_PROPERTIES] = { NULL, }; static void my_object_class_init (MyObjectClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); obj_properties[PROP_FOO] = g_param_spec_int ("foo", NULL, NULL, -1, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); obj_properties[PROP_BAR] = g_param_spec_string ("bar", NULL, NULL, NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); gobject_class->set_property = my_object_set_property; gobject_class->get_property = my_object_get_property; g_object_class_install_properties (gobject_class, G_N_ELEMENTS (obj_properties), obj_properties); }allows calling g_object_notify_by_pspec() to notify of property changes:
void my_object_set_foo (MyObject *self, gint foo) { if (self->foo != foo) { self->foo = foo; g_object_notify_by_pspec (G_OBJECT (self), obj_properties[PROP_FOO]); } }- Parameters:
pspecs- theGParamSpecsarray defining the new properties- Since:
- 2.26
-
installProperty
Installs a new property.All properties should be installed during the class initializer. It is possible to install properties after that, but doing so is not recommend, and specifically, is not guaranteed to be thread-safe vs. use of properties on the same type on other threads.
Note that it is possible to redefine a property in a derived class, by installing a property with the same name. This can be useful at times, e.g. to change the range of allowed values or the default value.
- Parameters:
propertyId- the id for the new propertypspec- theGParamSpecfor the new property
-
listProperties
Get an array ofGParamSpec* for all properties of a class.- Returns:
- an array of
GParamSpec* which should be freed after use
-
overrideProperty
RegisterspropertyIdas referring to a property with the namenamein a parent class or in an interface implemented byoclass.This allows this class to "override" a property implementation in a parent class or to provide the implementation of a property from an interface.Internally, overriding is implemented by creating a property of type
GParamSpecOverride; generally operations that query the properties of the object class, such as g_object_class_find_property() or g_object_class_list_properties() will return the overridden property. However, in one case, theconstructPropertiesargument of theconstructorvirtual function, theGParamSpecOverrideis passed instead, so that theparamIdfield of theGParamSpecwill be correct. For virtually all uses, this makes no difference. If you need to get the overridden property, you can call g_param_spec_get_redirect_target().- Parameters:
propertyId- the new property IDname- the name of a property registered in a parent class or in an interface of this class.- Since:
- 2.4
-