Friday, August 28, 2009

How's this for open? Nokia posts some code to get you started on your own Maemo app, no SDK required!

/**
* gtk_helloworld-1.c
*
* This maemo code example is licensed under a MIT-style license,
* that can be found in the file called “License” in the same
* directory as this file.
* Copyright (c) 2007-2008 Nokia Corporation. All rights reserved.
*
* A simple GTK+ Hello World. You need to use Ctrl+C to terminate
* this program since it doesn’t implement GTK+ signals (yet).
*/

#include /* EXIT_* */
/* Introduce types and prototypes of GTK+ for the compiler. */
#include

int main(int argc, char** argv) {

/* We’ll have two references to two GTK+ widgets. */
GtkWindow* window;
GtkLabel* label;

/* Initialize the GTK+ library. */
gtk_init(&argc, &argv);

/* Create a window with window border width of 12 pixels and a
title text. */
window = g_object_new(GTK_TYPE_WINDOW,
“border-width”, 12,
“title”, “Hello GTK+”,
NULL);

/* Create the label widget. */
label = g_object_new(GTK_TYPE_LABEL,
“label”, “Hello World!”,
NULL);

/* Pack the label into the window layout. */
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(label));

/* Show all widgets that are contained by the window. */
gtk_widget_show_all(GTK_WIDGET(window));

/* Start the main event loop. */
g_print(”main: calling gtk_main\n”);
gtk_main();

/* Display a message to the standard output and exit. */
g_print(”main: returned from gtk_main and exiting with success\n”);

/* The C standard defines this condition as EXIT_SUCCESS, and this
symbolic macro is defined in stdlib.h (which GTK+ will pull in
in-directly). There is also a counter-part for failures:
EXIT_FAILURE. */
return EXIT_SUCCESS;
}

Yeah, I don't really understand it either... But it's reassuring to know that the barriers to entry are low to non-existent for would-be Maemo developers.

For more information check out Garage.Maemo.org, the Maemo equivalent to LaunchPad and SourceForge.

Posted via web from Andrew Currie on Posterous

No comments:

Post a Comment