Re: [Vala] vala on a mac
On Sat, Sep 3, 2011 at 5:29 PM, august 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 ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] How to use Gtk.Builder in our custum widgets?
On Sun, Jul 3, 2011 at 11:49 AM, Daniel Svensson wrote: > On Sat, Jul 2, 2011 at 3:57 PM, Sepehr Aryani wrote: >> does not work well for me. Besides I need to pass Gtk.builder reference to >> MyWindow to be able to handle the ui inside my custom window class. In C++ >> we could do this using get_widget_derived. I didn't see the same mechanism >> in Vala's gtk library. would someone please help me? > > Do you have MyWindow in your .ui file? > > I do this quite extensively in my application, here is one example: > http://git.xmms.se/xmms2/abraca/tree/src/components/server/server_browser.vala#n42 > > and the .ui-file: > http://git.xmms.se/xmms2/abraca/tree/data/ui/server_browser.xml#n18 > > it was a while since I wrote that and I'm not sure if you need to > explicitly add the Buildable interface or if that comes with the > widget you inherit.. but anyway.. something like that ought to get you > started. And if you still want to be able to edit your .ui-files in glade, you have to build glade modules for your widgets too. You can find details on how to do that in the above mentioned git repository too. -- Daniel Svensson ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] How to use Gtk.Builder in our custum widgets?
On Sat, Jul 2, 2011 at 3:57 PM, Sepehr Aryani wrote: > I've created a UI in glade and I want to use it inside my vala app. I need to > derive my own Gtk.Window and customize it but the problem is that I don't > know how to relate UI to my custom Window class. > > class MyWindow : Gtk.Window{ > public Window(){ > } > } > var window = (MyWindow) builder.get_object("gld_top_window"); // > !! does not work correctly > window.destroy.connect(Gtk.main_quit); > window.show_all(); > does not work well for me. Besides I need to pass Gtk.builder reference to > MyWindow to be able to handle the ui inside my custom window class. In C++ we > could do this using get_widget_derived. I didn't see the same mechanism in > Vala's gtk library. would someone please help me? Do you have MyWindow in your .ui file? I do this quite extensively in my application, here is one example: http://git.xmms.se/xmms2/abraca/tree/src/components/server/server_browser.vala#n42 and the .ui-file: http://git.xmms.se/xmms2/abraca/tree/data/ui/server_browser.xml#n18 it was a while since I wrote that and I'm not sure if you need to explicitly add the Buildable interface or if that comes with the widget you inherit.. but anyway.. something like that ought to get you started. -- Daniel Svensson ___ vala-list mailing list vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] when will vala 0.8 be released?
On Wed, Nov 18, 2009 at 6:44 PM, Frederik wrote: > I have another hackathon idea: A documentation "hackathon". That's > something where everyone can help. For example, one thing that lacks > documentation are code attributes used for bindings ([CCode] et al.) -- > a tutorial for writing bindings by hand. And there are still some > language features not documented in the tutorial (e.g. stack allocated > arrays, dynamic growth for dynamically allocated arrays, static > initialization, generic methods, hiding methods, inline methods, extern > methods). The "Working with Collections" section is still for libgee < 0.5. Got curious, how do you make stack allocated arrays? -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Building a build tool
On Tue, Sep 29, 2009 at 11:30 PM, Phil Housley wrote: > I've been messing around with a little build tool recently (well, > actually not that recently, but I've not had any time for a couple of > months,) aiming to build primarily Vala apps and libraries. Generally > it's a bit inspired by Maven, so you declare some units to build, and > let the tool decide what actually needs to be done. Something that would be very sweet is if you've made it easy to embed and access resources such as images and UI description files from Vala.. any data really. So that the build system produces object files from these, similar to that of winres on Wintendo, and QT's stuff there. I've done this in my current SCons setup so that I can distribute a single binary that contains my whole application. Here's some examples: Here using the BinaryBlob type: http://git.xmms.se/?p=abraca.git;a=blob;f=data/ui/SConscript And here using the GdkPixBuf C-Source program: http://git.xmms.se/?p=abraca.git;a=blob;f=data/SConscript Behind the scenes a .vapi file is generated to match these symbols so that they can be used from within Vala: http://git.xmms.se/?p=abraca.git;a=blob;f=src/medialib.vala#l65 See the Resources.XML.mediainfo there, which is a null terminated string embedded into the binary. The tools that perform these operations are kind of hacky, but works well enough for my use cases: http://git.xmms.se/?p=abraca.git;a=blob;f=site_scons/site_tools/binaryblob.py http://git.xmms.se/?p=abraca.git;a=blob;f=site_scons/site_tools/gdkpixbufcsource.py > Also, I need to push the code somewhere, probably on launchpad, so I > need a name. Currently I'm calling it Valapillar, but that's a pretty > obscure joke even to me, and I know why I chose it. GitHub is pretty nice too. -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
[Vala] Using 'as' for casting?
When converting my application to use Gtk.Builder I ended up with a lot of code like this: var lbl = builder.get_object("foo") as Gtk.Label; And this caused me to try the following: var time = Time.gm (unxtime as time_t); as it was more readable than: var time = Time.gm ((time_t) unxtime); This however is not valid syntax, but maybe it should be? On IRC I got the answer that if an 'as' would fail it would return null, and that's why it shouldn't work. I thought it was best to drop a mail to the list and see what people think. -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Problem using the Gtk.Buildable iface
On Fri, Jul 24, 2009 at 1:52 AM, Daniel Svensson wrote: > This might be a bug in Vala, GTK, or simply (and hopefully!) me not > doing it right. And it turned out to be --pkg=gmodule-2.0 missing from my commandline \o/ -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
[Vala] Problem using the Gtk.Buildable iface
I've just started to experiment with making my widgets implement the Gtk.Buildable interface. I have however stumbled upon some strange issues. When loading the builder definition file I get an error that my custom class does not exist even though I've named it correctly in the xml file (NamespaceClassname). This can be fixed by instantiating the class one time before GtkBuilder parses the ui definition. So it seems like there is some type registration going on when instantiating an object the first time, this is all pretty confusing and I really hope I'm doing something wrong here and hope someone on the list can clear things up for me. Here's a minimal test case: namespace Foo { public class Bar : Gtk.Window, Gtk.Buildable { public static int main (string[] args) { Gtk.init(ref args); // NEVER USED BUT NEEDED FOR GtkBuilder TO NOT RAISE EXCEPTION var test = new Foo.Bar(); var builder = new Gtk.Builder (); var desc = "mytesttitle"; try { builder.add_from_string(desc, desc.length); } catch (GLib.Error e) { GLib.error(e.message); } var window = builder.get_object("window") as Foo.Bar; window.show(); Gtk.main(); return 0; } } } When executing the code a window will pop up with the "mytesttitle" as title, so it really is the window created from the ui definition, and if the "var test ..." line is commented out the application will exit with the following error message: ** ERROR **: Invalid object type `FooBar' This might be a bug in Vala, GTK, or simply (and hopefully!) me not doing it right. -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] How to wrap select(2)'s fd_set?
On Fri, Jan 30, 2009 at 1:20 AM, Michael 'Mickey' Lauer wrote: > I'd like to complete more of the posix wrapper, namely select(2) and the > required datatypes. The respective man page excerpt is: As common use of Vala depends on GLib, why not use GIOChannels instead? -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Bindings for gdkkeysyms.h
On Mon, Nov 17, 2008 at 7:24 PM, Daniel Svensson <[EMAIL PROTECTED]> wrote: > On Sun, Nov 16, 2008 at 6:55 PM, Dan Saul <[EMAIL PROTECTED]> wrote: >>0, >>1, >>2, >>3, >>4, >>5, >>6, >>7, >>8, >>9, > > Those doesn't work now do they? I also have a gdk-keysyms-file but > instead of using enum I use "public const int" on each row. Humm.. or maybe I'm saying too much here, maybe it works because you use enum instead! Sorry bout that. -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Bindings for gdkkeysyms.h
On Sun, Nov 16, 2008 at 6:55 PM, Dan Saul <[EMAIL PROTECTED]> wrote: >0, >1, >2, >3, >4, >5, >6, >7, >8, >9, Those doesn't work now do they? I also have a gdk-keysyms-file but instead of using enum I use "public const int" on each row. The reason for not including gdk-keysyms support was something to do with autogenerating the bindings iirc. -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] embedding c code snippet in vala source.
On Thu, Aug 21, 2008 at 8:27 PM, Yu Feng <[EMAIL PROTECTED]> wrote: > Dear all, > > I made a patch that allows embedding c code snippet in vala source. > > http://bugzilla.gnome.org/show_bug.cgi?id=548897 Why not just write a .vapi-file for your C-code? It's easy as pie to mix vala with C-code. Just smash the sources together in your favorite build system: http://git.xmms.se/?p=abraca.git;a=blob;f=src/SConscript;hb=HEAD -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Vala autoconf macro
On Wed, Aug 20, 2008 at 2:52 PM, Levi Bard <[EMAIL PROTECTED]> wrote: >> Guys, what's the point on discussing this on this mailing list? We're >> not going anywhere with this discussion. >> >> I mean, write vala integration for whatever build system you like, do >> not stop other people to write things that are actually useful for >> other people just because you don't like the tool they use, and do not >> start a flame every time does it. > > Well said. I could not agree more. I've written a Vala builder for SCons http://git.xmms.se/?p=abraca.git;a=blob;f=scons-tools/vala.py;hb=HEAD And also a gdkpixbufthingvalaintegration thing that eliminates the need to keep track of where to install images: http://git.xmms.se/?p=abraca.git;a=blob;f=scons-tools/gdkpixbufcsource.py;hb=HEAD To use: images, header, vapi = env.GdkPixBufCSource('abraca_images', ['abraca-192.png', ..., ..., ...]) images variable = .c-file that is linked into the program. And then automagically in teh code.. in this case "abraca-192.png" becomes: Gdk.Pixbuf tmp = new Gdk.Pixbuf.from_inline (-1, Resources.abraca_192, false); Maybe something autohellicopters or wafflers could make use of :-) -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] vapi tip
On Fri, Jul 18, 2008 at 4:58 PM, Sam Liddicott <[EMAIL PROTECTED]> wrote: > you can do: > /usr/bin/valac -C --pkg zlib --pkg gtk+-2.0 --basedir . > src/mainwindow.vala src/api.vapi However, --pkg api automagically handles dependencies and runs pkg-config for you, so it's much easier to use in most scenorios. -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] ABI stable code?
2008/4/26 Mikkel Kamstrup Erlandsen <[EMAIL PROTECTED]>: > I am wondering if it is possible to write a lib in Vala that can be ABI > stable... Both varying (ABI stable) code changes, but also varying Vala > compiler versions? Shouldn't be a problem once Vala 1.0 has been released and things have stabilized? -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] VAPI file syntax documented somewhere?
On Tue, Mar 25, 2008 at 10:54 PM, Jaap A. Haitsma <[EMAIL PROTECTED]> wrote: > I'm trying to make vala bindings for a library not based on gobject. > Is there documentation on the syntax of the vapi file I have to create Not really.. I at least didn't find any either.. > So far I only found [1], but that only talks about the case when you > have a gobject based library I looked at the bindings that came with vala... http://svn.gnome.org/viewvc/vala/trunk/vapi/ Here's my non-gobject based bindings: http://tinyurl.com/yueyls Also, the people at the IRC channel were very helpful when reading existing vapi-files weren't enough, or if something seemed confusing. There's really not much diffrence between non-gobject and gobject based bindings, it has mostly to do how your API looks like, and how it works. In my case I had to modify the library I wrote bindings for a tiny bit to make it a bit more vala-friendly (luckily abi-compatible), it all depends on what you try to bind. -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Windows development
On Tue, Mar 18, 2008 at 1:09 PM, Matt Emson <[EMAIL PROTECTED]> wrote: > Z:\>valac -o basic basic.vala > Z:/basic.vala:1.7-1.10: error: The namespace name `GLib' could not be found > Z:/basic.vala:3.17-3.22: error: The type name `Object' could not be found > Z:/basic.vala:14.10-14.12: error: The type name `int' could not be found > Z:/basic.vala:14.19-14.24: error: The type name `string' could not be found > Compilation failed: 4 error(s), 0 warning(s) The GLib one is due to not adding --pkg=glib-2.0 to the compile flags. That assumes you have the vapi-files installed where vala looks for them, otherwise you have to use --vapidir=/path/to/vapidirectory. Not sure about the int and string though. -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Vala on Windows
On Feb 4, 2008 5:24 PM, Vlad <[EMAIL PROTECTED]> wrote: > This way you can install the .vapi files in Application Data, on windows. Is Application Data really a place to store static global data? Isn't that the place where applications store data that gets created by the application, and is local to the user? vapi-files are system-wide, so shouldn't they be placed in c:\program files\vala\vapi\*? There is an environment for finding out where c:\program files is (localized in non-english versions). -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Added initial vala support to waf build system
On Jan 22, 2008 2:22 AM, Jaap A. Haitsma <[EMAIL PROTECTED]> wrote: > Hi, > > Thanks for the explanation > > > > vala-gen-introspect mylib path/to/settings > > > > And in path/to/settings you add .metadata and other stuff. > > > > Like in these sub directories: > > http://svn.gnome.org/viewvc/vala/trunk/vapi/packages/ > > Looking overthere it seems that these files are not generated by make > files but just by hand, which seems logical to me because you don't > want to regenerate them all the time. > > Correct me if I'm wrong but I don't see many people using > vala-gen-introspect and vapigen in vala project. It will be used by all projects sporting vala bindings. If the api changes, the .gi/.vapi-files should of course be re-generated. However, as vala-gen-introspect doesn't work for the project I'm working on I don't really care any longer. -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Added initial vala support to waf build system
On Jan 19, 2008 4:21 PM, <[EMAIL PROTECTED]> wrote: > I'm pretty new to vala. If you explain me how it works I can take a > look at it. Also feel free to provide patches for the current vala > support in waf vala-gen-introspect mylib path/to/settings And in path/to/settings you add .metadata and other stuff. Like in these sub directories: http://svn.gnome.org/viewvc/vala/trunk/vapi/packages/ Then when a .gi-file has been generated from your headers you generate the actual .vapi-file with: vapigen --library=your-libs-pkg-config-name -d outputpath path/to/your/gi-file.gi And you're ready to rock... if I understand correctly. -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Added initial vala support to waf build system
On Jan 18, 2008 10:05 PM, Jaap A. Haitsma <[EMAIL PROTECTED]> wrote: > The waf build system is an alternative to autotools but is much easier > to use and to understand. Anyway if you want to learn more about it > you can read it on the homepage [1] You don't happen to have support for vala-gen-introspect + vapigen planned? -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Request: Some high level documentation about how vala works internally
On Jan 18, 2008 2:26 PM, Clément DAVID <[EMAIL PROTECTED]> wrote: > If you want more exemple take a look at the vala/tests/*.vala . > > You can also take a look at my vala-benchmark project. I re-implement > part of "The Computer Language Benchmarks Game" in Vala. These > benchmarks are implemented in many languages and you can compare these > with the Vala version. > > Vala benchmark : http://code.google.com/p/vala-benchmarks/ > The Computer Language Benchmarks Game : http://shootout.alioth.debian.org The project I'm working on might also be a source of vala example: http://git.xmms.se/?p=abraca.git;a=tree It probably uses a fair share of the featureset vala provides. Note that I too am pretty new to vala so perhaps some strange parts. More documentation and tutorials would definatly rock. I guess it's time to start contributing to http://live.gnome.org/Vala/Tutorial -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] Code generation error
On Jan 3, 2008 11:47 PM, Jürg Billeter <[EMAIL PROTECTED]> wrote: > Hi Daniel, > > But _tmp1 will be declared in __lambda0 function and not in the > > function it's used. > > I can't reproduce the bug here, do you have a stand-alone testcase? This vala code: private void on_playlist_insert(Client c, string playlist, uint mid, int pos) { Gtk.ListStore store = (Gtk.ListStore) model; Gtk.TreePath path; Gtk.TreeIter iter; if (playlist != _playlist) { return; } path = new Gtk.TreePath.from_indices(pos, -1); if (model.get_iter(out iter, path)) { Gtk.TreeIter added; store.insert_before (out added, iter); c.xmms.medialib_get_info(mid).notifier_set( (r, u) => { GLib.stdout.printf("apan\n"); }); } Generates this C-code, notice where _tmp2 is defined: static void __lambda0 (xmmsc_result_t* r, gpointer u) { xmmsc_result_t* _tmp2; _tmp2 = NULL; fprintf (stdout, "apan\n"); (_tmp2 == NULL ? NULL : (_tmp2 = (xmmsc_result_unref (_tmp2), NULL))); } static void abraca_playlist_tree_on_playlist_insert (AbracaClient* c, const char* playlist, guint mid, gint pos, AbracaPlaylistTree* self) { GtkListStore* _tmp0; GtkListStore* store; GtkTreePath* path; GtkTreeIter iter; GtkTreePath* _tmp1; g_return_if_fail (ABRACA_IS_PLAYLIST_TREE (self)); g_return_if_fail (c == NULL || ABRACA_IS_CLIENT (c)); _tmp0 = NULL; store = (_tmp0 = GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (self))), (_tmp0 == NULL ? NULL : g_object_ref (_tmp0))); path = NULL; memset (&iter, 0, sizeof (GtkTreeIter)); if (g_utf8_collate (playlist, self->priv->_playlist) != 0) { (store == NULL ? NULL : (store = (g_object_unref (store), NULL))); (path == NULL ? NULL : (path = (gtk_tree_path_free (path), NULL))); return; } _tmp1 = NULL; path = (_tmp1 = gtk_tree_path_new_from_indices (pos, -1, NULL), (path == NULL ? NULL : (path = (gtk_tree_path_free (path), NULL))), _tmp1); if (gtk_tree_model_get_iter (gtk_tree_view_get_model (GTK_TREE_VIEW (self)), &iter, path)) { GtkTreeIter added; memset (&added, 0, sizeof (GtkTreeIter)); gtk_list_store_insert_before (store, &added, iter); xmmsc_result_notifier_set ((_tmp2 = xmmsc_medialib_get_info (abraca_client_get_xmms (c), mid)), ((xmmsc_result_notifier_t) __lambda0), NULL); } (store == NULL ? NULL : (store = (g_object_unref (store), NULL))); (path == NULL ? NULL : (path = (gtk_tree_path_free (path), NULL))); } Which then ofc gives this errror when gcc enters the game: playlist_tree.c: In function 'abraca_playlist_tree_on_playlist_insert': playlist_tree.c:181: error: incompatible type for argument 3 of 'gtk_list_store_insert_before' playlist_tree.c:182: error: '_tmp2' undeclared (first use in this function) playlist_tree.c:182: error: (Each undeclared identifier is reported only once playlist_tree.c:182: error: for each function it appears in.) This is Vala 0.1.5, so maybe this mail is just stupid. I don't suppose there are any snapshot builds of vala for ubuntu gutsy? -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
Re: [Vala] gtk+2.0.vapi bug
On Jan 7, 2008 10:55 PM, Ed Schouten <[EMAIL PROTECTED]> wrote: > You can just do this: > > | [NoArrayLength] > | public bool get_dest_row_at_pos (int drag_x, int drag_y, out weak | > Gtk.TreePath path, Gtk.TreeViewDropPosition[] pos); > > This will omit the length argument. Ah, nice to know. But the problem wasn't passing an array. The problem was that the pos should be passed as "out Gtk.TreeViewDropPosition pos". Just talked to the devs at irc and a fix will be commited shortly. -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
[Vala] gtk+2.0.vapi bug
Under Gtk.TreeView: public bool get_dest_row_at_pos (int drag_x, int drag_y, out weak Gtk.TreePath path, Gtk.TreeViewDropPosition pos); The last parameter is incorrect here I think. The C-code wants a GtkTreeViewDropPosition *pos, that is.. a list of positions. But passing a [] pos expands to multiple parameters (len and the actual data) so I don't know how to fix it. I just changed it to 'pointer' instead to get my app working, but that's obviously not a real fix. -- Daniel Svensson ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list
[Vala] Code generation error
Hi, think I found a bug in vala. xc.playback_current_id().notifier_set((res, u) => { int id; res.get_int(out id); stdout.printf("%d\n", id); }); Just tried out lambda for the first time. It will generate: xmmsc_result_notifier_set ((_tmp1 = xmmsc_playback_current_id (xc)), ((xmmsc_result_notifier_t) __lambda0), NULL); But _tmp1 will be declared in __lambda0 function and not in the function it's used. -- Daniel Svensson, <[EMAIL PROTECTED]> ___ Vala-list mailing list Vala-list@gnome.org http://mail.gnome.org/mailman/listinfo/vala-list