1 /* Example for use of GNU gettext.
2 This file is in the public domain.
4 Source code of the C++ program. */
7 /* Get GNOME declarations. */
11 /* Get getpid() declaration. */
16 static Gtk::Main
*application
;
19 quit_callback (GdkEventAny
*)
25 main (int argc
, char *argv
[])
30 Gtk::Alignment
*label1aligned
;
32 Gtk::Alignment
*label2aligned
;
34 Gtk::HButtonBox
*buttonbar
;
36 /* Initializations. */
38 setlocale (LC_ALL
, "");
39 application
= new Gtk::Main (argc
, argv
);
40 textdomain ("hello-c++-gnome");
41 bindtextdomain ("hello-c++-gnome", LOCALEDIR
);
43 /* Create the GUI elements. */
45 window
= new Gtk::Window (GTK_WINDOW_TOPLEVEL
);
46 window
->set_title ("Hello example");
48 window
->delete_event
.connect (SigC::slot (quit_callback
));
50 label1
= new Gtk::Label (_("Hello, world!"));
52 label1aligned
= new Gtk::Alignment (0.0, 0.5, 0, 0);
53 label1aligned
->add (*label1
);
55 label2
= new Gtk::Label (g_strdup_printf (_("This program is running as process number %d."), getpid ()));
57 label2aligned
= new Gtk::Alignment (0.0, 0.5, 0, 0);
58 label2aligned
->add (*label2
);
60 button
= new Gtk::Button ("OK");
61 button
->clicked
.connect (Gtk::Main::quit
.slot()); //slot (quit_callback));
63 buttonbar
= new Gtk::HButtonBox (GTK_BUTTONBOX_END
);
64 buttonbar
->pack_start (*button
);
66 panel
= new Gtk::VBox (false, GNOME_PAD_SMALL
);
67 panel
->pack_start (*label1aligned
);
68 panel
->pack_start (*label2aligned
);
69 panel
->pack_start (*buttonbar
);
73 /* Make the GUI elements visible. */
76 label1aligned
->show ();
78 label2aligned
->show ();
84 /* Start the event loop. */