//------------------------------------------------------------------------------
const IntColumn&
ColumnsModel::append_int_column(const int bec_tm_idx, const std::string& name, const Editable editable)
{
  Gtk::TreeModelColumn<int> *col = new Gtk::TreeModelColumn<int>;

  add(*col);
  add_bec_index_mapping(bec_tm_idx);

  int nr_of_cols;
  if ( editable == EDITABLE )
  {
    nr_of_cols= _treeview->append_column_editable(bec::replace_string(name, "_", "__"), *col);

    Gtk::CellRendererText *cell = (Gtk::CellRendererText*)(_treeview->get_column_cell_renderer(nr_of_cols - 1));
    cell->signal_edited().connect(sigc::bind
                                  (sigc::mem_fun(*_tmw
                                                ,&ListModelWrapper::after_cell_edit<int>
                                                )
                                                , sigc::ref(*col)
                                  )
                                 );
  }
  else
    nr_of_cols= _treeview->append_column(bec::replace_string(name, "_", "__"), *col);

  _treeview->get_column(nr_of_cols-1)->set_resizable(true);

  _columns.push_back(col);

  return *col;
}
Esempio n. 2
0
ClassEditor::TypeSelectorWidgets ClassEditor::createStimTypeSelector()
{
	TypeSelectorWidgets widgets;

	// Type Selector
	widgets.hbox = Gtk::manage(new Gtk::HBox(false, 0));

	widgets.label = Gtk::manage(new gtkutil::LeftAlignedLabel(_("Type:")));

	// Cast the helper class onto a ListStore and create a new treeview
	widgets.list = Gtk::manage(new Gtk::ComboBox(_stimTypes.getListStore()));
	widgets.list->set_size_request(-1, -1);

	// Add the cellrenderer for the name
	Gtk::CellRendererText* nameRenderer = Gtk::manage(new Gtk::CellRendererText);
	Gtk::CellRendererPixbuf* iconRenderer = Gtk::manage(new Gtk::CellRendererPixbuf);

	widgets.list->pack_start(*iconRenderer, false);
	widgets.list->pack_start(*nameRenderer, true);

	widgets.list->add_attribute(iconRenderer->property_pixbuf(), _stimTypes.getColumns().icon);
	widgets.list->add_attribute(nameRenderer->property_text(), _stimTypes.getColumns().captionPlusID);
	iconRenderer->set_fixed_size(26, -1);

	widgets.hbox->pack_start(*widgets.label, false, false, 0);
	widgets.hbox->pack_start(*Gtk::manage(new gtkutil::LeftAlignment(*widgets.list, 12, 1.0f)),
		true, true,	0
	);

	// Set the combo box to use two-column
	widgets.list->set_wrap_width(2);
	widgets.list->set_active(0);

	return widgets;
}
//------------------------------------------------------------------------------
const StringColumn& ColumnsModel::append_markup_column(const int bec_tm_idx, const std::string& name,
                                                       const Iconic have_icon) {
  Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf>>* icon = 0;

  Gtk::TreeViewColumn* column = Gtk::manage(new Gtk::TreeViewColumn(base::replaceString(name, "_", "__")));

  if (have_icon == WITH_ICON) {
    icon = new Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf>>;
    add(*icon);
    add_bec_index_mapping(bec_tm_idx);
    column->pack_start(*icon, false);

    _columns.push_back(icon);
  }

  Gtk::TreeModelColumn<Glib::ustring>* col = new Gtk::TreeModelColumn<Glib::ustring>;
  Gtk::CellRendererText* cell = Gtk::manage(new Gtk::CellRendererText());
  add(*col);
  add_bec_index_mapping(bec_tm_idx);
  column->pack_start(*cell);
  column->add_attribute(cell->property_markup(), *col);

  _columns.push_back(col);

  int nr_of_cols = _treeview->append_column(*column);
  _treeview->get_column(nr_of_cols - 1)->set_resizable(true);

  return *col;
}
Esempio n. 4
0
FontSizeComboBox::FontSizeComboBox(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder) :
	Gtk::ComboBox( cobject )
{
	font_size_tree_model_ = Gtk::ListStore::create(columns_);
	
	font_size_tree_model_->set_sort_column(columns_.font_size, Gtk::SORT_ASCENDING);
	
	set_model(font_size_tree_model_);
	
	Gtk::TreeModel::Row row = *(font_size_tree_model_->append()); row[columns_.font_size] = 6; 
	row = *(font_size_tree_model_->append()); row[columns_.font_size] = 8; 
	row = *(font_size_tree_model_->append()); row[columns_.font_size] = 10; 
	row = *(font_size_tree_model_->append()); row[columns_.font_size] = 11; 
	row = *(font_size_tree_model_->append()); row[columns_.font_size] = 12; 
	row = *(font_size_tree_model_->append()); row[columns_.font_size] = 14; 
	row = *(font_size_tree_model_->append()); row[columns_.font_size] = 16; 
	row = *(font_size_tree_model_->append()); row[columns_.font_size] = 18; 
	row = *(font_size_tree_model_->append()); row[columns_.font_size] = 24; 
	row = *(font_size_tree_model_->append()); row[columns_.font_size] = 32; 
	
	Gtk::CellRendererText* renderer = Gtk::manage (new Gtk::CellRendererText());
	pack_start (*renderer, true);
	
	add_attribute(renderer->property_text(), columns_.font_size);	
}
Esempio n. 5
0
void Frame_FilesTab::treeviewcolumn_filepriority(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter)
{
    if(iter)
    {
        Gtk::TreeModel::Row row = *iter;
        int model_value = row[FilesColumns.Priority];

        string Priority = "[unknown]";
        switch(model_value)
        {
        case 0:
            Priority = "Don't Download";
            break;
        case 1:
            Priority = "Low Priority";
            break;
        case 2:
            Priority = "Normal Priority";
            break;
        case 3:
            Priority = "High Priority";
            break;
        }

        Gtk::CellRendererText *crt = dynamic_cast<Gtk::CellRendererText*>(renderer);
        crt->property_text() = Priority;
    }
}
Esempio n. 6
0
ProjectDashboard::ProjectDashboard()
{
  mref_TreeModel = Gtk::ListStore::create(m_Columns);

  mp_TreeView = Gtk::manage(new Gtk::TreeView(mref_TreeModel));

  Gtk::TreeView::Column* pColumn = Gtk::manage(new Gtk::TreeView::Column(
      "Project Dashboard"));
  pColumn->pack_start(m_Columns.m_StateIcon, false);
  pColumn->pack_start(m_Columns.m_Title, false);
  mp_TreeView->append_column(*pColumn);

  mp_TreeView->append_column("", m_Columns.m_StateInfo);
  Gtk::CellRendererText* InfoCell =
      ((Gtk::CellRendererText*) mp_TreeView->get_column_cell_renderer(1));
  InfoCell->property_wrap_mode() = Pango::WRAP_WORD;
  InfoCell->property_wrap_width() = 200;

  mp_TreeView->set_visible(true);

  mp_MainWin = Gtk::manage(new Gtk::ScrolledWindow());
  mp_MainWin->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
  mp_MainWin->add(*mp_TreeView);
  mp_MainWin->set_visible(true);

  m_RedIcon = BuilderGraphicsHelper::createPixbufFromFile("red.png");
  m_OrangeIcon = BuilderGraphicsHelper::createPixbufFromFile("orange.png");
  m_GreenIcon = BuilderGraphicsHelper::createPixbufFromFile("green.png");

}
Esempio n. 7
0
void PluginDisplay::display_type(Gtk::CellRenderer *cell, const Gtk::TreeIter& it) {
    PortDesc *q = it->get_value(port_liststore->col.port);
    Gtk::CellRendererText *tcell = dynamic_cast<Gtk::CellRendererText*>(cell);
    if (q->is_set(ChangeableValues::tp_set)) {
        tcell->property_foreground().set_value("red");
    } else {
        tcell->property_foreground_set().set_value(false);
    }
}
//------------------------------------------------------------------------------
void ColumnsModel::disable_edit_first_row(Gtk::CellRenderer* cell, const Gtk::TreeIter& iter) {
  Gtk::CellRendererText* txt = (Gtk::CellRendererText*)cell;
  if (txt) {
    Gtk::TreeModel::Path path = this->_treeview->get_model()->get_path(iter);
    if (path[0] == 0)
      txt->property_editable() = false;
    else
      txt->property_editable() = true;
  }
}
void PresentationTreeView::initialize() {
	//  We only need single copies of these renderers since all instances of PresentationTreeView have
	//  identical properties. Cannot make them global though as that would require them to be
	//  initialized before the call to the GTK initialization and so leads to an initialization error.
	//  Having them in this scope means they are not initialized until the first instance of a
	//  PresentationTreeView is made which is after the GTK+ system is initialized.
	static Gtk::CellRendererText font_style_renderer;
	static Gtk::CellRendererText visibility_renderer;
	static Gtk::CellRendererText sample_text_renderer;
	static Gtk::CellRendererText file_name_renderer;
	PresentationListStore::ColumnRecord const & column_record{PresentationListStore::get_column_record()};
	font_style_column.pack_start(font_style_renderer, true);
	font_style_column.set_title(_("Font Style"));
	font_style_column.add_attribute(font_style_renderer.property_text(), column_record.style_name);
	visibility_column.pack_start(visibility_renderer, true);
	visibility_column.set_title(" ");
	visibility_column.add_attribute(visibility_renderer.property_text(), column_record.visibility);
	sample_text_column.pack_start(sample_text_renderer, true);
	sample_text_column.set_title(_("Sample Text"));
	sample_text_column.add_attribute(sample_text_renderer.property_font_desc(), column_record.font_description);
	sample_text_column.add_attribute(sample_text_renderer.property_text(), column_record.sample_text);
	file_name_column.pack_start(file_name_renderer, true);
	file_name_column.set_title(_("File Name"));
	file_name_column.add_attribute(file_name_renderer.property_text(), column_record.file_name);
	append_column(font_style_column);
	append_column(visibility_column);
	append_column(sample_text_column);
	append_column(file_name_column);
	for (auto i = 0; i < 4; ++i) { get_column(i)->set_resizable(true); }
	Registry::registry.insert(this);
}
Esempio n. 10
0
Gtk::Widget& DifficultyEditor::createTreeView()
{
	// First, create the treeview
	_settingsView = Gtk::manage(new Gtk::TreeView(_settings->getTreeStore()));
	_settingsView->set_size_request(TREE_VIEW_MIN_WIDTH, -1);

	// Connect the tree view selection
	Glib::RefPtr<Gtk::TreeSelection> selection = _settingsView->get_selection();
	selection->signal_changed().connect(sigc::mem_fun(*this, &DifficultyEditor::onSettingSelectionChange));

	// Add columns to this view
	Gtk::CellRendererText* textRenderer = Gtk::manage(new Gtk::CellRendererText);

	Gtk::TreeViewColumn* settingCol = Gtk::manage(new Gtk::TreeViewColumn);
	settingCol->pack_start(*textRenderer, false);

    settingCol->set_title(_("Setting"));
	settingCol->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE);
    settingCol->set_spacing(3);

	_settingsView->append_column(*settingCol);

	settingCol->add_attribute(textRenderer->property_text(), _settings->getColumns().description);
	settingCol->add_attribute(textRenderer->property_foreground(), _settings->getColumns().colour);
	settingCol->add_attribute(textRenderer->property_strikethrough(), _settings->getColumns().isOverridden);

	Gtk::ScrolledWindow* frame = Gtk::manage(new gtkutil::ScrolledFrame(*_settingsView));

	// Create the action buttons
	Gtk::HBox* buttonHBox = Gtk::manage(new Gtk::HBox(false, 6));

	// Create button
	_createSettingButton = Gtk::manage(new Gtk::Button(Gtk::Stock::ADD));
	_createSettingButton->signal_clicked().connect(sigc::mem_fun(*this, &DifficultyEditor::onSettingCreate));

	// Delete button
	_deleteSettingButton = Gtk::manage(new Gtk::Button(Gtk::Stock::DELETE));
	_deleteSettingButton->signal_clicked().connect(sigc::mem_fun(*this, &DifficultyEditor::onSettingDelete));

	_refreshButton = Gtk::manage(new Gtk::Button(Gtk::Stock::REFRESH));
	_refreshButton->signal_clicked().connect(sigc::mem_fun(*this, &DifficultyEditor::onRefresh));

	buttonHBox->pack_start(*_createSettingButton, true, true, 0);
	buttonHBox->pack_start(*_deleteSettingButton, true, true, 0);
	buttonHBox->pack_start(*_refreshButton, true, true, 0);

	Gtk::VBox* vbox = Gtk::manage(new Gtk::VBox(false, 6));
	vbox->pack_start(*frame, true, true, 0);
	vbox->pack_start(*buttonHBox, false, false, 0);

	vbox->set_border_width(12);

	return *vbox;
}
Esempio n. 11
0
void Frame_FilesTab::treeviewcolumn_filesize(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter)
{
    if(iter)
    {
        tools_formatsize fs;
        Gtk::TreeModel::Row row = *iter;
        int model_value = row[FilesColumns.Size];

        Gtk::CellRendererText *crt = dynamic_cast<Gtk::CellRendererText*>(renderer);
        crt->property_text() = fs.format(model_value);
    }
}
Esempio n. 12
0
Gtk::TreeView::Column* Chooser::addTextColumn( const Glib::ustring& name, Gtk::TreeModelColumnBase& column )
{
	Gtk::CellRendererText* renderer = Gtk::manage( new Gtk::CellRendererText );
	Gtk::TreeView::Column* col = Gtk::manage( new Gtk::TreeView::Column( name, *renderer ) );
	col->add_attribute( renderer->property_text(), column );
	/*col->add_attribute( renderer->property_cell_background(), f_columns.background_color );
	col->add_attribute( renderer->property_foreground(), f_columns.foreground_color );
	col->add_attribute( renderer->property_style(), f_columns.style );
	col->add_attribute( renderer->property_sensitive(), f_columns.sensitive );*/
	col->set_resizable( true );
	col->set_alignment( 0.5 );
	col->set_sort_column( column );
	append_column( *col );
	return col;
}
const StringColumn&
ColumnsModel::append_string_column(const int bec_tm_idx, const std::string& name, const Editable editable, const Iconic have_icon)
{
  Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> > *icon= 0;

  Gtk::TreeViewColumn *column= Gtk::manage(new Gtk::TreeViewColumn(bec::replace_string(name, "_", "__")));

  if ( have_icon == WITH_ICON )
  {
    icon = new Gtk::TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf> >;
    add(*icon);
    add_bec_index_mapping(bec_tm_idx);
    column->pack_start(*icon, false);

    _columns.push_back(icon);
  }

  Gtk::TreeModelColumn<Glib::ustring> *col = new Gtk::TreeModelColumn<Glib::ustring>;
  add(*col);
  add_bec_index_mapping(bec_tm_idx);
  column->pack_start(*col);

  _columns.push_back(col);

  int nr_of_cols= _treeview->append_column(*column);
  _treeview->get_column(nr_of_cols-1)->set_resizable(true);

  if (editable == EDITABLE || editable == EDITABLE_WO_FIRST)
  {

    std::vector<Gtk::CellRenderer*> rends= column->get_cell_renderers();

    Gtk::CellRendererText *cell = (Gtk::CellRendererText*)rends[icon ? 1 : 0];
    cell->property_editable()= true;
    cell->signal_edited().connect(sigc::bind
                                  (sigc::mem_fun(*_tmw
                                                ,&ListModelWrapper::after_cell_edit<Glib::ustring>
                                                )
                                                , sigc::ref(*col)
                                  )
                                 );

    if (editable == EDITABLE_WO_FIRST)
      column->set_cell_data_func(*cell, sigc::mem_fun(this, &ColumnsModel::disable_edit_first_row));
  }

  return *col;
}
Esempio n. 14
0
void Frame_FilesTab::treeviewcolumn_filetype(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter)
{
    if(iter)
    {
        Gtk::TreeModel::Row row = *iter;
        string model_value = row[FilesColumns.Name];

        string FileType = model_value.substr(model_value.find_last_of(".") + 1);
        if(model_value.compare(FileType) == 0) FileType = "[None]";

        std::transform(FileType.begin(), FileType.end(), FileType.begin(), ::tolower);

        Gtk::CellRendererText *crt = dynamic_cast<Gtk::CellRendererText*>(renderer);
        crt->property_text() = FileType;
    }
}
Esempio n. 15
0
/** Constructor.
 * @param cobject pointer to base object type
 * @param builder Gtk builder
 */
