Re: New to GObject, few questions



hi tomasz,

Tomasz Jankowski wrote:
Hi!

Well, I'm working with GTK+ quite long, but I have never tried to get inside
it's code. Now I'm trying to understood how GObject works and I must say,
that it isn't as easy as I tought ;)

I read few times "Gobject tutorial" provided with GLib's documentation but I
don't understood it enouhg good, maybe because I don't like (and know)
object languages, I know only C++ basics. So these are my questions:

I. What the Interfaces are? I don't understood their predestination? I
understood them as other type of Methods, but I'm know, that Interfaces
aren't Methods, can someone explain me it?
  
An example for a real world interface are play/stop/pause buttons on a
cd/tape/mp3-player. All kind of players have those. The interface would
be called "music-player-controls" and the user does not need to know
technical details to operate them. Play starts playback, if it is mp3 or
cd or whatever does not matter. In GObject if you have a "Sortable"
interface then this object can be sorted, what ever this means
internaly. The purpose is to use common operations on different objects.
Interfaces are important in GObject (and also Java) as unlike C++, it
does not support multiple inheritance.
II. For example, object "XXX" inherits from object "ZZZ" and I defined
*_finalize () functions for object ZZZ, but I didn't define any *finalize
functions for object XXX. What will happen if I'll try to destroy XXX
object? Will ZZZ's *_finalize functions will be used?
  
yes, thats the idea.
III. What 'GTypeInstance' is?
  
You don't really need to deal with that usually.Its used for bookkeeping
of types (GValue, GObject based).

Stefan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]