3

I have an application that uses gtkmm 2.4 which has worked fine until I recently changed over to gtkmm 3.0. I am having a problem with g++ (version 4.6.1) where it keeps spitting out the error "error: ‘class Gtk::TextView’ has no member named ‘modify_font’". This isn't the case when I revert my build includes back to gtkmm 2.4 (by changing pkg-config gtkmm-3.0 --cflags --libs back to gtkmm-2.4).

I followed the headers back (from within code::blocks) and the function header is definitely there. It doesn't look like Gtk::Widget::modify_font was depreciated either.

An example of what my class hierarchy looks like in respect to that Gtk::TextView:

// The parent of the offending TextView
class popupWindow : public Gtk::Window
{
public:
  popupWindow();
private:
  Gtk::TextView theView;
  Gtk::ScrolledWindow scrollView;
  Gtk::VBox layoutBox;
  Glib::RefPtr<Gtk::TextBuffer> textBuffer;
};

// The main window class
class mainWindow : public Gtk::Window
{
private:
  popupWindow foo;
};

// Part of the header where I try and set the modified font
popupWindow::popupwindow() : layoutBox(false, 8)
{
  // Modify the font styling of the TextView
  {
    Pango::FontDescription fdesc;
    fdesc.set_family("monospace");
    fdesc.set_size(10 * PANGO_SCALE);
    theView.modify_font(fdesc);
  }

  // Make a new text buffer
  textBuffer = Gtk::TextBuffer::create();


  add(layoutBox);
  layoutBox.pack_start(scrollView);
  scrollView.add(theView);
  theView.set_buffer(textBuffer);
}
Jeff Geisperger
  • 583
  • 4
  • 17

1 Answers1

2

gtkmm 3.0 has override_font() instead of modify_font().

The documentation is indeed somewhat lacking on the details of what has changed in 3.0, and some symbols were renamed without being deprecated in 2.4. I am sure the gtkmm developers would be interested in some help getting the documentation in a better shape, if you have time to help out with that.

kalev
  • 1,925
  • 1
  • 15
  • 12
  • Thanks for the feedback. I couldn't find this listed anywhere. You are right about the 2.4 -> 3.0 changelog being somewhat lacking. I shall try and help contribute to it when I get the time. – Jeff Geisperger Aug 10 '11 at 15:57