Using GLib.List of AppInfo Objects and Handles #1239
-
|
Hello, Couldn't find any repos in github or examples that show how to use a GLib.List to hold AppInfo objects. I am using AppInfoHelper to get a list of applications on a linux system and I see distinct records but all I can see are Handles. So my questions is, what exactly are these handles, particularly ListOwnedHandle and in this case how do I use them to retrieve application info? At first this seemed similar to handling GObjects however the solution is not obvious to me. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
In general: GirCore has some "public" and "internal" namespace. Public is an object oriented api you would expect for c#. The "internal" is a lot more low level to integrate with the native code. You should only use internal APIs to workaround bugs / missing code in the public namespace. Handles are part of the "internal" namespace so the handle code cares about pointers instead of objects, as C is all about pointers. To give you a more concrete answer I need a more detailed question. I don't know all the APIs available. I don't even know in which library "AppInfo" is located. As I do support mostly on mobile I really need detailed description as researching this stuff manually is really no fun. So what do you want to achieve? Which APIs from https://docs.gtk.org/ you want to use and how? |
Beta Was this translation helpful? Give feedback.
This is what a list actually is: https://docs.gtk.org/glib/struct.List.html
There is currently no additional support to retrieve the things inside the list in a convenient way. The related issue is: #588 which is planned for version 0.11.0.
If you know that inside the list is some GObject you can call some internal API to work around this problem:
var obj = GObject.Internal.InstanceWrapper.WrapHandle<ExpectedType>(ptrfromlist, false);alternatively you can call and should be able to see what is inside the object and cast it accordingly:
var obj = GObject.Internal.InstanceWrapper.WrapHandle<GObject.Object>(ptrfromlist, false);