[maemo-developers] Porting a C program in Maemo

From: Tim Teulings rael at edge.ping.de
Date: Tue Jul 15 09:20:19 EEST 2008
Hallo!

> Can you start by defining what you want when you say "stuff would be
> shown on the Maemo (2.2) screen"?
> 
> Do you want the text in a dialog box? As a text box? You saw it on the
> terminal so it got somewhere.

>>      printf("%d. Hail to Kernighan and Ritchie \n", i);

To clearify:
* All standard output like printf or similar (or std:cout in C++) by
default will be printed to the terminal this application is started in.

So in your case, the user of the Device has to open the xterm first and
then start your application. If you would get your application listed in
the menues and start it you would not see anything because you do not
have a terminal attached.

If you want to open your own window (and do not rely on the user opening
the xterm window first) and print stuff there there are several options:
* Write a wrapper script for your application and make that wrapper
script open the window first (you might need to work around the DBus
application helth probing).
* Write a shell script and use a package like dialog to show text
(however I thing dialog is not available on the device). Dialog offers
you command line application that create simple dialogs that can be
opened from a shell script.
* Write a GUI application using a GUI library like GTk or similar. Note
that this will be very different to your initial C program but is the
prefered way.

Besides C you can also use c++ or python, which are also supported - but
the principle solutions are the same.

You can also use Curses for nifty console output but you wll still have
the problem that you require an open terminal first.

I would suggest to take a look at the maemo tutorial andthe various Gtk
tutorials that give you an introduction to Gtk programming.

-- 
Gruß...
       Tim


More information about the maemo-developers mailing list