Archives for: January 2005, 23

01/23/05

I started looking into Gnome coding last days, by reading some of the great tutorials in the Developer section of the Gnome site. Currently I'm reading the stuff on GObjects, which is very interesting. I first read the article on IBM DeveloperWorks regarding "Wrapping GObjects in Python", which is a neat way to use C code in Python. It's also written by Ross Burton, as you might remember the author of the Contact Lookup Applet.
Regarding that applet: Ross is not willing to incorporate my Gaim patch, because it is too much bound to Gaim, and requires a patched version of Gaim. Too bad, Cdis should provide a solution for this.

Now what is Cdis? It's the new name for what I previously called DAL. Cdis stands for "Common Desktop Integration Standard", a name proposed by John "J5" Palmieri. Some information regarding it I sent to the Xdg list at freedesktop.org is available here. Beware, the thread got corrupted somewhere and is attached to the pkgconfig2 thread, so it continues here

I had some talkings on IRC with JakobS, the KDE maintainer of the MulticastDNS features coming in KDE 3.4, regarding automatic code generation. It will be fun to get this working (XML2C, XML2GObject, XML2KObject,...). It should be possible to do this without writing real code, just using XML and XSLT, which generates the necessary code for various platforms, based on a CdisInterface description file.

For the GObject creation, which is a very tedious task, I've been looking into Gob, the GObject builder. It just rocks. This is a sample Gob file:

requires 2.0.0

%{
//This should not be necessary, but well...
#include <stdio.h>
%}

class Ikke:GobTestOne from G:Object
{
        private int test=1;
        property INT test
                (nick = "test",
                 blurb = "Testje",
                 export,
                 link);

        public void
        printtest (self)
        {
                g_printf("%d\n", self->_priv->test);
        }

        public GObject *
        new (void)
        {
                return (GObject *) GET_NEW;
        }
}

As you can see, a very simple format.
If I process this file using gob, this is what I get:

$gob2 gobtest1.gob
$ ls
gobtest1.gob ikke-gobtestone-private.h ikke-gobtestone.h
ikke-gobtestone.c
$ wc -l ikke-gobtestone*
22 ikke-gobtestone-private.h
276 ikke-gobtestone.c
75 ikke-gobtestone.h
373 total

which is rather impressive. The generated code is also very usefull.

A "bigger" Gob file (just a sample) can be seen here, whilst this is a sample C file "using" the object. Impressive, huh?

Gnome 2.10.0 beta1 tarball creation tomorrow, launch on wednesday. Jay! I got the webcal in my Evolution Calendar ;-)

That's it for now, maybe I'll have some usefull stuff to say soon ;-)

Permalink . Ikke . 11:04:37 pm . 581 Words . Technology, Linux, Desktop . . 9760 views . 43 comments