Changeset 66412030f4aeae129a0a9dd502638f834481454d

Show
Ignore:
Timestamp:
04/07/07 23:30:54 (6 years ago)
Author:
Philipp Kern <phil@…>
Parents:
852b5aeb311ca8a9d90b790d791aca0160560178
Children:
24a527a2ffba5e33a2fe7375535d69f3357e4178
git-committer:
Philipp Kern <phil@0x539.de> / 2007-04-07T21:30:54Z+0000
Message:

2007-04-07 Philipp Kern <phil@…>

  • inc/userlist.hpp:
  • src/userlist.hpp: allow doubleclicks on documents in the userlist to subscribe to them [fixes #225]
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r852b5ae r6641203  
     12007-04-07  Philipp Kern <phil@0x539.de> 
     2 
     3        * inc/userlist.hpp: 
     4        * src/userlist.hpp: allow doubleclicks on documents in the userlist 
     5        to subscribe to them [fixes #225] 
     6 
    172007-04-07  Philipp Kern <phil@0x539.de> 
    28 
  • inc/userlist.hpp

    rca239b4 r6641203  
    4343                Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > icon; 
    4444                Gtk::TreeModelColumn<Glib::ustring> text; 
     45                Gtk::TreeModelColumn<LocalDocumentInfo*> info; 
    4546                // TODO: Column with pointer that holds reference to obby::user? 
    4647        }; 
     
    6667 
    6768        void on_user_subscribe(const obby::user& user, 
    68                                const LocalDocumentInfo& info); 
     69                               LocalDocumentInfo& info); 
    6970        void on_user_unsubscribe(const obby::user& user, 
    7071                                 const LocalDocumentInfo& info); 
     72 
     73        void on_row_activated(const Gtk::TreePath& path, 
     74                              Gtk::TreeViewColumn* column); 
    7175 
    7276        Header& m_header; 
  • src/userlist.cpp

    rca239b4 r6641203  
    6363        add(icon); 
    6464        add(text); 
     65        add(info); 
    6566} 
    6667 
     
    106107        m_tree_view.get_selection()->set_mode(Gtk::SELECTION_NONE); 
    107108        m_tree_view.set_headers_visible(false); 
     109        m_tree_view.signal_row_activated().connect( 
     110                sigc::mem_fun(*this, &UserList::on_row_activated) ); 
    108111 
    109112        m_scrolled_wnd.set_shadow_type(Gtk::SHADOW_IN); 
     
    174177                        on_user_subscribe( 
    175178                                user, 
    176                                 dynamic_cast<const LocalDocumentInfo&>( 
     179                                dynamic_cast<LocalDocumentInfo&>( 
    177180                                        *iter 
    178181                                ) 
     
    240243 
    241244void Gobby::UserList::on_user_subscribe(const obby::user& user, 
    242                                         const LocalDocumentInfo& info) 
     245                                        LocalDocumentInfo& info) 
    243246{ 
    244247        Gtk::TreeIter iter = find_iter(m_iter_online, user.get_name() ); 
     
    253256 
    254257        (*doc)[m_tree_cols.text] = info.get_title(); 
     258 
     259        (*doc)[m_tree_cols.info] = &info; 
    255260} 
    256261 
     
    288293                iter = m_tree_data->erase(iter); 
    289294} 
     295 
     296void Gobby::UserList::on_row_activated(const Gtk::TreePath& path, 
     297                                       Gtk::TreeViewColumn* columns) 
     298{ 
     299        Gtk::TreeIter tree_iter = m_tree_data->get_iter(path); 
     300        LocalDocumentInfo* info = (*tree_iter)[m_tree_cols.info]; 
     301 
     302        if(info == NULL) 
     303                // The selected row is a user, not a document. 
     304                return; 
     305 
     306        if(Gobby::is_subscribable(*info) && 
     307           info->get_subscription_state() == Gobby::LocalDocumentInfo::UNSUBSCRIBED) 
     308        { 
     309                info->subscribe(); 
     310        } 
     311} 
     312