rendered paste bodyvoid RoomListTab::room_list(Moo::RoomList roomlist) { RoomListView.freeze_child_notify(); RoomListView.room_list(roomlist); RoomListView.thaw_child_notify(); }RoomListTreeView::RoomListTreeView(){ //Create the Tree model: RoomListStore = Gtk::ListStore::create(m_Columns); set_model(RoomListStore); //Fill the TreeView's model set_headers_clickable(TRUE); //Add the TreeView's view columns: append_column("Rooms", m_Columns.m_col_name); append_column_numeric("Users", m_Columns.m_col_users, "%d" ); set_search_column(1); //Fill the TreeView's model Gtk::TreeModel::Row row = *(RoomListStore->append()); row[m_Columns.m_col_users] = 1; row[m_Columns.m_col_name] = "right-click on this"; row = *(RoomListStore->append()); row[m_Columns.m_col_users] = 2; row[m_Columns.m_col_name] = "or this"; row = *(RoomListStore->append()); row[m_Columns.m_col_users] = 3; row[m_Columns.m_col_name] = "or this, for a popup context menu"; Gtk::TreeViewColumn* pColumn = get_column(0); if(pColumn) { pColumn->set_sort_column (0); pColumn->set_sizing(Gtk::TREE_VIEW_COLUMN_FIXED); pColumn->set_fixed_width(180); } pColumn = get_column(1); if(pColumn) { pColumn->set_sort_column (1); pColumn->set_sizing(Gtk::TREE_VIEW_COLUMN_FIXED); } /////////////////////////////////////////// RoomListStore->set_default_sort_func(-1); /////////////////////////////////////// // Reorderable 0-3 (4 columns) for(guint i = 0; i < 2; i++) { Gtk::TreeView::Column* pColumn = get_column(i); pColumn->set_reorderable(); pColumn->set_min_width(0); pColumn->set_resizable(TRUE); } //Fill popup menu: { Gtk::Menu::MenuList& menulist = m_Menu_Popup.items(); menulist.push_back( Gtk::Menu_Helpers::MenuElem("_Join", sigc::mem_fun( *this, &RoomListTreeView::on_join) ) ); menulist.push_back( Gtk::Menu_Helpers::MenuElem("_Refresh", sigc::mem_fun(*this, &RoomListTreeView::on_refresh) ) ); } m_Menu_Popup.accelerate(*this); }RoomListTreeView::~RoomListTreeView(){}void RoomListTreeView::room_list(Moo::RoomList roomlist) { unset_model(); RoomListStore->clear(); Moo::RoomList::iterator it = roomlist.begin(); Gtk::TreeModel::Row row; for(; it != roomlist.end(); ++it) { row = *(RoomListStore->append()); row[m_Columns.m_col_name] = it->first.c_str(); row[m_Columns.m_col_users] = it->second; } set_model(RoomListStore);}