* Jared Moore wrote, On 23/06/08 13:27:
> Hi Sam,
>
> I'm having trouble understanding exactly what you are trying to access
> where. Would you please be able to send a complete and minimal test
> case, i.e. a standalone program which is as small as possible and
> demonstrates the problem.
>   
sorry; I'm confusing my larger design problem with smaller technical
problems and it makes it hard to see what the specific complaint is.

here is a small file; t.vala, compile it with:
  valac --pkg gtk+-2.0 t.vala

The problem is that Subclass cannot access protected member "widgets" of
the Superclass.

[EMAIL PROTECTED]:~/projects/vala/phoneui/src$ valac --pkg gtk+-2.0 t.vala
t.vala:13.5-13.16: error: Access to private member `window_widgets.blah'
denied
    widgets.blah=null;
    ^^^^^^^^^^^^
Compilation failed: 1 error(s), 0 warning(s)


The widgets member is declared in the .h file (therefore public-ish),
but vala still call's it private.


using Gtk;

protected struct window_widgets {
    Gtk.Object blah;
}

public class Superclass : Gtk.Object {
    protected window_widgets widgets;
}

public class Subclass : Superclass {
  construct {
    widgets.blah=null;
  }
}

> Cheers,
> Jared
>
> 2008/6/23 Sam Liddicott <[EMAIL PROTECTED]>:
>   
>> Even defining it as an outer class makes vala think that it is private:
>>
>> /* widgets is still private */
>>     public class window_widgets {
>>     Gtk.Widget blah;
>>     Gtk.Widget blah2;
>>     }
>>
>> public class PhoneUIGlade : Gtk.Object {
>>     protected Glade.XML xml;
>>     public window_widgets widgets;
>> }
>>
>> but if I go back to a struct, it "works" and for some reason isn't giving me
>> incomplete class either.
>>
>>     public struct window_widgets {
>>     Gtk.Widget blah;
>>     Gtk.Widget blah2;
>>     }
>>
>> public class PhoneUIGlade : Gtk.Object {
>>     protected Glade.XML xml;
>>     public window_widgets widgets;
>> }
>>
>> But if I change "public" to "protected" (below) the generated .h files are
>> correctly exposing the protected members, but vala still complains that:
>> Access to private member `window_widgets.blah' denied
>> if a subclass tries to access the widgets member.
>>
>>     protected struct window_widgets {
>>     Gtk.Widget blah;
>>     Gtk.Widget blah2;
>>     }
>>
>> public class PhoneUIGlade : Gtk.Object {
>>     protected Glade.XML xml;
>>     protected window_widgets widgets;
>> }
>>
>>
>> * Sam Liddicott wrote, On 23/06/08 12:58:
>>
>> public class PhoneUIGlade : Gtk.Object {
>>     protected Glade.XML xml;
>>     public class window_widgets {
>>     Gtk.Widget blah;
>>     Gtk.Widget blah2;
>>     }
>>     protected window_widgets widgets;
>>     private Module module;
>> }
>>
>> Does not work; a subclass cannot access the protected member "widgets" with
>> the error:
>>  error: Access to private member `PhoneUIGlade.window_widgets.blah' denied
>>
>> Making the class and variable public do not work:
>>
>> public class PhoneUIGlade : Gtk.Object {
>>     protected Glade.XML xml;
>>     public class window_widgets {
>>     Gtk.Widget blah;
>>     Gtk.Widget blah2;
>>     }
>>     public window_widgets widgets;
>>     private Module module;
>> }
>>
>> aggghhhh
>>
>> Sam
>>
>> ________________________________
>> _______________________________________________
>> Vala-list mailing list
>> [email protected]
>> http://mail.gnome.org/mailman/listinfo/vala-list
>>
>>
>> _______________________________________________
>> Vala-list mailing list
>> [email protected]
>> http://mail.gnome.org/mailman/listinfo/vala-list
>>
>>
>>     

_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to