Maemo 5 Examples
Overview of maemoexamples
Maemoexample package contains example applications aimed to assist development of Hidon applications. They are stored at garage.maemo.org.
Precondition:
Fremantle SDK is installed with application framework started. nokia-binaries meta package is installed.
Checkout maemoexamples from svn, build and install them as below.
svn checkout https://garage.maemo.org/svn/maemoexamples/branches/fremantle-sdk-testing/maemo-examples
cd maemo-examples
Manual steps to build and install each example application are described below. Alternatively, all example applications can be built using 'dpkg-buildpackage -rfakeroot'. maemo-example*.deb is created in parent folder. Install maemoexamples package as below:
dpkg -i maemoexamples*.deb
1. Hildon application
Summary: This application demonstrates a simple hildon application.
[sbox-FREMANTLE_X86: ~/maemo-examples] > make example_hildonprogram
[sbox-FREMANTLE_X86: ~/maemo-examples] >run-standalone.sh ./example_hildonprogram
Application has one simple hildon window and it looks as below.
2. Hildon Menu
Summary: example_menu application demonstrates how to enable hildon menus in hildon applications.
[sbox-FREMANTLE_X86: ~/maemo-examples] > make example_menu
[sbox-FREMANTLE_X86: ~/maemo-examples] > run-standalone.sh ./example_menu
Menu items like radio button and check-box can be enabled or disabled from the menu and application looks like below picture.
3. Toolbar
Summary: This application demonstrates how to use a tool bar in hildon applications.
[sbox-FREMANTLE_X86: ~/maemo-examples] > make example_toolbar
[sbox-FREMANTLE_X86: ~/maemo-examples] >run-standalone.sh ./example_toolbar
The application has one toolbar and the items from the list are selectable.
4. File management – file chooser dialog
Summary: This application demonstrates how applications can use file chooser dialog.
[sbox-FREMANTLE_X86: ~/maemo-examples] > make example_file_chooser
[sbox-FREMANTLE_X86: ~/maemo-examples] > run-standalone.sh ./example_file_chooser
Click on the application menu and follow the pictures below. Click on 'Test File Save'.
Select the location and save the file.
Click on the application menu-> Test File Open. File Oopen Dialog is shown as below.
5. Color selector dialog
Summary: This application demonstrates how applications can use color chooser dialog.
[sbox-FREMANTLE_X86: ~/maemo-examples] > make example_color_selector
[sbox-FREMANTLE_X86: ~/maemo-examples] > run-standalone.sh ./example_color_selector
The test application has two buttons and demonstrates two different ways of using color selection in Hildon applications. The first button is using HildonColorButton and can show the selected color on the button. Click the button and color chooser dialog opens as below.
6. Font selection Dialog
Summary: example_font_selector application demonstrates how to use font selection in hildon applications.
[sbox-FREMANTLE_X86: ~/maemo-examples] > make example_font_selector
[sbox-FREMANTLE_X86: ~/maemo-examples] > run-standalone.sh ./example_font_selector
This application has a button. When clicked, a font selection dialog is opened and allows selection of font, formatting, color etc. All available selections can be found by clicking on each of three tabs Style, Formatting and Other.
7. File management – file details dialog
Summary: This application demonstrates how applications can use file details dialog.
Precondition: A plain text file ~/MyDocs/.example/foo.txt has to be created before hand so that the test application finds the file and provides details about the file.
Procedure: If maemo-examples package is not built and installed so far then it can be achieved as below:
[sbox-FREMANTLE_X86: ~/maemo-examples] > make example_file_details
[sbox-FREMANTLE_X86: ~/maemo-examples] > run-standalone.sh ./example_file_details
The application has a button. When clicked, details of the file are shown as below picture.
8. Context Menu
Summary: The application demonstrates how to implement context sensitive menu in hildon applications.
[sbox-FREMANTLE_X86: ~/maemo-examples] > make example_context
[sbox-FREMANTLE_X86: ~/maemo-examples] >run-standalone.sh ./example_context
Tap and hold the button available in the application and a new 'close' button appears.
9. libosso
Summary: The application demostrates how to use libosso in hildon applications.
[sbox-FREMANTLE_X86: ~/maemo-examples] > make example_libosso
[sbox-FREMANTLE_X86: ~/maemo-examples] > make example_message
[sbox-FREMANTLE_X86: ~/maemo-examples] >run-standalone.sh ./example_libosso &
The application awaits a dbus message. Once it is received, the text in the example application is updated.
10. Drawing
Summary: A simple drawing appliciton.
Precondition: Fremantle SDK is installed and applcation framework started. Maemo-examples checked out from svn.
Procedure: If maemo-examples package is not built and installed so far then it can be achieved as below
[sbox-FREMANTLE_X86: ~/maemo-examples] > make example_drawing
[sbox-FREMANTLE_X86: ~/maemo-examples] >run-standalone.sh ./example_drawing
The application allows drawing and co-ordinates of each click is shown as below.
11. Gconf support – application specific
Summary: This application demonstrates how applications can use gconf
Precondition: Fremantle SDK is installed and applcation framework started. Maemo-examples checked out from svn.
Procedure: If maemo-examples package is not built and installed so far then it can be achieved as below
[sbox-FREMANTLE_X86: ~/maemo-examples] > make example_gconf
[sbox-FREMANTLE_X86: ~/maemo-examples] > run-standalone.sh ./example_gconf
Observe that the application has a label “Change window title” and a text box.
Also note that application does not have a title yet and we use gconf to store new title for the application. Enter new title in the text box and press 'enter' as below.Close the application now. The application is storing the new title for application using gconf and will be read and shown if we open the application again.
12 Gconf support – System wide
Summary: This application demonstrates how applications can use gconf to find out a keyboard layout which is available system wide.
[sbox-FREMANTLE_X86: ~/maemo-examples] > make example_gconf_subscr
[sbox-FREMANTLE_X86: ~/maemo-examples] > run-standalone.sh ./example_gconf_subscr &
The application has a label “Current keyboard layout” with no keyboard layout details.
Use gconftool to set a new keyboard layout as below.
[sbox-FREMANTLE_X86: ~/maemo-examples] > gconftool --set --type=string /apps/osso/inputmethod/int_kb_layout "fi"
The new keyboard layout is now shown on the application as shown in the below picture.
Change the layout again to “us”
[sbox-FREMANTLE_X86: ~/maemo-examples] > gconftool --set --type=string /apps/osso/inputmethod/int_kb_layout "us"
The new layout set is updated in the application too.
13. Developing Home plugins for hildon desktop
Summary: This application demonstrates development of custom desktop home plugins. This example create a new button on the desktop when clicked opens a new dialog with 'close' button.
[sbox-FREMANTLE_X86: ~/maemo-examples] > make clean
[sbox-FREMANTLE_X86: ~/maemo-examples] > make hello-world-home.so
[sbox-FREMANTLE_X86: ~/maemo-examples] > ./install_home_applet.sh
After installing the home applet, A button appears on the desktop with GNU image as show in below picture.
Click on the button and you will see a dialog:
14. Developing control panel applets
Summary: This application demonstrates development of new plugins for control panel.
[sbox-FREMANTLE_X86: ~/maemo-examples] > make libapplet.so
[sbox-FREMANTLE_X86: ~/maemo-examples] > ./install_controlpanel_applet.sh
A new applet with GNU image is shown in the control panel application.
On clicking the applet, a dialog with the title "Hello control panel" is displayed.
15. Gstreamer
Summary: This application demonstrates how to use GStreamer APIs in hildon applications.
Configure pulseaudio on the host as follows:
Enable system-wide PulseAudio server by editing /etc/default/pulseaudio and change PULSEAUDIO_SYSTEM_START=1
Enable TCP connections in PulseAudio by editing /etc/pulse/default.pa on host and uncomment load-module-native-protocol-tcp
Restart pulseaudio
After restarting pulseaudio, copy the file .pulse-cookie from the host user home directory to the scratchbox user home directory.
Inside scratchbox, configure the client by creating a new file called client.conf under .pulse folder with the following two lines:
disable-shm = yes
default-server = 127.0.0.1:4713
[sbox-FREMANTLE_X86: ~/maemo-examples] > make example_wavlaunch
[sbox-FREMANTLE_X86: ~/maemo-examples] > run-standalone.sh ./example_wavlaunch
Open the Front_Center.wav file under Sounds directory from the application and click on Play. The application should be able to play the file.
16. Games startup
Summary: This application demonstrates how to use osso-games-startup.
Precondition: Fremantle SDK is installed and applcation framework started. Check out the latest crazyparking game from here
svn co https://garage.maemo.org/svn/maemoexamples/branches/fremantle-sdk-testing/crazyparking
Procedure: If maemo-examples package is not built so far then it can be achieved as below:
[sbox-FREMANTLE_X86: ~/crazyparking] > sh autogen.sh
[sbox-FREMANTLE_X86: ~/crazyparking] > dpkg-buildpackage -rfakeroot
[sbox-FREMANTLE_X86: ~/crazyparking] > fakeroot dpkg -i ../crazyparking*deb
Launch the application from the application view matrix (restart the application framework may be required). The application will look as follows:
17. Developing Status menu applets for hildon desktop
Summary: This application demonstrates development of custom status menu applets. This example creates a new icon in the status area and a button to the status menu.
[sbox-FREMANTLE_X86: ~/maemo-examples] > make clean
[sbox-FREMANTLE_X86: ~/maemo-examples] > make example_statusmenu.so
[sbox-FREMANTLE_X86: ~/maemo-examples] > ./install_statusmenu_applet.sh
After installing the status menu applet, a gnu icon appears in the status area. When clicked on the staus area, the status menu appears with a button as seen on the picture.
Note: if hildon-status-menu is not running, start it by:
[sbox-FREMANTLE_X86: ~/maemo-examples] > run-standalone.sh hildon-status-menu &