Hi everybody,

I'm experiencing some difficulties with a Gtk::Dialog built with Glade which I 
instantiate from somewhere (I don't think it's relevant, but the somewhere is 
just a Gtk::window...).

Basically, when I run it the first time, all is fine. When I run it a second 
time or plus, the Gtk::Dialog becomes empty except for the dialog title :-/ I 
think I'm doing something wrong... but where `??? All parameters of the 
Gtk::Dialog are defined into the XML Glade.

I copy paste the relevant parts of my source below

Regards

////////////////////// the instantiation from the parent window
void metadataWindow::on_exportEBUCore_clicked(void){
      metadataEncapsulationDialog * MetadataExportDialog;
      // instantiate glade dialog
      
m_refGlade->get_widget_derived("MetadataExportDialog",MetadataExportDialog);
      if (MetadataExportDialog->getResponse() == Gtk::RESPONSE_OK)
            std::cout<<"it works, I pressed the save button..."<<std::endl;
      // free memory
      delete MetadataExportDialog;
}

////////////////////// dialog hpp file
#ifndef CPP_METADATAENCAPSULATIONDIALOG_CLASS_H
#define CPP_METADATAENCAPSULATIONDIALOG_CLASS_H
/// includes [...]
class metadataEncapsulationDialog : public Gtk::Dialog {
public:
      metadataEncapsulationDialog(BaseObjectType* cobject, const 
Glib::RefPtr<Gtk::Builder>& refGlade);
      ~metadataEncapsulationDialog(void);
      int getResponse(void);
protected:
      // Glade reference
      Glib::RefPtr<Gtk::Builder> m_refGlade; /*!< m_refGlade Glade references */
      // gtk button
      Gtk::Button* cancelDialog; /*!< cancelDialog */
      Gtk::Button* saveMetadata; /*!< saveMetadata */
      Gtk::Button* SelectPathToOutputMXF; /*!< SelectPathToOutputMXF */
      // gtk radio button
      Gtk::RadioButton* header; /*!< header */
      Gtk::RadioButton* footer; /*!< footer */
      Gtk::RadioButton* KLV; /*!< KLV */
      Gtk::RadioButton* Dark; /*!< Dark */
      Gtk::RadioButton* Sidecar; /*!< Sidecar */
      // gtk entries
      Gtk::Entry * PathToOutputMXF;
      // dialog response
      int response; /*!< response */

      void refGladeWidgets(const Glib::RefPtr<Gtk::Builder>& refGlade);
      void refGladeButton(const Glib::RefPtr<Gtk::Builder>& refGlade);
      void connectSignalClicked(void);
      void on_close_dialog(void);
      void on_confirm_clicked(void);
};
#endif

////////////////////////////// dialog cpp file
#include "metadataEncapsulationDialog.hpp"

// class constructor
metadataEncapsulationDialog::metadataEncapsulationDialog
(
      BaseObjectType* cobject,
      const Glib::RefPtr<Gtk::Builder>& refGlade
)
:
      Gtk::Dialog(cobject),
      m_refGlade(refGlade)
{
      std::cout<<"Im instantiating this...."<<std::endl;
      refGladeButton(refGlade); // " " " " buttons
      refGladeWidgets(refGlade);// " " " " widgets
      connectSignalClicked();
      // run and grab the result
      response = run();
}
metadataEncapsulationDialog::~metadataEncapsulationDialog(void)
{std::cout<<"byebye"<<std::endl;}

void metadataEncapsulationDialog::refGladeButton(const 
Glib::RefPtr<Gtk::Builder>& refGlade) {
refGlade->get_widget("cancelDialog",cancelDialog);
      refGlade->get_widget("saveMetadata",saveMetadata);
      refGlade->get_widget("SelectPathToOutputMXF",SelectPathToOutputMXF);
}

void metadataEncapsulationDialog::refGladeWidgets(const 
Glib::RefPtr<Gtk::Builder>& refGlade) {
      refGlade->get_widget("header",header);
      refGlade->get_widget("footer",footer);
      refGlade->get_widget ("KLV",KLV);
      refGlade->get_widget("Dark",Dark);
      refGlade->get_widget("Sidecar",Sidecar);
      refGlade->get_widget("PathToOutputMXF",PathToOutputMXF);
}

void metadataEncapsulationDialog::connectSignalClicked(void){
      
cancelDialog->signal_clicked().connect(sigc::mem_fun(*this,&metadataEncapsulationDialog::on_close_dialog));
      
saveMetadata->signal_clicked().connect(sigc::mem_fun(*this,&metadataEncapsulationDialog::on_confirm_clicked));
}

void metadataEncapsulationDialog::on_close_dialog(void) {hide();}

void metadataEncapsulationDialog::on_confirm_clicked(void) {hide();}

int metadataEncapsulationDialog::getResponse(void) {return response;}

Marco Dos Santos Oliveira
EBU/European Broadcasting Union
Technology and Innovation Department

------------------------------------------------------------------------------

**************************************************
This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error, please notify the system manager. 
This footnote also confirms that this email message has been swept by the 
mailgateway
**************************************************
_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to