port-to-gtk3: Use Gtk::CellLayout::get_cells() (#7)

GParted uses Gtk::TreeViewColumn::get_cell_renderers().  This is not
present in Gtkmm3.  Now Gtk::TreeViewColumn inherits from
Gtk::CellLayout and we have to use Gtk::CellLayout::get_cells() instead.

GtkCellLayout was introduced in Gtk2 version 2.18 as the common
interface for containers of cell renderers.

The C++ wrapper Gtk::CellLayout was introduced in Gtkmm2 version 2.18,
but Gtk::TreeViewColumn was never made to inherit from Gtk::CellLayout
to avoid breaking the API / ABI.  That change was made for Gtkmm3.

This is an excerpt from gtkmm/treeviewcolumn.h header in Gtkmm2:
  // TODO: Should be deprecated, but we cannot derive from CellLayout
  // without breaking API and ABI.

  /** Returns a list of all the cell renderers in the column,
   * in no particular order.
   *
   * @return A list of Gtk::CellRenderers.
   */
  Glib::ListHandle<CellRenderer*> get_cell_renderers();

Replace Gtk::TreeViewColumn::get_cell_renderers() with base class
method Gtk::CellLayout::get_cells().

Reference:

[1] Commit - "Deprecate get_cell_renderers implementations"
    6abc52a29d

Closes #7 - Port to Gtk3
This commit is contained in:
Luca Bacci 2018-08-03 20:24:25 +02:00 committed by Mike Fleetwood
parent 21d8ad218e
commit 202e6e9034
1 changed files with 1 additions and 1 deletions

View File

@ -60,7 +60,7 @@ TreeView_Detail::TreeView_Detail()
// Color pixbuf cell is left aligned.
get_column(2)->get_first_cell()->property_xalign() = Gtk::ALIGN_START;
// File system text cell is left aligned.
std::vector<Gtk::CellRenderer*> renderers = get_column( 2 )->get_cell_renderers();
std::vector<Gtk::CellRenderer *> renderers = get_column(2)->get_cells();
Gtk::CellRendererText *cell_renderer_text = dynamic_cast<Gtk::CellRendererText*>( renderers.back() );
cell_renderer_text->property_xalign() = Gtk::ALIGN_START;