Re: gtk_builder_connect_signals

Thanks for that confirmation Jason!
Indeed I found in <gtkmm/builder.h>

//TODO:_WRAP_METHOD(GSList* get_objects(), gtk_builder_get_objects)
//_WRAP_METHOD(void connect_signals(gpointer       user_data),
//_WRAP_METHOD(void connect_signals_full(GtkBuilderConnectFunc func,
gpointer       user_data), gtk_builder_connect_signals_full)

I suspect it has something to do with the difficulty of type safe
method invocation for a compiled language like C++ as opposed to ones
like Python that can manipulate their name space at run time. Now
knowing that function doesn't exist seems to be actually helping me to
fully embrace Object Oriented philosophy :)

I'm not sure whether it would be a good practice to continue
specifying signal handlers in the .glade file even though the binding
is being done independently in the code. Another problem is to
identify signals that glade knows about (e.g. window destroy) with an
appropriate widget signal that gtkmm handles.

p.s. I hope I'm doing the right thing responding to
gtkmm-list gnome org, I never used these mailing lists before.

On 14 August 2010 17:12, Jason Grimes <jason gina alaska edu> wrote:
>  Hi Chris,
> As far as I know Gtkmm does not support connect_signals.  I don't know why,
> it really should as it makes builder so much easier to use.  All of the
> other GTK bindings I have used had support for it, even RubyGtk.  Right now
> all you can do is connect them explicitly.  :(
> Jason
> On 08/13/2010 02:07 PM, Chris Scaife wrote:
>> Hoping to learn object oriented technique of creating GUI with Glade
>> for C++ I am new to this mailing list.
>> I seem to have got stuck on my first attempt :(
>> In C I could use gtk_builder_connect_signals() to connect all the
>> signals specified in the .glade file but I can't find an equivalent
>> for C++.
>> Here is my simplified code. My question is how can I make it connect
>> all the .glade defined signals without having to do them each and
>> every one explicitly?
>> [CODE]
>> #include<gtkmm.h>
>> G_MODULE_EXPORT void on_button1_clicked(
>>        GtkButton *button,
>>        gpointer data
>> ) {
>>        printf("button1_clicked\n");
>> }
>> int main(int argc, char *argv[]) {
>>        Gtk::Main kit(argc, argv);
>>        // instantiate the widgets as defined by glade's XML file
>>        Glib::RefPtr<Gtk::Builder>  builder =
>> Gtk::Builder::create_from_file("");
>>        // run with reference to the top level window
>>        Gtk::Window *pWin = NULL;
>>        builder->get_widget("window1", pWin);
>>        Gtk::Main::run(*pWin);
>>        return 0;
>> }
>> [/CODE]
>> Thanks in advance for any assistance :)
>> _______________________________________________
>> gtkmm-list mailing list
>> gtkmm-list gnome org

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