[Vala] libserialport binding

2015-06-18 Thread
Hi:

i was written libserialport vala's binding

https://github.com/Matrix-Zhang/libserialport-vala

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


[Vala] How to implement gtk textview auto scroll?

2015-01-22 Thread
Hi:

I'm using Vala to write a serialport tool...

the window class implement the observer and the serialport class as the
subject, so i need the textview could auto scroll to the end...

right now, my solution is :

1.when serialport data coming, insert the data at the end of the
textbuffer

public void data_report(uint8[] data, int size)
{
Gtk.TextIter iter;

textbuffer_output.get_end_iter(out iter);

textbuffer_output.insert(ref iter, (string)data, size);
}

2. in the textview's size_allocate event, scroll to the end

[GtkCallback]
public void on_textview_output_size_allocate(Gtk.Allocation
allocation)
{
Gtk.TextIter iter;

textbuffer_output.get_end_iter(out iter);

textview_output.scroll_to_iter(iter, 0, false, 0, 0);
}

it works well under the windows with msys2's gtk3's bundle, but it will
crash under ubuntu 14.04 if the data report fast...

   (magicom:3547): Gtk-WARNING **: Invalid text buffer iterator: either the
iterator is uninitialized, or the characters/pixbufs/widgets in the buffer
have been modified since the iterator was created.
You must use marks, character numbers, or line numbers to preserve a
position across buffer modifications.
You can apply tags and insert marks without invalidating your iterators,
but any mutation that affects 'indexable' buffer contents (contents that
can be referred to by character offset)
will invalidate all outstanding iterators
coredump
___
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] About Translating Vala Tutorial

2013-01-24 Thread
i have already done this work now

i want to devote my result to offical community

but, because of some issues for support chinese in Latex, i just work in
libreoffice...

i don't know how to generate standard doc for offical community, there are
.odt and .pdf edition of my translation tutorial...




2013/1/16 Matrix.Zhang pigex.zh...@gmail.com

  Hi:
 i'm try to translating the Vala Tutorial (
 https://live.gnome.org/Vala/Tutorial#Generics ) into chinese.

 i have been translated into Chapter 4

 i have two questions:

 1) in section about structs, the Tutorial said **:

 A Vala struct may have methods in a limited way and also may
 have private members, meaning the explicit public access modifier is
 required.

 but i write following code like :

 struct STest {

 private int member;
 }

 static int main() {

 STest s = STest ();

 s.member = 1;

 return 0;
 }

 there was no any errors hint when build the code, but in c#, it
 should error

 i want to know, if it is a bug, or not support actually


 2) in section about gobject - style construction, the Tutorial said :

 Construct properties are defined just as get and setproperties, 
 and therefore can run arbitrary code on assignment. If you need
 to do initialisation based on a single construct property, it is possible
 to write a custom construct block for the property, which
 will be executed immediately on assignment, and before any other
 construction code.

 there is no example about this feature,  i don't know how to do
 this , and in my mind, the construct block is execute after then property
 construction, except the static construct block, but it would not
 conform this clearly.

 i want a example, thank you


 Thank you for your reply, and best regards to you! at last sorry my
 bad english


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