Re: [Vala] C# developer, newbie question

2018-12-19 Thread Wolfgang Mauer

Thanks, but same result, does it work that way at all?

GLib-GObject-CRITICAL **: 23:22:53.584: g_enum_get_value_by_name: 
assertion 'G_IS_ENUM_CLASS (enum_class)' failed


EnumClass enumc = (EnumClass)typeof(Gdk.WindowState).class_ref ();
var state = (Gdk.WindowState)enumc.get_value_by_name("FOCUSED").value;


I think it is better and easier to use int and string instead of enum

var val = ((int)get_window().get_state()).to_string();
.
var state = (Gdk.WindowState)int.parse(val);


Am 19.12.18 um 22:51 schrieb Andy Lees:
I believe it's because the string produced in your first assignment to 
strState is the C transformed enum value which concatenates the type 
and value with an "_".  It does this to map the nested name space of 
Vala enums into the flat C name space.  You would need to remove the 
type + "_" from the returned string to create the associated enum value.


On Wed, Dec 19, 2018 at 10:28 PM Wolfgang Mauer 
mailto:wolfgang.ma...@kabelmail.de>> wrote:


Hi all,
i try to put a enum to string and back, with no success.

var strState = get_window().get_state().to_string(); <--
"GDK_WINDOW_STATE_FOCUSED"

and back dont work

EnumClass enumc = (EnumClass)typeof(Gdk.WindowState).class_ref ();
var state = (Gdk.WindowState)enumc.get_value_by_name(strState).value;

What im doing wrong?

Thanks for help

Wolfgang


___
vala-list mailing list
vala-list@gnome.org 
https://mail.gnome.org/mailman/listinfo/vala-list


___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] C# developer, newbie question

2018-12-19 Thread Andy Lees via vala-list
I believe it's because the string produced in your first assignment to
strState is the C transformed enum value which concatenates the type and
value with an "_".  It does this to map the nested name space of Vala enums
into the flat C name space.  You would need to remove the type + "_" from
the returned string to create the associated enum value.

On Wed, Dec 19, 2018 at 10:28 PM Wolfgang Mauer 
wrote:

> Hi all,
> i try to put a enum to string and back, with no success.
>
> var strState = get_window().get_state().to_string(); <--
> "GDK_WINDOW_STATE_FOCUSED"
>
> and back dont work
>
> EnumClass enumc = (EnumClass)typeof(Gdk.WindowState).class_ref ();
> var state = (Gdk.WindowState)enumc.get_value_by_name(strState).value;
>
> What im doing wrong?
>
> Thanks for help
>
> Wolfgang
>
>
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] C# developer, newbie question

2018-12-19 Thread Wolfgang Mauer

Hi all,
i try to put a enum to string and back, with no success.

var strState = get_window().get_state().to_string(); <-- 
"GDK_WINDOW_STATE_FOCUSED"


and back dont work

EnumClass enumc = (EnumClass)typeof(Gdk.WindowState).class_ref ();
var state = (Gdk.WindowState)enumc.get_value_by_name(strState).value;

What im doing wrong?

Thanks for help

Wolfgang


___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] C# developer, newbie question

2018-12-19 Thread Wolfgang Mauer

Hi all,
i try to put a enum to string and back, with no success.

var strState = get_window().get_state().to_string(); <-- 
"GDK_WINDOW_STATE_FOCUSED"


and back dont work

EnumClass enumc = (EnumClass)typeof(Gdk.WindowState).class_ref ();
var state = (Gdk.WindowState)enumc.get_value_by_name(strState).value;

What im doing wrong?

Thanks for help
Wolfgang

___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] C# developer, newbie question

2018-12-18 Thread Wolfgang Mauer
>OK, to instantiate it I think it needs to be a GtkChild. What error 
are you getting with GtkChild?


Yes, i also think GtkChild is correct, i just remember that i have a 
similar problem with gtk-sharp.


Found the problem,

I'm kidding, forgot to include the namespace

Everything works fine, thanks a lot!


Am 18.12.18 um 16:08 schrieb Al Thomas:
> On Tuesday, 18 December 2018, 14:44:30 GMT, Wolfgang Mauer 
 wrote:


> So *i* have to make the "new StatusList" !?

> But how the glade-file "mainpaned" should look like??? Just remove 
the StatusList ?



OK, to instantiate it I think it needs to be a GtkChild. What error 
are you getting with GtkChild?



> Am 18.12.18 um 15:37 schrieb Al Thomas:
>> On Tuesday, 18 December 2018, 13:51:25 GMT, Wolfgang Mauer 
  wrote:
>> [GtkTemplate(ui = "/v/StatusList.glade")] public StatusList 
statusList;  << what to do here? Both [GtkChild] and [GtkTemplate] 
don't work
> The type StatusList is already defined and the GtkBuilder code is 
dealt with in its own class. So it should just be:

> public StatusList statusList;
> No need to tell Vala to generate extra code, you are just storing a 
reference to the widget in the main widget.

___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] C# developer, newbie question

