Re: [Vala] vapigen and Autotools problem

2012-03-27 Thread august
Alejandro,

Is there a reason to create a .vapi file?  Couldn't your vala developers just
use the .gir file?  AFAIK, that is the preferred method for binding to vala if
you are already writing gobject libs.

-august.


   Hi, vala-list.
   Before anything else, I have to say I'm new to Vala and also to
 vapigen usage. I've been working on a library which uses GObject and GTK
 + and is written in C, now other developers are going to use this
 library to write an application, but they will do it using Vala, so I'm
 currently binding it using GObjectIntrospecton and vapigen, both
 integrated with the GNU Autotools.
 
   The directory structure of the library is composed by 4 directories,
 each of which contains an alredy generated .gir file. I've managed to
 integrate GObjectInstrospection in the project, and right now I'm
 dealing with vapigen (whose documentation about integration with
 Autotools doesn't exist, currently).
 
   The 4 directories have an horizontal dependency so the .gir of the
 first one is needed to generate the .gir (and .vapi) of the next one and
 so on with all of them, all being in the same level of the build tree. 
 
   To generate the .girs I've used the --include-uninstalled option to
 include the previously generated .gir file of the project. Now, when the
 build system tries to run vapigen to generate a .vapi that depends on
 another part of the library, it fails.
 
   The call to vapigen is something like this:
 $(VAPIGEN) --pkg glib-2.0 --pkg gobject-2.0 --pkg gvn-0.1 -d
 $(vapidir) --vapidir=$(vapidir) --library foo-0.1 Foo-0.1.gir
 
   The .vapi file of the gvn package is alredy generated (and put in
 the directory specified via the --vapidir option) at this point, as well
 as the .gir of the current package.
 
   And this is the error it produces:
 error: Package `Gvn-0.1' not found in specified Vala API directories
 or GObject-Introspection GIR directories
 
   I guess it has something to do with the package not being installed,
 but I couldn't find a way to tell it to vapigen. However that's just a
 guess, so I don't really know what i'm doing wrong and/or how to solve
 this. Can anyone help me with it?
   
   Thanks in advance!
 
   Regards,
 Alex
 
 PS: sorry if my english is a mess, if something is not clear tell me and
 I'll try to rewrite it.
 
 ___
 vala-list mailing list
 vala-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/vala-list

-- 
http://aug.ment.org
GPG: 0A8D 2BC7 243D 57D0 469D  9736 C557 458F 003E 6952

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


Re: [Vala] vapigen and Autotools problem

2012-03-27 Thread august
 August,
   I just didn't know that. Reading the documentation and looking at an
 official gnome project (GDA, that does the same thing I was trying to do) I
 though it was the only way to bind C to Vala. And the other developers I
 mentioned are using Vala by the first time, too.
 
   If I can do this that way I'll save some time! Can you give me some
 reference to that method?

If you have already created the .gir file and installed it in the proper
location (with other gir files), then you should be able to use it directly in
vala code.

For example, if you are writing a gobject lib called Mylib, you create a
Mylib-1.0.gir file and then a typelib file with something like:

g-ir-compiler --includedir $(PREFIX)/share/gir-1.0/ Mylib-1.0.gir -o 
Mylib-1.0.typelib 

and put the .gir file  under

$(PREFIX)/share/gir-1.0/

and put the .typelib file under

$(PREFIX)/lib/girepository-1.0/



then, vala users _should_ be able to call your api with:

using Mylib-1.0;


Since you are creating a GObject lib, I _thought_ the preferred method was
through .gir and not .vapia.  But, I could be wrong.  I remember getting
advised to do it this way on IRC.   Of course, I am writing my gobject C lib in
VALA, so that may have been why I was given that advice.


If any of this is wrong, I would also love to know the proper methodwith or
without autotools.

thanks, best, suerte -august.


-- 
http://aug.ment.org
GPG: 0A8D 2BC7 243D 57D0 469D  9736 C557 458F 003E 6952

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


[Vala] research papers

2011-11-07 Thread august


Hi,

I'm looking for research papers on Vala, GObject, or related
technologies, but I can't seem to find anything on google scholar.

Do they exist?

thanks -august.

-- 
http://aug.ment.org
GPG: 0A8D 2BC7 243D 57D0 469D  9736 C557 458F 003E 6952

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


Re: [Vala] vala on a mac

2011-09-06 Thread august


wow.  This is also very helpful.  Thanks for this.

Do you happen to know if GTK3 will be maintained on OSX?  Are the bugs
you mention ones that can be squashed?  It would be great to eventually
put together a workflow that is completely cross-compilable using vala.

-august.

 On Sat, Sep 3, 2011 at 5:29 PM, august aug...@alien.mur.at wrote:
  Thanks for this.  There's some good info in there.
 
  I'm sure there will be some differences with GTK+3, but this gives me a
  great place to starts.
 
 fyi GTK 3 is still pretty buggy on OS X, with rendering bugs, crashes
 etc, but it does work somewhat, and each new bug opened in bugzilla is
 a win for all of us who are determined to stick with GTK for UI on OS
 X as well :)
 
 For integrating with the menu, dock etc, and also .app packaging, you
 can find some stuff over here:
 
 https://github.com/jralls
 
 -- 
 Daniel Svensson

-- 
http://aug.ment.org
GPG: 0A8D 2BC7 243D 57D0 469D  9736 C557 458F 003E 6952

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


Re: [Vala] vala on a mac

2011-09-03 Thread august



Thanks for this.  There's some good info in there.

I'm sure there will be some differences with GTK+3, but this gives me a
great place to starts.

Thanks

-august.

 Yup. And I wrote this:
 
 http://radare.org/cgi-bin/wk/GTK
 
 On 01/09/2011, at 18:20, august aug...@alien.mur.at wrote:
 
  
  
  Hi,
  
 I'm looking to port some software from linux to a mac and eventually
 to windows.  Is anyone using vala on a mac to make deployable
 software?  If so, how do you create and package binaries?  Do you
 include glib and gtk+ inside of the app bundle?  If so, how?  If not,
 what other methods would you recommend for distributing or using
 shared libraries?
  
 Any other cross-compile and cross-distribution methods you use?
  
 thanks for any tips -august.
  
  
  
  -- 
  http://aug.ment.org
  GPG: 0A8D 2BC7 243D 57D0 469D  9736 C557 458F 003E 6952
  
  ___
  vala-list mailing list
  vala-list@gnome.org
  http://mail.gnome.org/mailman/listinfo/vala-list
  

-- 
http://aug.ment.org
GPG: 0A8D 2BC7 243D 57D0 469D  9736 C557 458F 003E 6952

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


[Vala] vala on a mac

2011-09-01 Thread august


Hi,

I'm looking to port some software from linux to a mac and eventually
to windows.  Is anyone using vala on a mac to make deployable
software?  If so, how do you create and package binaries?  Do you
include glib and gtk+ inside of the app bundle?  If so, how?  If not,
what other methods would you recommend for distributing or using
shared libraries?

Any other cross-compile and cross-distribution methods you use?

thanks for any tips -august.



-- 
http://aug.ment.org
GPG: 0A8D 2BC7 243D 57D0 469D  9736 C557 458F 003E 6952

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


Re: [Vala] Vala logo symbol voting

2011-08-27 Thread august

Hi Tobias, All,

I hope you don't mind me making a suggestion here.  I find all of the
graphics you've made to be very professional.  I really like the wing
and definitely prefer the 2 tone graphic over glass effects.

I was only wondering if it would be possible to see the wings with
another text graphic below it.  The vala with the sharp edges kind
of turns me off.  Vala is more of a rounded and soft word with lots
of vowels.  It rolls off the tongue.  The graphic I see in your
logos, however, expresses a lot of consonants and pointedness.  To
me, the current text graphic contradicts the forgiving and welcoming
feel of the vala language.  To me, vala takes the snagging edges out
of programming.  It's a more human and organic language, less
machine.

Would it be possible to round off the points on the text graphic?
I'm not sure it would be better, but I think it would be interesting
to see.  For sure, it will set other things in the logo out of
balance, but it just might fit the wings better.


best -august.



Tobias Bernard say:
 Hi
 
 Since there were no further comments on the logo drafts, I thought I'd
 propose to vote on the logo symbol.
 here http://ubuntuone.com/p/1DBL/'s a revised version of the logo symbol
 part of my proposal document http://ubuntuone.com/p/1AW8/ (alternative
 download http://tobias.bluestain.net/wp-content/uploads/2011/08/vala01.pdf
 )
 
 I don't know how you organize votings here, so I have some questions on
 that:
 What is needed to start an official voting?
 Is there a some kind of a leader who offcially announces votings?
 Who is allowed to vote and how many people need to vote to take a decision?
 
 After thinking a bit more about it, I changed certain poposals, deleted
 others and added new ones. Of course I tried to always keep your feedback in
 mind. So here's the changes in detail:
 
 1) Putting the symbol inside a circle for the main logo is a bad idea. In
 some cases the symbol could be used this way, but as a variant, not as the
 main one. This is why I deleted all proposals inside a circle.
 
 2) The symbolism of ancient warfare is hard to understand. Probably too
 hard to be understood instantly by most people, so I put that proposal away
 too.
 
 3) The simplicity of the first proposal (horizontal wing) was liked by many,
 so I added a similar symbol with a simple vertical wing.
 
 4) Thanks to XY, I used your idea for proposal 04, however I am still not
 sure if
  a) The V is readable
  b) The wing is recognizable
 
I thought I'd let the community decide this by voting ;)
 
 I'm looking forward to hear from you, so the votings can begin.
 Of course,  any kind of feedback is welcome and any changes can be made to
 the current proposals.
 
 kind regards
 tobias

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


-- 
---
http://aug.ment.org
GPG: 0A8D 2BC7 243D 57D0 469D  9736 C557 458F 003E 6952



signature.asc
Description: Digital signature
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] opengl and gtk+-3.0

2011-07-16 Thread august
 Am Freitag, den 24.06.2011, 19:57 +0200 schrieb august:
  Is there any way right now to open a GL context up inside of a GTK+3
  window using vala?
 
 Yes there is, but it's not as straightforward since nobody ported
 gtkglext yet.
 
 You should be able to create the context yourself using glx
 (not sure about systems without xorg though).
 I haven't done this myself yet so I'm afraid I cannot help you directly
 but you can take a look at the glchess source in the gnome-games
 repository http://git.gnome.org/browse/gnome-games/ to see an example
 (chess-view-3d.vala).
 
 Hope that helps.


Thanks for the link.  I finally got a chance to look at it.  But,
afaict, the glchess source you mention uses GTK+2's Drawable class and
glXSwapBuffers to do some indirect drawing in GL.  

What I am after is a straight forward GL context that can easily be used
in GTK+3.


Is there no such thing (using vala or c)?



thanks -august.
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Further speculations on couroutines, generators and threads : Emulating Go's goroutines and channels in Vala

2011-07-13 Thread august

I've been following this thread with interest.   I also find the
documentation about async methods in vala to be a little thin.  For
example, in the tutorial, the first line of description says:


With asynchronous methods it is possible to do programming without
any blocking.

The following examples in the tutorial  are much more enlightening...so
it's not that bad.   But, maybe it could be improved.


I always thought async methods:
a) are always single threaded
b) uses the glib runtime scheduler to simulate 
multi-processes
c) cannot take advantage of multi-core or multi-processor
computers

Is that correct?


Also, are there any plans to ease multi-core development in Vala?


thanks, best -august.


 Actually, this is Luca's code (the coroutine-based generator).
 
 (I am the guilty party to blame for the naive idea to try to add threads to
 it : I had the Goroutine/channel concept of Go in mind and was trying to
 emulate it by attempting to combine Luca's generator with threads).
 
 :)
 
 Serge.
 
 
 
 On Wed, Jul 13, 2011 at 3:02 PM, Jim Peters j...@uazu.net wrote:
 
  Serge Hulne wrote:
   Here is a further development of the idea of Luca Bruno about a Vala
   implementation for Generators:
  
   Simulating  Go's goroutines and channels in Vala:
  
   Basically the idea is to start as many threads as needed (which play the
   role of Go' goroutines) and to recuperate their output from a Generator
   (which plays the role of the Go channel form which the result from a
  given
   thread can be pulled):
 
  To clarify after all the confusion (partly my fault -- sorry):
 
  - Luco's Generator doesn't need threads, and it doesn't need a main
   loop either, even though it is using 'async'
 
  - The whole thing runs in a single thread
 
  A few thoughts:
 
  - 'async' is really powerful in Vala, but also quite hard to
   understand.  (I wish I could find a high-level design document
   explaining async in GIO.)
 
  - Its implementation of coroutines doesn't require another stack, it
   holds its state in a private data structure.  When it does a 'yield'
   it returns to the caller, and when it is next given control, it
   resumes the previous point of execution using a switch and 'goto'.
 
  - Probably it could all go a lot faster if less housekeeping was going
   on, but I haven't seen Go's implementation either, so who knows how
   it compares.  Anyway, Vala always puts functionality first and
   optimisation second, which suits people who want to get the job done
   now instead of waiting for the ultimate language to arrive, so that
   seems okay.
 
  Attached is a version of Serge's code with all the thread stuff cut
  out, which still works.
 
  Jim
 
  /
  using Posix;
 
  abstract class GeneratorG {
 private bool consumed;
 private unowned G value;
 private SourceFunc callback;
 
 public Generator () {
 helper ();
 }
 
 private async void helper () {
 yield generate ();
 consumed = true;
 }
 
 protected abstract async void generate ();
 
 protected async void feed (G value) {
 this.value = value;
 this.callback = feed.callback;
 yield;
 }
 
 public bool next () {
 return !consumed;
 }
 
 public G get () {
 var result = value;
 callback ();
 return result;
 }
 
 public GeneratorG iterator () {
 return this;
 }
  }
 
  class IntGenerator : Generatorint {
 protected override async void generate () {
 for (int i=0; i  10; i++) {
  if (i%2 ==0) yield feed (i);
 }
 }
  }
 
  class IntGenerator_1 : Generatorint {
 protected override async void generate () {
 for (int i=0; i  10; i++) {
  if (i%2 !=0) yield feed (i);
 }
 }
  }
 
  int main(string[] args) {
 
 var gen = new IntGenerator();
 var gen_1 = new IntGenerator_1();
 
 print(\n\nResults computed in first generator\n);
 
 var i=0;
 foreach (var item in gen) {
 if (i10) Posix.stdout.printf(%i\n, item);
 i++;
 }
 
  print(\n\nResults computed in the second generator\n\n);
 
 i=0;
 foreach (var item in gen_1) {
 if (i10) Posix.stdout.printf(%i\n, item);
 i++;
 }
 
 return 0;
  }
 
  /
 
  --
   Jim Peters  (_)/=\~/_(_) j...@uazu.net
   (_)  /=\  ~/_  (_)
   Uazú  (_)/=\~/_(_)http://
   in Peru(_)  /=\  ~/_  (_)uazu.net
 

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


-- 
---
http://aug.ment.org



signature.asc
Description: Digital signature

Re: [Vala] opengl and gtk+-3.0

2011-06-24 Thread august

Is there any way right now to open a GL context up inside of a GTK+3
window using vala?


 I've been trying to automatically parse the headers glext.h and glxext.h so I 
 could use OpenGL functions that aren't available in the current gl.vapi 
 (anything beyond OpenGL 1.3). So far, I've managed to produce bindings for 
 the 
 functions and the constants defined in both headers. I'm not sure what to do 
 with the types, though.
 
 Is there anywhere I can go to find out what all the [IntegerType (rank=9)] 
 stuff 
 means, and how I decide to use rank=9 versus rank=7 or 6, or whatever number 
 strikes my fancy?
 
 I've attached my progress so far. There are two python  files; each of them 
 parse the header they are named after. Two directories need to be present
 before either script runs: intermediates and xintermediates.
 
 To run the script, type:
 
 python vala_glext_header_parser.py debug
 
 The scripts produces 4 things:
 1. and 2.) A constants.vapi and functions.vapi file either in 
 intermediates 
 or xintermediates, depending on whether the parser is for GL or GLX.
 
 3.) A debug log
 
 4.) A list of the types used in each function printed to the command line. 
 This 
 is so I have an easy-to-reference list of the types used in the .vapi that 
 need 
 binding.
 
 
 On Mon Jun 5 2011, august wrote:
 Are there .vapi's that work with openGL and GTK+-3.0?
 
 any examples?
 
 thanks -august.





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


-- 
---
http://aug.ment.org



signature.asc
Description: Digital signature
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] pulseaudio example

2011-05-22 Thread august


I thought this might be useful for others.  

PulseAudio comes with vapi bindings, but without any examples.  

Here is a simple example that uses their  callback api to generate and
play a sine wave.

http://pastebin.com/h92TT5hD

maybe one could put it in the gnome live examples page.


best -august.
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] vala, libpeas, GIR

2011-05-18 Thread august

Hi there,

I've been playing around with vala, libpeas, and plugins loaded on
the fly through libseed (javascript) and python.  

The way you make plugins in libpeas  is through extensions.  These
can be defined through an interface.  It looks something like this:

public interface MyActivatable : Object {
public abstract ScriptableWindow window { get; set; }
public abstract void activate ();
public abstract void deactivate ();
}

Since libpeas doesn't really handle Vala code, I've been trying to
write vala that compiles close to the same C code that libpease
wants.

The above interface works to some extent, but I did
noticed that the  GIR file that  vala produces is not the same as
what libpeas has.  They have a default interface called Activatable
whos GIR file looks like so (section): 

 field name=activate
callback name=activate
  return-value transfer-ownership=none
type name=none c:type=void/
  /return-value
  parameters
parameter name=activatable transfer-ownership=none
  type name=Activatable c:type=PeasActivatable*/
/parameter
  /parameters
/callback
  /field

The GIr that vala produces looks like this however:

callback name=my_activatable_activate 
c:type=my_activatable_activate
  return-value transfer-ownership=none
type name=none/
  /return-value
/callback

 It is missing the field tags altogether.  Since they are using some 
sort
of automatic means of generating the GIR file, I wonder where these field
statems come from.  I was told on the #libpeas IRC that the GIR creation is off
in vala.   Any ideas or help on this? 

There is something wrong in the GIR that causes all python plugins to 
crash when they use MyActivatable instead of the default Activatable from 
libpeas.

thanks -august.
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Cross compiling vala gtk to win32

2011-04-30 Thread august


fantastico.  This is really useful.  Thanks for taking the time and
effort.


 I spend some time this morning to write down some notes and upload some blobs 
 and examples to build gtk apps for windows and osx.
 
 Have fun
 
 http://radare.org/cgi-bin/wk/GTK
 
 On 30/04/2011, at 0:44, august aug...@alien.mur.at wrote:
 
  
  I would be very interested in both the mingw cross compile instructions
  and the OSx dmg creation instructions.
  
  (Would be great to work out the GTK3 kinks too.)
  
  best -august.
  
  
  I have crosscompiled big vala+gtk (gtkaml) apps with mingw from linux to 
  windows.
  
  The setup is simple, but requires some tricks. 
  
  I used to install the last gtk blobs for windows and then by setting 
  pkgconfig, cflags and ldflags yo point to the directory containing the 
  liba and include files the projects compiles just fine.
  
  I have a zip somewhere with all this environment prepared (w32 blobs and a 
  test program in valagtl that crosscompiles with 'make') .. I will have to 
  find it because im replying thia from my phone. 
  
  But if someone finds it interesting i can provide instructions and the zip 
  for this.
  
  I have also recently packaged a vala+gtkon app for osx with gtk and quartz 
  (no x11). And stored in a standalone .app in a .dmg image.. 
  
  If someone finds this interesting i can write some instructions to do it.
  
  I still have to play with the themes (to be emedded in the .app) and i 
  would love to switch to gtk3. If someone have any experience with it let 
  me know :)
  
  --pancake
  
  On 29/04/2011, at 17:34, Martin Leibner mleib...@tincorad.com wrote:
  
  Hello,
  
  I'm a GNU beginner learning Vala since a couple of months and after 
  playing
  and enjoying a lot in my Ubuntu desktop installation, now I want to build
  some small apps to be used by MS Windows users.
  I came into MingW32, and with some efforts finally was able to build a
  console-based 'HelloWorld' targeting i586-mingw32msvc
  But it's getting really difficult to build a gtk-based 'HelloWorld', btw 
  I'm
  using autotools stack.
  
  Someone could help me, maybe with a minimal gtk vala sample application
  targeting w32 ?
  
  I looked at valaide source but it uses waf and I'm not really used to it.
  
  Thanks in advance,
  Greetings,
  Martín
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] Cross compiling vala gtk to win32

2011-04-29 Thread august

I would be very interested in both the mingw cross compile instructions
and the OSx dmg creation instructions.

(Would be great to work out the GTK3 kinks too.)

best -august.


 I have crosscompiled big vala+gtk (gtkaml) apps with mingw from linux to 
 windows.
 
 The setup is simple, but requires some tricks. 
 
 I used to install the last gtk blobs for windows and then by setting 
 pkgconfig, cflags and ldflags yo point to the directory containing the liba 
 and include files the projects compiles just fine.
 
 I have a zip somewhere with all this environment prepared (w32 blobs and a 
 test program in valagtl that crosscompiles with 'make') .. I will have to 
 find it because im replying thia from my phone. 
 
 But if someone finds it interesting i can provide instructions and the zip 
 for this.
 
 I have also recently packaged a vala+gtkon app for osx with gtk and quartz 
 (no x11). And stored in a standalone .app in a .dmg image.. 
 
 If someone finds this interesting i can write some instructions to do it.
 
 I still have to play with the themes (to be emedded in the .app) and i would 
 love to switch to gtk3. If someone have any experience with it let me know :)
 
 --pancake
 
 On 29/04/2011, at 17:34, Martin Leibner mleib...@tincorad.com wrote:
 
  Hello,
  
  I'm a GNU beginner learning Vala since a couple of months and after playing
  and enjoying a lot in my Ubuntu desktop installation, now I want to build
  some small apps to be used by MS Windows users.
  I came into MingW32, and with some efforts finally was able to build a
  console-based 'HelloWorld' targeting i586-mingw32msvc
  But it's getting really difficult to build a gtk-based 'HelloWorld', btw I'm
  using autotools stack.
  
  Someone could help me, maybe with a minimal gtk vala sample application
  targeting w32 ?
  
  I looked at valaide source but it uses waf and I'm not really used to it.
  
  Thanks in advance,
  Greetings,
  Martín
  ___
  vala-list mailing list
  vala-list@gnome.org
  http://mail.gnome.org/mailman/listinfo/vala-list
 ___
 vala-list mailing list
 vala-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/vala-list

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


[Vala] vala + gtk+-3.0 ?

2011-03-24 Thread august

sorry if I break threading on this post.
I am replying to this mail:
http://mail.gnome.org/archives/vala-list/2011-March/msg00134.html

I lost the original posting.



I posted a gtk+ 3.0 example in February:

http://mail.gnome.org/archives/vala-list/2011-February/msg00096.html

I hope this helps.

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


[Vala] widget subclass example for gtk+-3.0

2011-02-24 Thread august

Below is a revised version of the widget subclass example given here:
http://live.gnome.org/Vala/CustomWidgetSamples

It is update to work with gtk+-3.0.   It took me a while to figure out what 
needed to be changed to work with the latest gtk (there may still be some wonky 
bits there, so feel free to revise further).  Maybe it is useful for someone 
else.

best -august.





using Gtk;
using Gdk;
using Cairo;

public class ValaWidget : Widget {

private static const string TEXT = Hello World!;
private static const int BORDER_WIDTH = 10;
private Pango.Layout layout;
construct {
this.layout = create_pango_layout (TEXT);
set_has_window (false); //need this for 
some reason, don't know why.
set_size_request (100, 100);
}

public override bool draw(Cairo.Context cr) {
int width  = this.get_allocated_width();
int height  = this.get_allocated_height();
// In this example, draw a rectangle in the foreground 
color
//Gdk.cairo_set_source_color (cr, 
this.style.fg[this.state]);
cr.set_source_rgba (0.5,0.5,0.5, 1);
cr.rectangle (BORDER_WIDTH, BORDER_WIDTH,
width - 2 * BORDER_WIDTH,
height - 2 * BORDER_WIDTH);
cr.set_line_width (5.0);
cr.set_line_join (LineJoin.ROUND);
cr.stroke ();

// And draw the text in the middle of the allocated 
space
int fontw, fonth;
this.layout.get_pixel_size (out fontw, out fonth);
cr.move_to ((width - fontw) / 2,
(height - fonth) / 2);
Pango.cairo_update_layout (cr, this.layout);
Pango.cairo_show_layout (cr, this.layout);
return true;
}

static int main (string[] args) {
Gtk.init (ref args);

var win = new Gtk.Window (Gtk.WindowType.TOPLEVEL);
win.border_width = 5;
win.title = Widget test;
win.destroy.connect (Gtk.main_quit);

var frame = new Frame (Example Vala Widget);
win.add (frame);

var widget = new ValaWidget ();
frame.add (widget);

win.show_all ();

Gtk.main ();
return 0;
}
}

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


Re: [Vala] appsink binding in gstreamer

2010-09-28 Thread august


okay, I received some help from the IRC channel (thanks!) and here is
what I found:

To create the appsink object, you need to use the element factory and
cast it like this:

// not this.sink = AppSink()  like you would think.
this.sink = (AppSink)ElementFactory.make (appsink, sink);

then, you can set the signals like so:

this.sink.new_preroll.connect(this.new_preroll);
this.sink.new_buffer.connect(this.new_buf_cb);

my problem now  is how to deal with Gst.Buffers.  Sorry if my questions
are elementary.  I'm trying to learn vala, glib, gst all at once.  
In my signal callback for new_buffer, I do this:

private void new_buf_cb( ) {
print(new buffer.\n);
//Gst.Buffer.replace(ref buffer,this.sink.pull_buffer() );
buffer = this.sink.pull_buffer();
this.queue_draw();
}

Can someone tell my why the app crashes when trying to assign the
pull_buffer() to my Buffer buffer?

I also tried to call replace on the buffer, but it won't compile.

Any hints?

chugging along -august.


 
 I was talking with some folks about the faulty appsink bindings in
 gstreamer on IRC last night.
 
 I also found this online:
 http://www.mail-archive.com/vala-list@gnome.org/msg05147.html
 
 Any answers to those questions?
 
 It seems you can't even create the AppSink object.
 
 Is there another way to create it and set the signals using
 ElementFactory ?
 
 
 thanks -august.
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


[Vala] appsink binding in gstreamer

2010-09-27 Thread august

I was talking with some folks about the faulty appsink bindings in
gstreamer on IRC last night.

I also found this online:
http://www.mail-archive.com/vala-list@gnome.org/msg05147.html

Any answers to those questions?

It seems you can't even create the AppSink object.

Is there another way to create it and set the signals using
ElementFactory ?


thanks -august.
___
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list


Re: [Vala] valgrind or something similar

2010-09-27 Thread august

thanks for all the tips.

 Hey August,
 
 Am Sonntag, den 26.09.2010, 20:18 +0200 schrieb august:
  Is there something like a valgrind or method for debugging memory
  leaks and mismanagement?
 
 Something that helped me in real life (tm) was using nemiver and
 watching the ref_count field of Object derived classes.
 
 You need to compile the vala files using the -g flag, to be able to use
 nemiver (a gdb gui).
 
 Greetings
 - fabian

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


[Vala] valgrind or something similar

2010-09-26 Thread august

Hi,

I'm new to the reference counting way of glib.  I'm also a little
worried about the weak and unowned keywords.  After reading the docs,
I'm still a bit confused.  

Is there something like a valgrind or method for debugging memory
leaks and mismanagement?

thanks -august.

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