UI::UI (string namestr, int *argc, char ***argv)
: AbstractUI<UIRequest> (namestr)
+ , _receiver (*this)
+
{
theMain = new Main (argc, argv);
errors->set_title (title.get_string());
errors->dismiss_button().set_name ("ErrorLogCloseButton");
- errors->signal_delete_event().connect (bind (sigc::ptr_fun (just_hide_it), (Window *) errors));
+ errors->signal_delete_event().connect (sigc::bind (sigc::ptr_fun (just_hide_it), (Window *) errors));
errors->set_type_hint (Gdk::WINDOW_TYPE_HINT_UTILITY);
//load_rcfile (rcfile);
void
UI::run (Receiver &old_receiver)
{
- listen_to (error);
- listen_to (info);
- listen_to (warning);
- listen_to (fatal);
+ _receiver.listen_to (error);
+ _receiver.listen_to (info);
+ _receiver.listen_to (warning);
+ _receiver.listen_to (fatal);
/* stop the old receiver (text/console) once we hit the first idle */
theMain->run ();
_active = false;
stopping ();
- hangup ();
+ _receiver.hangup ();
return;
}
ustring ap = action->get_accel_path();
if (!ap.empty()) {
bool has_key = ActionManager::lookup_entry(ap, key);
- if (has_key && key.get_abbrev() != "") {
- msg.append("\n\nKey: ").append(key.get_abbrev());
+ if (has_key) {
+ string abbrev = key.get_abbrev();
+ if (!abbrev.empty()) {
+ replace_all (abbrev, "<", "");
+ replace_all (abbrev, ">", "-");
+ msg.append(_("\n\nKey: ")).append (abbrev);
+ }
}
}
}
return;
}
- replace_all (msg, "<", "");
- replace_all (msg, ">", "-");
req->widget = w;
req->msg = msg.c_str();
handle_fatal (str);
} else {
- display_message (prefix, prefix_len, ptag, mtag, str);
-
- if (!errors->is_visible() && chn != Transmitter::Info) {
- show_errors ();
+ if (!ptag || !mtag) {
+ /* oops, message sent before we set up tags - don't crash */
+ cerr << prefix << str << endl;
+ } else {
+ display_message (prefix, prefix_len, ptag, mtag, str);
+
+ if (!errors->is_visible() && chn != Transmitter::Info) {
+ show_errors ();
+ }
}
}