Changeset 66412030f4aeae129a0a9dd502638f834481454d
- 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:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r852b5ae
|
r6641203
|
|
| | 1 | 2007-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 | |
| 1 | 7 | 2007-04-07 Philipp Kern <phil@0x539.de> |
| 2 | 8 | |
-
|
rca239b4
|
r6641203
|
|
| 43 | 43 | Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > icon; |
| 44 | 44 | Gtk::TreeModelColumn<Glib::ustring> text; |
| | 45 | Gtk::TreeModelColumn<LocalDocumentInfo*> info; |
| 45 | 46 | // TODO: Column with pointer that holds reference to obby::user? |
| 46 | 47 | }; |
| … |
… |
|
| 66 | 67 | |
| 67 | 68 | void on_user_subscribe(const obby::user& user, |
| 68 | | const LocalDocumentInfo& info); |
| | 69 | LocalDocumentInfo& info); |
| 69 | 70 | void on_user_unsubscribe(const obby::user& user, |
| 70 | 71 | const LocalDocumentInfo& info); |
| | 72 | |
| | 73 | void on_row_activated(const Gtk::TreePath& path, |
| | 74 | Gtk::TreeViewColumn* column); |
| 71 | 75 | |
| 72 | 76 | Header& m_header; |
-
|
rca239b4
|
r6641203
|
|
| 63 | 63 | add(icon); |
| 64 | 64 | add(text); |
| | 65 | add(info); |
| 65 | 66 | } |
| 66 | 67 | |
| … |
… |
|
| 106 | 107 | m_tree_view.get_selection()->set_mode(Gtk::SELECTION_NONE); |
| 107 | 108 | m_tree_view.set_headers_visible(false); |
| | 109 | m_tree_view.signal_row_activated().connect( |
| | 110 | sigc::mem_fun(*this, &UserList::on_row_activated) ); |
| 108 | 111 | |
| 109 | 112 | m_scrolled_wnd.set_shadow_type(Gtk::SHADOW_IN); |
| … |
… |
|
| 174 | 177 | on_user_subscribe( |
| 175 | 178 | user, |
| 176 | | dynamic_cast<const LocalDocumentInfo&>( |
| | 179 | dynamic_cast<LocalDocumentInfo&>( |
| 177 | 180 | *iter |
| 178 | 181 | ) |
| … |
… |
|
| 240 | 243 | |
| 241 | 244 | void Gobby::UserList::on_user_subscribe(const obby::user& user, |
| 242 | | const LocalDocumentInfo& info) |
| | 245 | LocalDocumentInfo& info) |
| 243 | 246 | { |
| 244 | 247 | Gtk::TreeIter iter = find_iter(m_iter_online, user.get_name() ); |
| … |
… |
|
| 253 | 256 | |
| 254 | 257 | (*doc)[m_tree_cols.text] = info.get_title(); |
| | 258 | |
| | 259 | (*doc)[m_tree_cols.info] = &info; |
| 255 | 260 | } |
| 256 | 261 | |
| … |
… |
|
| 288 | 293 | iter = m_tree_data->erase(iter); |
| 289 | 294 | } |
| | 295 | |
| | 296 | void 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 | |