Thanks Simon, this is brilliant and so obvious in retrospect.

Jason

On Wed, Feb 25, 2009 at 8:59 PM, Simon Fuhrmann <[email protected]>wrote:

> > How would one pass/send the filename chosen _out_ of the toolbar
> > object and up to the main window object where the database object has
> access
> > to it?
>
> That is exactly what you have to do. Use have to write your own signal
> like any other GTK widget is doing. Here is how to do that:
>
> Create a private member in your toolbar:
>
> public:
>  typedef sigc::signal<void, Glib::ustring> SignalFileSelected;
> private:
>  SignalFileSelected sig_file_selected;
>
> Create a public access method to access the signal:
>
>  SignalFileSelected& signal_file_selected (void)
>  { return this->sig_file_selected; }
>
> Don't forget the reference ("&")! Connect the signal from you main GUI,
>
>  this->toolbar.signal_file_selected().connect
>      (sigc::mem_fun(*this, &MainGui::on_file_selected));
>
> Inside the Toolbar, emit the signal if you have the new filename:
>
>  this->sig_file_selected.emit(filename);
>
> The method that takes the filename inside the main GUI is of type:
>
>  void on_file_selected (Glib::ustring filename);
>
> Cheers,
> Simon
>
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to