1 /* Example for use of GNU gettext.
2 Copyright (C) 2003 Free Software Foundation, Inc.
3 This file is in the public domain.
5 Source code of the Objective C program. */
8 /* Get GNOME declarations. */
9 #include <obgnome/obgnome.h>
11 /* Get getpid() declaration. */
17 quit_callback (GtkWidget *widget, void *data)
23 main (int argc, char *argv[])
25 Gnome_App *application;
29 Gtk_Alignment *label1aligned;
31 Gtk_Alignment *label2aligned;
33 Gtk_ButtonBox *buttonbar;
35 /* Initializations. */
37 application = [[Gnome_App alloc] initApp: PACKAGE : VERSION : argc : argv];
38 textdomain ("hello-objc-gnome");
39 bindtextdomain ("hello-objc-gnome", LOCALEDIR);
41 /* Create the GUI elements. */
43 window = [[Gtk_Window alloc] initWithWindowInfo: GTK_WINDOW_TOPLEVEL];
44 [window set_title: "Hello example"];
46 [window signal_connect: "delete_event" signalFunc: quit_callback funcData: NULL];
48 label1 = [[Gtk_Label alloc] initWithLabelInfo: _("Hello, world!")];
50 label1aligned = [[Gtk_Alignment alloc] initWithAlignmentInfo: 0.0 : 0.5 : 0 : 0];
51 [label1aligned add: label1];
53 label2 = [[Gtk_Label alloc] initWithLabelInfo: g_strdup_printf (_("This program is running as process number %d."), getpid ())];
55 label2aligned = [[Gtk_Alignment alloc] initWithAlignmentInfo: 0.0 : 0.5 : 0 : 0];
56 [label2aligned add: label2];
58 button = [Gtk_Button alloc];
59 [button initWithLabel: "OK"];
60 [button signal_connect: "clicked" signalFunc: quit_callback funcData: NULL];
62 buttonbar = [Gtk_HButtonBox new];
63 [buttonbar set_layout: GTK_BUTTONBOX_END];
64 [buttonbar pack_start_defaults: button];
66 panel = [[Gtk_VBox alloc] initWithVBoxInfo: FALSE : GNOME_PAD_SMALL];
67 [panel pack_start_defaults: label1aligned];
68 [panel pack_start_defaults: label2aligned];
69 [panel pack_start_defaults: buttonbar];
73 /* Make the GUI elements visible. */
84 /* Start the event loop. */