practical gnome programming with ruby
play

Practical GNOME Programming with Ruby FOSDEM 2004 Tutorial Laurent - PowerPoint PPT Presentation

Practical GNOME Programming with Ruby FOSDEM 2004 Tutorial Laurent Sansonetti - lrz@gnome.org Nikolai Weibull - pcp@pcppopper.org http://ruby-gnome2.sourceforge.jp Ruby-GNOME2 Tutorial, FOSDEM 2004 p.1/26 Goal Our goal is to demonstrate


  1. Practical GNOME Programming with Ruby FOSDEM 2004 Tutorial Laurent Sansonetti - lrz@gnome.org Nikolai Weibull - pcp@pcppopper.org http://ruby-gnome2.sourceforge.jp Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.1/26

  2. Goal Our goal is to demonstrate that Ruby is Useful to glue complex components together Mature enough for real GNOME development Sexy by developing a very, very simple audio player: Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.2/26

  3. TOC Contents: The Ruby-GNOME2 Project User Interface Design Multimedia Design Implementation Questions Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.3/26

  4. TOC Contents: The Ruby-GNOME2 Project User Interface Design Multimedia Design Implementation Questions Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.4/26

  5. The Ruby-GNOME2 Project Since 2002 Current release: 0.8.1 Has 16 developers worldwide Supports 17 GNOME libraries Resources in English, and i18n in progress (French, Italian, and Japanese) Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.5/26

  6. The Ruby-GNOME2 Project Supported libraries: Name Implementation Status Tutorials? API Reference? Examples? ATK *** No No Yes GConf *** Yes Yes Yes GDK *** No Yes Yes GLib *** No No Yes GStreamer *** No Yes Yes GTK *** Yes Yes Yes GnomeCanvas *** No No Yes GtkGLExt *** No Yes Yes Libgda *** Yes Yes Yes Libglade *** No No Yes Libgnome *** No No Yes GdkPixbuf ** No No Yes GnomeVFS ** No No Yes Libart ** No No Yes Pango ** No No Yes GtkHtml * No No Yes GtkSourceView * No No Yes Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.6/26

  7. The Ruby-GNOME2 Project RBBR (RuBy BRowser): Inspects classes/modules: Native stuff: methods, constants, ancestors, . . . GLib stuff: signals, properties, enum/flags, . . . Displays API reference (if exists) Shows GNOME stock items/icons Usable (HIG compliant) i18n (Belarusian, English, French, Japanese) Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.7/26

  8. TOC Contents: The Ruby-GNOME2 Project User Interface Design Multimedia Design Implementation Questions Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.8/26

  9. User Interface Design Glade is a GTK+/GNOME user interface builder. Glade can: generate source code (C/C++/Perl/.../Ruby) for the user interface: the bad generate an XML file ( .glade ) loadable by Libglade: the good crash: the ugly Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.9/26

  10. User Interface Design Ruby/Libglade in action: require ’libglade2’ engine = GladeXML.new(’my_project.glade’) do |handler_name| # connect the signal handler somewhere # we need to return a method reference lambda{ puts handler_name + " was called!" } end window = engine[’my_window’] # window is a Gtk::Window window.title = "My Application" button = engine[’my_button’] # button is a Gtk::Button button.text = "My Button" button.sensitive = false : : Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.10/26

  11. User Interface Design Let’s play a bit with Glade! Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.11/26

  12. TOC Contents: The Ruby-GNOME2 Project User Interface Design Multimedia Design Implementation Questions Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.12/26

  13. Multimedia Design GStreamer is A multimedia framework A set of components (plugins) for input codecs (audio, video, . . . ) filters / processors output Network transparent Extensible Fast Still under heavy development Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.13/26

  14. Multimedia Design GStreamer deals with pipelines. Pipelines are sets of elements Elements are sets of pads Pads are connection points between elements Elements are generally one of the following: A source - provides data A filter - tranforms data A sink - consumes data Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.14/26

  15. Multimedia Design GStreamer pipeline overview: Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.15/26

  16. Multimedia Design Pipelines are what we get after connecting elements in a sequence, much like connecting commands in a shell. We will discuss three pipelines: filesrc ! mad ! osssink filesrc ! spider ! osssink gnomevfssrc ! spider ! osssink Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.16/26

  17. Multimedia Design The filesrc ! osssink pipeline consists of: mad ! filesrc - provides data from a file on disk mad - decodes MPEG audio using libmad osssink - sends audio to soundcard using OSS Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.17/26

  18. Multimedia Design Positive Simple, works very well Negative Can only decode files on disk Can only decode MPEG audio Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.18/26

  19. Multimedia Design We can do better! The filesrc ! osssink pipeline consists spider ! of: filesrc - provides data from a file on disk spider - finds type of data and creates proper decoder osssink - sends audio to soundcard using OSS Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.19/26

  20. Multimedia Design Positive Works for any kind of media type with audio data Works well in most cases Simple to set up Negative Can only decode files on disk Can fail to find type Can fail to find decoder Slower than using proper decoder immediately Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.20/26

  21. Multimedia Design We can still do better! The gnomevfssrc ! osssink pipeline spider ! consists of: gnomevfssrc - provides data from an URL using GnomeVFS spider - finds type of data and creates proper decoder osssink - sends audio to soundcard using OSS Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.21/26

  22. Multimedia Design Positive Works for anything that can be accessed through an URL Works for any kind of media type with audio data Works well in most cases Simple to set up Negative Adds GnomeVFS dependency Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.22/26

  23. TOC Contents: The Ruby-GNOME2 Project Multimedia Design User Interface Design Implementation Questions Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.23/26

  24. User Interface Design Let’s write some code! Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.24/26

  25. TOC Contents: The Ruby-GNOME2 Project Multimedia Design User Interface Design Implementation Questions Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.25/26

  26. Questions Ask away! Ruby-GNOME2 Tutorial, FOSDEM 2004 – p.26/26

Recommend


More recommend