File: TODO.md

package info (click to toggle)
ruby-gir-ffi 0.14.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,824 kB
  • sloc: ruby: 20,895; makefile: 90; sh: 1
file content (138 lines) | stat: -rw-r--r-- 4,565 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# TODO

## Memory managment

GirFFI does not ~~attempt to free any memory at the moment, or~~ lower the
reference count of any objects it gets from GObject. This task therefore involves two parts:

- Free non-GObject pointers as needed (at garbage-collection time)
- [Done!] Lower reference count of GObjects (at garbage-collection time)

**Use memory_profiler to check memory use (https://github.com/SamSaffron/memory_profiler)**

## Refactorings

These in the order they occured to me, and may therefore be fixed in any order.

- Create Type objects for all FFI types, including the ones currently
  represented by a single symbol, so we can always do stuff like

  > `GirFFI::Types::UInt8.get_value_from_pointer(ptr)`

  rather than having awkward dynamic method dispatch inside GirFFI::InOutPointer.

- Move to a single Pointer class, rather than InPointer, InOutPointer and
  Pointer monkeypatching.

## Derived types

Derived classes can now be registered with GObject, but the way to do this is
not very nice:

    class Derived < Base
    end

    GirFFI.define_type Derived do |info|
      info.install_property GObject.param_spec_int("foo", "foo bar",
                                                   "The Foo Bar Property",
                                                   10, 20, 15, 3)
      # assume Base defines a virtual function called 'some_vfunc'
      info.install_vfunc_implementation :some_vfunc, proc {|obj|
        #implementation goes here
      }
    end

or

    class Derived < Base
      def some_vfunc
        #implementation goes here
      end
    end

    GirFFI.define_type Derived do |info|
      info.install_property GObject.param_spec_int("foo", "foo bar",
                                                   "The Foo Bar Property",
                                                   10, 20, 15, 3)
      info.install_vfunc_implementation :some_vfunc
    end


It would be good to replace this with something that's easier to use:
* Perhaps auto-register types, like Gtk# does
* Perhaps automagically find vfunc implementations, like PyGObject and
  Ruby-GNOME do
* What about properties?

How about:

    class Derived < Base
      include SomeGObjectInterface

      register_type 'Derived'

      install_property ...
      install_vfunc_implementation ...
    end

This needs issue #63 to be resolved.

NOTE: When adding an interface module to a derived class, its prerequisites
should be checked.

## Persistent Ruby GObject identity

GirFFI should make sure that if it gets a pointer to a GObject for which a Ruby
object already exists, the existing object is returned. This involves the use
of WeakRef, no doubt.

## Handle fundamental objects that are not GObject.

This is a big one. See commit 1e9822c7817062a9b853269b9418fd78782090b5 in
gobject-introspection, and TestFundamentalObject in Regress.

The tests for TestFundamentalObject accidentally pass, but there may be
hidden issues.

## Check binding of GObject:

    (11:37:03 PM) walters: the basic story is that GObject should be manually bound
    (11:47:02 PM) ebassi: the really necessary bits are: GObject/GInitiallyUnowned memory management; properties accessors; GSignal connection API
    (11:47:15 PM) ebassi: the rest is "nice to have"
    (11:47:37 PM) ebassi: oh, and probably GBinding - but that's just because I wrote it ;-)

## Use FFI::DataConverter to automatically convert GObject types

GirFFI now generates loads of Something.wrap(ptr) calls; Perhaps these can be
replace by implementing to_native and from_native in ClassBase and including
FFI::DataConverter.

## Handle Variants more nicely

Currently, GirFFI requires the user to create GVariant objects by hand, and
retrieve values from them by hand as well. Ideally, we would have `.from_ruby` and
`#to_ruby` methods or somesuch that do this for us. Some classes, like GAction,
require a specifice VariantType to be used consistently. Special logic will have
to be put in place for that.

## Handle ownership-transfer correctly

For how to handle objects, see https://bugzilla.gnome.org/show_bug.cgi?id=657202#c1

## Miscellaneous

* Move GObjectIntrospection to GIRepository, and allow generating its own
  members.
* Do something useful with the versioning info in the GIR

## External dependencies

Things that I think GirFFI cannot fix:

* gobject-introspection should correctly mark private fields as not readable.
* gobject-introspection should ignore functions that are only defined but not
  implemented, or implement those cases in GIMarshallingTests.

## See Also

  dnote