/srv/irclogs.ubuntu.com/2011/09/07/#ubuntu-classroom.txt

=== abiss is now known as abiss27
=== callaghan_ is now known as callaghan
dpmAllright, we're about to start the 3rd day of Ubuntu App Developer Week, is everyone ready?15:55
dpmAll right, let's get started!16:00
dpmWelcome to the 3rd day of Ubuntu App Developer Week16:00
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: App Developer Week - Current Session: Unity Mail: Webmail Notification on Your Desktop - Instructors: mitya57
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/09/07/%23ubuntu-classroom.html following the conclusion of the session.16:01
dpmOur first speaker has developed a really slick app to check your webmail directly from your desktop. Welcome Dmitry Shachnev who's going to tell us all about Unity Mail!16:01
dpmmitya57, I'll leave the room for you now16:01
mitya57So, let's start16:01
mitya57I'm Dmitry Shachnev, currently student at Moscow University16:01
mitya57I am developer of Unity Mail,16:02
mitya57ReText (retext.sf.net),16:02
mitya57TQ Educational suite (tq-suite.sf.net) and some other things16:02
mitya57Since my first distro was Mandriva, I'm also known as Mandriver16:03
mitya57Unity Mail is an application that displays unread messages count on your Launcher,16:03
mitya57as well as Notify-OSD notifications16:04
mitya57and mail subjects in Messaging Menu (this is currently only for Oneiric)16:04
mitya57It works with any IMAP4 or IMAP4-SSL server, not only with GMail as some people think16:05
mitya57It also support multiple accounts16:05
mitya57*supports16:05
=== Lethalman_ is now known as Lethalman
mitya57It's written in Python and uses GObject-Introspection,16:06
mitya57I'll say more about this later16:06
mitya57Three days ago I released the new version, 0.816:07
mitya57(the Natty backport will come soon, too)16:07
mitya57It has Messaging Menu integration and new configuration dialog16:07
mitya57Screenshot: http://ubuntuone.com/4VNpTopZZxmGN2fyXY4ZmD16:08
mitya57It's also the first release working on Oneiric16:08
mitya57So, now about used technologies16:08
mitya57GObject-Introspection (http://live.gnome.org/GObjectIntrospection) is a new GNOME framework16:09
mitya57for accessing C-language API in many languages,16:10
mitya57such as Python, Vala, and so on16:10
mitya57In Ubuntu, Python bindings are provided by python-gobject package16:11
mitya57The most known component is Gtk API,16:12
mitya57which allows working with both Gtk2 and Gtk316:12
mitya57It's recommended alternative for PyGtk,16:12
mitya57read more about porting here: http://live.gnome.org/PyGObject/IntrospectionPorting16:13
mitya57But there are many other bindings,16:13
mitya57You can use any API provided by gir1.2-* packages16:14
mitya57Here is Unity Mail's import string:16:14
mitya57from gi.repository import GObject, GLib, Gtk, Unity, Notify, Indicate16:14
mitya57The last three are Ubuntu-specific technologies, so let's speak more16:15
mitya57about them16:15
mitya57Unity Launcher API provides a way to set a count badge or a progress-bar16:16
mitya57for a specific .desktop file16:17
mitya57https://wiki.ubuntu.com/Unity/LauncherAPI16:17
mitya57This page contains an overview and code examples for Python and Vala16:17
mitya57Indicate API16:18
mitya57It provides a way to add an indicator to your panel, or integrate16:18
mitya57with existing menu (Messaging Menu in my case)16:19
=== ejat is now known as fenris
=== fenris is now known as Guest40004
mitya57I used this page as a documentation:16:20
mitya57http://www.kryogenix.org/days/2011/01/16/working-with-the-ubuntu-messaging-menu16:20
=== Guest40004 is now known as ejat
mitya57Note that UM doesn't make that envelope blue or green, it just add some items16:21
mitya57If you want to add your items to Messaging Menu,16:21
mitya57you'll need to set up a server (basically the container connected to a .desktop file_16:22
mitya57and any number of clients (entries)16:22
mitya57Each entry can contain a time (which'll be displayed like "30 min" or "2 h")16:23
mitya57or just a number (count), i.e you can add a client titled "Inbox" with a mails count16:23
mitya57Time in UM case16:24
mitya57Then, Notify API16:24
mitya57You SHOULD NOT use pynotify because it is based on Gtk2 and is deprecated16:24
mitya57Gir-Notify usage is very simple, like this:16:25
mitya57Notify.init('unity-mail')16:25
mitya57Notify.Notification.new(title, message, icon).show()16:26
mitya57You can see more advanced-usage examples in 'tests' directory16:26
mitya57of libnotify tarball16:26
mitya57And there is one another important component - GNOME Keyring16:27
mitya57Currently there's no Gir for it - wait a moment, I'll find a bug about that16:28
mitya57It's https://bugs.launchpad.net/ubuntu/+source/libgnome-keyring/+bug/80217316:29
mitya57and https://bugzilla.gnome.org/show_bug.cgi?id=598414 for upstream16:29
mitya57so we use python-gnomekeyring binding,16:29
mitya57which is the only reason for us not moving to Python316:30
mitya57Also, it adds a Gtk2 dependency, so I really don't like it16:30
mitya57You can read more about it here:16:31
mitya57http://blogs.codecommunity.org/mindbending/bending-gnome-keyring-with-python-part-1/16:31
mitya57Credits to Andre Ryser who added GNOME Keyring support to UM16:32
mitya57Now a bit about translations16:32
mitya57UM uses gettext for translations and Launchpad for hosting them16:32
mitya57Also, it uses desktop2gettext script to generate .po (source) files from .desktop files16:33
mitya57(There are actually 2 desktop files used in UM:16:33
mitya57The main, that displays in Launcher, and another one which is copied to your16:34
mitya57~/.config/autostart/ directory and is used for auto-starting Unity Mail)16:34
mitya57http://bazaar.launchpad.net/~chromium-team/chromium-browser/chromium-translations-tools.head/view/head:/desktop2gettext.py16:35
mitya57(Originally it was developed for Chromium)16:35
mitya57More about gettext: http://docs.python.org/library/gettext.html16:35
mitya57More about using Launchpad for translating your project: https://help.launchpad.net/Translations/YourProject16:36
mitya57There were even 2 sessions about this in previous AppDeveloperWeek16:37
mitya57And also we use Bazaar for hosting code.16:38
mitya57Now - some future plans for Unity Mail16:39
mitya57You know why Unity Mail is better than other mailing clients16:39
mitya57(like Thunderbird and Evolution)16:40
mitya57First, it's written especially for WebMail services16:40
mitya57When you click it's icon your mail is opened in a web browser16:41
mitya57It uses GMail links by default, but you can set your own in the new configuration dialog16:41
mitya57You can even set a custom command by starting the URL with 'Exec:'16:41
mitya57dpm, I plan to release 1.0 firstly16:42
ClassBotdpm asked: have you thought about submitting Unity Mail for inclusion in Ubuntu?16:42
mitya57And I'll release it when there will be a gir for gnomekeyring16:42
mitya57and I'll be able to use Py3K16:43
mitya57So, some ideas for future versions:16:43
mitya57 - More configuration options, like disabling Messaging Menu16:44
mitya57   or even  Unity Launcher :)16:44
mitya57 - "Mark all as read" option16:44
mitya57  - (I don't yet know if it's possible) - Opening a mail when you click on it in the Messaging Menu16:45
mitya57 - And it really needs a new icon, maybe someone will help me with it?16:46
mitya57So, I think, that's all16:47
mitya57Please ask your questions16:47
ClassBotThere are 10 minutes remaining in the current session.16:50
ClassBotgnomie asked: if i decided to give UM a try, will it conflict with thunderbird (which is already set up)?16:51
mitya57gnomie no, it won't16:51
=== jelmer_ is now known as jelmer
mitya57If I have another five minutes, I'll advertise my another app - ReText editor16:52
mitya57It's an editor for markup languages, such as Markdown and reStructuredText16:53
mitya57It allows you to control all your formatting and storing documents in plain text files16:53
mitya57But it supports export to ODT, PDF, HTML and whatever you want via plugins16:53
mitya57Also it can upload documents to Google Docs16:54
mitya57And it supports tabs, which is very useful feature16:55
mitya57Screenshot: https://sourceforge.net/p/retext/screenshot/retext.png16:55
mitya57Web-site: http://retext.sourceforge.net/16:55
ClassBotThere are 5 minutes remaining in the current session.16:55
mitya57It's available in my PPA, too (ppa:mitya57)16:55
dpmthanks mitya57 for a great session!16:59
mitya57So, good bye (=16:59
dpmNext up, Jelmer Vernooij will tell us all about using Launchpad for creating build recipes to rapidly get your packages to users17:00
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: App Developer Week - Current Session: Launchpad Daily Builds and Rapid Feedback: Writing Recipe Builds - Instructors: jelmer
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/09/07/%23ubuntu-classroom.html following the conclusion of the session.17:00
jelmerHello!17:01
jelmerMy name is Jelmer Vernooij. I currently work in the Bazaar team at Canonical, and before that I worked on Launchpad.17:02
jelmerThis app developer week session is going to be about source package recipe builds.17:02
jelmerI am going to assume that everybody here is familiar with at least basic Debian packaging. If you are not, the Ubuntu packaging guide is a great start. See http://developer.ubuntu.com/packaging/html/17:02
jelmerYou should also have some familiarity with a distributed version control system. Recipe builds on Launchpad use Bazaar. A quick introduction about Bazaar can be found at http://doc.bazaar.canonical.com/latest/en/mini-tutorial/17:03
jelmerPlease do interrupt me with questions if you have any.17:03
jelmerToday we are going to create a basic recipe for a small project. I have a project in mind (pydoctor), but if somebody has other suggestions I am also happy to do another project (nothing like living on the edge and doing this live).17:04
jelmerDoes anybody have a suggestion for a project that doesn't take too long to build?17:04
jelmerSource package recipes are, like cooking recipes, a description of a set of ingredients (branches in this case) and a description of how to meld them together.17:05
jelmerThe result of a recipe is usually a Debian source package.17:06
jelmerYou can write and build recipes locally by installing the "builder" plugin for Bazaar ("apt-get install bzr-builder"). This is quite convenient when writing and testing recipes.17:07
jelmerLaunchpad can also build recipes for you, and can directly upload the resulting source package to a PPA.17:08
jelmerIt can do this a single time, or you can have it build the recipe daily (as long as one of the branches involved in the recipe has changed).17:08
jelmerThis makes it very easy to do daily builds of a project, because Launchpad can automatically grab the source code out of the upstream version control system, as long as Launchpad can import from the upstream version control system.17:09
jelmerOnce a recipe has been set up your PPA will automatically receive new packages, fresh from trunk, every day.17:11
jelmerDoes anybody have a suggestion of a project we should create a recipe for?17:11
jelmerI guess not, so let's go with pydoctor (a API documentation generator for Python).17:14
jelmerEvery recipe has a "base" branch> This is usually the trunk of the upstream project you're building.17:14
jelmerIn our case, it would be lp:pydoctor17:14
jelmerThe upstream project does not contain any Debian packaging metadata, so we will also have to merge that in.17:16
jelmerThere happens to be a Debian package for pydoctor, so I have created an import of the Debian packaging branch on launchpad - https://code.launchpad.net/~jelmer/pydoctor/unstable17:17
jelmerThe last thing to consider is the version string. As we create the source package from multiple branches, we don't want to just use the version in the last changelog entry of the packaging branch.17:17
jelmerIf we did, that would mean that if the upstream branch changed and a new source package would be built, that source package would have the same version string (but different contents).17:18
jelmerTo work around this, bzr-builder will automatically add a new dummy changelog entry indicating that a recipe build has been done, with a new version.17:19
jelmerTO give you a concrete example, let's look at the pydoctor recipe: https://code.launchpad.net/~jelmer/+recipe/pydoctor-daily17:20
jelmerYou can see the recipe text at the bottom of the page below "Recipe contents"17:20
jelmerAs you can see, the first line describes the version string that will be added to the changelog.17:21
jelmerThe second line contains the "base" branch, in this case lp:pydoctor17:22
jelmerand the third line specifies that the lp:~jelmer/pydoctor/unstable branch should be merged and can be identified by the string "debian".17:22
jelmerThe version string will be "0.3+bzr" followed by the last revision number of the base branch, then a tilde and then the revision number of the packaging branch.17:23
jelmerYou can see how the identifier for the third line comes in handy here.17:23
jelmer"merge" isn't the only supported command; other options are "nest" and "nest-part". There also more variables available to use in the version string, such as {time} which will contain the current time. See https://help.launchpad.net/Packaging/SourceBuilds/Recipes for a full list.17:25
jelmerif you put the contents of the recipe in a local file, you should be able to build it with bzr-builder.17:26
jelmerFor example, if you name this file "pydoctor.recipe" you can use:17:26
jelmer$ bzr dailydeb pydoctor.recipe build-pydoctor17:26
jelmerthis will create a source package in the build-pydoctor directory.17:26
jelmerIt is generally a good idea to test recipes locally first before adding them to Launchpad. That way you don't have to wait for a slot in the build queue, and you save build resources on Launchpad.17:28
jelmerDid that work for everybody?17:30
jelmeronce you have a working recipe, you can register it on Launchpad by clicking the "Create packaging recipe" link on the branch page of one of the branches involved.17:35
jelmerThere you'll have the chance to specify when the recipe should be built, what its instructions are, and what PPA should be targetted.17:36
jelmerIt is possible to specify what Ubuntu releases a recipe should be built for. Of course, you will need to make sure that all of the build dependencies of your package are available in those releases (or your PPA dependencies).17:38
jelmerAfter you have created a recipe, the page should look roughly like the one for my pydoctor recipe (https://code.launchpad.net/~jelmer/+recipe/pydoctor-daily)17:38
jelmerIf you have indicated that a recipe should be built daily, it will usually be built quickly after you update one of its branches.17:39
jelmerAre there any questions so far?17:40
jelmerAs I mentioned earlier, more information can be found on the Launchpad help pages: https://help.launchpad.net/Packaging/SourceBuilds17:47
jelmerThere is also a list of existing recipes that are in use on Launchpad, https://code.launchpad.net/+daily-builds17:48
jelmeras you can see, we have about 400 that build on a daily basis17:49
jelmerThat's about all I had. If you have questions about recipes, please ask them now or otherwise you can always find me on this network under the nickname "jelmer"17:50
jelmerIf you don't feel comfortable with recipe builds just yet, I can also recommend Matthew Revell's video cast about source package recipe builds.17:50
jelmerhttp://www.youtube.com/watch?v=_bG-SXNX9Ww17:50
ClassBotThere are 10 minutes remaining in the current session.17:51
jelmerThanks for your attention, happy hacking!17:52
ClassBotThere are 5 minutes remaining in the current session.17:55
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: App Developer Week - Current Session: Using the Ubuntu One APIs for Your Apps: An Overview - Instructors: aquarius_
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/09/07/%23ubuntu-classroom.html following the conclusion of the session.18:00
aquarius_Hi, all!18:01
aquarius_I'm Stuart Langridge, from the Ubuntu One team, and I'm here to talk about our app developer programme.18:01
aquarius_Do please ask questions throughout the talk: in the #ubuntu-classroom-chat channel, write QUESTION: here is my question18:01
aquarius_We want to make it possible, and easy, for you to add the cloud to your apps and to make new apps for the cloud18:02
aquarius_This is your personal cloud we're talking about here; your data. Not an enterprise cloud sort of thing :)18:03
aquarius_So we do all the heavy lifting, and your users (and you!) get the benefits.18:03
aquarius_Imagine, for example, you've made a recipe manager application.18:03
aquarius_So you can type in all the recipes you like to cook, and you've got a permanent record of them.18:04
aquarius_(For me, that would be: get a pizza base; put pepperoni on it. I reckon you can think of better recipes than that.)18:04
aquarius_(and: actual recipes, for nice food. Not, like, Launchpad recipes. :)18:04
aquarius_Don't really want to take your laptop into the kitchen, though, of course.18:05
aquarius_So, build a mobile app which you sign into with Ubuntu One, and have that show all your recipes too.18:05
aquarius_And a web app which you sign into with Ubuntu One, so that you can look up recipes while you're at a friend's house.18:05
aquarius_So you've got your stuff, wherever you are, whichever device you're on. Ubuntu, Android, iOS, Windows, webOS, whichever you want, your data's in your personal cloud and so it's everywhere for you.18:06
aquarius_This is the sort of thing that we want to make easy; giving your users and you quick access to the Ubuntu One technology.18:06
aquarius_Mobile access to your data; web app access to your data; saving files direct into Ubuntu One; publishing files and photos from all your apps; adding playlists to the Ubuntu One music streaming app; streaming the user's own music into a game you've written.18:07
aquarius_This stuff is all being heavily worked on right now as we speak.18:07
aquarius_So this talk won't be too detailed with specifics, because they might change.18:07
aquarius_But I'm more than happy to answer questions and so on! And I can probably tell you what I think the specifics are, if they're not already documented at https://one.ubuntu.com/developer/ :)18:08
aquarius_I want to give you a flavour of what will soon be possible, and answer questions, and give some pointers, and get your thoughts.18:08
ClassBotinfodroid asked: you didn't mention desktop access to data... this is the primary use case i am looking at: seamless synchronisation of the user's app on the desktop18:09
aquarius_oops :)18:09
aquarius_I didn't deliberately leave it out!18:09
aquarius_desktop access to data is absolutely part of this18:09
aquarius_so you can sync a desktop app's data to other desktops, totally18:09
aquarius_and then you get to build web apps or mobile apps or both as well which also share the same data18:10
aquarius_Also, this is App Developer Week, so I can talk about what the components we're working on are and then admire all the cool ways you all come up with for snapping them together, rather than waiting for marketing to come up with a "product" for you to use :)18:10
aquarius_So, some components that can be snapped together.18:11
aquarius_You'll be able to sign in to a web application with Ubuntu One.18:11
aquarius_This means that you don't have to manage your own identity system, think about password renewal, all that.18:11
aquarius_This is just like "sign in with Facebook" or "sign in with Twitter"; it's OpenID-based, and lets your users sign in to a web app and you'll know their Ubuntu identity.18:11
ClassBotinfodroid asked: I have reviewd the online docs for API Docs > Data > Store data. However it is not clear what language bindings are available to use.18:13
aquarius_infodroid, there are lots, depending on what you're trying to do18:15
aquarius_but I know that the developer site doesn't yet talk about bindings18:15
aquarius_I'm working on that :)18:16
aquarius_Once you've signed in to an app with Ubuntu One, that app can ask for permission to work with your data.18:16
aquarius_This lets you, developers, build applications that work on the desktop, on the web, on mobile phones.18:16
aquarius_The recipe manager example I mentioned above is one sort of thing you could do, there18:16
aquarius_Your users use the nice recipe manager app on Ubuntu, which you've built with Quickly or whatever you prefer18:16
aquarius_And then they can go to yourrecipemanager.com and sign in with Ubuntu One18:16
aquarius_yourrecipemanager.com then asks them for permission to access their "recipes" database18:16
aquarius_and can then show them all their recipes on the web!18:18
aquarius_Your app (yourrecipemanager.com) does this via OAuth; it goes through the standard OAuth dance to get an OAuth token which can be used to access the user's recipes data18:18
aquarius_And your users can be happy that it's secure, because yourrecipemanager.com will only have access to their recipes data; it can't read their contacts or their credit card info.18:18
ClassBottomalan asked: Is Ubuntu One also available on other Linux Desktop Distros, like Fedora?18:18
aquarius_Certainly some people have done some work to package Ubuntu One for other distros18:19
aquarius_I think there's an ITP for Debian18:19
aquarius_and we've been pinged on #ubuntuone by people interested in putting Ubuntu One on Fedora and Arch18:19
aquarius_I don't remember the details, though, so I'm not sure what stage those bits of work are at18:20
aquarius_so, I was talking about apps working with your data18:20
aquarius_But you can imagine sharing other sorts of data between applications.18:20
aquarius_Imagine, for example, an achievements system.18:21
aquarius_You write a few games; some on the web, some on mobile phones, some on the Ubuntu desktop, some on Windows.18:21
aquarius_And every time the user achieves something in a game, you save that achievement to that user's "achievements" database.18:21
aquarius_On Ubuntu, you'd save that "trophy" into a file, and Ubuntu One will take care of synchronising that into the cloud.18:22
aquarius_On the web, your game's backend can use the REST API for file access: see https://one.ubuntu.com/developer/store_files/cloud18:22
aquarius_On Android or iOS or webOS or Blackberry or Meego or Windows Phone 7 you can do exactly the same thing; every language has an HTTP access library!18:22
aquarius_You could even write your own wrapper library for PHP or Rails or Flash or whatever you prefer (and then tell me about it so I can point to the documentation for it!)18:23
aquarius_At that point, all your games save achievements to the same place, so all your games can show you the achievements you've won in any game18:23
aquarius_And, as before, you can set up yourachievements.com where a user can log in and see all their achievements.18:23
ClassBotkermit66676 asked: So, the methods listed on the API documentation pages are all HTTP methods for the one.ubuntu.com server?18:23
aquarius_I think the API docs list all the public documented committed-to APIs18:24
aquarius_but I'd be interested to hear if there's something the docs don't cover18:24
ClassBotpaglia_s asked: i'm realizing an implementation of Ubuntu One apis written in php and i've seen that apis are quite slow. Do you plan to improve speed?18:24
aquarius_paglia_s, hiya!18:25
aquarius_paglia_s, yes, we're working on that, definitely18:25
aquarius_and we're also interested in how people are using the APIs18:25
aquarius_so that we may be able to add ones which more closely return the information you want18:26
=== yofel_ is now known as yofel
aquarius_There's loads of stuff you can do with shared data.18:27
aquarius_But Ubuntu One's not just about data.18:27
aquarius_Take the music streaming service, for example.18:27
aquarius_You can currently stream music to Android and iPhone, and you'll be able to add that music to the cloud from Ubuntu and Windows.18:27
aquarius_Maybe you want to be able to stream music back to your Ubuntu machine without syncing it, or your Mac, or your Palm Pre, or your LG mobile phone, or your toaster.18:27
aquarius_So, just use the music streaming API, which is again a simple REST HTTP API, or help people to get at their music by showing them our HTML5 web player for streaming music.18:28
aquarius_But there's more interesting ideas around music streaming than just "listen to the music".18:28
aquarius_Playlists, for example. The Ubuntu One Streaming apps on Android and iPhone know how to create playlists.18:28
aquarius_But how they do that is not a secret. Your playlists are just stored in your cloud databases.18:29
aquarius_So, why not sync your playlists from Banshee or Rhythmbox or Amarok or Exaile or Quod Libet or iTunes or Windows Media Player?18:29
aquarius_(insert your choice of player here :))18:29
aquarius_Copy the playlists from your media player into desktopcouch on Ubuntu or into the cloud directly with u1couch on Windows or the Mac or anywhere else, in the correct format, and those playlists will instantly show up on your phone!18:29
aquarius_A simple example of this is https://code.launchpad.net/~sil/%2Bjunk/m3u2u1ms/ which is a quick script I wrote to take an m3u playlist and store it in desktopcouch on Ubuntu.18:30
aquarius_So you can make your Banshee playlists available to the Ubuntu One app on your Android phone by exporting them as m3u and then importing them with the script.18:30
aquarius_And of course if you sync your playlists from your media player to Ubuntu One, then you can sync them back from Ubuntu One to your media player.18:30
aquarius_What this means is that if you've got two machines -- let's say, a desktop and a netbook -- then creating a playlist on your desktop will automatically also make it appear on your netbook.18:30
aquarius_And your netbook can either sync all your music that you store in Ubuntu One (if it's got enough space) or stream that music directly from Ubuntu One without ever syncing it locally.18:30
aquarius_Your music, everywhere; but importantly, not just your music but your playlists and scores and ratings and everything.18:30
aquarius_If you're interested in bringing this to your music player, let me know and I can help; ask questions now :-)18:31
ClassBotpaglia_s asked: do you plan to add support for notes, too? Will this support also images/video...?18:32
aquarius_paglia_s, I'm not sure what you mean by "support for notes"?18:33
aquarius_paglia_s, you already can edit notes synced from tomboy on the website18:35
ClassBotjsjgruber_test asked: ​ I can't synchronize my desktopcouch database -- because of 503 service unavailable returns, and I hear that the servers are being worked on for this. Any news about when they will be able to handle the load?18:37
aquarius_jsjgruber_test, we're working on that, as you know, but I don't have an answer fo when that work will be completed18:38
ClassBotkermit66676 asked: yes, have there been any intentions of making an Ubuntu One gallery viewable online from a Shotwell photo collection?18:38
aquarius_kermit66676, interesting idea! If you were thinking of displaying that sort of thing on a website, the rest files API would be a good starting point18:39
aquarius_we've had a few ideas ourselves in that sort of area too :)18:39
aquarius_so, I was talking about music :)18:40
aquarius_Tighter integration is great, here; what we want to do is to make it easy for you all to build the stuff that you want on top of Ubuntu One.18:40
aquarius_So if you want to have your Amarok playlists available for streaming, it should be possible to do.18:40
aquarius_I rather like the idea of playing a Flash game on the web and having the background music be the most appropriate music chosen from *my* music collection. That'd be cool.18:40
aquarius_Ubuntu One also, as you know, does file sync.18:40
aquarius_:-)18:40
aquarius_But just syncing files is already taken care of by Ubuntu One itself, on Ubuntu and Windows.18:40
aquarius_What's more interesting is working with those files.18:41
aquarius_So, for example, imagine being able to instantly, one-click-ly, publish a file from your application to a public URL and then tweet that URL.18:41
aquarius_Instant get-this-out-there-ness from your apps.18:41
aquarius_The screenshot tool Shutter, for example, can do this already; PrtSc to take a screenshot, then "Export > Ubuntu One".18:41
aquarius_They did a bunch of hard work to do that, and I massively applaud them; nice one Shutter team!18:41
aquarius_Based on what they did, that's the sort of thing that should be easier to do.18:41
aquarius_So there are easy-to-use APIs so your apps can do the same. Imagine quickly sharing your newly created image or document or recipe with the world.18:41
aquarius_Your app could have a button to "store all my files in the cloud", or "publish all my files when I save them", or "automatically share files that are part of Project X with my boss".18:41
aquarius_More to the point, you can work with files directly *in* the cloud.18:43
aquarius_So a backup program, for example, could back up your files straight into Ubuntu One and not sync them to your local machines.18:43
aquarius_That's exactly what Deja Dup, by the great mterry, does; one of its backup options is "Ubuntu One". So to make sure you've got backups of your machine, just start Deja Dup (which is in Ubuntu 11.10), choose "Ubuntu One" for backups, and that's it; you're done.18:43
aquarius_You'll never lose data again; yay for backups!18:43
aquarius_Enabling that sort of work in *your* apps is exactly what the Ubuntu One app dev programme is all about; making it easy to add your users' personal cloud to what your app does.18:44
aquarius_And of course being able to save things in and out of the cloud means that you can get an Ubuntu One sync solution on other platforms.18:44
aquarius_So you could work with your files from your non-Android mobile phone (we've already got Ubuntu One files available in the Android Market, and it's also on Launchpad if you want to look at how it works).18:44
aquarius_Build a fuse or gvfs backend for Ubuntu or Fedora or SuSE or Arch Linux. Build a WebDAV server which works with Ubuntu One and mount your Ubuntu One storage as a remote folder on your Mac.18:44
aquarius_And web apps can work with your cloud too, for files as well as data.18:45
aquarius_Imagine, say, a torrent client, running on the web, which can download something like a movie or music from legittorrents.info and save it directly into your cloud storage.18:45
aquarius_So you see an album you want on that torrent site (say, Ghosts I by Nine Inch Nails) and go tell this web torrent client about it (and you've signed in to that web torrent client with Ubuntu One)18:45
aquarius_And the website then downloads that NIN album directly into your personal cloud -- which of course makes it available for streaming direct to your phone.18:45
aquarius_You could do that with videos as well: choose a torrentable video (say, Beyond the Game, the documentary about World of Warcraft) and download that directly into your cloud, if someone built the web torrent client.18:45
aquarius_(Of course, that would be cooler if Ubuntu One offered a video streaming service as well as music streaming, wouldn't it. Hm... ;-)18:45
aquarius_But it's not just about your content for yourself; think about sharing.18:45
aquarius_Ubuntu One lets you share a folder with people. This would be great for distribution.18:45
aquarius_Imagine that you publish an online magazine.18:45
aquarius_So, you create a folder on your desktop, and put issues of the magazine in it.18:45
aquarius_Then, you put a button on your website saying "Sign in with Ubuntu One to get our magazine".18:46
aquarius_When someone signs in, your website connects to the Ubuntu One files API, with your private OAuth token, and adds that signed-in user to the list of people that your magazine folder is shared with.18:46
aquarius_Then, whenever your magazine has a new issue, you just drop it into that folder on your desktop.18:46
aquarius_(Or even upload it to Ubuntu One directly through the website.)18:46
aquarius_All the subscribed people will get the new issue instantly, on all the machines they want it on, and in the cloud.18:46
aquarius_You could distribute anything like this. Imagine a podcast, or chapters of a novel.18:46
aquarius_It would also work for paid-for content; when someone pays, have your code share a folder with them, and put their paid-for stuff in that folder. That's all doable through the files API.18:46
aquarius_We've built the files API itself (an HTTP-based REST API) and also some wrappers for it to make it easier to use in your apps from Python and the like (and we're continuing to enhance it, and this is another place you can contribute; let me know what you want the Files API to do!)18:46
ClassBotinfodroid asked: i hear that couchdb as a backend for a desktop app is really slow. is this true? are there any strategies to get around this?18:47
aquarius_infodroid, we're working on ways to make synced data a better experience for developers18:47
aquarius_(In fact I've been in a meeting room today talking about it :))18:48
aquarius_so stay in touch with what we're up to and if you're having problems, be assured that things will get better18:48
aquarius_at the moment using couchdb is problematic, we agree; for some people it works fine but there are issues18:49
aquarius_we're still working out what it's best to do about that18:49
ClassBotThere are 10 minutes remaining in the current session.18:50
aquarius_staying in touch with what's going on can be done by following the blog (http://voices.canonical.com/ubuntuone/) and we're on twitter as well :)18:50
aquarius_and you can hang out in #ubuntuone too; we're a friendly bunch18:51
aquarius_and I'm always happy to have someone buy me a beer ;) (Or just drop me an email or ping me on irc to chat about what you're trying to do or hoping to do. I like talking about this stuff, as you may have noticed.)18:51
aquarius_OK, I've talked about a blizzard of ideas that'll be made possible, and shown you almost no code.18:52
aquarius_However, code is nothing without documentation, and that's really important.18:52
aquarius_So, as I mentioned earlier, you want https://one.ubuntu.com/developer18:52
aquarius_There you can find documentation for the files and music APIs, and for how to create and manage your Ubuntu One account.18:52
aquarius_So there's documentation for all this stuff so all of you clever people can build things that I haven't even dreamed of.18:52
aquarius_So, what I'd like to know is: what are your cool ideas? What help do you need from me in making them happen? What do you want to use Ubuntu One for in your apps and your scripts and your work?18:52
aquarius_as I say, drop me a line, ping me on irc, tweet at me or at U1 or hang out on irc and tell me what you want to get done, and we can talk about how to do it18:52
aquarius_I've got a few minutes fo questions now before you get to hear cool stuff about unity :)18:53
ClassBotThere are 5 minutes remaining in the current session.18:55
aquarius_kermit66676, syncing your shotwell structures is a really interesting idea18:55
aquarius_you should already be able to sync the photos themselves -- simply mark the folde with them in as synced with Ubuntu One, and they'll be on all your machines18:56
aquarius_syncing shotwell's preferences and so on is more interesting, because it depends how they're stored18:57
aquarius_catch up with me another time (I have to leave at the end of this talk :( ) and we can talk it over?18:57
aquarius_ok, thanks all!18:58
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: App Developer Week - Current Session: Supercharging Your Apps with Unity Launcher Integration - Instructors: DBO
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/09/07/%23ubuntu-classroom.html following the conclusion of the session.19:00
DBOHi everyone, my name is Jason Smith, I am a developer from the Canonical Desktop Experience team (DX for short)19:02
DBOI'll be giving a talk on supercharging applications with unity launcher integration for the next hour or so19:02
DBOanyone reading along should feel free to ask questions as they pop into their heads19:03
DBOFirst I want to start off by making sure everyone is familiar with the general terminology I am going to be using through this talk19:03
DBOUnity is (of course) the new shell being developed on top of GNOME for Ubuntu 11.04 and newer19:04
DBOthe Launcher refers to the bar full of icons on the left side of the screen during usage of Unity19:04
DBOwhat we have found over the course of the last year is that application developers have desired a better way to display tiny pieces of information to users without doing rather drastic things like popping up alert boxes19:05
DBOmany application authors have resorted to doing things like changing the title of their application to indicate new messages, urgency, or task progress19:06
DBOso we decided to make those three things in particular an explicit and consistent API for usage with the Unity Launcher19:06
DBOthis API has been included in a library called libunity, and is available in the Ubuntu main repositories, you can also find its source code here: https://launchpad.net/libunity19:08
DBOLibunity will allow application developers to convey tiny bits of information about their application (or actually any application) they wish with very little work19:08
DBOwe'll look at this piece by piece19:08
DBOI'll be using Vala as code snippets, but python and C bindings are also available (or anything else that supports GIR)19:09
DBOThe first thing we do with libunity is get a LauncherEntry object19:10
DBOLauncherEntry objects serve as a control center for a single item on the launcher. They are asyncronous and currently one way (can be used to push information but not to inspect remote state)19:10
DBOLauncherEntry objects are keyed on the desktop file, so to create an entry for banshee, we would do:19:11
DBOvar launcher_entry = Unity.LauncherEntry.get_for_desktop_file ("banshee.desktop");19:11
DBOthe resulting launcher_entry will be remotely watched and tracked by the Unity Launcher as soon as it is created19:12
DBO(there is a caveat here that you must have a running main loop for any communication to work, otherwise it will queue until you run your main loop)19:12
DBOyou may create as many launcher entry objects as you like, for as many different applications as you like in a single program. This is useful for creating applications to bridge public API's between two different programs (say skype where we dont have source code access)19:13
DBOnow that we have a LauncherEntry, we can do 4 different, useful things with it19:14
DBO1) Mark or unmark the application as urgent19:14
DBO2) Set a count on the object (useful for unread messages)19:15
DBO3) Set a progress on the object19:15
DBO4) Add quicklist menu items to the object19:15
DBOEach of these is very simple, so we will just go through them in order, at the end I will post the entire source code for the example program19:15
DBOSetting our launcher_entry as urgent is as easy as "launcher_entry.urgent = true"19:16
DBOthis state will be immediately communicated over dbus to unity where it will be reflected on the launcher19:17
DBOsetting this back to false will reset the state19:17
ClassBotmhr3 asked: aren't there other methods to mark app urgent? shouldn't those be used instead?19:17
DBOYes, there are other methods for marking an application as urgent19:17
DBOthese methods are based on window hints applied to the xproperties of a related window19:18
DBOwhile these methods are quite useful, and should be preferred when the make sense19:18
DBOthere are some cases where they dont, such as when an application that has no mapped windows still wishes to be marked urgent19:18
DBOUbuntu One is an example of such an application19:19
DBOit will mark itself urgent when the user runs out of space, even though it has no mapped windows19:19
ClassBotkermit66676 asked: so there has to exist an <app_name>.desktop file somewhere? That file has to be included in a deb package by convention?19:20
DBOIn short yes, there must be a desktop file somewhere. This is what the unity launcher considers an "application"19:21
DBOHowever, that file does not have to be added by a deb package19:21
DBOthere was a bug last cycle where the daemon responsible for matching wouldn't seen manually added desktop files19:21
DBObut that has been fixed now19:22
DBOLibunity also allows users to set a count and a progress very simply, the api is almost identical for this so we'll just do them together19:22
DBOlauncher_entry.count = 1;19:23
DBOlauncher_entry.count_visible = true;19:23
DBOthese two lines of code set the count to 1, then instruct the launcher to actually display the count. The count and its display are decoupled so it can be turned on and off as needed19:23
DBOsimilarly, progress can be done as:19:23
DBOlauncher_entry.progress = 0.0;19:24
DBOlauncher_entry.progress_visible = true;19:24
DBOagain, the progress is set to 0, and then made visible19:24
ClassBotTrevinho asked: is actually impossible to check if a launcher entry is actually shown in the unity bar and maybe notified when it is there... Is this something planned (or that I can do :) )?19:25
DBOCurrently there is no method for checking the contents of the launcher, this is a planned feature we feel desperately needs fixing :)19:25
DBOand yes Trevinho, this is certainly something you could do :)19:26
DBOask me in #ayatana later and I will help you with the dbus work if needed19:26
DBOThe last major item libunity allows developers to modify the launcher with is the addition of new quicklist items19:26
=== Ron is now known as Guest738
DBOthese are done using the dbusmenu library, which has been covered in previous sessions and is fairly well documented, so I will only deal with the basic coupling code required for libunity19:27
DBOfirst we need to create a quicklist19:27
DBOsome example code looks a bit like:19:28
DBOvar ql = new Dbusmenu.Menuitem ();19:28
DBO    var item1 = new Dbusmenu.Menuitem ();19:28
DBO    item1.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "Item 1");19:28
DBO    var item2 = new Dbusmenu.Menuitem ();19:28
DBO    item2.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "Item 2");19:28
DBO    ql.child_append (item1);19:28
DBO    ql.child_append (item2);19:28
DBOthis will create a quicklist, called ql, containing two label items19:28
DBOthose items have signals on them you can subscribe to in order to get information about when they are clicked :)19:28
DBOadding them to the launcher is then as easy as:19:28
DBOlauncher_entry.quicklist = ql;19:29
DBOThis concludes the basic usage of libunity19:29
DBOunfortunately there are some limitations currently19:29
DBOand they mostly deal with applications wishing to use concurrent libunity connections19:29
DBOFirst, an application wishing to show a state on the launcher MUST remain active. The launcher watches the application on the session bus, and when it dies it reverts any changes it has made to the launcher icons state19:30
DBOso progress, count, urgent, and menu items all go away if you application dies19:31
DBOSecond, state is currently last write overwrites previous data for multiple connections19:31
DBOthis is very limiting and needs to be fixed, but people should be aware of it in the mean time :)19:32
ClassBotmhr3 asked: what is undone when the process which changed something on the launcher disappears?19:32
DBOThe changes go away :) I think I was slow to answer this but if I wasn't clear, yeah, the changes just get reverted :)19:33
ClassBotmhr3 asked: any plans with the DockManager spec? :)19:34
DBODockManager is a beautiful specification, and I really deeply regret we dont support it19:34
DBOits very comprehensive and covers a lot of corner cases pretty well19:34
DBOthe one major advantage I think the libunity implementation covers better is it allows multiple consumers AND multiple subscribers19:35
DBOso you could, in theory, have many docks all listening to the same signals from applications19:35
DBOthis was a shortcoming of dock manager (if I recall correctly)19:35
ClassBotkermit66676 asked: how come the Dbusmenu code is not masked using something more intuitive, such as ql = new Unity.Quicklist()? That would make it independent of the underlying technology (even though it might never change to something else).19:36
DBOI think the thought process is that dbusmenu is used in more places that just libunity (in the indicators for example), so making it a consistent API across the entire ecosystem was important19:36
DBOoh I forgot to pastebin the program :)19:36
DBOhere we are: http://paste2.org/p/163667419:37
DBOAs libunity grows, I hope we can see it used more consistently across the ubuntu desktop. Items in the desktop switcher, nautilus, and maybe the dash will see increased usage of these signals and display the same hints19:39
DBOanyhow, unless there are more questions, that is about all I got19:40
ClassBotrsajdok asked: Why did you choose value instead python?19:44
DBOVala is just the language I used in the example19:44
DBOits all gobject introspection19:44
DBOso you can use python too19:44
DBOI picked vala here just because thats what my test program is written in and I didn't feel like re-writing it :)19:45
ClassBotThere are 10 minutes remaining in the current session.19:51
ClassBotThere are 5 minutes remaining in the current session.19:55
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Event: App Developer Week - Current Session: Hello Vala: An Introduction to the Vala Language - Instructors: Lethalman, juergbi
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/09/07/%23ubuntu-classroom.html following the conclusion of the session.20:00
Lethalmanalright :)20:01
Lethalmanhi all, I'm Luca Bruno and I contribute to the Vala project20:01
Lethalmanjuergbi is the project leader20:01
Lethalmanvala is a new programming language with C#-like syntax that compiles to C and targets the GObject type system20:01
LethalmanI'm going to introduce the basics and the features of the vala language20:02
Lethalmanthe homepage can be found at https://live.gnome.org/Vala20:02
Lethalmanyou can get the vala compiler with "apt-get install valac", this is likely going to install at least vala 0.12 on an up-to-date system20:02
Lethalmanso what's good with vala... :)20:03
Lethalmanvala has syntax support for most of GLib/GObject features like classes/interfaces, properties, RTTI, virtual methods, signals, GValue and GVariant boxing/unboxing, error handling and optionally GIO features like GAsync and GDBus20:03
Lethalmanit also provides generics, closures, delegates, contract programming, duck typing and some other cool stuff without any additional run-time!20:03
Lethalmanhttps://live.gnome.org/Vala/Documentation#Projects_Developed_in_Vala20:04
Lethalmanthese are some applications written in vala20:04
Lethalmanso, let's start by taking a look at the hello world: http://paste.debian.net/127646/20:04
Lethalmanyou can compile it with "valac hello.vala" then run it with "./hello"20:05
Lethalmanargs is the well known array of strings passed to the command line20:05
Lethalmanstring[] denotes an array of strings, while "print" refers to "GLib.print" which is static method mapped to g_print()20:05
Lethalmanin vala you can have namespaces, and GLib is the default namespace20:06
Lethalmanfor reference, the online documentation for GLib can be found here: http://valadoc.org/glib-2.0/GLib.html20:06
Lethalmanthe main() static method is the entry point for applications, it will be executed first20:07
Lethalmanat the very basics you might want to see what happens behind the scenes... if you want to see the generated C code, compile with "valac -C hello.vala" then read "hello.c"20:07
Lethalmanvala has most of the basic glib types like int, bool, int16, uint16, float, double, string, structs, enums, flags, classes, interfaces and so on20:07
Lethalmanso let's take a look at the next example: http://paste.debian.net/127644/20:08
Lethalmanwe're defining the "Foo" class that extends the "Object" class20:08
Lethalmanthen the "bar" property of type int with automatic getter and setter (you can also define custom getter and setter)20:08
Lethalmanwe have a constructor which takes an int value and sets the bar property, "this" refers to the instance of the class20:08
Lethalmanin main() we create a new Foo instance and assign it to the local variable foo20:09
Lethalmanthe "var" keyword is meant to exploit type inference, so the type of foo is Foo... useful when you're lazy at writing long types ;)20:09
Lethalmanyou can find other examples of type inference in vala here: https://live.gnome.org/Vala/Tutorial#Type_Inference20:09
Lethalmanfor completeness let me say that the print() method supports printf-like format (man sprintf), so that you can format the arguments to the output very easily20:10
Lethalmanthe first important thing to notice is that we don't manually manage the foo variable lifetime in the example, instead vala does manage it20:10
Lethalmanvala has automatic memory management using reference counting when possible, so you don't have to manually call ref() or unref() functions for gobjects20:10
Lethalmanin this case, the foo variable is automatically unref()'d once it goes out of the scope20:11
Lethalmanfor more information about the memory model see both http://developer.gnome.org/gobject/stable/gobject-memory.html#gobject-memory-refcount and https://live.gnome.org/Vala/ReferenceHandling20:11
Lethalmanwhat's special in this example is that Foo is a registered GObject class in C and bar is a regular GObject property20:12
Lethalmanso, if you tell valac to autogenerate the header (valac -H sample.h sample.vala), C applications can use the class directly20:12
Lethalmanin general, vala performs very well in the interoperability area20:13
Lethalmanvala can talk to C using vala bindings (.vapi files) without additional run-time20:13
Lethalmanthat is, vala calls C functions directly without the need of any FFI20:13
Lethalmanin fact .vapi files are just descriptions of the API of C libraries20:14
Lethalmane.g. in order to use a foreign package called gtk+-2.0.vapi that is installed in your system, just use valac --pkg gtk+-2.0 yourprogram.vala so that vala compiles your program against gtk+-2.0 and you can use the gtk symbols20:14
Lethalmana .vapi file has the same syntax of a .vala file, thus easy to write manually, see json-1.0.vapi (short enough for a pastebin) for example: http://paste.debian.net/127656/20:15
Lethalmandon't worry, bindings can also be autogenerated from GIR files ;) (http://live.gnome.org/GObjectIntrospection)20:15
Lethalmanto generate a somelib.vapi from a gir it's as simple as doing vapigen --library somelib SomeLib-1.0.gir20:16
Lethalmanthat's a little different than python or javascript or... as it's compile-time stuff20:16
Lethalmananyway, vala itself ships with many bindings, you can see the docs at http://valadoc.org/20:16
Lethalmanok some more about interoperability then we talk about some cool features :)20:17
Lethalmanvala is able to autogenerate well-annotated GIR files to be used from other languages like python, javascript, etc.20:17
Lethalmanthat means higher level languages can talk to vala just immediately (just two steps without writing any GI annotation like in C)20:18
Lethalmanlet's see for example: https://live.gnome.org/Vala/SharedLibSample#Calling_vala_functions_using_introspection20:18
Lethalmanwhat we do is first creating a test_shared.so library and tell valac to generate testShared-0.1.gir for us20:19
Lethalmanonce you got a gir we're done, it's only a matter of generating a typelib using the GI compiler20:19
Lethalman!y20:19
ClassBotshazzner77 asked: weird question, but I have a microcontroller that can be programmed in C. Can I use Vala for this?20:19
Lethalmanthat's an hard question as it highly depends on the microcontroller20:20
Lethalmanmost of microcontroller have different C dialects20:20
Lethalmanbut you can use the posix profile to generate non-glib code somehow, but it's mostly an experimental feature... it's usable to some sort though20:21
Lethalmanso, let's talk about error handling20:21
Lethalmanvala features error handling on top of GError, with the well known try/catch/finally syntax20:21
Lethalmanin other words, you can catch errors thrown by C methods... eek! that sounds weird ;)20:22
Lethalmanthis is a simple example: http://paste.debian.net/128329/20:22
Lethalmanin the example we try to read a file, if the file doesn't exist (FileError.NOENT) we keep throwing the error, for any other error we abort the program with GLib.error()20:22
Lethalmanerrors in glib are propagated using GError, so vala autogenerates the necessary code to handle that gracefully20:23
Lethalmanyou can define your own error types using "errordomain" like this: http://paste.debian.net/128714/20:23
Lethalmanso, this is already a lot of nice features, but that's not all about it!20:24
Lethalmansome cool stuff about vala is the syntax support for async operations, closures and dbus client/server20:24
Lethalmanit is possible to define GIO-style async methods and calling other async methods very easily20:24
Lethalmanan async method returns immediately giving control back to the caller, and when the job is completed a callback is fired20:24
Lethalmantake a look at the first example here: http://live.gnome.org/Vala/AsyncSamples20:25
Lethalmanthe "async" keyword in front of list_dir() marks it as being a GIO-style coroutine20:25
Lethalmanyield dir.enumerate_children_async() will pause the method, then it will be resumed once there's a result... that's amazingly simple20:25
Lethalman(in the meantime, thanks to nemequ for doing a great work in -chat :P)20:26
Lethalmanalso notice in the main() method (which is not an async method) that we used a closure to be notified when list_dir() completes its job20:26
Lethalmanlist_dir.begin() will initiate the async operation, then when the job is complete we free the resources with list_dir.end()20:26
Lethalmanclosures are an important feature of vala compared to raw C20:27
Lethalmana closure (or lambda expression, or ...) is a method created on-the-fly that shares the scope of the parent method (main() in this case)20:27
Lethalmanthis is very very useful for callbacks for which you need to pass user data20:27
Lethalmanin fact, in the example the "loop" variable is used within the closure, but it's defined outside the closure20:27
Lethalmanthe general syntax for defining lambda expressions is (param1, param2, ...) => { ... body here ... }20:27
Lethalmanthe types of param1, param2, ... automatically match the parameters of the target type20:28
Lethalmanin this case the target type is AsyncReadyCallback which is a delegate type (i.e. a type that accepts methods)20:28
Lethalmanhere's the definition of AsyncReadyCallback: http://www.valadoc.org/gio-2.0/GLib.AsyncReadyCallback.html20:28
Lethalmanit takes two parameters, an Object and an AsyncResult... that's why we used (obj,res) => { ... } in the example20:29
ClassBotkermit66676 asked: I noticed there is no #include directive when using a library in Vala - doesn't that make things messy in bigger applications with a lot of packages - you have to watch out not to repeat class names from some other libraries? Or use namespaces all the time...20:30
Lethalmanif I understood the question correctly... when you compile a project you feed to valac all the .vala files at once20:30
Lethalmanvalac file1.vala file2.vala ...20:30
Lethalmanfor what concerns collision with existing names, yes namespaces are used for that20:30
Lethalmanbut applications or libraries written in vala usually have their own namespace, that's the best practice20:31
ClassBotmjaga asked: is valac part of the gcc family?20:31
Lethalmanno it isn't, it's a self-hosted compiler on its own20:32
Lethalmanbut valac uses the C compiler as it produces C code20:32
Lethalmanit's very slim and compiles fast, most of the time spent on compiling is usually due to the C compiler20:32
Lethalmanvala lets the underlying C compiler optimize things...20:33
Lethalmanso... the async stuff is very powerful when combined with dbus :)20:33
Lethalmanwe can call dbus methods (well, a property in this case) in a such simple way: http://paste.debian.net/128341/20:34
Lethalmanmethods of UPower would have suspended your workstation, so :P20:34
Lethalmanthe interface in the example is a way for vala to generate proxy calls to the dbus interface20:35
Lethalmanthe "can_hibernate" property is mapped to the dbus property org.freedesktop.UPower.CanHibernate20:35
Lethalmanwhat we do here is starting the async upower_query() operation, which will asynchronously connect to the system bus and request a proxy for UPower20:35
Lethalmanafterwards we request the value of the "can_hibernate" property... bool.to_string() is an helper method defined by vala, you know what it does :)20:35
Lethalmanvala automatically does dbus serialization of values when doing dbus stuff (the bool property in this case), even for the most complex types20:36
Lethalmanthis is about client code, but you can write dbus servers by just writing normal class methods20:36
Lethalmantake for example this server code: http://paste.debian.net/128754/20:36
Lethalmanand the following client snippet to query the server: http://paste.debian.net/128756/20:37
Lethalmancompile the server with "valac dbusserver.vala --pkg gio-2.0" and the client with "valac dbusclient.vala --pkg gio-2.0"20:37
Lethalmanso you can start the server with ./dbusserver and then invoke the client multiple times with ./dbusclient20:37
Lethalmanif everything goes well, on the client you should see a counter increasing on each call20:38
Lethalmannotice: as said in -chat not _all_ of the complex types, there might be some bug/limitation but you can use GLib.Variant manually as well20:40
Lethalmanin this case we assumed the client didn't know the server codebase, otherwise we could share the same interface definition and let the server class implement it20:40
Lethalmanserver side we do some other stuff for acquiring the name, registering a callback when it's available20:42
Lethalmanso, this vala integration is very important as our desktops are leading toward async and dbus more and more20:43
Lethalmanthere are several projects that massively use such advanced features of vala successfully20:43
Lethalmanafter this low level stuff we can take a look at some GUI with GTK+: http://live.gnome.org/Vala/GTKSample20:43
Lethalmanreference docs for gtk3 can be found here: http://valadoc.org/gtk+-3.0/index.htm20:43
Lethalmanthe "using Gtk;" statement on the top means that the Gtk namespace is merged in the file20:43
Lethalmantherefore we can use "new Window ()" instead of "new Gtk.Window ()", and so on20:44
Lethalmanalso notice window.title = "First GTK+ Program";20:44
Lethalmanwindow.title is a gobject property, we saw them in the first hello world example20:44
Lethalmanin this case vala will generate the C code for calling gtk_window_set_title (GTK_WINDOW (window), "First GTK+ Program") properly20:44
Lethalmanin the example we can also see the button.clicked.connect() call: it's used to connect to the "GtkButton::clicked" signal!20:44
Lethalmanthe first argument is the callback that will be fired when the signal is emitted20:45
Lethalmanyou can also specify a method (static method or instance method) as the signal callback, not only a closure20:45
LethalmanI've written an equivalent code here without the use of a closure: http://paste.debian.net/128743/20:45
Lethalmanyeah, it's more typing without closures ;)20:45
Lethalmanas you can see writing gui with vala is very simple, and you can take advantage of async operations for doing I/O without blocking the GUI!20:46
Lethalmanso now we're connecting to a signal, but in vala defining signals is as easy as putting a "signal" keyword in front of a method declaration20:46
Lethalmanan example of signal definition can be found here: https://live.gnome.org/Vala/Tutorial#Signals20:46
Lethalmanin that code we defined a full gobject signal named "sig_1" with an int parameter... like properties, signals can be used from C as well as higher level languages20:47
Lethalmanand emitting the signal is as simple as calling a normal method: t1.sig_1 (5)20:47
Lethalmanok now let's talk a little about generics20:48
Lethalmangenerics in vala are similar to C# or Java generics20:48
Lethalmanthey are used to restrict the type of data that is contained in a class, both at compile-time and at run-time (no type erasure)20:48
Lethalmanfor example let's use GList, which is a glib structure for doubly linked lists: http://paste.debian.net/128737/20:48
Lethalmanthe type List<string> will define a list whose elements are of type string20:49
Lethalmanthen we append to strings to the list, and print them20:49
Lethalmanthe foreach statement is another neat feature of vala, allowing to iterate through the elements of a collection20:49
Lethalmanthe syntax is simple: foreach (element_type variable_name in container_expression) { ... }20:49
Lethalmanin this case we used "var" as element type to exploit the type inference20:50
Lethalmanroughly speaking, in this case vala will infer the element type from the generic type of the container which is "string"20:50
ClassBotThere are 10 minutes remaining in the current session.20:50
ClassBotmhr3 asked: there's this nice syntax to read/write gobject properties, are there any plans to have similar support for widget style properties?20:50
Lethalmanwell, not that I know of20:51
Lethalmananyway while the properties defined in a class are known at compile-time, not necessarily style properties (or child properties...) are known at compile-time20:51
Lethalmanso it may lack some type checking... if you have a clear idea you can feature request it :)20:52
Lethalmanyou can also define your own complex types using generics like the first example here: https://live.gnome.org/Vala/Tutorial#Generics20:53
Lethalmanglib offers several data structures already, but there's also libgee that provides a collection library that is written in vala and widely used20:54
Lethalmanlibgee is more vala-friendly and has data structures such as TreeMap, PriorityQueue, HashSet, HashMultiMap, etc.20:54
Lethalmanthe reference docs for libgee can be found here: http://valadoc.org/libgee-0.7/index.htm20:54
Lethalmanok... we're almost done :)20:55
Lethalmanvala comes with libvala, which is a library for parsing and analyzing the vala code and generating code...20:55
ClassBotThere are 5 minutes remaining in the current session.20:55
Lethalmandespite the libvala API is not stable, there are many users of it like IDEs, documentation tools, code generators, etc.20:55
Lethalmanfor generating documentation for you projects you can use valadoc: https://live.gnome.org/Valadoc20:56
Lethalmanthere're lots of other neat features like lock statement, inheritance, virtual/abstract methods and properties, etc. that we didn't mention...20:56
Lethalmanor experimental features like chained expressions: foo < bar < baz < mama20:57
Lethalmanor regex literals like in perl: /.../ will create a GLib.Regex20:57
Lethalmanif you want to know more the tutorial at https://live.gnome.org/Vala/Tutorial is a good start... and the community is wide and very active ;)20:57
Lethalmanok that's all, thanks everyone :)20:58
Lethalmanok suggested from -chat to mention our community is on the mailing list vala-list@gnome.org and on #vala on irc.gimp.org20:59
ClassBotLogs for this session will be available at http://irclogs.ubuntu.com/2011/09/07/%23ubuntu-classroom.html21:00
=== ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat ||

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!