Changeset ecfdae11289287fec91513ba406f03d044dc56d9

Show
Ignore:
Timestamp:
09/21/10 21:42:01 (3 years ago)
Author:
Armin Burgmeier <armin@…>
Parents:
4a12852956b8c9d65420066459277f873f6247ee
Children:
428f3277c6c01ec69d678024f9073fd42c839e46
git-committer:
Armin Burgmeier <armin@arbur.net> / 2010-09-21T21:42:01Z+0200
Message:

Add a "Disconnect from Server" option to the context menu (#542)

2010-09-21 Armin Burgmeier <armin@…>

  • code/commands/browser-context-commands.hpp:
  • code/commands/browser-context-commands.cpp: Add a "Disconnect from Server" option to the context menu (#542).
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r4a12852 recfdae1  
     12010-09-21  Armin Burgmeier  <armin@arbur.net> 
     2 
     3        * code/commands/browser-context-commands.hpp: 
     4        * code/commands/browser-context-commands.cpp: Add a "Disconnect from 
     5        Server" option to the context menu (#542). 
     6 
    172010-09-21  Armin Burgmeier  <armin@arbur.net> 
    28 
  • code/commands/browser-context-commands.cpp

    r61cce2c recfdae1  
    9090                        *this, &BrowserContextCommands::on_menu_deactivate)); 
    9191 
     92                // Add "Disconnect" menu option if the connection 
     93                // item has been clicked at 
     94                if(is_toplevel) 
     95                { 
     96                        Gtk::ImageMenuItem* disconnect_item = Gtk::manage( 
     97                                new Gtk::ImageMenuItem(_("_Disconnect from Server"), true)); 
     98                        disconnect_item->set_image(*Gtk::manage(new Gtk::Image( 
     99                                Gtk::Stock::DISCONNECT, Gtk::ICON_SIZE_MENU))); 
     100                        disconnect_item->signal_activate().connect(sigc::bind( 
     101                                sigc::mem_fun(*this, 
     102                                        &BrowserContextCommands::on_disconnect), 
     103                                browser)); 
     104                        disconnect_item->show(); 
     105                        menu->append(*disconnect_item); 
     106 
     107                        // Separator 
     108                        Gtk::SeparatorMenuItem* sep_item = 
     109                                Gtk::manage(new Gtk::SeparatorMenuItem); 
     110                        sep_item->show(); 
     111                        menu->append(*sep_item); 
     112                } 
     113 
    92114                // Create Document 
    93115                Gtk::ImageMenuItem* new_document_item = Gtk::manage( 
     
    127149 
    128150                Gtk::ImageMenuItem* new_directory_item = Gtk::manage( 
    129                         new Gtk::ImageMenuItem(_("Create Directory..."), 
     151                        new Gtk::ImageMenuItem(_("Create Di_rectory..."), 
    130152                                               true)); 
    131153                new_directory_item->set_image(*new_directory_image); 
     
    184206} 
    185207 
     208void Gobby::BrowserContextCommands::on_disconnect(InfcBrowser* browser) 
     209{ 
     210        InfXmlConnection* connection = infc_browser_get_connection(browser); 
     211        InfXmlConnectionStatus status; 
     212        g_object_get(G_OBJECT(connection), "status", &status, NULL); 
     213 
     214        if(status != INF_XML_CONNECTION_CLOSED && 
     215           status != INF_XML_CONNECTION_CLOSING) 
     216        { 
     217                inf_xml_connection_close(connection); 
     218        } 
     219} 
     220 
    186221void Gobby::BrowserContextCommands::on_new(InfcBrowser* browser, 
    187222                                           InfcBrowserIter iter, 
  • code/commands/browser-context-commands.hpp

    r61cce2c recfdae1  
    5858 
    5959        // Context commands 
     60        void on_disconnect(InfcBrowser* browser); 
     61 
    6062        void on_new(InfcBrowser* browser, InfcBrowserIter iter, 
    6163                    bool directory);