Changeset 8343ef5b25d88a8435bcc3c904c1653f928f3950

Show
Ignore:
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:
6 modified

Legend:

Unmodified
Added
Removed
  • po/POTFILES.in

    rb761034 r8343ef5  
    99src/statusbar.cpp 
    1010src/buffer_wrapper.cpp 
    11  
     11src/document.cpp 
  • src/buffer_wrapper.cpp

    rbb37d8e r8343ef5  
    2020#include <obby/client_user_table.hpp> 
    2121#include <obby/host_user_table.hpp> 
     22#include <obby/format_string.hpp> 
    2223#include "common.hpp" 
    2324#include "buffer_wrapper.hpp" 
     
    171172        { 
    172173                // 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() ); 
    179178        } 
    180179 
  • src/chat.cpp

    ree9a068 r8343ef5  
    1818 
    1919#include <gtkmm/stock.h> 
     20#include <obby/format_string.hpp> 
    2021#include "common.hpp" 
    2122#include "chat.hpp" 
     
    7677void Gobby::Chat::obby_user_join(obby::user& user) 
    7778{ 
    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"); 
    7982} 
    8083 
    8184void Gobby::Chat::obby_user_part(obby::user& user) 
    8285{ 
    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"); 
    8489} 
    8590 
  • src/document.cpp

    r29715c2 r8343ef5  
    1818 
    1919#include <iostream> 
     20#include <obby/format_string.hpp> 
    2021#include <obby/user_table.hpp> 
    2122#include <obby/client_document.hpp> 
     
    598599#endif 
    599600 
    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 
    608614        Glib::RefPtr<Gtk::TextChildAnchor> anchor = 
    609615                buf->create_child_anchor(buf->end() ); 
  • src/header.cpp

    ree9a068 r8343ef5  
    2020#include <gtkmm/toggleaction.h> 
    2121#include <gtkmm/radioaction.h> 
     22#include <obby/format_string.hpp> 
    2223#include <obby/local_buffer.hpp> 
    2324 
     
    275276                        m_lang_group, 
    276277                        "ViewLanguageNone", 
    277                         "None", 
    278                         "Unselects the current language" 
     278                        _("None"), 
     279                        _("Unselects the current language") 
    279280                ), 
    280281                sigc::bind( 
     
    295296                Glib::ustring language_xml_name = language->get_name(); 
    296297 
     298                // Build description string 
     299                obby::format_string str(_("Selects %0 as language") ); 
     300                str << language->get_name(); 
     301 
    297302                // Add language to action group 
    298303                remove_entities(language_xml_name); 
     
    302307                                "ViewLanguage" + language_xml_name,  
    303308                                language->get_name(), 
    304                                 _("Selects ") + language->get_name() + 
    305                                         _(" as language") 
     309                                str.str() 
    306310                        ), 
    307311                        sigc::bind( 
  • src/statusbar.cpp

    ree9a068 r8343ef5  
    1818 
    1919#include <sstream> 
     20#include <obby/format_string.hpp> 
    2021#include <obby/local_buffer.hpp> 
    2122#include "common.hpp" 
     
    6162        // Selected language 
    6263        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        } 
    6769        else 
     70        { 
    6871                m_language.set_text(_("No language selected") ); 
     72        } 
    6973} 
    7074#endif 
     
    7276void Gobby::StatusBar::update_sync(Document& document) 
    7377{ 
    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() ); 
    7882} 
    7983 
    8084void Gobby::StatusBar::update_revision(Document& document) 
    8185{ 
    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() ); 
    8589} 
    8690 
     
    8993        unsigned int row, col; 
    9094        document.get_cursor_position(row, col); 
    91         ++ row; ++ col; 
    9295 
    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() ); 
    9699} 
    97100