Tuesday, May 22, 2012

Gnome Shell - Netbook Interface - Part II - quick update

It turns out that I got something horribly fundamentally wrong with my last post. I knew there'd be some mistakes.

I found the style guide - found here.

Firstly, the applicationObject would have to change to:

function applicationObject() {
    // change this to allow for .desktop file information
    // to come in and an icon and localised text to be
    // returned.
    let self = new St.BoxLayout(
            { vertical: true,
            style_class: 'application' });
    self.icon = new St.Icon(
            { icon_name: 'applications-system',
            icon_type: St.IconType.FULLCOLOR,
            style_class: 'applicationIcon' });
    self.lblName = new St.Label(
            { text: 'calculator' });
    self.add_actor( self.icon );
    self.add_actor( self.lblName );
    self.connect( 'button-press-event', _tellMe )
    return self;

Why? The "this" variable is disregarded if you have a return value. I'm also going against one of the design patterns in the style guide - namely, I'm getting my object to return a type - self, which is basically a St.BoxLayout object.

This is inheritance. Later on in the guide, it also states the method for inheritance they suggest doesn't allow for inheriting from a GObject type. I'm not sure if I'm missing the point, but I think this is a way around that restriction. Don't quote me on that.

It appears to work though I guess I really should test it...

The other thing I've discovered - if I start looking glass while I have my "interface" showing, it starts to respond to mouse clicks... Now if I could just figure out what's happening for it to start responding to clicks.

No comments:

Post a Comment