Re: [gnome-love] Projects using GObject



On Fri, 2007-05-04 at 11:12 +0200, Thierry Chappuis wrote:
Hi all,

I'm currently writing a course discussing object-oriented programming in 
C using the GObject system. That is quite easy to find plenty of 
GUI-based examples using this library. However, I'm looking for some 
non-GUI-based projects using the GObject framework in order to provide 
readers with a representative overview of its use in real-world programs.

I would be highly interested in getting some ideas and/or project 
examples on this subject. Thank you by advance.

You could look at Yelp.  We use GObject to help us provide a
uniform data type and API for doing document transformations.
In the current Yelp, there's a YelpPager base class to define
the common API.  We then have subclasses for various document
types, such as DocBook, man, and info.

On the yelp-spoon branch, we've restructured the transformation
API to address some issues that we only saw after a few years of
hindsight.  On this branch, we have a common YelpDocument class,
which is again subclassed for the various document types.

Using GObject for these means:

1) We can have a single API, so that very few places in Yelp
   have to know what type of document they're dealing with.
2) We can push common code into base classes, minimizing code
   duplication.
3) We get reference counting for free.

We do use non-GObject structs for quite a few things as well,
some of them non-trivial (for example, the new YelpPage on
the yelp-spoon branch).

--
Shaun





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