-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHelpMenu.cc
78 lines (65 loc) · 2.21 KB
/
HelpMenu.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "HelpMenu.h"
#include <sstream>
#include <gettext-po.h>
#include "config.h"
using namespace Gtk;
HelpMenu::HelpMenu(Window *main_win) {
Menu *help_content_menu = new Menu();
help_content_menu->items().push_back(
Menu_Helpers::StockMenuElem(
Stock::HELP,
sigc::bind<Window*>(sigc::mem_fun(this, &HelpMenu::onHelp), main_win)
)
);
help_content_menu->items().push_back(
Menu_Helpers::StockMenuElem(
Stock::ABOUT,
sigc::bind<Window*>(sigc::mem_fun(this, &HelpMenu::onAbout), main_win)
)
);
this->items().push_back(Menu_Helpers::MenuElem(_("_Help"), *help_content_menu));
}
void HelpMenu::onAbout(Window *main_win) {
AboutDialog about;
about.set_transient_for(*main_win);
about.set_copyright("GNU GPL 2");
std::list<Glib::ustring> authors;
authors.push_back("Author: Emil Nowak <[email protected]>");
about.set_authors(authors);
about.set_version(PROGRAM_VERSION);
about.set_translator_credits(_("Translator credits"));
std::ostringstream os;
int v = libgettextpo_version;
os << _("Used libraries:") << std::endl;
os << _("libGettext-po version ");
os << (v>>16) << "." << (v>>8) << "." << (v-v>>8-v>>16) << std::endl;
os << _("Gtkmm version ") << GTKMM_MAJOR_VERSION;
os << "." << GTKMM_MINOR_VERSION << "." << GTKMM_MICRO_VERSION << std::endl;
about.set_comments(os.str());
about.run();
}
void HelpMenu::onHelp(Window *main_win) {
Dialog di;
di.set_transient_for(*main_win);
int w,h;
main_win->get_size(w, h);
di.set_default_size(w*0.5, h*0.8);
di.set_title(_("Gettext Translator - Help"));
Box *box = di.get_vbox();
ScrolledWindow *sw = manage(new ScrolledWindow());
box->pack_start(*sw);
sw->set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC);
Label *lb = manage(new Gtk::Label("", ALIGN_LEFT, ALIGN_TOP));
lb->set_use_markup(true);
lb->set_markup(_("<b>Gettext Translator Help</b>\n\n"
"This program should be so easy to use that you should't need manual/help.\n"
"If you have some problems please contact author on [email protected] or jabber [email protected]\n"
"You can visit program homepage at http://emiml.pl/translator/"
));
lb->set_line_wrap(true);
sw->add(*lb);
box->show_all();
di.add_button(Gtk::Stock::CLOSE, 0);
di.run();
delete sw;
}