Re: Derived Gtk::Dialog discomforts



On Wed, 2006-01-25 at 11:07 +0100, Dick Eimers wrote:
> > [snip]
> > > Now for my problem, this works just fine for windows derived from
> > > GladeWindow, but there is an issue with GladeDialog as the response id
> > > are not returned when clicked on the buttons in the 'action area' and
> > > hence I have to add code like the following in every GladeDialog
> > > derivative to fix it or wait for run() to return forever..
> > >
> > > Gtk::Button* button;
> > > m_gladexml->get_widget("cancelbutton1", button);
> > >    button->signal_clicked().connect(
> > > sigc::bind(sigc::mem_fun(*this,&SelectGroupAndProjectDialog::response),
> > > Gtk::RESPONSE_CANCEL)
> > >       );
> > > //etc. for all buttons..
> > >
> > > Any idea why this is not transfered from one dialog to another?

Maybe you need to use Gtk::Dialog::add_action_widget() or
Gtk::Dialog::add_button() to make sure that the dialog knows about these
response widgets - you are just taking the parent container and adding
the widgets via that, without giving the dialog a chance to connect to
any signals for the buttons. See the implementation of 
gtk_dialog_add_action_widget().

I guess you could add them one by one to the action area to make sure
that that code runs. I wouldn't do it for fun.

[snip]
>    //adapt some properties and take over widgets
>    Gtk::Dialog* dialog = 0L; m_gladexml->get_widget(root, dialog);
> 
>    //Widget ->
>    {
>       int width, height; 
>       dialog->get_size_request(width, height); 
>       this->set_size_request(width, height);  
>    }
> 
>    //Container ->
>    this->set_border_width(dialog->get_border_width());
> 
>    //Bin ->
>    
>    //Window ->
>    this->set_title(dialog->get_title());
>    this->set_type_hint(dialog->get_type_hint());
>    this->set_modal(dialog->get_modal());
>    {
>       int width, height; 
>       dialog->get_default_size(width, height); 
>       this->set_default_size(width, height);   
>    }
>    this->set_resizable(dialog->get_resizable());
>    this->set_gravity(dialog->get_gravity());

This doesn't seem sensible. It's very repetitive and likely to miss
something. You could use the C API to iterate over all the properties, I
suppose. For an example, see:
http://cvs.gnome.org/viewcvs/glibmm/tools/extra_defs_gen/generate_extra_defs.cc?view=markup

By the way, I'd like to simplify the Glade::Xml API slightly, so that you don't need to provide 
the widget name twice for the common case, to xml::create() and then also to Xml::get_widget(), but I can't do that 
easily without adding a member variable, which would break ABI.

It shouldn't be impossible to just specify the XML file and widget name
details in the consructor's initializer if that's what you want to
achieve.

>    //Dialog
>    // ..
>  
>    this->remove(); //remove the one object contained in this 'Bin' 
>    m_gladexml->reparent_widget (dialog->get_child()->get_name(),
> *this);   

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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