Changeset bb701404f93f68d6525a906a5196648f24158df5

Show
Ignore:
Timestamp:
03/03/09 12:01:47 (4 years ago)
Author:
Armin Burgmeier <armin@…>
Parents:
6de9d3e6ad08269fde98c532ae747b229878d4b8
Children:
6e0d5b2a5b4b05c72c59298583b1d95cf0ff7f5f
git-committer:
Armin Burgmeier <armin@arbur.net> / 2009-03-03T12:01:47Z+0100
Message:

Added "Save Session As" menu option

2009-03-03 Armin Burgmeier <armin@…>

  • inc/header.hpp:
  • src/header.cpp: Added a "Save Session As" menu option.
  • inc/window.hpp:
  • src/window.cpp: Added corresponding functionality. Now "Save Session" saves to a known location, if any, and "Save Session As" brings up a File Chooser. Patch by Nick <gentuu@…>.
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r6de9d3e rbb70140  
     12009-03-03  Armin Burgmeier  <armin@0x539.de> 
     2 
     3        * inc/header.hpp: 
     4        * src/header.cpp: Added a "Save Session As" menu option. 
     5 
     6        * inc/window.hpp: 
     7        * src/window.cpp: Added corresponding functionality. Now "Save 
     8        Session" saves to a known location, if any, and "Save Session As" 
     9        brings up a File Chooser. Patch by Nick <gentuu@gmail.com>. 
     10 
    1112009-02-02  Armin Burgmeier  <armin@0x539.de> 
    212 
  • inc/header.hpp

    r4cf90bd rbb70140  
    135135        const Glib::RefPtr<Gtk::Action> action_app_session_join; 
    136136        const Glib::RefPtr<Gtk::Action> action_app_session_save; 
     137        const Glib::RefPtr<Gtk::Action> action_app_session_save_as; 
    137138        const Glib::RefPtr<Gtk::Action> action_app_session_quit; 
    138139        const Glib::RefPtr<Gtk::Action> action_app_quit; 
  • inc/window.hpp

    r9b6eca5 rbb70140  
    120120        void on_session_join(); 
    121121        void on_session_save(); 
     122        void on_session_save_as(); 
    122123        void on_session_quit(); 
    123124 
  • src/header.cpp

    r599632f rbb70140  
    3939                "      <menuitem action=\"AppSessionJoin\" />" 
    4040                "      <menuitem action=\"AppSessionSave\" />" 
     41                "      <menuitem action=\"AppSessionSaveAs\" />" 
    4142                "      <menuitem action=\"AppSessionQuit\" />" 
    4243                "      <separator />" 
     
    250251                        "AppSessionSave", 
    251252                        Gtk::Stock::SAVE, 
    252                         _("Save session..."), 
     253                        _("Save session"), 
    253254                        _("Saves the complete session for a later restore") 
     255                ) 
     256        ), 
     257 
     258        action_app_session_save_as( 
     259                Gtk::Action::create( 
     260                        "AppSessionSaveAs", 
     261                        Gtk::Stock::SAVE_AS, 
     262                        _("Save session as..."), 
     263                        _("\"Saves as...\" the complete session for a later restore") 
    254264                ) 
    255265        ), 
     
    456466 
    457467        set_action_auto( 
     468                action_app_session_save_as, state, 
     469                APPLICATION_NONE, APPLICATION_INITIAL 
     470        ); 
     471 
     472        set_action_auto( 
    458473                action_app_session_quit, state, 
    459474                APPLICATION_SESSION, APPLICATION_NONE 
     
    581596        group_app->add(action_app_session_create); 
    582597        group_app->add(action_app_session_join); 
    583         group_app->add(action_app_session_save, Gtk::AccelKey("") ); 
     598        group_app->add(action_app_session_save, 
     599                Gtk::AccelKey("<control>E", "<Actions>/MenuApp/AppSessionSave") ); 
     600        group_app->add(action_app_session_save_as); 
    584601        group_app->add(action_app_session_quit); 
    585602        group_app->add(action_app_quit); 
  • src/window.cpp

    r22c739f rbb70140  
    8686        m_header.action_app_session_save->signal_activate().connect( 
    8787                sigc::mem_fun(*this, &Window::on_session_save) ); 
     88        m_header.action_app_session_save_as->signal_activate().connect( 
     89                sigc::mem_fun(*this, &Window::on_session_save_as) ); 
    8890        m_header.action_app_session_quit->signal_activate().connect( 
    8991                sigc::mem_fun(*this, &Window::on_session_quit) ); 
     
    445447 
    446448void Gobby::Window::on_session_save() 
     449{ 
     450        // Call the dialog if we have no previos filename 
     451        if(m_prev_session.empty()) { 
     452                on_session_save_as(); 
     453        } else { 
     454                // Just overwrite if we already were writing there 
     455                try 
     456                { 
     457                        m_buffer->serialise(m_prev_session); 
     458                } 
     459                catch(std::exception& e) 
     460                { 
     461                        display_error(e.what() ); 
     462                } 
     463        } 
     464} 
     465 
     466void Gobby::Window::on_session_save_as() 
    447467{ 
    448468        Gtk::CheckButton m_chk_default_ext(