Changeset 8343ef5b25d88a8435bcc3c904c1653f928f3950
- Timestamp:
- 01/06/07 23:39:09 (6 years ago)
- Author:
- Philipp Kern <phil@…>
- Parents:
- 29715c255541ab3aa8d8f67699d73b3d998e4f3d
- Children:
- 01f86001264bebde561c59a71d8fd87b39120b6a
- git-committer:
- Philipp Kern <phil@0x539.de> / 2007-01-06T22:39:09Z+0000
- Message:
-
[project @ Using obby::format_string instead of std::stringstream]
Original author: Armin Burgmeier <armin@…>
Date: 2005-06-14 17:44:41+00:00
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
rb761034
|
r8343ef5
|
|
| 9 | 9 | src/statusbar.cpp |
| 10 | 10 | src/buffer_wrapper.cpp |
| 11 | | |
| | 11 | src/document.cpp |
-
|
rbb37d8e
|
r8343ef5
|
|
| 20 | 20 | #include <obby/client_user_table.hpp> |
| 21 | 21 | #include <obby/host_user_table.hpp> |
| | 22 | #include <obby/format_string.hpp> |
| 22 | 23 | #include "common.hpp" |
| 23 | 24 | #include "buffer_wrapper.hpp" |
| … |
… |
|
| 171 | 172 | { |
| 172 | 173 | // Should not happen... |
| 173 | | throw Error( |
| 174 | | Error::PEER_NOT_FOUND, |
| 175 | | _("Peer ") + peer.get_name() + _("(") |
| 176 | | + peer.get_address().get_name() + |
| 177 | | _(") not found in peer list") |
| 178 | | ); |
| | 174 | obby::format_string str( |
| | 175 | _("Peer %0 (%1) not found in peer list") ); |
| | 176 | str << peer.get_name() << peer.get_address().get_name(); |
| | 177 | throw Error(Error::PEER_NOT_FOUND, str.str() ); |
| 179 | 178 | } |
| 180 | 179 | |
-
|
ree9a068
|
r8343ef5
|
|
| 18 | 18 | |
| 19 | 19 | #include <gtkmm/stock.h> |
| | 20 | #include <obby/format_string.hpp> |
| 20 | 21 | #include "common.hpp" |
| 21 | 22 | #include "chat.hpp" |
| … |
… |
|
| 76 | 77 | void Gobby::Chat::obby_user_join(obby::user& user) |
| 77 | 78 | { |
| 78 | | m_log_chat.log(user.get_name() + " has joined", "blue"); |
| | 79 | obby::format_string str(_("%0 has joined") ); |
| | 80 | str << user.get_name(); |
| | 81 | m_log_chat.log(str.str(), "blue"); |
| 79 | 82 | } |
| 80 | 83 | |
| 81 | 84 | void Gobby::Chat::obby_user_part(obby::user& user) |
| 82 | 85 | { |
| 83 | | m_log_chat.log(user.get_name() + " has left", "blue"); |
| | 86 | obby::format_string str(_("%0 has left") ); |
| | 87 | str << user.get_name(); |
| | 88 | m_log_chat.log(str.str(), "blue"); |
| 84 | 89 | } |
| 85 | 90 | |
-
|
r29715c2
|
r8343ef5
|
|
| 18 | 18 | |
| 19 | 19 | #include <iostream> |
| | 20 | #include <obby/format_string.hpp> |
| 20 | 21 | #include <obby/user_table.hpp> |
| 21 | 22 | #include <obby/client_document.hpp> |
| … |
… |
|
| 598 | 599 | #endif |
| 599 | 600 | |
| 600 | | buf->set_text(_( |
| 601 | | "You are not subscribed to the document \"") + |
| 602 | | m_doc.get_title() + _("\".\n\nTo view changes that " |
| 603 | | "others make or to edit the document yourself, you have to " |
| 604 | | "subscribe to this document. Use the following button to " |
| 605 | | "perform this.\n\n") |
| 606 | | ); |
| 607 | | |
| | 601 | // Build text |
| | 602 | obby::format_string str(_( |
| | 603 | "You are not subscribed to the document \"%0\".\n\n" |
| | 604 | "To view changes that others make or to edit the document " |
| | 605 | "yourself, you have to subscribe to this document. Use the " |
| | 606 | "following button to perform this.\n\n" |
| | 607 | ) ); |
| | 608 | str << m_doc.get_title(); |
| | 609 | |
| | 610 | // Set it |
| | 611 | buf->set_text(str.str() ); |
| | 612 | |
| | 613 | // Add child anchor for the button |
| 608 | 614 | Glib::RefPtr<Gtk::TextChildAnchor> anchor = |
| 609 | 615 | buf->create_child_anchor(buf->end() ); |
-
|
ree9a068
|
r8343ef5
|
|
| 20 | 20 | #include <gtkmm/toggleaction.h> |
| 21 | 21 | #include <gtkmm/radioaction.h> |
| | 22 | #include <obby/format_string.hpp> |
| 22 | 23 | #include <obby/local_buffer.hpp> |
| 23 | 24 | |
| … |
… |
|
| 275 | 276 | m_lang_group, |
| 276 | 277 | "ViewLanguageNone", |
| 277 | | "None", |
| 278 | | "Unselects the current language" |
| | 278 | _("None"), |
| | 279 | _("Unselects the current language") |
| 279 | 280 | ), |
| 280 | 281 | sigc::bind( |
| … |
… |
|
| 295 | 296 | Glib::ustring language_xml_name = language->get_name(); |
| 296 | 297 | |
| | 298 | // Build description string |
| | 299 | obby::format_string str(_("Selects %0 as language") ); |
| | 300 | str << language->get_name(); |
| | 301 | |
| 297 | 302 | // Add language to action group |
| 298 | 303 | remove_entities(language_xml_name); |
| … |
… |
|
| 302 | 307 | "ViewLanguage" + language_xml_name, |
| 303 | 308 | language->get_name(), |
| 304 | | _("Selects ") + language->get_name() + |
| 305 | | _(" as language") |
| | 309 | str.str() |
| 306 | 310 | ), |
| 307 | 311 | sigc::bind( |
-
|
ree9a068
|
r8343ef5
|
|
| 18 | 18 | |
| 19 | 19 | #include <sstream> |
| | 20 | #include <obby/format_string.hpp> |
| 20 | 21 | #include <obby/local_buffer.hpp> |
| 21 | 22 | #include "common.hpp" |
| … |
… |
|
| 61 | 62 | // Selected language |
| 62 | 63 | if(document.get_language() ) |
| 63 | | m_language.set_text( |
| 64 | | _("Selected language: ") + |
| 65 | | document.get_language()->get_name() |
| 66 | | ); |
| | 64 | { |
| | 65 | obby::format_string str(_("Selected language: %0") ); |
| | 66 | str << document.get_language()->get_name(); |
| | 67 | m_language.set_text(str.str() ); |
| | 68 | } |
| 67 | 69 | else |
| | 70 | { |
| 68 | 71 | m_language.set_text(_("No language selected") ); |
| | 72 | } |
| 69 | 73 | } |
| 70 | 74 | #endif |
| … |
… |
|
| 72 | 76 | void Gobby::StatusBar::update_sync(Document& document) |
| 73 | 77 | { |
| 74 | | unsigned int unsynced_count = document.get_unsynced_changes_count(); |
| 75 | | std::stringstream sync_str; |
| 76 | | sync_str << unsynced_count << _(" unsynced change(s)"); |
| 77 | | m_sync.set_text(sync_str.str() ); |
| | 78 | // TODO: ngettext |
| | 79 | obby::format_string str(_("%0 pending change(s)") ); |
| | 80 | str << document.get_unsynced_changes_count(); |
| | 81 | m_sync.set_text(str.str() ); |
| 78 | 82 | } |
| 79 | 83 | |
| 80 | 84 | void Gobby::StatusBar::update_revision(Document& document) |
| 81 | 85 | { |
| 82 | | std::stringstream rev_str; |
| 83 | | rev_str << _("Revision: ") << document.get_revision(); |
| 84 | | m_revision.set_text(rev_str.str() ); |
| | 86 | obby::format_string str(_("Revision: %0") ); |
| | 87 | str << document.get_revision(); |
| | 88 | m_revision.set_text(str.str() ); |
| 85 | 89 | } |
| 86 | 90 | |
| … |
… |
|
| 89 | 93 | unsigned int row, col; |
| 90 | 94 | document.get_cursor_position(row, col); |
| 91 | | ++ row; ++ col; |
| 92 | 95 | |
| 93 | | std::stringstream pos_str; |
| 94 | | pos_str << _("Line: ") << row << _(" Column: ") << col; |
| 95 | | m_position.set_text(pos_str.str() ); |
| | 96 | obby::format_string str("Line: %0 Column: %1"); |
| | 97 | str << (row + 1) << (col + 1); |
| | 98 | m_position.set_text(str.str() ); |
| 96 | 99 | } |
| 97 | 100 | |