1 /* Example for use of GNU gettext.
2 This file is in the public domain.
4 Source code of the Objective C program. */
7 /* Get GNOME declarations. */
8 #include <obgnome/obgnome.h>
10 /* Get getpid() declaration. */
16 quit_callback (GtkWidget *widget, void *data)
22 main (int argc, char *argv[])
24 Gnome_App *application;
28 Gtk_Alignment *label1aligned;
30 Gtk_Alignment *label2aligned;
32 Gtk_ButtonBox *buttonbar;
34 /* Initializations. */
36 application = [[Gnome_App alloc] initApp: PACKAGE : VERSION : argc : argv];
37 textdomain ("hello-objc-gnome");
38 bindtextdomain ("hello-objc-gnome", LOCALEDIR);
40 /* Create the GUI elements. */
42 window = [[Gtk_Window alloc] initWithWindowInfo: GTK_WINDOW_TOPLEVEL];
43 [window set_title: "Hello example"];
45 [window signal_connect: "delete_event" signalFunc: quit_callback funcData: NULL];
47 label1 = [[Gtk_Label alloc] initWithLabelInfo: _("Hello, world!")];
49 label1aligned = [[Gtk_Alignment alloc] initWithAlignmentInfo: 0.0 : 0.5 : 0 : 0];
50 [label1aligned add: label1];
52 label2 = [[Gtk_Label alloc] initWithLabelInfo: g_strdup_printf (_("This program is running as process number %d."), getpid ())];
54 label2aligned = [[Gtk_Alignment alloc] initWithAlignmentInfo: 0.0 : 0.5 : 0 : 0];
55 [label2aligned add: label2];
57 button = [Gtk_Button alloc];
58 [button initWithLabel: "OK"];
59 [button signal_connect: "clicked" signalFunc: quit_callback funcData: NULL];
61 buttonbar = [Gtk_HButtonBox new];
62 [buttonbar set_layout: GTK_BUTTONBOX_END];
63 [buttonbar pack_start_defaults: button];
65 panel = [[Gtk_VBox alloc] initWithVBoxInfo: FALSE : GNOME_PAD_SMALL];
66 [panel pack_start_defaults: label1aligned];
67 [panel pack_start_defaults: label2aligned];
68 [panel pack_start_defaults: buttonbar];
72 /* Make the GUI elements visible. */
83 /* Start the event loop. */