Re: [Vala] Genie, subclassing and some help!



On 27/06/10 18:47, Abderrahim Kitouni wrote:
Hi,

2010/6/27 Andrew <rugby471 gmail com>:
On 27/06/10 17:32, Abderrahim Kitouni wrote:
Hi,

2010/6/27 Andrew <rugby471 gmail com>:
On 27/06/10 08:16, Andrew wrote:
Ignore that, I managed to do the APP_INDICATOR_TYPE correctly in the
vapi file, however I don't seem to have any success with the
APP_INDICATOR_TYPE_INDICATOR_CATEGORY.

Attached is the vapi file, could you point me in the right direction?

in :
      [CCode (cprefix = "APP_INDICATOR_CATEGORY_", cheader_filename =
"libappindicator/app-indicator.h")]
      public enum Category {

add type_id="APP_INDICATOR_TYPE_INDICATOR_CATEGORY" just like you did
it with the class. I see no reason for it not working.

Abderrahim

Nope doesn't work, the error is:

/home/andrew/Software/Projects/wasiliana/src/indicator.vala.c: In
function ‘wapp_indicator_category_from_enum’:
/home/andrew/Software/Projects/wasiliana/src/indicator.vala.c:82: error:
‘APP_INDICATOR_TYPE_INDICATOR_CATEGORY’ undeclared

For me, that seems like it works : valac is now using
APP_INDICATOR_TYPE_INDICATOR_CATEGORY , so the problem is that it
isn't in the included header. You need to add the correct header
(app-indicator-enum-types.h in this case, AFAICS) to cheader_filename
(separate by a comma).

HTH,
Abderrahim

P.S. Don't forget to report all this once you get it to work : the
vapi is broken and this isn't the proper way to fix it.

Thankyou very much you are a star! I shall resubmit that vapi file as well

Just two more questions:

1) I have to use the code below to do what I want it to, can I put this
in the init of the class cuz it doesn't appear to work

def create_indicator()
    var ind = new wAppIndicator("wasiliana-wapp", "indicator-messages",
Category.APPLICATION_STATUS)
    ind.set_status(Status.ACTIVE)
    ind.set_attention_icon("indicator-messages-new")

    var menu = new Menu()

    for i:int = 1 to 3
        var buf = "Test-undermenu"
        var menu_items = new MenuItem.with_label(buf)
        menu.append(menu_items)
        menu_items.show()

    ind.set_menu(menu)
    Gtk.main()

2) Perhaps related, in the main.gs file, I have:

init
    Gtk.init(ref args)
    create_indicator()
    Gtk.main()

However, if I don;t put the Gtk.main() in the function above (rather
than the init), it doesn't work. Why is this/is this on purpose?

Nearly there.. :-)

-- 
Andrew



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