ConfigTreeView::ConfigTreeView(BaseObjectType* cobject,
			       const Glib::RefPtr<Gtk::Builder> &builder)
  : Gtk::TreeView(cobject)
{
  m_dlg_edit = NULL;
  builder->get_widget_derived("dlgConfigEdit", m_dlg_edit);

  m_dlg_add = NULL;
  builder->get_widget_derived("dlgConfigAdd", m_dlg_add);

  m_dlg_remove = NULL;
  builder->get_widget_derived("dlgConfigRemove", m_dlg_remove);

  m_config_tree = Gtk::TreeStore::create(m_config_record);
  m_config_tree->set_sort_column(0, Gtk::SORT_ASCENDING);

  set_model(m_config_tree);
  append_column("Path", m_config_record.node);

  Gtk::TreeViewColumn *column = get_column(0);
  Gtk::CellRendererText *cell =
#if GTK_VERSION_GE(3,0)
    (Gtk::CellRendererText *)column->get_first_cell();
#else
    (Gtk::CellRendererText *)column->get_first_cell_renderer();
#endif
#ifdef GLIBMM_PROPERTIES_ENABLED
  column->add_attribute(cell->property_underline(), m_config_record.is_default);
#else
  column->add_attribute(*cell, "underline", m_config_record.is_default);
#endif

  append_column("Value", m_config_record.value_string);

  /*
  Gtk::Menu::MenuList& menulist = m_menu.items();

  menulist.push_back( Gtk::Menu_Helpers::MenuElem("Edit", sigc::mem_fun( *this, &ConfigTreeView::on_menu_edit_selected) ) );
  menulist.push_back( Gtk::Menu_Helpers::MenuElem("Remove", sigc::mem_fun( *this, &ConfigTreeView::on_menu_remove_selected) ) );
  menulist.push_back( Gtk::Menu_Helpers::MenuElem("Add", sigc::mem_fun( *this, &ConfigTreeView::on_menu_add_selected) ) );
  */

  m_config = NULL;
  m_own_config = false;

  signal_button_press_event().connect_notify( sigc::mem_fun(*this, &ConfigTreeView::on_button_press_event_custom) );
}
Esempio n. 16
0
void PluginDisplay::display_upper(Gtk::CellRenderer *cell, const Gtk::TreeIter& it) {
    PortDesc *q = it->get_value(port_liststore->col.port);
    Gtk::CellRendererText *tcell = dynamic_cast<Gtk::CellRendererText*>(cell);
    tcell->property_foreground_set().set_value(false);
    tcell->property_background_set().set_value(false);
    DisplayType tp = q->get_tp();
    if (tp == tp_toggle || tp == tp_display_toggle || tp == tp_none) {
        cell->property_visible().set_value(false);
        return;
    }
    cell->property_visible().set_value(true);
    if (q->is_set(ChangeableValues::up_set)) {
        tcell->property_foreground().set_value("red");
    } else if (q->fake_up) {
        tcell->property_background().set_value("grey");
    }
}
// Actor Argument
ActorArgument::ActorArgument(
		const conversation::ArgumentInfo& argInfo,
		const Glib::RefPtr<Gtk::ListStore>& actorStore,
		const ActorColumns& actorColumns) :
	CommandArgumentItem(argInfo),
	_actorColumns(actorColumns),
	_actorStore(actorStore)
{
	// Cast the helper class onto a ListStore and create a new treeview
	_comboBox = Gtk::manage(new Gtk::ComboBox(Glib::RefPtr<Gtk::TreeModel>::cast_static(_actorStore)));

	// Add the cellrenderer for the name
	Gtk::CellRendererText* nameRenderer = Gtk::manage(new Gtk::CellRendererText);

	_comboBox->pack_start(*nameRenderer, true);
	_comboBox->add_attribute(nameRenderer->property_text(), _actorColumns.caption);
}
Esempio n. 18
0
void EffectEditor::populateWindow()
{
	// Create the overall vbox
	_dialogVBox = Gtk::manage(new Gtk::VBox(false, 3));
	add(*_dialogVBox);

	Gtk::HBox* effectHBox = Gtk::manage(new Gtk::HBox(false, 0));

	_effectTypeCombo = Gtk::manage(new Gtk::ComboBox(static_cast<const Glib::RefPtr<Gtk::TreeModel>&>(_effectStore)));

	// Add the cellrenderer for the caption
	Gtk::CellRendererText* captionRenderer = Gtk::manage(new Gtk::CellRendererText);
	_effectTypeCombo->pack_start(*captionRenderer, false);
	_effectTypeCombo->add_attribute(captionRenderer->property_text(), _effectColumns.caption);

	Gtk::Label* effectLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(_("Effect:")));

	effectHBox->pack_start(*effectLabel, false, false, 0);
	effectHBox->pack_start(*Gtk::manage(new gtkutil::LeftAlignment(*_effectTypeCombo, 12, 1.0f)),
		true, true, 0
	);

	_dialogVBox->pack_start(*effectHBox, false, false, 3);

	_stateToggle = Gtk::manage(new Gtk::CheckButton(_("Active")));
	_stateToggle->signal_toggled().connect(sigc::mem_fun(*this, &EffectEditor::onStateToggle));

	_dialogVBox->pack_start(*_stateToggle, false, false, 3);

	Gtk::Label* argLabel =
		Gtk::manage(new gtkutil::LeftAlignedLabel(std::string("<b>") + _("Arguments") + "</b>"));
	_dialogVBox->pack_start(*argLabel, false, false, 0);

	Gtk::Button* saveButton = Gtk::manage(new Gtk::Button(Gtk::Stock::APPLY));
	saveButton->signal_clicked().connect(sigc::mem_fun(*this, &EffectEditor::onSave));

	Gtk::Button* cancelButton = Gtk::manage(new Gtk::Button(Gtk::Stock::CANCEL));
	cancelButton->signal_clicked().connect(sigc::mem_fun(*this, &EffectEditor::onCancel));

	Gtk::HBox* buttonHBox = Gtk::manage(new Gtk::HBox(false, 0));
	buttonHBox->pack_end(*saveButton, false, false, 0);
	buttonHBox->pack_end(*cancelButton, false, false, 6);

	_dialogVBox->pack_end(*buttonHBox, false, false, 3);
}
//------------------------------------------------------------------------------
const StringColumn&
ColumnsModel::append_combo_column(const int bec_tm_idx
                                     ,const std::string            &name
                                     ,Glib::RefPtr<Gtk::ListStore>  list_w
                                     ,const Editable                editable
                                     ,bool popup_only)
{
  Gtk::TreeModelColumn<Glib::ustring> *choosen = new Gtk::TreeModelColumn<Glib::ustring>;
  _columns.push_back(choosen);
  add(*choosen);
  add_bec_index_mapping(bec_tm_idx);

  Gtk::TreeView::Column   *col = Gtk::manage(new Gtk::TreeViewColumn(bec::replace_string(name, "_", "__")));
  Gtk::CellRendererCombo *cell = Gtk::manage(new Gtk::CellRendererCombo);
  col->pack_start(*cell);

  col->add_attribute(cell->property_text(), *choosen);
  cell->property_model() = list_w;
  cell->property_text_column() = 0;
  cell->property_editable() = editable;
  cell->property_has_entry() = !popup_only;
  
  Gtk::TreeModelColumn<Glib::RefPtr<Gtk::TreeModel> > *model_col = new Gtk::TreeModelColumn<Glib::RefPtr<Gtk::TreeModel> >();
  add_bec_index_mapping(bec_tm_idx);
  add(*model_col);
  const int nr_of_cols = _treeview->append_column(*col);

  _columns.push_back(model_col);

  _treeview->get_column(nr_of_cols-1)->set_resizable(true);

  if ( editable == EDITABLE )
  {
    Gtk::CellRendererText *cell = (Gtk::CellRendererText*)(_treeview->get_column_cell_renderer(nr_of_cols - 1));
    cell->signal_edited().connect(sigc::bind
                                    (sigc::mem_fun(*_tmw
                                                  ,&ListModelWrapper::after_cell_edit<Glib::ustring>
                                                  )
                                                  , sigc::ref(*choosen)
                                   )
                                 );
  }

  return *choosen;
}
Esempio n. 20
0
void DomainIDataViewImpl::setTreeModel(Glib::RefPtr<Gtk::TreeModel> TreeModel,
    DomainIDataColumns* Columns)
{
  mp_TreeView->remove_all_columns();
  mp_TreeView->set_model(TreeModel);

  if (TreeModel->get_n_columns() < 2)
    return;

  mp_TreeView->append_column("Unit ID", *Columns->getIdColumn());
  mp_TreeView->get_column(0)->set_sort_column(*Columns->getIdColumn());

  std::map<std::string, Gtk::TreeModelColumn<std::string>*> ColumnsByTitle =
      Columns->getByTitleColumns();

  for (std::map<std::string, Gtk::TreeModelColumn<std::string>*>::iterator it =
      ColumnsByTitle.begin(); it != ColumnsByTitle.end(); ++it)
  {
    int ColIndex = mp_TreeView->append_column_editable("", *it->second) - 1;

    /*
     * use of a widget label instead of a column title because
     * in column title, underscores have to be escaped by another one
     * (same as Label::set_use_underline(true))
     */
    Gtk::Label* TitleLabel = Gtk::manage(new Gtk::Label(it->first));
    TitleLabel->set_visible(true);
    mp_TreeView->get_column(ColIndex)->set_widget(*TitleLabel);

    mp_TreeView->get_column(ColIndex)->set_sort_column(*it->second);

    Gtk::CellRendererText* CellRend =
        (Gtk::CellRendererText *) mp_TreeView->get_column_cell_renderer(
            ColIndex);

    CellRend->signal_edited().connect(sigc::bind<std::string>(sigc::mem_fun(
        *this, &DomainIDataViewImpl::onDataEdited), it->first));
  }

  mp_TreeView->get_selection()->signal_changed().connect(sigc::mem_fun(*this,
      &DomainIDataViewImpl::onUnitSelectionChanged));

}
Esempio n. 21
0
//TODO: klasse soll window extenden (schoener so)
EwAccountsWin::EwAccountsWin() {
	EWLOG("In EwAccountsWin::EwAccountsWin()", 8);
	Glib::RefPtr<Gtk::Builder> builder = Gtk::Builder::create_from_file("data/EwAccountsWin.glade");
	Gtk::Button *add, *del, *close;
	Gtk::ScrolledWindow *scrolledwindow;
	builder->get_widget("EwAccounts", window);
	builder->get_widget("add", add);
	builder->get_widget("delete", del);
	builder->get_widget("close", close);
	builder->get_widget("scrolledwindow", scrolledwindow);
	scrolledwindow->add(treeView);
	add->signal_clicked().connect(sigc::mem_fun(this, &EwAccountsWin::onAddBtnClicked));
	del->signal_clicked().connect(sigc::mem_fun(this, &EwAccountsWin::onDelBtnClicked));
	close->signal_clicked().connect(sigc::mem_fun(this, &EwAccountsWin::onCloseBtnClicked));

	liststore = Gtk::ListStore::create(m_Columns);
	treeView.set_model(liststore);
	treeView.append_column("Enabled", m_Columns.m_col_enab);
	treeView.append_column_editable("Identifier", m_Columns.m_col_identifier);
	treeView.append_column("Use Https", m_Columns.m_col_https);
	Gtk::CellRendererText *crtu;
	Gtk::CellRendererToggle *crtenab, *crthttps;
	crtenab = dynamic_cast<Gtk::CellRendererToggle*>(treeView.get_column_cell_renderer(0));
	crtenab->set_activatable();
	crtenab->signal_toggled().connect(sigc::mem_fun(this, &EwAccountsWin::onColumnEnabledToggled));
	crtu = dynamic_cast<Gtk::CellRendererText*>(treeView.get_column_cell_renderer(1));
	crtu->signal_edited().connect(sigc::mem_fun(this, &EwAccountsWin::onColumnIdentifierChanged));
	crthttps = dynamic_cast<Gtk::CellRendererToggle*>(treeView.get_column_cell_renderer(2));
	crthttps->set_activatable();
	crthttps->signal_toggled().connect(sigc::mem_fun(this, &EwAccountsWin::onColumnHttpsToggled));

	std::list<EwAccountList::EwAccount> accounts = EwAccountList::Instance()->getAccounts();
	for (std::list<EwAccountList::EwAccount>::iterator iter = accounts.begin(); iter != accounts.end(); iter++) {
		Gtk::TreeModel::Row row = *(liststore->append());
		row[m_Columns.m_col_id] = (*iter).id;
		row[m_Columns.m_col_identifier] = (*iter).identifier;
		row[m_Columns.m_col_enab] = (*iter).enabled;
		row[m_Columns.m_col_https] = (*iter).https;
	}
	
	window->show_all_children();
	Gtk::Main::run(*window);
}
ContactsTreeWidget::ContactsTreeWidget(BaseObjectType* baseObject, const Glib::RefPtr<Gnome::Glade::Xml>& refGlade) : Gtk::TreeView(baseObject) {
  appInstance->logEvent("ContactsTreeWidget::ContactsTreeWidget()", SEVERITY_DEBUG);
  treeModel = Gtk::TreeStore::create(columns);
  // sort by status codes.
  // STATUS_OFFLINE is 0, so it will always be at bottom of the list
  treeModel->set_sort_column(columns.contactStatus, Gtk::SORT_DESCENDING);
  set_model(treeModel);
  set_search_equal_func(sigc::mem_fun(*this, &ContactsTreeWidget::onSearchEqual));

  // appending columns
  gint colCount;
  Gtk::TreeViewColumn* pColumn;
  Gtk::CellRenderer* renderer;
  Gtk::CellRendererPixbuf *avatarRenderer, *statusRenderer;
  Gtk::CellRendererText *textRenderer;

  statusRenderer = Gtk::manage(new Gtk::CellRendererPixbuf);
  statusRenderer->property_xalign() = 0.0;
  colCount = append_column(_("Status"), *statusRenderer);
  pColumn = get_column(colCount - 1);
  pColumn->add_attribute(statusRenderer->property_pixbuf(), columns.statusImage);

  textRenderer = Gtk::manage(new Gtk::CellRendererText);
  textRenderer->property_xalign() = 0.0;
  colCount = append_column(_("Nickname"), *textRenderer);
  pColumn = get_column(colCount - 1);
  pColumn->set_resizable(true);
  pColumn->add_attribute(textRenderer->property_markup(), columns.contactNickname);

  avatarRenderer = Gtk::manage(new Gtk::CellRendererPixbuf);
  avatarRenderer->property_xalign() = 1.0;
  avatarRenderer->property_xpad() = 10;
  colCount = append_column("", *avatarRenderer);
  pColumn = get_column(colCount - 1);
  pColumn->add_attribute(avatarRenderer->property_pixbuf(), columns.contactAvatar);

  // connecting signal handlers
  signal_row_activated().connect(sigc::mem_fun(*this, &ContactsTreeWidget::contactsTreeOnActivate));
  appInstance->sigServer->signal_user_status().connect(sigc::mem_fun(*this, &ContactsTreeWidget::onStatusChange));
}
ValidationPanel::ValidationPanel()
  : Gtk::Box(Gtk::ORIENTATION_VERTICAL), _label_box(0), _label(_("<small>Validations</small>")) {
  _label.set_use_markup(true);
  _model = ListModelWrapper::create(&_be, &_tv, "ValidationModel");

  _model->model().append_string_column(bec::ValidationMessagesBE::Description, _("Description"), RO, WITH_ICON);

  _tv.set_fixed_height_mode(false);
  _tv.set_model(_model);

  add(_tv);

  show_all();

  std::vector<Gtk::CellRenderer*> cells = _tv.get_column(0)->get_cells();
  Gtk::CellRendererText* ct = dynamic_cast<Gtk::CellRendererText*>(cells[1]);
  ct->property_wrap_width() = 120;
  ct->property_wrap_mode() = Pango::WRAP_WORD;

  _tv.signal_size_allocate().connect(sigc::mem_fun(this, &ValidationPanel::size_request_slot));

  scoped_connect(_be.tree_changed_signal(), sigc::mem_fun(this, &ValidationPanel::refresh));
}
Esempio n. 24
0
ClassEditor::ClassEditor(StimTypes& stimTypes) :
	Gtk::VBox(false, 6),
	_stimTypes(stimTypes),
	_updatesDisabled(false)
{
	set_border_width(6);

	_list = Gtk::manage(new Gtk::TreeView);
	_list->set_size_request(TREE_VIEW_WIDTH, TREE_VIEW_HEIGHT);

	// Connect the signals to the callbacks
	_list->get_selection()->signal_changed().connect(sigc::mem_fun(*this, &ClassEditor::onSRSelectionChange));
	_list->signal_key_press_event().connect(sigc::mem_fun(*this, &ClassEditor::onTreeViewKeyPress), false);
	_list->signal_button_release_event().connect(
		sigc::bind(sigc::mem_fun(*this, &ClassEditor::onTreeViewButtonRelease), _list));

	// Add the columns to the treeview
	// ID number
	Gtk::TreeViewColumn* numCol = Gtk::manage(new Gtk::TreeViewColumn("#"));
	Gtk::CellRendererText* numRenderer = Gtk::manage(new Gtk::CellRendererText);

	numCol->pack_start(*numRenderer, false);
	numCol->add_attribute(numRenderer->property_text(), SREntity::getColumns().index);
	numCol->add_attribute(numRenderer->property_foreground(), SREntity::getColumns().colour);

	_list->append_column(*numCol);

	// The S/R icon
	Gtk::TreeViewColumn* classCol = Gtk::manage(new Gtk::TreeViewColumn(_("S/R")));

	Gtk::CellRendererPixbuf* pixbufRenderer = Gtk::manage(new Gtk::CellRendererPixbuf);

	classCol->pack_start(*pixbufRenderer, false);
	classCol->add_attribute(pixbufRenderer->property_pixbuf(), SREntity::getColumns().srClass);

	_list->append_column(*classCol);

	// The Type
	Gtk::TreeViewColumn* typeCol = Gtk::manage(new Gtk::TreeViewColumn(_("Type")));

	Gtk::CellRendererPixbuf* typeIconRenderer = Gtk::manage(new Gtk::CellRendererPixbuf);

	typeCol->pack_start(*typeIconRenderer, false);
	typeCol->add_attribute(typeIconRenderer->property_pixbuf(), SREntity::getColumns().icon);

	Gtk::CellRendererText* typeTextRenderer = Gtk::manage(new Gtk::CellRendererText);

	typeCol->pack_start(*typeTextRenderer, false);
	typeCol->add_attribute(typeTextRenderer->property_text(), SREntity::getColumns().caption);
	typeCol->add_attribute(typeTextRenderer->property_foreground(), SREntity::getColumns().colour);

	_list->append_column(*typeCol);
}
ArbitratorPropertyWindow::ArbitratorPropertyWindow(MainWindow* parent, 
                               Manager* manager, ApplicationWindow* appWnd)
{   
    m_pParent = parent;
    m_pManager = manager;
    m_pAppWindow = appWnd;
    m_arbPort.clear();

    /* Create a new scrolled window, with scrollbars only if needed */
    set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    add(m_TreeView);

    /* create tree store */
    m_refTreeModel = Gtk::TreeStore::create(m_Columns);
    m_TreeView.set_model(m_refTreeModel);

    //Add the Model’s column to the View’s columns: 
    Gtk::CellRendererText* itemRenderer = Gtk::manage(new Gtk::CellRendererText());
    itemRenderer->property_editable() = false;
    Gtk::TreeViewColumn* itemCol = Gtk::manage(new Gtk::TreeViewColumn("Property", *itemRenderer));
    //itemCol->add_attribute(*itemRenderer, "background-gdk", m_Columns.m_col_color);
    itemCol->add_attribute(*itemRenderer, "text", m_Columns.m_col_name);
    itemCol->set_resizable(true);
    m_TreeView.append_column(*itemCol);



    Gtk::CellRendererText* valueRenderer = Gtk::manage(new Gtk::CellRendererText());
    valueRenderer->property_editable() = false;
    Gtk::TreeViewColumn* valueCol = Gtk::manage(new Gtk::TreeViewColumn("Value", *valueRenderer));
    valueCol->add_attribute(*valueRenderer, "foreground-gdk", m_Columns.m_col_color_value);
    valueCol->add_attribute(*valueRenderer, "text", m_Columns.m_col_value);
    valueCol->set_resizable(true);
    valueRenderer->property_editable() = true;
    //valueCol->set_cell_data_func(*valueRenderer, sigc::mem_fun(*this,
    //    &ArbitratorPropertyWindow::onCellData) );
    valueRenderer->signal_edited().connect( sigc::mem_fun(*this,
              &ArbitratorPropertyWindow::onCellEdited) );
    m_TreeView.append_column(*valueCol);
    valueCol->add_attribute(*valueRenderer, "editable", m_Columns.m_col_editable);   


    //m_TreeView.append_column_editable("Value", m_Columns.m_col_value);
    //m_TreeView.get_column(1)->set_resizable(true);
       //Tell the view column how to render the model values:
    m_TreeView.set_property("enable_grid_lines", true);
    show_all_children();
    m_TreeView.set_grid_lines(Gtk::TREE_VIEW_GRID_LINES_BOTH);
    m_TreeView.set_rules_hint(true);
}
Esempio n. 26
0
ModuleWindow::ModuleWindow(Module* module, MainWindow* parent,
                               Manager* manager)
{
    m_pModule = module;
    m_pParent = parent;
    m_pManager = manager;

    /* Create a new scrolled window, with scrollbars only if needed */
    set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
    add(m_TreeView);

    /* create tree store */
    m_refTreeModel = Gtk::TreeStore::create(m_Columns);
    m_TreeView.set_model(m_refTreeModel);

    //Add the Model’s column to the View’s columns:
    Gtk::CellRendererText* cellText = Gtk::manage(new Gtk::CellRendererText());
    cellText->property_style() = Pango::STYLE_ITALIC;
    Gtk::CellRendererPixbuf* cellPix = Gtk::manage(new Gtk::CellRendererPixbuf());
    Gtk::TreeViewColumn* col = Gtk::manage(new Gtk::TreeViewColumn("Item"));
    col->pack_start(*cellPix, false);
    col->pack_start(*cellText, true);
    col->add_attribute(*cellText, "text", 1);
    col->add_attribute(*cellPix, "pixbuf", 0);
    m_TreeView.append_column(*col);
    m_TreeView.get_column(0)->set_resizable(true);

    //m_TreeView.append_column("Value", m_Columns.m_col_value);
    //m_TreeView.get_column(1)->set_resizable(true);

    Gtk::CellRendererText* cellValue = Gtk::manage(new Gtk::CellRendererText());
    cellValue->property_editable() = false;
    cellValue->property_wrap_mode() = Pango::WRAP_WORD;
    cellValue->property_style() = Pango::STYLE_ITALIC;
    //cellValue->property_wrap_width() = m_Columns.m_col_width;
    Gtk::TreeViewColumn* valueCol = Gtk::manage(new Gtk::TreeViewColumn("Value", *cellValue));
    valueCol->add_attribute(*cellValue, "text", m_Columns.m_col_value);
    valueCol->add_attribute(*cellValue, "wrap_width", m_Columns.m_col_width);

    valueCol->set_resizable(true);
    m_TreeView.append_column(*valueCol);
    //m_TreeView.set_rules_hint(true);


    updateWidget();
    show_all_children();
}
Esempio n. 27
0
void SearchNotesWidget::notebook_text_cell_data_func(Gtk::CellRenderer * renderer,
                                                     const Gtk::TreeIter & iter)
{
  Gtk::CellRendererText *crt = dynamic_cast<Gtk::CellRendererText*>(renderer);
  crt->property_ellipsize() = Pango::ELLIPSIZE_END;
  notebooks::Notebook::Ptr notebook;
  iter->get_value(0, notebook);
  if(!notebook) {
    crt->property_text() = "";
    return;
  }

  crt->property_text() = notebook->get_name();

  if(dynamic_pointer_cast<notebooks::SpecialNotebook>(notebook)) {
    // Bold the "Special" Notebooks
    crt->property_markup() = Glib::ustring::compose("<span weight=\"bold\">%1</span>",
                                 notebook->get_name());
  }
  else {
    crt->property_text() = notebook->get_name();
  }
}
Esempio n. 28
0
/** greebo: Creates all the widgets
 */
