×
Namespaces

Variants
Actions
Revision as of 17:20, 2 December 2012 by lpvalente (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Getting started with Maemo development using C

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.


Article Metadata
Article
Created: rbelwal (11 Dec 2007)
Last edited: lpvalente (02 Dec 2012)

Contents

Overview

This article provides an overview on how to develop for Maemo using C.

Tools

Scratchbox which is a cross compilation tool is required. Check www.scratchbox.org for more details.

Xephyr is required to launch the application framework and execute GUI applications.

Install the Maemo SDK (( you need to have a Linux OS to install the SDK though Debian and Ubuntu are recommended and Xephyr is included in most of the Linux distributions). Also if you want to install SDK on your windows machine you have to emulate a Linux environment to be able to work with maemo SDK. For that pupose you need to set up the VMWARE player).

Creating a Helloworld application

After you have installed all the packages log into the scratchbox then select the x86 SDK target.

Create a folder in your scratchbox home directory and then move to that folder. Now create the file with the below source code


include <hildon/hildon-program.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkbutton.h>
 
 
void button_pressed()
{
int i = 0;
int p=100/i;
HildonProgram *program;
g_print ("%s - %d","Hello World-",p);
program = HILDON_PROGRAM(hildon_program_get_instance());
 
 
}
 
int main(int argc, char *argv[])
{
/* Create needed variables */
HildonProgram *program;
HildonWindow *window;
GtkWidget *button;
 
/* Initialize the GTK. */
gtk_init(&argc, &argv);
 
/* Create the hildon program and setup the title */
program = HILDON_PROGRAM(hildon_program_get_instance());
g_set_application_name("Hello Wiki!");
 
/* Create HildonWindow and set it to HildonProgram */
window = HILDON_WINDOW(hildon_window_new());
hildon_program_add_window(program, window);
 
/* Create button and add it to main view */
button = gtk_button_new_with_label("Hello!");
gtk_container_add(GTK_CONTAINER(window), button);
 
g_signal_connect(G_OBJECT(button),"pressed",G_CALLBACK(button_pressed),NULL);
 
/* Connect signal to X in the upper corner */
g_signal_connect(G_OBJECT(window), "delete_event",
G_CALLBACK(gtk_main_quit), NULL);
 
/* Begin the main application */
gtk_widget_show_all(GTK_WIDGET(window));
gtk_main();
 
/* Exit */
}

Further Reading

Writing a Plug-in for Maemo

This page was last modified on 2 December 2012, at 17:20.
40 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×