2018-12-18 Thread Al Thomas via vala-list
   > On Tuesday, 18 December 2018, 14:44:30 GMT, Wolfgang Mauer 
 wrote:  > So i have to make the "new StatusList" 
!?
Not sure if it's the only way, but the following project uses 
 in the UI filethen instantiates the widget in 
the constructor of the main window and adds it to that window.
These files might give you a way to achieve what you want:
https://github.com/phastmike/gdx/blob/master/data/ui/share-window.uihttps://github.com/phastmike/gdx/blob/master/data/ui/share-spot-view.uihttps://github.com/phastmike/gdx/blob/master/src/Widgets/ShareWindow/share-window.vala

  
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] C# developer, newbie question

2018-12-18 Thread Al Thomas via vala-list
   > On Tuesday, 18 December 2018, 14:44:30 GMT, Wolfgang Mauer 
 wrote:   
> So i have to make the "new StatusList" !?
 
 
> But how the glade-file "mainpaned" should look like??? Just remove the 
> StatusList ?
 
 
OK, to instantiate it I think it needs to be a GtkChild. What error are you 
getting with GtkChild?


  > Am 18.12.18 um 15:37 schrieb Al Thomas:
 >> On Tuesday, 18 December 2018, 13:51:25 GMT, Wolfgang Mauer 
 >>  wrote:  >> [GtkTemplate(ui = 
 >> "/v/StatusList.glade")] public StatusList statusList;  << what to do 
 >> here? Both [GtkChild] and [GtkTemplate] don't work > The type StatusList is 
 >> already defined and the GtkBuilder code is dealt with in its own class. So 
 >> it should just be: > public StatusList statusList; > No need to tell Vala 
 >> to generate extra code, you are just storing a reference to the widget in 
 >> the main widget.

___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] C# developer, newbie question

2018-12-18 Thread Wolfgang Mauer
Thanks a lot, one Class per template, i understood that, but i can't 
find [GtkTemplate] inside [GtkTemplate]



Am 18.12.18 um 15:03 schrieb Steven Oliver:
I used Gtk.Builder + Glade in my application. It might help to see it 
used in a "real application".


https://github.com/steveno/balistica/blob/master/src/BalisticaApplication.vala#L80

Steven N. Oliver


On Tue, Dec 18, 2018 at 8:39 AM Al Thomas via vala-list 
mailto:vala-list@gnome.org>> wrote:


 >On Tuesday, 18 December 2018, 13:34:17 GMT, Wolfgang Mauer
mailto:wolfgang.ma...@kabelmail.de>>
wrote:
 > Is there a way to have a GtkTemplate inside a GtkTemplate ?

It sounds like you are trying to use a widget contained within
another widget?
I would try that in the GtkBuilder file. So the second widget is
references as a component within the larger widget, but is defined
separately. The Vala code would be two separateclasses with the
relevant GtkTemplate annotations.

___
vala-list mailing list
vala-list@gnome.org 
https://mail.gnome.org/mailman/listinfo/vala-list


___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] C# developer, newbie question

2018-12-18 Thread Steven Oliver via vala-list
I used Gtk.Builder + Glade in my application. It might help to see it used
in a "real application".

https://github.com/steveno/balistica/blob/master/src/BalisticaApplication.vala#L80

Steven N. Oliver


On Tue, Dec 18, 2018 at 8:39 AM Al Thomas via vala-list 
wrote:

>>On Tuesday, 18 December 2018, 13:34:17 GMT, Wolfgang Mauer <
> wolfgang.ma...@kabelmail.de> wrote:
>  > Is there a way to have a GtkTemplate inside a GtkTemplate ?
>
> It sounds like you are trying to use a widget contained within another
> widget?
> I would try that in the GtkBuilder file. So the second widget is
> references as a component within the larger widget, but is defined
> separately. The Vala code would be two separateclasses with the relevant
> GtkTemplate annotations.
>
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list
>
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] C# developer, newbie question

2018-12-18 Thread Al Thomas via vala-list
   >On Tuesday, 18 December 2018, 13:34:17 GMT, Wolfgang Mauer 
 wrote:  
 > Is there a way to have a GtkTemplate inside a GtkTemplate ?

It sounds like you are trying to use a widget contained within another widget?
I would try that in the GtkBuilder file. So the second widget is references as 
a component within the larger widget, but is defined separately. The Vala code 
would be two separateclasses with the relevant GtkTemplate annotations.
  
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] C# developer, newbie question

2018-12-18 Thread Wolfgang Mauer

Is there a way to have a GtkTemplate inside a GtkTemplate ?


Am 18.12.18 um 12:21 schrieb Wolfgang Mauer:

Ok, thanks a lot!

Am 18.12.18 um 12:09 schrieb Al Thomas:
> On Tuesday, 18 December 2018, 09:27:06 GMT, Wolfgang Mauer 
 wrote:

> In vala tried Gtk.Builder "extend_with_template".

> If i try this in vala with

> [GtkChild] private Box mainBox;
> i get the error "error: [GtkChild] is only allowed in classes with a
[GtkTemplate] attribute"

> Is there a other attribute for the gtk.builder using 
"extend_with_template"?