void CustomStimEditor::populatePage()
{
	set_border_width(6);

	// Setup a treemodel filter to display the custom stims only
	_customStimStore = Gtk::TreeModelFilter::create(_stimTypes.getListStore());
	_customStimStore->set_visible_column(_stimTypes.getColumns().isCustom);

	_list = Gtk::manage(new Gtk::TreeView(_customStimStore));
	_list->set_size_request(TREE_VIEW_WIDTH, TREE_VIEW_HEIGHT);

	// Connect the signals to the callbacks
	_list->get_selection()->signal_changed().connect(sigc::mem_fun(*this, &CustomStimEditor::onSelectionChange));
	_list->signal_button_release_event().connect(sigc::mem_fun(*this, &CustomStimEditor::onTreeViewButtonRelease));

	// Add the columns to the treeview
	// ID number
	Gtk::TreeViewColumn* numCol = Gtk::manage(new Gtk::TreeViewColumn(_("ID")));

	Gtk::CellRendererText* numRenderer = Gtk::manage(new Gtk::CellRendererText);
	numCol->pack_start(*numRenderer, false);
	numCol->add_attribute(numRenderer->property_text(), _stimTypes.getColumns().id);

	_list->append_column(*numCol);

	// The Type
	Gtk::TreeViewColumn* typeCol = Gtk::manage(new Gtk::TreeViewColumn(_("Type")));

	Gtk::CellRendererPixbuf* typeIconRenderer = Gtk::manage(new Gtk::CellRendererPixbuf);
	typeCol->pack_start(*typeIconRenderer, false);

	Gtk::CellRendererText* typeTextRenderer = Gtk::manage(new Gtk::CellRendererText);
	typeCol->pack_start(*typeTextRenderer, false);

	typeCol->add_attribute(typeTextRenderer->property_text(), _stimTypes.getColumns().caption);
	typeCol->add_attribute(typeIconRenderer->property_pixbuf(), _stimTypes.getColumns().icon);

	_list->append_column(*typeCol);

	Gtk::VBox* listVBox = Gtk::manage(new Gtk::VBox(false, 6));
	listVBox->pack_start(*Gtk::manage(new gtkutil::ScrolledFrame(*_list)), true, true, 0);
	listVBox->pack_start(createListButtons(), false, false, 0);

	pack_start(*listVBox, false, false, 0);

	_propertyWidgets.vbox = Gtk::manage(new Gtk::VBox(false, 6));

	pack_start(*_propertyWidgets.vbox, true, true, 0);

	// The name widgets
	Gtk::HBox* nameHBox = Gtk::manage(new Gtk::HBox(false, 6));
	_propertyWidgets.nameLabel = Gtk::manage(new Gtk::Label(_("Name:")));
	_propertyWidgets.nameEntry = Gtk::manage(new Gtk::Entry);

	nameHBox->pack_start(*_propertyWidgets.nameLabel, false, false, 0);
	nameHBox->pack_start(*_propertyWidgets.nameEntry, true, true, 0);

	// Connect the entry field
	_propertyWidgets.nameEntry->signal_changed().connect(sigc::mem_fun(*this, &CustomStimEditor::onEntryChanged));

	_propertyWidgets.vbox->pack_start(*nameHBox, false, false, 0);

	Gtk::Label* infoText = Gtk::manage(new gtkutil::LeftAlignedLabel(
		_("<b>Note:</b> Please beware that deleting custom stims may\n"
		"affect other entities as well. So check before you delete.")
	));
	_propertyWidgets.vbox->pack_start(*infoText, false, false, 0);
}
Esempio n. 29
0
Gtk::Widget& DifficultyEditor::createEditingWidgets()
{
	_editorPane = Gtk::manage(new Gtk::VBox(false, 6));
	_editorPane->set_border_width(12);

	// The "Settings" label
	Gtk::Label* settingsLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(std::string("<b>") + _("Setting") + "</b>"));
	_editorPane->pack_start(*settingsLabel, false, false, 0);

	// The table aligning the editing widgets
	Gtk::Table* table = Gtk::manage(new Gtk::Table(3, 2, false));
    table->set_col_spacings(12);
    table->set_row_spacings(6);

	_editorPane->pack_start(*Gtk::manage(new gtkutil::LeftAlignment(*table, 18, 1.0)), false, false, 0);

	// ===== CLASSNAME ======

	Gtk::Label* classNameLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(_("Classname:")));

	// Add classname widget
	_classCombo = Gtk::manage(new Gtk::ComboBoxEntry(
		ClassNameStore::Instance().getModel(),
		ClassNameStore::Instance().getColumns().classname
	));

	// Add completion functionality to the combobox entry
	Glib::RefPtr<Gtk::EntryCompletion> completion = Gtk::EntryCompletion::create();
	completion->set_model(ClassNameStore::Instance().getModel());
	completion->set_text_column(ClassNameStore::Instance().getColumns().classname);

	_classCombo->get_entry()->set_completion(completion);

	table->attach(*classNameLabel, 0, 1, 0, 1, Gtk::FILL, Gtk::AttachOptions(0), 0, 0);
	table->attach(*_classCombo, 1, 2, 0, 1);

	// ===== SPAWNARG ======
	_spawnArgEntry = Gtk::manage(new Gtk::Entry);
	Gtk::Label* spawnArgLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(_("Spawnarg:")));

	table->attach(*spawnArgLabel, 0, 1, 1, 2, Gtk::FILL, Gtk::AttachOptions(0), 0, 0);
	table->attach(*_spawnArgEntry, 1, 2, 1, 2);

	// ===== ARGUMENT ======
	_argumentEntry = Gtk::manage(new Gtk::Entry);
	Gtk::Label* argumentLabel = Gtk::manage(new gtkutil::LeftAlignedLabel(_("Argument:")));

	// The appType chooser
	_appTypeCombo = Gtk::manage(new Gtk::ComboBox(difficulty::Setting::getAppTypeStore()));
	_appTypeCombo->signal_changed().connect(sigc::mem_fun(*this, &DifficultyEditor::onAppTypeChange));

	// Add the cellrenderer for the apptype text
	Gtk::CellRendererText* appTypeRenderer = Gtk::manage(new Gtk::CellRendererText);

	_appTypeCombo->pack_start(*appTypeRenderer, false);
	_appTypeCombo->add_attribute(appTypeRenderer->property_text(), difficulty::Setting::getTreeModelColumns().name);

	// Pack the argument entry and the appType dropdown field together
	Gtk::HBox* argHBox = Gtk::manage(new Gtk::HBox(false, 6));
	argHBox->pack_start(*_argumentEntry, true, true, 0);
	argHBox->pack_start(*_appTypeCombo, false, false, 0);

	table->attach(*argumentLabel, 0, 1, 2, 3, Gtk::FILL, Gtk::AttachOptions(0), 0, 0);
	table->attach(*argHBox, 1, 2, 2, 3);

	// Save button
	Gtk::HBox* buttonHbox = Gtk::manage(new Gtk::HBox(false, 6));

	_saveSettingButton = Gtk::manage(new Gtk::Button(Gtk::Stock::SAVE));
	_saveSettingButton->signal_clicked().connect(sigc::mem_fun(*this, &DifficultyEditor::onSettingSave));

	buttonHbox->pack_start(*_saveSettingButton, false, false, 0);
	_editorPane->pack_start(*Gtk::manage(new gtkutil::RightAlignment(*buttonHbox)), false, false, 0);

	// The "note" text
	_noteText = Gtk::manage(new Gtk::Label);
	_noteText->set_line_wrap(true);
	_editorPane->pack_start(*Gtk::manage(new gtkutil::LeftAlignment(*_noteText)), false, false, 6);

	return *_editorPane;
}
Esempio n. 30
0
// Cringe.
void GtkTorrentSideBar::setupColumns()
{
	int cid = 0;
	Gtk::TreeViewColumn     *col = nullptr;
	Gtk::CellRendererText   *cell = Gtk::manage(new Gtk::CellRendererText());
	Gtk::CellRendererPixbuf *cellp = Gtk::manage(new Gtk::CellRendererPixbuf());

	cell->set_alignment(0, 0.5);
	cell->signal_edited().connect([this](const std::string& path,const std::string& name){ addedItem(path, name); });

	cid = append_column(*Gtk::manage(new Gtk::TreeViewColumn("Name")));	
	col = get_column(cid - 1);
	col->pack_start(*cellp);
	col->pack_start(*cell);
	col->add_attribute(cell->property_markup(), m_cols.name);
	col->add_attribute(cell->property_editable(), m_cols.editable);
	col->add_attribute(cellp->property_pixbuf(), m_cols.icon);

        // This really isn't "setupColumns" anymore from this point.
        // TODO Move to own function
	m_torrent_row = *(m_liststore->append());
	m_torrent_row[m_cols.name] = "Torrents";
	m_torrent_row[m_cols.editable] = false;
	m_torrent_row[m_cols.clickCallback] = [](){}; // clicks on titles don't do shit

	auto torrent_icon = Gdk::Pixbuf::create_from_resource("/org/gtk/gtorrent/icon-torrent.png");
	auto torrent_icon_scaled =  torrent_icon->scale_simple(16, 16, Gdk::INTERP_BILINEAR);
	m_torrent_row[m_cols.icon] = torrent_icon_scaled;

        // XXX TMP WILL REMOVE AND REPLACE WITH PROPER FUNCTION
        // Yes this is horrible. Bear with it for now.
        auto g = Application::getSingleton()->getCore()->getAllTorrents();
	Gtk::TreeModel::Row row = *(m_liststore->append(m_torrent_row.children()));
	row[m_cols.name] = "All";
	row[m_cols.title] = "All";
	row[m_cols.group] = g;
	row[m_cols.group_vector] = &g->m_torrents_all;

	Gtk::TreeModel::Row row2 = *(m_liststore->append(row.children()));
	row2[m_cols.name] = "Downloading";
	row2[m_cols.title] = "Downloading";
	row2[m_cols.group_vector] = &g->m_torrents_downloading;
        row2 = *(m_liststore->append(row.children()));
        row2[m_cols.name] = "Seeding";
        row2[m_cols.title] = "Seeding";
        row2[m_cols.group_vector] = &g->m_torrents_seeding;
        row2 = *(m_liststore->append(row.children()));
        row2[m_cols.name] = "Checking";
        row2[m_cols.title] = "Checking";
        row2[m_cols.group_vector] = &g->m_torrents_checking;
        row2 = *(m_liststore->append(row.children()));
        row2[m_cols.name] = "Finished";
        row2[m_cols.title] = "Finished";
        row2[m_cols.group_vector] = &g->m_torrents_finished;
        row2 = *(m_liststore->append(row.children()));
        row2[m_cols.name] = "Stopped";
        row2[m_cols.title] = "Stopped";
        row2[m_cols.group_vector] = &g->m_torrents_stopped;
        row2 = *(m_liststore->append(row.children()));
        row2[m_cols.name] = "Paused";
        row2[m_cols.title] = "Paused";
        row2[m_cols.group_vector] = &g->m_torrents_paused;

        // End of new horrible code
        // Continue horrible code from before
	//row = *(m_liststore->append(m_torrent_row.children()));
	//row[m_cols.name] = "Add a label";
	//row[m_cols.editable] = true;
	//row[m_cols.icon] = Gtk::IconTheme::get_default()->lookup_icon("list-add-symbolic", 16, Gtk::ICON_LOOKUP_USE_BUILTIN).load_icon();
	//row[m_cols.clickCallback] = [row](){};

	m_rssfeed_row = *(m_liststore->append());
	m_rssfeed_row[m_cols.name] = "RSS Feeds";
	m_rssfeed_row[m_cols.editable] = false;
	m_rssfeed_row[m_cols.clickCallback] = [](){};

	auto rss_icon = Gdk::Pixbuf::create_from_resource("/org/gtk/gtorrent/icon-rss.png");
	auto rss_icon_scaled =  rss_icon->scale_simple(16, 16, Gdk::INTERP_BILINEAR);
	m_rssfeed_row[m_cols.icon] = rss_icon_scaled;

	for(auto fg : Application::getSingleton()->getCore()->m_feeds)
	{
		row = *(m_liststore->append(m_rssfeed_row.children()));
		row[m_cols.name] = fg->name;
		row[m_cols.editable] = false;
		// TODO change icon to some sort of generic RSS icon
		row[m_cols.clickCallback] = [this, fg](){m_rss->run(fg->name);m_rss->hide();};

	}
	
	row = *(m_liststore->append(m_rssfeed_row.children()));
	row[m_cols.name] = "Add an RSS group";
	row[m_cols.editable] = true;

	row[m_cols.icon] = Gtk::IconTheme::get_default()->lookup_icon("list-add-symbolic", 16, Gtk::ICON_LOOKUP_USE_BUILTIN).load_icon();
	row[m_cols.clickCallback] = [row](){};

	//Maybe migrate settings there
/*	row = *(m_liststore->append());
	row[m_cols.name] = "Settings";
	row[m_cols.title] = true;
	row[m_cols.clickCallback] = [](){}; // clicks on titles don't do shit*/
}