Install gettext-0.18.1.1.tar.gz
[msysgit.git] / mingw / share / doc / gettext / examples / hello-objc-gnome / hello.m
blobeb3a0bcc2aaa8aec7e98e7194dfbf3d702e70d17
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.  */
11 #if HAVE_UNISTD_H
12 # include <unistd.h>
13 #endif
15 static void
16 quit_callback (GtkWidget *widget, void *data)
18   gtk_main_quit ();
21 int
22 main (int argc, char *argv[])
24   Gnome_App *application;
25   Gtk_Window *window;
26   Gtk_VBox *panel;
27   Gtk_Label *label1;
28   Gtk_Alignment *label1aligned;
29   Gtk_Label *label2;
30   Gtk_Alignment *label2aligned;
31   Gtk_Button *button;
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"];
44   [window realize];
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];
70   [window add: panel];
72   /* Make the GUI elements visible.  */
74   [label1 show];
75   [label1aligned show];
76   [label2 show];
77   [label2aligned show];
78   [button show];
79   [buttonbar show];
80   [panel show];
81   [window show];
83   /* Start the event loop.  */
85   gtk_main ();
87   return 0;