No there isn't. You either use [GtkChild] in a class marked with 
[GtkTemplate] and
Vala generates the right code for you or you code it all using the 
GTK+ API.


All the best,

Al

___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] C# developer, newbie question

2018-12-18 Thread Wolfgang Mauer

Ok, thanks a lot!

Am 18.12.18 um 12:09 schrieb Al Thomas:
> On Tuesday, 18 December 2018, 09:27:06 GMT, Wolfgang Mauer 
 wrote:

> In vala tried Gtk.Builder "extend_with_template".

> If i try this in vala with

> [GtkChild] private Box mainBox;
> i get the error "error: [GtkChild] is only allowed in classes with a
[GtkTemplate] attribute"

> Is there a other attribute for the gtk.builder using 
"extend_with_template"?


No there isn't. You either use [GtkChild] in a class marked with 
[GtkTemplate] and
Vala generates the right code for you or you code it all using the 
GTK+ API.


All the best,

Al

___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] C# developer, newbie question

2018-12-18 Thread Al Thomas via vala-list
   > On Tuesday, 18 December 2018, 09:27:06 GMT, Wolfgang Mauer 
 wrote: > In vala tried Gtk.Builder 
"extend_with_template".

> If i try this in vala with

> [GtkChild] private Box mainBox;
> i get the error "error: [GtkChild] is only allowed in classes with a 
[GtkTemplate] attribute"

> Is there a other attribute for the gtk.builder using "extend_with_template"?
No there isn't. You either use [GtkChild] in a class marked with [GtkTemplate] 
andVala generates the right code for you or you code it all using the GTK+ API.
All the best,
Al
  
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] C# developer, newbie question

2018-12-18 Thread Wolfgang Mauer

Good example so far, but not answer my question...


Am 18.12.18 um 12:00 schrieb Corentin Noël:

Hi Wolfgang!

You can find an example of Gtk.Builder with Vala soon in Valadoc itself
(will be at this page once the site get refreshed:
https://valadoc.org/gtk+-3.0/Gtk.Builder.html), in the meantime a
complete example is available from this commit:

https://github.com/Valadoc/valadoc-org/commit/7310a079d4faf67939641aa3715fc0963d0f8cc5

Hope it helps,
Regards,
Corentin

Le mardi 18 décembre 2018 à 10:26 +0100, Wolfgang Mauer a écrit :

Hi all,

in gtk-sharp i use the Gtk.Builder to "ExtendWithTemplate" my Widget.

In vala tried Gtk.Builder "extend_with_template".


In gtk-sharp i can define widgets like this:

glade-file








source-file

[Builder.Object]privateBoxmainBox;
[Builder.Object]privateBoxstartPage;


If i try this in vala with

[GtkChild] private Box mainBox;

i get the error "error: [GtkChild] is only allowed in classes with a
[GtkTemplate] attribute"

Is there a other attribute for the gtk.builder using
"extend_with_template"?


Thanks for help

Wolfgang

___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] C# developer, newbie question

2018-12-18 Thread Corentin Noël
Hi Wolfgang!

You can find an example of Gtk.Builder with Vala soon in Valadoc itself
(will be at this page once the site get refreshed: 
https://valadoc.org/gtk+-3.0/Gtk.Builder.html), in the meantime a
complete example is available from this commit:

https://github.com/Valadoc/valadoc-org/commit/7310a079d4faf67939641aa3715fc0963d0f8cc5

Hope it helps,
Regards,
Corentin

Le mardi 18 décembre 2018 à 10:26 +0100, Wolfgang Mauer a écrit :
> Hi all,
> 
> in gtk-sharp i use the Gtk.Builder to "ExtendWithTemplate" my Widget.
> 
> In vala tried Gtk.Builder "extend_with_template".
> 
> 
> In gtk-sharp i can define widgets like this:
> 
> glade-file
> 
> 
> 
> 
> 
> 
> 
> 
> source-file
> 
> [Builder.Object]privateBoxmainBox;
> [Builder.Object]privateBoxstartPage;
> 
> 
> If i try this in vala with
> 
> [GtkChild] private Box mainBox;
> 
> i get the error "error: [GtkChild] is only allowed in classes with a 
> [GtkTemplate] attribute"
> 
> Is there a other attribute for the gtk.builder using
> "extend_with_template"?
> 
> 
> Thanks for help
> 
> Wolfgang
> 
> ___
> vala-list mailing list
> vala-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/vala-list

___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


[Vala] C# developer, newbie question

2018-12-18 Thread Wolfgang Mauer

Hi all,

in gtk-sharp i use the Gtk.Builder to "ExtendWithTemplate" my Widget.

In vala tried Gtk.Builder "extend_with_template".


In gtk-sharp i can define widgets like this:

glade-file








source-file

[Builder.Object]privateBoxmainBox;
[Builder.Object]privateBoxstartPage;


If i try this in vala with

[GtkChild] private Box mainBox;

i get the error "error: [GtkChild] is only allowed in classes with a 
[GtkTemplate] attribute"


Is there a other attribute for the gtk.builder using "extend_with_template"?


Thanks for help

Wolfgang

___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list