Re: [Vala] Genie, subclassing and some help!
Hey, Got this compiled after a little hassle, for people that want the command: valac --vapidir=./ --pkg gtk+-2.0 --pkg appindicator-0.1 --pkg webkit-1.0 indicator.gs webkit_view.gs main_window.gs main.gs with the appindicator.vapi in the same dir as the files. It should compile, assuming you have all the dependencies n things in place. It just pops up in the same place as all my other icons, so LXDE supports appindicator stuff. :-) Cheers, -Harry PS: Pretty impressed with WebKit, never had sources that used it before.. it will be used for projects in the future! ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
On 03/07/10 20:45, Harry Van Haaren wrote: Don't worry got it solved, indicator was being lost (a local variable) and so I had to bind it as a property of the class and now even subclassing works! Hey, Glad you got it working... any chance you'd post a .zip of the files as you had before with the working example..? To test on my LXDE install, and just to see what exactly it is that this appindicator is all about..! Congrats, -Harry Sure http://www.2shared.com/file/rj3sUTMB/src.html -- Andrew ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
On 02/07/10 18:25, Andrew wrote: On 30/06/10 14:41, Harry Van Haaren wrote: Aha, fully understand the problem now at least. Do you have one of these appIndicator dock things in your panel? The following document [1] seems to say that they might re-design/ change some things in how the docks work. I'm running LXDE, (no fancy AppIndicator dock I dont think...). What I suggest is that your compile using valac --save-temps (provides C output files), check that against the documentation of LibAppIndicator. I have no experience with LibAppIndicator and hence can't really help you much there. If it turns out that it should work, please send me sources and I can try it on my LXDE. -Harry PS: There was/is quite some controversy about libappindicator, see [2]. I'm not sure if this helps dev-s to write documentation test cases... I havent found any. Getting in touch with the authors or LibAppIndicator might be a good idea.. ? Up to you. [1] https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators [2] http://www.advogato.org/person/mbanck/diary.html?start=49 Sure, the window popus (which is correct), however the application indicator does not appear. Okay, so I spoke to the authors of appindicator and they couldn't work it out, a bit of a mystery, so instead of subclassing, I am just using a function to create a standard Indicator. One problem I have come up with now is more alarming, my code is as follows: uses Gtk AppIndicator class wMain : GLib.Object main_window : MainWindow init main_window = new MainWindow() var indicator = new Indicator(wasiliana,applications-utilities, Category.APPLICATION_STATUS) indicator.set_status(Status.ATTENTION) indicator.set_attention_icon (indicator-messages-new) var menu = new Menu() var show_menuitem = new CheckMenuItem.with_label(Show Wasiliana) menu.append(show_menuitem) menu.show_all() indicator.set_menu(menu) //Gtk.main() main_window.show_all() init Gtk.init (ref args) var w = new wMain() Gtk.main() Now unless I uncomment the //Gtk.main(), the indicator doesn't show. I don't know what the problem is, but one of the authors said it might be something to do with references (but I have no idea what these are) Any help? Don't worry got it solved, indicator was being lost (a local variable) and so I had to bind it as a property of the class and now even subclassing works! Thanks everyone! -- Andrew ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
Don't worry got it solved, indicator was being lost (a local variable) and so I had to bind it as a property of the class and now even subclassing works! Hey, Glad you got it working... any chance you'd post a .zip of the files as you had before with the working example..? To test on my LXDE install, and just to see what exactly it is that this appindicator is all about..! Congrats, -Harry ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
On 30/06/10 14:41, Harry Van Haaren wrote: Aha, fully understand the problem now at least. Do you have one of these appIndicator dock things in your panel? The following document [1] seems to say that they might re-design/ change some things in how the docks work. I'm running LXDE, (no fancy AppIndicator dock I dont think...). What I suggest is that your compile using valac --save-temps (provides C output files), check that against the documentation of LibAppIndicator. I have no experience with LibAppIndicator and hence can't really help you much there. If it turns out that it should work, please send me sources and I can try it on my LXDE. -Harry PS: There was/is quite some controversy about libappindicator, see [2]. I'm not sure if this helps dev-s to write documentation test cases... I havent found any. Getting in touch with the authors or LibAppIndicator might be a good idea.. ? Up to you. [1] https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators [2] http://www.advogato.org/person/mbanck/diary.html?start=49 Sure, the window popus (which is correct), however the application indicator does not appear. Okay, so I spoke to the authors of appindicator and they couldn't work it out, a bit of a mystery, so instead of subclassing, I am just using a function to create a standard Indicator. One problem I have come up with now is more alarming, my code is as follows: uses Gtk AppIndicator class wMain : GLib.Object main_window : MainWindow init main_window = new MainWindow() var indicator = new Indicator(wasiliana,applications-utilities, Category.APPLICATION_STATUS) indicator.set_status(Status.ATTENTION) indicator.set_attention_icon (indicator-messages-new) var menu = new Menu() var show_menuitem = new CheckMenuItem.with_label(Show Wasiliana) menu.append(show_menuitem) menu.show_all() indicator.set_menu(menu) //Gtk.main() main_window.show_all() init Gtk.init (ref args) var w = new wMain() Gtk.main() Now unless I uncomment the //Gtk.main(), the indicator doesn't show. I don't know what the problem is, but one of the authors said it might be something to do with references (but I have no idea what these are) Any help? -- Andrew ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
On 29/06/10 12:58, Harry Van Haaren wrote: Hey! 2) Perhaps related, in the main.gs http://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? Maybe you understand this already, just in case though: Gtk needs to be initialized before you can use it (display any widgets or even create them). The function that does this is *Gtk.init() *Then you create some widgets, ie *Gtk.Button.with_label(Hello); *, add this to a window etc... And then to hand control over to Gtk, we call *Gtk.main()*. This function lets Gtk actually *DRAW* the window on the screen, and its is only now that the window is actually SHOWN to the user. (Despite that it was created long beforehand). Hence that these 3 steps are nessisary in your main() function. The reason that its a very good idea to put *Gtk.init() *and *Gtk.main() *in your *main()*, is this: If you want to show 2 toplevel windows, and you've got *Gtk.main()* in your class' init function, Gtk is going to create your class, and then show the window. (ie: pass control of the thread to Gtk.) This is going to halt the program exectution until this window is destroyed, and then your program gets control of the thread back, and the next class' init will be called, and that window shown. Don't think I explained that 100%, but hope you understand me anyway. Cheers, -Harry Thanks Harry for the explanation, it makes it a bit clearer, but it doesn't seem to solve the problem :-( Perhaps it is easier for Abderrahim and Harry if I just put my code online and tell you what is not happening. The file that are concerned are main.gs and indicator.gs The problem is that the wAppIndicator class defined in indicator.gs and created in main.gs does not show. However if I take the functions in the wAppIndicator class, put them into a function and just apply the functions to an instance of Indicator (the class from which wAppIndicator is subclassed from) and add Gtk.main() on the end (which means I have two overall), it then works. The problem is really why it doesn't work in the first place :-( BZR branch with code in (if you need it in other form, please don't hesitate to ask): https://code.launchpad.net/~and471/+junk/not-working -- Andrew ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
On 30/06/10 11:57, Harry Van Haaren wrote: BZR branch with code in (if you need it in other form, please don't hesitate to ask): Would you mind just tar-ing or zipping it? I tried to find a download zip button on Launchpad, only Bazaar is there I think though... And I don't use bazaar.. (Git :-) Just Email me the .zip or whatever is probably just as handy.. unless you want to post it online o course! Cheers, -Harry Okay, I have put a Zip of the branch in the branch which you can download here: http://bazaar.launchpad.net/~and471/+junk/not-working/annotate/head:/wasiliana.zip (just click download file) -- Andrew ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
On 30/06/10 12:37, Harry Van Haaren wrote: Okay, I have put a Zip of the branch in the branch which you can download here: http://bazaar.launchpad.net/~and471/+junk/not-working/annotate/head:/wasiliana.zip http://bazaar.launchpad.net/%7Eand471/+junk/not-working/annotate/head:/wasiliana.zip (just click download file) Hey, Downloaded it just there. Note to others that downloaded it: 1. Check dependencies (webkit etc) 2. Add the VAPI dir to the project, (its saved as /home/andrew/, and should be /home/yourName/.../) Andrew: In the .vide project you have included a file in /home/andrew/Temp/appindicator-0.1.vapi Were going to need that file too. Put it in the vapi folder. Another Q: Is the data folder part of what your doing? It seems.. a little unrelated? Cheers, -Harry The vapi is in the vapi/ dir, don't know why it has been set to another directory sorry about that. The appindicator-0.1.vapi is in the vapi/ dir Yes the data folder is related but I haven't connected any of it to the program yet. -- Andrew ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
In the .vide project you have included a file in /home/andrew/Temp/appindicator-0.1.vapi Were going to need that file too. Put it in the vapi folder. The vapi is in the vapi/ dir, don't know why it has been set to another directory sorry about that. The appindicator-0.1.vapi is in the vapi/ dir Hey, Your right about the appindicator.vapi being in the /vapi folder, sorry I got confused because there a link to a different appindicator.vapi in the project too. Nevermind, all that's needed is in the zip file. As for dependencies, the Ubuntu Lucid Lynx repos must be enabled ( updated) because libappindicator is a new library. (Im still on Ubuntu 9.10). As for compiling, fine, no problems, a window pops up when I run the program. :-) Could you describe the problem again to me? I dont really see what's going wrong..? -Harry ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
On 30/06/10 13:10, Harry Van Haaren wrote: In the .vide project you have included a file in /home/andrew/Temp/appindicator-0.1.vapi Were going to need that file too. Put it in the vapi folder. The vapi is in the vapi/ dir, don't know why it has been set to another directory sorry about that. The appindicator-0.1.vapi is in the vapi/ dir Hey, Your right about the appindicator.vapi being in the /vapi folder, sorry I got confused because there a link to a different appindicator.vapi in the project too. Nevermind, all that's needed is in the zip file. As for dependencies, the Ubuntu Lucid Lynx repos must be enabled ( updated) because libappindicator is a new library. (Im still on Ubuntu 9.10). As for compiling, fine, no problems, a window pops up when I run the program. :-) Could you describe the problem again to me? I dont really see what's going wrong..? -Harry Sure, the window popus (which is correct), however the application indicator does not appear. -- Andrew ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
Aha, fully understand the problem now at least. Do you have one of these appIndicator dock things in your panel? The following document [1] seems to say that they might re-design/ change some things in how the docks work. I'm running LXDE, (no fancy AppIndicator dock I dont think...). What I suggest is that your compile using valac --save-temps (provides C output files), check that against the documentation of LibAppIndicator. I have no experience with LibAppIndicator and hence can't really help you much there. If it turns out that it should work, please send me sources and I can try it on my LXDE. -Harry PS: There was/is quite some controversy about libappindicator, see [2]. I'm not sure if this helps dev-s to write documentation test cases... I havent found any. Getting in touch with the authors or LibAppIndicator might be a good idea.. ? Up to you. [1] https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators [2] http://www.advogato.org/person/mbanck/diary.html?start=49 Sure, the window popus (which is correct), however the application indicator does not appear. ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
On 30/06/10 14:41, Harry Van Haaren wrote: Aha, fully understand the problem now at least. Do you have one of these appIndicator dock things in your panel? The following document [1] seems to say that they might re-design/ change some things in how the docks work. I'm running LXDE, (no fancy AppIndicator dock I dont think...). What I suggest is that your compile using valac --save-temps (provides C output files), check that against the documentation of LibAppIndicator. I have no experience with LibAppIndicator and hence can't really help you much there. If it turns out that it should work, please send me sources and I can try it on my LXDE. -Harry PS: There was/is quite some controversy about libappindicator, see [2]. I'm not sure if this helps dev-s to write documentation test cases... I havent found any. Getting in touch with the authors or LibAppIndicator might be a good idea.. ? Up to you. [1] https://wiki.ubuntu.com/DesktopExperienceTeam/ApplicationIndicators [2] http://www.advogato.org/person/mbanck/diary.html?start=49 Sure, the window popus (which is correct), however the application indicator does not appear. Yes everything else is working, apart from my code :-( I am asking help from the developers, however if someone can spot why it isn't working before then (they are looking at the C code) please do tell me :-) -- Andrew ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
Hey! 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? Maybe you understand this already, just in case though: Gtk needs to be initialized before you can use it (display any widgets or even create them). The function that does this is *Gtk.init() *Then you create some widgets, ie *Gtk.Button.with_label(Hello); *, add this to a window etc... And then to hand control over to Gtk, we call *Gtk.main()*. This function lets Gtk actually *DRAW* the window on the screen, and its is only now that the window is actually SHOWN to the user. (Despite that it was created long beforehand). Hence that these 3 steps are nessisary in your main() function. The reason that its a very good idea to put *Gtk.init() *and *Gtk.main() *in your *main()*, is this: If you want to show 2 toplevel windows, and you've got *Gtk.main()* in your class' init function, Gtk is going to create your class, and then show the window. (ie: pass control of the thread to Gtk.) This is going to halt the program exectution until this window is destroyed, and then your program gets control of the thread back, and the next class' init will be called, and that window shown. Don't think I explained that 100%, but hope you understand me anyway. Cheers, -Harry ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
On 27/06/10 18:47, Abderrahim Kitouni wrote: Hi, 2010/6/27 Andrew rugby...@gmail.com: On 27/06/10 17:32, Abderrahim Kitouni wrote: Hi, 2010/6/27 Andrew rugby...@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 ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
On 26/06/10 23:09, Abderrahim Kitouni wrote: Hi, 2010/6/25, Andrew rugby...@gmail.com: Thankyou very much :-) That seemed to work and hopefully I shall try less ambitious things next time :-) However now I get this error, is this a bug in the library (this is without invoking a new instance of the subclass, just compiling the definition of the subclass)? /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_CATEGORY’ undeclared (first use in this function) [...] /home/andrew/Software/Projects/wasiliana/src/indicator.vala.c: In function ‘wapp_indicator_get_type’: /home/andrew/Software/Projects/wasiliana/src/indicator.vala.c:160: error: ‘APP_INDICATOR_TYPE_INDICATOR’ undeclared (first use in this function) I've told you this library is weird. Looking at the sources, these are APP_INDICATOR_TYPE_INDICATOR_CATEGORY and APP_INDICATOR_TYPE respectively. So the bindings need to be fixed: you need to add type_id=... (replacing the ... with the above types) to the CCode attribute of the enum/class. HTH, Abderrahim Sorry, is that in the vapi file or the actual source code? -- Andrew ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
On 27/06/10 08:16, Andrew wrote: On 26/06/10 23:09, Abderrahim Kitouni wrote: Hi, 2010/6/25, Andrew rugby...@gmail.com: Thankyou very much :-) That seemed to work and hopefully I shall try less ambitious things next time :-) However now I get this error, is this a bug in the library (this is without invoking a new instance of the subclass, just compiling the definition of the subclass)? /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_CATEGORY’ undeclared (first use in this function) [...] /home/andrew/Software/Projects/wasiliana/src/indicator.vala.c: In function ‘wapp_indicator_get_type’: /home/andrew/Software/Projects/wasiliana/src/indicator.vala.c:160: error: ‘APP_INDICATOR_TYPE_INDICATOR’ undeclared (first use in this function) I've told you this library is weird. Looking at the sources, these are APP_INDICATOR_TYPE_INDICATOR_CATEGORY and APP_INDICATOR_TYPE respectively. So the bindings need to be fixed: you need to add type_id=... (replacing the ... with the above types) to the CCode attribute of the enum/class. HTH, Abderrahim Sorry, is that in the vapi file or the actual source code? 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? Thankyou -- Andrew /* appindicator.vapi generated by vapigen, do not modify. */ [CCode (cprefix = AppIndicator, lower_case_cprefix = app_indicator_)] namespace AppIndicator { [CCode (cheader_filename = libappindicator/app-indicator.h, cname = AppIndicator, type_id=APP_INDICATOR_TYPE)] public class Indicator : GLib.Object { [CCode (cname = app_indicator_new, has_construct_function = false)] public Indicator (string id, string icon_name, AppIndicator.Category category); [NoWrapper] public virtual void app_indicator_reserved_1 (); [NoWrapper] public virtual void app_indicator_reserved_2 (); [NoWrapper] public virtual unowned Gtk.StatusIcon fallback (); [CCode (cname = app_indicator_get_attention_icon)] public unowned string get_attention_icon (); [CCode (cname = app_indicator_get_category)] public AppIndicator.Category get_category (); [CCode (cname = app_indicator_get_icon)] public unowned string get_icon (); [CCode (cname = app_indicator_get_id)] public unowned string get_id (); [CCode (cname = app_indicator_get_menu)] public unowned Gtk.Menu get_menu (); [CCode (cname = app_indicator_get_status)] public AppIndicator.Status get_status (); [CCode (cname = app_indicator_set_attention_icon)] public void set_attention_icon (string icon_name); [CCode (cname = app_indicator_set_icon)] public void set_icon (string icon_name); [CCode (cname = app_indicator_set_menu)] public void set_menu (Gtk.Menu menu); [CCode (cname = app_indicator_set_status)] public void set_status (AppIndicator.Status status); [NoWrapper] public virtual void unfallback (Gtk.StatusIcon status_icon); [CCode (cname = app_indicator_new_with_path, has_construct_function = false)] public Indicator.with_path (string id, string icon_name, AppIndicator.Category category, string icon_path); [NoAccessorMethod] public string attention_icon_name { owned get; set; } public string category { get; construct; } [NoAccessorMethod] public bool connected { get; } [NoAccessorMethod] public string icon_name { owned get; set; } [NoAccessorMethod] public string icon_theme_path { owned get; construct; } public string id { get; construct; } public string menu { get; } public string status { get; set; } public virtual signal void connection_changed (bool connected); public virtual signal void new_attention_icon (); public virtual signal void new_icon (); public virtual signal void new_status (string status); } [CCode (cprefix = APP_INDICATOR_CATEGORY_, cheader_filename = libappindicator/app-indicator.h)] public enum Category { APPLICATION_STATUS, COMMUNICATIONS, SYSTEM_SERVICES, HARDWARE, OTHER } [CCode (cprefix = APP_INDICATOR_STATUS_, cheader_filename = libappindicator/app-indicator.h)] public enum Status { PASSIVE, ACTIVE, ATTENTION } [CCode (cheader_filename = libappindicator/app-indicator.h)] public const string APP_INDICATOR_SIGNAL_CONNECTION_CHANGED; [CCode (cheader_filename = libappindicator/app-indicator.h)] public const string APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON; [CCode (cheader_filename = libappindicator/app-indicator.h)] public const string APP_INDICATOR_SIGNAL_NEW_ICON; [CCode (cheader_filename = libappindicator/app-indicator.h)] public const string APP_INDICATOR_SIGNAL_NEW_STATUS; } ___ vala-list mailing list vala-list@gnome.org
Re: [Vala] Genie, subclassing and some help!
Hi, 2010/6/27 Andrew rugby...@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 ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
On 27/06/10 18:11, Andrew wrote: On 27/06/10 17:32, Abderrahim Kitouni wrote: Hi, 2010/6/27 Andrew rugby...@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 (first use in this function) /home/andrew/Software/Projects/wasiliana/src/indicator.vala.c:82: error: (Each undeclared identifier is reported only once /home/andrew/Software/Projects/wasiliana/src/indicator.vala.c:82: error: for each function it appears in.) error: cc exited with status 256 The C and genie files are attached (if it helps) And the vapi file (probably more useful) -- Andrew /* appindicator.vapi generated by vapigen, do not modify. */ [CCode (cprefix = AppIndicator, lower_case_cprefix = app_indicator_)] namespace AppIndicator { [CCode (cheader_filename = libappindicator/app-indicator.h, cname = AppIndicator, type_id=APP_INDICATOR_TYPE)] public class Indicator : GLib.Object { [CCode (cname = app_indicator_new, has_construct_function = false)] public Indicator (string id, string icon_name, AppIndicator.Category category); [NoWrapper] public virtual void app_indicator_reserved_1 (); [NoWrapper] public virtual void app_indicator_reserved_2 (); [NoWrapper] public virtual unowned Gtk.StatusIcon fallback (); [CCode (cname = app_indicator_get_attention_icon)] public unowned string get_attention_icon (); [CCode (cname = app_indicator_get_category)] public AppIndicator.Category get_category (); [CCode (cname = app_indicator_get_icon)] public unowned string get_icon (); [CCode (cname = app_indicator_get_id)] public unowned string get_id (); [CCode (cname = app_indicator_get_menu)] public unowned Gtk.Menu get_menu (); [CCode (cname = app_indicator_get_status)] public AppIndicator.Status get_status (); [CCode (cname = app_indicator_set_attention_icon)] public void set_attention_icon (string icon_name); [CCode (cname = app_indicator_set_icon)] public void set_icon (string icon_name); [CCode (cname = app_indicator_set_menu)] public void set_menu (Gtk.Menu menu); [CCode (cname = app_indicator_set_status)] public void set_status (AppIndicator.Status status); [NoWrapper] public virtual void unfallback (Gtk.StatusIcon status_icon); [CCode (cname = app_indicator_new_with_path, has_construct_function = false)] public Indicator.with_path (string id, string icon_name, AppIndicator.Category category, string icon_path); [NoAccessorMethod] public string attention_icon_name { owned get; set; } public string category { get; construct; } [NoAccessorMethod] public bool connected { get; } [NoAccessorMethod] public string icon_name { owned get; set; } [NoAccessorMethod] public string icon_theme_path { owned get; construct; } public string id { get; construct; } public string menu { get; } public string status { get; set; } public virtual signal void connection_changed (bool connected); public virtual signal void new_attention_icon (); public virtual signal void new_icon (); public virtual signal void new_status (string status); } [CCode (cprefix = APP_INDICATOR_CATEGORY_, cheader_filename = libappindicator/app-indicator.h, type_id=APP_INDICATOR_TYPE_INDICATOR_CATEGORY)] public enum Category { APPLICATION_STATUS, COMMUNICATIONS, SYSTEM_SERVICES, HARDWARE, OTHER } [CCode (cprefix = APP_INDICATOR_STATUS_, cheader_filename = libappindicator/app-indicator.h)] public enum Status { PASSIVE, ACTIVE, ATTENTION } [CCode (cheader_filename = libappindicator/app-indicator.h)] public const string APP_INDICATOR_SIGNAL_CONNECTION_CHANGED; [CCode (cheader_filename = libappindicator/app-indicator.h)] public const string APP_INDICATOR_SIGNAL_NEW_ATTENTION_ICON; [CCode (cheader_filename = libappindicator/app-indicator.h)] public const string APP_INDICATOR_SIGNAL_NEW_ICON; [CCode (cheader_filename = libappindicator/app-indicator.h)] public const string APP_INDICATOR_SIGNAL_NEW_STATUS; } ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
Hi, 2010/6/27 Andrew rugby...@gmail.com: On 27/06/10 17:32, Abderrahim Kitouni wrote: Hi, 2010/6/27 Andrew rugby...@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. ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
Hi, 2010/6/25, Andrew rugby...@gmail.com: Thankyou very much :-) That seemed to work and hopefully I shall try less ambitious things next time :-) However now I get this error, is this a bug in the library (this is without invoking a new instance of the subclass, just compiling the definition of the subclass)? /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_CATEGORY’ undeclared (first use in this function) [...] /home/andrew/Software/Projects/wasiliana/src/indicator.vala.c: In function ‘wapp_indicator_get_type’: /home/andrew/Software/Projects/wasiliana/src/indicator.vala.c:160: error: ‘APP_INDICATOR_TYPE_INDICATOR’ undeclared (first use in this function) I've told you this library is weird. Looking at the sources, these are APP_INDICATOR_TYPE_INDICATOR_CATEGORY and APP_INDICATOR_TYPE respectively. So the bindings need to be fixed: you need to add type_id=... (replacing the ... with the above types) to the CCode attribute of the enum/class. HTH, Abderrahim ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
On 24/06/10 21:39, Abderrahim Kitouni wrote: Hi, 2010/6/24, Andrew rugby...@gmail.com: Hi guys, I am a programmer coming form python and I am trying to get to grips with Genie. One problem I am having is as follows: Say I have a class called Gerrard and to create a new version of this class, I use the following: var g = new Gerrard(arg1, arg2, arg3) Now I wish to subclass Gerrard, into the class Terry. However I wish to be able to create a new version of Terry as follows: var t = new Terry(arg1, arg2, arg3) How do I do this in Genie? it's as simple as construct (arg1: type1, arg2: type2, arg3: type3) super(arg1, arg2, arg3) BUT this won't work if the base class isn't defined in vala, in which case you'll need to find the properties initialized by the creation method (usually the same as the arg name) and chain up to GLib.Object directly, something like (untested) : construct (arg1: type1, arg2: type2, arg3: type3) Object(arg1: arg1, arg2: arg2, arg3: arg3) HTH, Abderrahim Thankyou for your help. I tried the first method but it didn't work (it is a Gtk object and so I doubted it would due to what you said above). I then tried to do the second method but I didn't really understand what to do. Could you do an example with this http://people.canonical.com/~ted/libappindicator/current/AppIndicator.html#app-indicator-new ? Again thankyou for you help -- Andrew ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
On 25/06/10 09:00, Abderrahim Kitouni wrote: Hi, 2010/6/25 Andrew rugby...@gmail.com: Thankyou for your help. I tried the first method but it didn't work (it is a Gtk object and so I doubted it would due to what you said above). I then tried to do the second method but I didn't really understand what to do. Could you do an example with this http://people.canonical.com/~ted/libappindicator/current/AppIndicator.html#app-indicator-new ? Take a look at the properties section [1], the construct only properties cannot be changed afterwards and so need to be passed to Object(...) if you don't want the default value. The other is icon-name (which becomes icon_name in Vala/Genie). What we notice here is that the usually part in my past message doesn't work : category is passed to the creation method as an enum but is stored in the property as a string. I'm not sure how to do the mapping, you may need to look at the source of app_indicator_new HTH, Abderrahim [1] http://people.canonical.com/~ted/libappindicator/current/AppIndicator.html#AppIndicator.properties Sorry maybe I didn't explain, I am using Genie for the VERY FIRST time and so what you are saying doesn't really mean anything to me. Could you give me an example that I could learn off of? -- Andrew ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
Hi, 2010/6/25 Andrew rugby...@gmail.com: Thankyou for your help. I tried the first method but it didn't work (it is a Gtk object and so I doubted it would due to what you said above). I then tried to do the second method but I didn't really understand what to do. Could you do an example with this http://people.canonical.com/~ted/libappindicator/current/AppIndicator.html#app-indicator-new ? Take a look at the properties section [1], the construct only properties cannot be changed afterwards and so need to be passed to Object(...) if you don't want the default value. The other is icon-name (which becomes icon_name in Vala/Genie). What we notice here is that the usually part in my past message doesn't work : category is passed to the creation method as an enum but is stored in the property as a string. I'm not sure how to do the mapping, you may need to look at the source of app_indicator_new HTH, Abderrahim [1] http://people.canonical.com/~ted/libappindicator/current/AppIndicator.html#AppIndicator.properties ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
Hi, 2010/6/25 Andrew rugby...@gmail.com: On 25/06/10 09:00, Abderrahim Kitouni wrote: Hi, 2010/6/25 Andrew rugby...@gmail.com: Thankyou for your help. I tried the first method but it didn't work (it is a Gtk object and so I doubted it would due to what you said above). I then tried to do the second method but I didn't really understand what to do. Could you do an example with this http://people.canonical.com/~ted/libappindicator/current/AppIndicator.html#app-indicator-new ? Take a look at the properties section [1], the construct only properties cannot be changed afterwards and so need to be passed to Object(...) if you don't want the default value. The other is icon-name (which becomes icon_name in Vala/Genie). What we notice here is that the usually part in my past message doesn't work : category is passed to the creation method as an enum but is stored in the property as a string. I'm not sure how to do the mapping, you may need to look at the source of app_indicator_new HTH, Abderrahim [1] http://people.canonical.com/~ted/libappindicator/current/AppIndicator.html#AppIndicator.properties Sorry maybe I didn't explain, I am using Genie for the VERY FIRST time and so what you are saying doesn't really mean anything to me. Could you give me an example that I could learn off of? I assumed you knew a bit of C and GObject to look at the source [1], you need to do something similar to this function in your construct (be careful to reindent correctly when copy-pasting) construct (id: string, icon: string, category: AppIndicatorCategory) Object(id: id, icon_name: icon, category: category_from_enum(category)) def category_from_enum (category: AppIndicatorCategory): string var categ_cls = (EnumClass) typeof(AppIndicatorCategory).class_ref() return categ_class.get_value(category).value_nick I didn't test this code but it should work. It's not always that difficult with Genie/Vala (Object(id: id, icon_name: icon, category: category) should be enough), it's just that this library is a bit weird (the value is an enum in the constructor and internally, but is exposed as a string to gobject). I think you should report this. HTH, Abderrahim [1] http://bazaar.launchpad.net/~indicator-applet-developers/indicator-application/trunk/annotate/head:/src/app-indicator.c#L1009 ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
On 25/06/10 10:29, Abderrahim Kitouni wrote: Hi, 2010/6/25 Andrew rugby...@gmail.com: On 25/06/10 09:00, Abderrahim Kitouni wrote: Hi, 2010/6/25 Andrew rugby...@gmail.com: Thankyou for your help. I tried the first method but it didn't work (it is a Gtk object and so I doubted it would due to what you said above). I then tried to do the second method but I didn't really understand what to do. Could you do an example with this http://people.canonical.com/~ted/libappindicator/current/AppIndicator.html#app-indicator-new ? Take a look at the properties section [1], the construct only properties cannot be changed afterwards and so need to be passed to Object(...) if you don't want the default value. The other is icon-name (which becomes icon_name in Vala/Genie). What we notice here is that the usually part in my past message doesn't work : category is passed to the creation method as an enum but is stored in the property as a string. I'm not sure how to do the mapping, you may need to look at the source of app_indicator_new HTH, Abderrahim [1] http://people.canonical.com/~ted/libappindicator/current/AppIndicator.html#AppIndicator.properties Sorry maybe I didn't explain, I am using Genie for the VERY FIRST time and so what you are saying doesn't really mean anything to me. Could you give me an example that I could learn off of? I assumed you knew a bit of C and GObject to look at the source [1], you need to do something similar to this function in your construct (be careful to reindent correctly when copy-pasting) construct (id: string, icon: string, category: AppIndicatorCategory) Object(id: id, icon_name: icon, category: category_from_enum(category)) def category_from_enum (category: AppIndicatorCategory): string var categ_cls = (EnumClass) typeof(AppIndicatorCategory).class_ref() return categ_class.get_value(category).value_nick I didn't test this code but it should work. It's not always that difficult with Genie/Vala (Object(id: id, icon_name: icon, category: category) should be enough), it's just that this library is a bit weird (the value is an enum in the constructor and internally, but is exposed as a string to gobject). I think you should report this. HTH, Abderrahim [1] http://bazaar.launchpad.net/~indicator-applet-developers/indicator-application/trunk/annotate/head:/src/app-indicator.c#L1009 Thankyou very much :-) That seemed to work and hopefully I shall try less ambitious things next time :-) However now I get this error, is this a bug in the library (this is without invoking a new instance of the subclass, just compiling the definition of the subclass)? /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_CATEGORY’ undeclared (first use in this function) /home/andrew/Software/Projects/wasiliana/src/indicator.vala.c:82: error: (Each undeclared identifier is reported only once /home/andrew/Software/Projects/wasiliana/src/indicator.vala.c:82: error: for each function it appears in.) /home/andrew/Software/Projects/wasiliana/src/indicator.vala.c: In function ‘wapp_indicator_get_type’: /home/andrew/Software/Projects/wasiliana/src/indicator.vala.c:160: error: ‘APP_INDICATOR_TYPE_INDICATOR’ undeclared (first use in this function) error: cc exited with status 256 -- Andrew ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
[Vala] Genie, subclassing and some help!
Hi guys, I am a programmer coming form python and I am trying to get to grips with Genie. One problem I am having is as follows: Say I have a class called Gerrard and to create a new version of this class, I use the following: var g = new Gerrard(arg1, arg2, arg3) Now I wish to subclass Gerrard, into the class Terry. However I wish to be able to create a new version of Terry as follows: var t = new Terry(arg1, arg2, arg3) How do I do this in Genie? In Python I would simply give the __init__ method the same arguments and then call Gerrard.__init__(self, arg1, arg2, arg3). I have gathered from some people that it has to do with the construct method and calling a 'base' function, however I am at a loss at what to do. Thankyou -- Andrew ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Genie, subclassing and some help!
Hi, 2010/6/24, Andrew rugby...@gmail.com: Hi guys, I am a programmer coming form python and I am trying to get to grips with Genie. One problem I am having is as follows: Say I have a class called Gerrard and to create a new version of this class, I use the following: var g = new Gerrard(arg1, arg2, arg3) Now I wish to subclass Gerrard, into the class Terry. However I wish to be able to create a new version of Terry as follows: var t = new Terry(arg1, arg2, arg3) How do I do this in Genie? it's as simple as construct (arg1: type1, arg2: type2, arg3: type3) super(arg1, arg2, arg3) BUT this won't work if the base class isn't defined in vala, in which case you'll need to find the properties initialized by the creation method (usually the same as the arg name) and chain up to GLib.Object directly, something like (untested) : construct (arg1: type1, arg2: type2, arg3: type3) Object(arg1: arg1, arg2: arg2, arg3: arg3) HTH, Abderrahim ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list