File:GTK+ Hello World on Ubuntu.png

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

GTK+_Hello_World_on_Ubuntu.png(208 × 166 pixels, file size: 5 KB, MIME type: image/png)

Captions

Captions

Add a one-line explanation of what this file represents

Summary

[edit]
Description
English: GTK+ "Hello World" program on Ubuntu using Human theme.
Suomi: GTK+ "Hello World" -ohjelma Ubuntussa, jossa käytössä Human-teema.
Date
Source

Own work

Source code:

#include <gtk/gtk.h>

int main(int argc, char* argv[])
{
	/* Alustaa GTK:n. */
	gtk_init(&argc, &argv);
	
	/* Luo uuden ikkunan ja asettaa sille otsikon. */
	GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(window), "Hello World");
	
	/* Asettaa ikkunalle 60 pikseliä leveän marginaalin reunoille. */
	gtk_container_set_border_width(GTK_CONTAINER(window), 60);
	
	/* Luo tekstin "Hello World" ja liittää sen ikkunaan. */
	GtkWidget* label = gtk_label_new("Hello, world!");
	gtk_container_add(GTK_CONTAINER(window), label);
	
	/* Yhdistää ikkunansulkemisviesti pääsilmukan lopettamiseen niin, että
	 * ohjelma sammuu kun ikkuna suljetaan. */
	g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
	
	/* Näyttää ikkunan ja sen sisällön. */
	gtk_widget_show_all(window);
	
	/* Siirtyy suorittamaan pääsilmukkaa. */
	gtk_main();
	
	return 0;
}

Compile: gcc -Wall helloworld.c -o helloworld $(pkg-config --cflags --libs gtk+-2.0)

Execute: ./helloworld
Author Tmn

Licensing

[edit]
Public domain I, the copyright holder of this work, release this work into the public domain. This applies worldwide.
In some countries this may not be legally possible; if so:
I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current18:56, 28 August 2009Thumbnail for version as of 18:56, 28 August 2009208 × 166 (5 KB)Tmn (talk | contribs){{Information |Description={{en|1=GTK+ "Hello World" program on Ubuntu using Human theme.}} {{fi|1=GTK+ "Hello World" -ohjelma Ubuntussa, jossa käytössä Human-teema.}} |Source=Own work by uploader. Source code: <source lang="c"> #include <gtk/gtk.h>

There are no pages that use this file.

File usage on other wikis

The following other wikis use this file:

  • Usage on fi.wikipedia.org