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 C++ program. */
8 /* Get GNOME declarations. */
12 /* Get getpid() declaration. */
17 static Gtk::Main
*application
;
20 quit_callback (GdkEventAny
*)
26 main (int argc
, char *argv
[])
31 Gtk::Alignment
*label1aligned
;
33 Gtk::Alignment
*label2aligned
;
35 Gtk::HButtonBox
*buttonbar
;
37 /* Initializations. */
39 setlocale (LC_ALL
, "");
40 application
= new Gtk::Main (argc
, argv
);
41 textdomain ("hello-c++-gnome");
42 bindtextdomain ("hello-c++-gnome", LOCALEDIR
);
44 /* Create the GUI elements. */
46 window
= new Gtk::Window (GTK_WINDOW_TOPLEVEL
);
47 window
->set_title ("Hello example");
49 window
->delete_event
.connect (SigC::slot (quit_callback
));
51 label1
= new Gtk::Label (_("Hello, world!"));
53 label1aligned
= new Gtk::Alignment (0.0, 0.5, 0, 0);
54 label1aligned
->add (*label1
);
56 label2
= new Gtk::Label (g_strdup_printf (_("This program is running as process number %d."), getpid ()));
58 label2aligned
= new Gtk::Alignment (0.0, 0.5, 0, 0);
59 label2aligned
->add (*label2
);
61 button
= new Gtk::Button ("OK");
62 button
->clicked
.connect (Gtk::Main::quit
.slot()); //slot (quit_callback));
64 buttonbar
= new Gtk::HButtonBox (GTK_BUTTONBOX_END
);
65 buttonbar
->pack_start (*button
);
67 panel
= new Gtk::VBox (false, GNOME_PAD_SMALL
);
68 panel
->pack_start (*label1aligned
);
69 panel
->pack_start (*label2aligned
);
70 panel
->pack_start (*buttonbar
);
74 /* Make the GUI elements visible. */
77 label1aligned
->show ();
79 label2aligned
->show ();
85 /* Start the event loop. */