Maemo Diablo Reference Manual for Maemo 4.1 (DRAFT)
Total Page:16
File Type:pdf, Size:1020Kb
code in your hands Maemo Diablo Reference Manual for maemo 4.1 (DRAFT) June 19, 2008 Contents 1 Introduction 10 2 Glossary 14 3 Development Environment 16 3.1 Introduction .............................. 16 3.2 Maemo Software Development Kit ................. 16 3.3 Installing SDK ............................. 20 3.3.1 Prerequisites .......................... 20 3.3.2 Automatic Install of Scratchbox ............... 20 3.3.3 Manual Install of Scratchbox ................ 21 3.3.4 Automatic Install of Maemo SDK .............. 21 3.3.5 Manual Install of Maemo SDK ............... 22 3.3.6 Manual Install of ARMEL Target .............. 24 3.4 Testing SDK Installation ....................... 25 3.4.1 Testing Scratchbox ...................... 25 3.4.2 Writing GUI Hello World .................. 27 3.4.3 Running GUI Hello World .................. 31 3.4.4 Starting Virtual X Server (Xephyr) ............. 32 3.4.5 Directing Client to Virtual Server .............. 32 3.4.6 Starting Application Framework .............. 33 3.4.7 Running Hello World in Application Framework .... 34 3.5 Setting up USB Networking ..................... 35 3.5.1 Introduction .......................... 35 3.5.2 Setting up Environment and Device ............ 35 3.5.3 Testing Connection ...................... 36 3.6 CPU Transparency .......................... 37 3.6.1 Setting up Host Linux PC Environment .......... 37 3.6.2 Setting up Scratchbox ARMEL Target ........... 38 3.6.3 Setting up Device for CPU Transparency ......... 38 3.6.4 Testing CPU Transparency .................. 38 3.7 Using Linux Flasher Tool ....................... 39 4 GNU Build System 41 4.1 Introduction .............................. 41 4.2 GNU Make and Makefiles ...................... 41 4.2.1 Simplest Real Example .................... 42 4.2.2 Anatomy of Makefile ..................... 45 1 4.2.3 Default Goal .......................... 46 4.2.4 On Names of Makefiles ................... 46 4.2.5 Questions ........................... 46 4.2.6 Adding Make Goals ..................... 47 4.2.7 Making One Target at a Time ................ 48 4.2.8 PHONY Keyword ...................... 48 4.2.9 Specifying Default Goal ................... 49 4.2.10 Other Common Phony Goals ................ 49 4.2.11 Variables in Makefiles .................... 50 4.2.12 Variable Flavors ........................ 50 4.2.13 Recursive Variables ...................... 50 4.2.14 Simple Variables ....................... 51 4.2.15 Automatic Variables ..................... 53 4.2.16 Integrating with Pkg-Config ................ 54 4.3 GNU Autotools ............................ 55 4.3.1 Brief History of Managing Portability ........... 55 4.3.2 GNU Autoconf ........................ 56 4.3.3 Substitutions ......................... 60 4.3.4 Introducing Automake .................... 62 4.3.5 Checking for Distribution Sanity .............. 67 4.3.6 Cleaning up .......................... 67 4.3.7 Integration with Pkg-Config ................ 68 5 Architecture 69 5.1 Introduction .............................. 69 5.1.1 Key Components ....................... 69 5.1.2 Development Environment ................. 70 5.2 Software Layers ............................ 70 5.2.1 Operating System Layer and Bootup ............ 70 5.2.2 System Libraries ....................... 71 5.2.3 System Services ........................ 71 5.2.4 Hildon Framework ...................... 71 5.2.5 Applications .......................... 71 5.3 Software Decomposition View .................... 72 5.3.1 Software Components .................... 72 5.3.2 Kernel ............................. 79 5.3.3 Flash Partitioning ....................... 80 5.3.4 Application Framework ................... 80 5.3.5 Base Distribution ....................... 81 5.4 Run Time View ............................ 83 5.4.1 Overview ........................... 83 5.4.2 Components .......................... 83 5.4.3 Application Activation .................... 84 5.4.4 Application Termination ................... 86 5.4.5 State Saving and Background Killing ........... 86 5.4.6 X Window System ...................... 88 5.4.7 Window Management .................... 90 5.4.8 Misbehaved Applications .................. 91 5.5 Major APIs ............................... 92 5.6 Maemo Compared to Desktop Linux Distributions ........ 92 2 6 Application Development (DRAFT) 95 6.1 Introduction .............................. 95 6.2 Typical Maemo GUI Application .................. 96 6.3 Hildon Desktop ............................ 98 6.4 Writing Maemo GUI Applications ................. 98 6.4.1 Overview of Maemo GUI Applications .......... 98 6.4.2 Basic Hildon Layouts ..................... 98 6.4.3 Windows ............................ 100 6.4.4 Menus ............................. 102 6.4.5 Toolbars ............................ 104 6.4.6 HildonFindToolbar ...................... 106 6.5 Other Hildon Widgets ........................ 110 6.5.1 HildonFileChooserDialog .................. 111 6.5.2 HildonColorChooser ..................... 112 6.5.3 HildonFontSelectionDialog ................. 114 6.5.4 HildonFileDetailsDialog ................... 115 6.5.5 HildonBanner ......................... 116 6.6 Using Maemo Input Mechanism .................. 119 6.6.1 Touchscreen (Mouse) ..................... 119 6.6.2 Context Sensitive Menu ................... 119 6.6.3 Hardware Keys ........................ 119 6.6.4 Maemo’s Gtk Accelerator and Mnemonics ........ 121 6.6.5 Maemo Text Input Methods ................. 122 6.6.6 Application Layout Considerations ............ 123 6.7 Writing Control Panel Applets ................... 123 6.7.1 Functions ........................... 123 6.7.2 Building Applet ........................ 124 6.7.3 The .desktop File ....................... 125 6.8 Writing Hildon Desktop Plug-ins .................. 125 6.8.1 Introduction .......................... 125 6.8.2 Task Navigator Plug-ins ................... 125 6.8.3 Home Plug-ins ........................ 130 6.8.4 Status Bar Plug-ins ...................... 132 6.8.5 Control Panel Plug-ins .................... 136 6.8.6 Creating Makefiles and Package for Applet ........ 136 6.9 Integrating Applications to Maemo Framework ......... 142 6.9.1 Getting Application to Task Navigator Menu ....... 142 6.9.2 LibOSSO Library ....................... 144 6.9.3 Application Settings ..................... 149 6.10 MIME Types Mapping ........................ 150 6.10.1 New MIME Type with OSSO Category Extension .... 150 6.10.2 What is OSSO Category ................... 150 6.10.3 Updating Platform Databases ................ 151 6.10.4 Registering MIME Type with Package ........... 151 6.11 Writing Application from Scratch .................. 152 6.11.1 Introduction .......................... 152 6.11.2 Creating Application File Structure ............ 153 6.11.3 Coding Application Main .................. 154 6.11.4 User Interface ......................... 156 6.11.5 Localization .......................... 159 3 6.11.6 Adding Application to Menu ................ 161 6.11.7 Link to Maemo Menu .................... 161 6.11.8 Adding Help ......................... 161 6.11.9 Packaging Application .................... 162 6.12 Help Framework ........................... 163 6.12.1 Creating Help File ...................... 164 6.12.2 Adding Help Context Support into Application ..... 165 6.12.3 Distributing Example Application ............. 167 7 Using Generic Platform Components (DRAFT) 168 7.1 Introduction .............................. 168 7.2 File System - GnomeVFS ....................... 169 7.3 Message Bus System - D-Bus .................... 176 7.3.1 D-Bus Basics .......................... 176 7.3.2 LibOSSO ............................ 189 7.3.3 Using GLib Wrappers for D-Bus .............. 211 7.3.4 Implementing and Using D-Bus Signals .......... 233 7.3.5 Asynchronous GLib/D-Bus ................. 249 7.3.6 D-Bus Server Design Issues ................. 258 7.4 Application Preferences - GConf .................. 265 7.4.1 Using GConf ......................... 266 7.4.2 Using GConf to Read and Write Preferences ....... 268 7.4.3 Asynchronous GConf .................... 275 7.5 Alarm Framework .......................... 283 7.5.1 Alarm Events ......................... 285 7.5.2 Managing Alarm Events ................... 288 7.5.3 Checking for Errors ...................... 289 7.5.4 Localized Strings ....................... 290 7.6 Usage of Back-up Application .................... 291 7.6.1 Custom Back-up Locations ................. 292 7.6.2 After Restore Run Scripts .................. 293 7.7 Using Maemo Address Book API .................. 294 7.7.1 Using Library ......................... 294 7.7.2 Accessing Evolution Data Server (EDS) .......... 295 7.7.3 Creating User Interface ................... 300 7.7.4 Using Autoconf ........................ 304 7.8 Clipboard Usage ........................... 304 7.8.1 GtkClipboard API Changes ................. 304 7.8.2 GtkTextBuffer API Changes ................. 305 7.9 Global Search Usage ......................... 305 7.9.1 Global Search Plug-ins .................... 306 7.10 Writing "Send Via" Functionality .................. 308 7.11 Using HAL ............................... 310 7.11.1 Background .......................... 310 7.11.2 C API .............................. 312 7.12 Certificate Storage Guide ....................... 313 7.12.1 Digital Certificates ...................... 314 7.12.2 Certificates in Maemo Platform ............... 316 7.12.3 Creating Own Certificates with OpenSSL ......... 316 7.12.4 Maemo Certificate Databases