[gtkmm] Toolbar disapperars after hiding window



I'm porting an application from gtkmm 1.2 to gtkmm 2.0. The application 
has two diferent windows with toolbars. I have noticed that after hiding 
one of the windows with Window::hide_all and showing again with 
Window::show_all, the buttons on the toolbar disappers.

Is this a bug or I'm doing something wrong? I have included sample 
code below. Note that this worked perfectly in gtkmm 1.2. I'm using gtkmm 
2.0.1

#include <gtkmm/main.h>
#include <gtkmm/window.h>
#include <gtkmm/toolbar.h>
#include <gtkmm/button.h>
#include <gtkmm/box.h>

class Subwindow : public Gtk::Window{
public:
  Subwindow(){
    Gtk::VBox* vbox=manage(new Gtk::VBox);
    add(*vbox);
    Gtk::Toolbar* toolbar=manage(new Gtk::Toolbar);
    vbox->pack_start(*toolbar);
    toolbar->tools().push_back(Gtk::Toolbar_Helpers::ButtonElem("B",SigC::slot(*this,&Subwindow::hide_all)));
    Gtk::Button* b=manage(new Gtk::Button("B"));
    vbox->pack_start(*b);
    b->signal_clicked().connect(SigC::slot(*this,&Subwindow::hide_all));
  }
  ~Subwindow(){};
  bool on_delete_event(GdkEventAny* any){
    hide_all();
    return false;
  }
};

class Principal : public Gtk::Window{
  Subwindow sub;
public:
  Principal(){
    Gtk::Button* a=manage(new Gtk::Button("A"));
    add(*a);
    a->signal_clicked().connect(SigC::slot(sub,&Subwindow::show_all));
    show_all_children();
  }
  ~Principal(){};
};

int main (int argc,char **argv){
  Gtk::Main app(argc,argv);
  Principal window;
  Gtk::Main::run(window);
  return 0;
}	





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]