Changeset 215618cb3db4556e21f4040ae192e01f100fde03

Show
Ignore:
Timestamp:
12/30/08 21:27:58 (4 years ago)
Author:
Armin Burgmeier <armin@…>
Parents:
46c2fe582fd327e88c951d358f31ef15536c8eca
Children:
9a8cd27d463ae24ca3b212a3d0be3bef9bea422a
git-committer:
Armin Burgmeier <armin@arbur.net> / 2008-12-30T21:27:58Z+0100
Message:

Added SignalFinish? to operation base class

2008-12-30 Armin Burgmeier <armin@…>

  • code/operations/operations.hpp:
  • code/operations/operations.cpp: Added signal_finished to the operation base class, and the various functions creating operations now return them.
  • code/operations/operation-save.cpp: Fixed a typo in a comment.
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r46c2fe5 r215618c  
    1 2008-12-28  Armin Burgmeier  <armin@arbur.net> 
     12008-12-30  Armin Burgmeier  <armin@arbur.net> 
     2 
     3        * code/operations/operations.hpp: 
     4        * code/operations/operations.cpp: Added signal_finished to the 
     5        operation base class, and the various functions creating operations 
     6        now return them. 
     7 
     8        * code/operations/operation-save.cpp: Fixed a typo in a comment. 
     9 
     102008-12-29  Armin Burgmeier  <armin@arbur.net> 
    211 
    312        * code/window.hpp: 
  • code/operations/operation-save.cpp

    r4d4ee96 r215618c  
    139139        if(done) 
    140140        { 
    141                 if(m_document != NULL) 
    142                 { 
    143                         // TODO: Don't unset modified flag if the document has 
    144                         // changed in the meanwhile. 
    145                         gtk_text_buffer_set_modified( 
    146                                 GTK_TEXT_BUFFER( 
    147                                         m_document->get_text_buffer()), 
    148                                 FALSE); 
    149                 } 
    150  
    151141                DocumentInfoStorage::Info info; 
    152142                info.uri = m_file->get_uri(); 
     
    156146 
    157147                m_stream->close(); 
     148 
     149                if(m_document != NULL) 
     150                { 
     151                        // TODO: Don't unset modified flag if the document has 
     152                        // changed in the meanwhile, but set 
     153                        // buffer-modified-time in algorithm. 
     154                        gtk_text_buffer_set_modified( 
     155                                GTK_TEXT_BUFFER( 
     156                                        m_document->get_text_buffer()), 
     157                                FALSE); 
     158                } 
     159 
    158160                remove(); 
    159161        } 
     
    204206 
    205207        /* iconv is defined as libiconv on Windows, or at least when using the 
    206          * binary packages from ftp.gnome.org. Therefore we can't propely 
     208         * binary packages from ftp.gnome.org. Therefore we can't properly 
    207209         * call Glib::IConv::iconv. Therefore, we use the C API here. */ 
    208210        std::size_t retval = g_iconv( 
  • code/operations/operations.cpp

    r4d4ee96 r215618c  
    2121#include "operations/operation-save.hpp" 
    2222#include "operations/operation-delete.hpp" 
     23 
    2324#include "operations/operations.hpp" 
    2425 
     
    4344} 
    4445 
    45 void Gobby::Operations::create_directory(InfcBrowser* browser, 
    46                                          InfcBrowserIter* parent, 
    47                                          const Glib::ustring& name) 
     46Gobby::Operations::Operation* 
     47Gobby::Operations::create_directory(InfcBrowser* browser, 
     48                                    InfcBrowserIter* parent, 
     49                                    const Glib::ustring& name) 
    4850{ 
    49         m_operations.insert(new OperationNew(*this, browser, parent, 
    50                                              name, true)); 
     51        OperationNew* op = new OperationNew(*this, browser, parent, 
     52                                            name, true); 
     53 
     54        m_operations.insert(op); 
     55        return op; 
    5156} 
    5257 
    53 void Gobby::Operations::create_document(InfcBrowser* browser, 
    54                                         InfcBrowserIter* parent, 
    55                                         const Glib::ustring& name) 
     58Gobby::Operations::Operation* 
     59Gobby::Operations::create_document(InfcBrowser* browser, 
     60                                   InfcBrowserIter* parent, 
     61                                   const Glib::ustring& name) 
    5662{ 
    57         m_operations.insert(new OperationNew(*this, browser, parent, 
    58                                              name, false)); 
     63        OperationNew* op = new OperationNew(*this, browser, parent, 
     64                                            name, false); 
     65 
     66        m_operations.insert(op); 
     67        return op; 
    5968} 
    6069 
    61 void Gobby::Operations::create_document(InfcBrowser* browser, 
    62                                         InfcBrowserIter* parent, 
    63                                         const Glib::ustring& name, 
    64                                         const Preferences& preferences, 
    65                                         const Glib::ustring& from_uri, 
    66                                         const char* encoding) 
     70Gobby::Operations::Operation* 
     71Gobby::Operations::create_document(InfcBrowser* browser, 
     72                                   InfcBrowserIter* parent, 
     73                                   const Glib::ustring& name, 
     74                                   const Preferences& preferences, 
     75                                   const Glib::ustring& from_uri, 
     76                                   const char* encoding) 
    6777{ 
    68         m_operations.insert( 
    69                 new OperationOpen(*this, preferences, browser, parent, name, 
    70                                   from_uri, encoding)); 
     78        OperationOpen* op = new OperationOpen(*this, preferences, browser, 
     79                                              parent, name, from_uri, 
     80                                              encoding); 
     81 
     82        m_operations.insert(op); 
     83        return op; 
    7184} 
    7285 
    73 void Gobby::Operations::save_document(DocWindow& document, 
    74                                       Folder& folder, 
    75                                       const std::string& uri, 
    76                                       const std::string& encoding, 
    77                                       DocumentInfoStorage::EolStyle eol_style) 
     86Gobby::Operations::Operation* 
     87Gobby::Operations::save_document(DocWindow& document, 
     88                                 Folder& folder, 
     89                                 const std::string& uri, 
     90                                 const std::string& encoding, 
     91                                 DocumentInfoStorage::EolStyle eol_style) 
    7892{ 
    79         m_operations.insert( 
    80                 new OperationSave(*this, document, folder, uri, encoding, 
    81                                   eol_style)); 
     93        OperationSave* op = new OperationSave(*this, document, folder, uri, 
     94                                              encoding, eol_style); 
     95 
     96        m_operations.insert(op); 
     97        return op; 
    8298} 
    8399 
    84 void Gobby::Operations::delete_node(InfcBrowser* browser, 
    85                                     InfcBrowserIter* iter) 
     100Gobby::Operations::Operation* 
     101Gobby::Operations::delete_node(InfcBrowser* browser, 
     102                               InfcBrowserIter* iter) 
    86103{ 
    87         m_operations.insert(new OperationDelete(*this, browser, iter)); 
     104        OperationDelete* op = new OperationDelete(*this, browser, iter); 
     105        m_operations.insert(op); 
     106        return op; 
    88107} 
    89108 
  • code/operations/operations.hpp

    r4d4ee96 r215618c  
    3939        { 
    4040        public: 
     41                typedef sigc::signal<void> SignalFinished; 
     42 
    4143                Operation(Operations& operations): 
    4244                        m_operations(operations) {} 
     
    5355                } 
    5456 
    55                 void remove() { m_operations.remove_operation(this); } 
     57                void remove() 
     58                { 
     59                        m_signal_finished.emit(); 
     60                        m_operations.remove_operation(this); 
     61                } 
     62 
     63                SignalFinished signal_finished() const 
     64                { 
     65                        return m_signal_finished; 
     66                } 
    5667        private: 
     68                SignalFinished m_signal_finished; 
    5769                Operations& m_operations; 
    5870        }; 
     
    6173        ~Operations(); 
    6274 
    63         void create_directory(InfcBrowser* browser, 
    64                               InfcBrowserIter* parent, 
    65                               const Glib::ustring& name); 
     75        Operation* create_directory(InfcBrowser* browser, 
     76                                    InfcBrowserIter* parent, 
     77                                    const Glib::ustring& name); 
    6678 
    67         void create_document(InfcBrowser* browser, 
    68                              InfcBrowserIter* parent, 
    69                              const Glib::ustring& name); 
     79        Operation* create_document(InfcBrowser* browser, 
     80                                   InfcBrowserIter* parent, 
     81                                   const Glib::ustring& name); 
    7082 
    71         void create_document(InfcBrowser* browser, 
    72                              InfcBrowserIter* parent, 
    73                              const Glib::ustring& name, 
    74                              const Preferences& preferences, 
    75                              const Glib::ustring& from_uri, 
    76                              const char* encoding); 
     83        Operation* create_document(InfcBrowser* browser, 
     84                                   InfcBrowserIter* parent, 
     85                                   const Glib::ustring& name, 
     86                                   const Preferences& preferences, 
     87                                   const Glib::ustring& from_uri, 
     88                                   const char* encoding); 
    7789 
    78         void save_document(DocWindow& document, 
    79                            Folder& folder, 
    80                            const std::string& uri, 
    81                            const std::string& encoding, 
    82                            DocumentInfoStorage::EolStyle eol_style); 
     90        Operation* save_document(DocWindow& document, 
     91                                 Folder& folder, 
     92                                 const std::string& uri, 
     93                                 const std::string& encoding, 
     94                                 DocumentInfoStorage::EolStyle eol_style); 
    8395 
    84         void delete_node(InfcBrowser* browser, 
    85                          InfcBrowserIter* iter); 
     96        Operation* delete_node(InfcBrowser* browser, 
     97                               InfcBrowserIter* iter); 
    8698 
    8799protected: