Re: Two toplevels in a glade file causes spurious warnings
- From: Gerald Britton <gerald britton gmail com>
- To: Tadej Borovšak <tadeboro gmail com>
- Cc: gtk-list gnome org
- Subject: Re: Two toplevels in a glade file causes spurious warnings
- Date: Mon, 15 Feb 2010 10:51:36 -0500
On Mon, Feb 15, 2010 at 10:42 AM, Tadej Borovšak <tadeboro gmail com> wrote:
> Hello.
>
>> I call it like this:
>>
>> self.xml.connect_signals({
>> "on_add_clicked" : self.on_add_clicked,
>> "on_remove_clicked" : self.on_remove_clicked,
>> "on_up_clicked" : self.on_up_clicked,
>> "on_down_clicked" : self.on_down_clicked,
>> "on_setup_clicked" : self.on_setup_clicked,
>> "on_clear_clicked" : self.on_clear_clicked,
>> "on_save_clicked" : self.on_save_clicked,
>> "on_open_clicked" : self.on_open_clicked,
>> "on_edit_clicked" : self.on_edit_clicked,
>> "on_book_ok_clicked" : self.on_book_ok_clicked,
>> "destroy_passed_object" : self.close,
>> }
>>
>> Since there is a second top-level in the glade file, I now have to add
>> these dummy entries to the first call:
>>
>> # Insert dummy handlers for second top level in the glade file
>> "on_booklist_ok_clicked" : lambda _:None,
>> "on_booklist_delete_clicked": lambda _:None,
>> "on_booklist_cancel_clicked": lambda _:None,
>> "on_booklist_ok_clicked" : lambda _:None,
>> "on_booklist_ok_clicked" : lambda _:None,
>>
>> Note 1: The dummy handlers get replaced with real handlers when I
>> activate the second toplevel
>
> So, if I understand you correctly, you build your entire interface at
> one point, then connect signals from first toplevel only and later you
> connect other handlers. If my understanding is correct, I really fail
> to see why would one want to do this. Create your interface, connect
> all signals and you're done. If you need to do things in chunks, you
> can create parts of your GUI separately (using
> gtk_builder_add_objects_from_file()), in which case your separate
> signal connection will not be problematic, since only relevant part of
> GUI is built and represented by GtkBuilder instance.
No, I don't build the entire interface at one point. In the first
section, I build an interface that uses the first toplevel. Later, I
may (or may not) build an interface that uses the second top level.
Unfortunately, I cannot use the gtk_builder_add_objects_from_file()
method since I need to be compatible with version 2.12. IIRC that
method was added later on.
Note that I am converting this work from a libglade interface to a
gtk.builder interface. libglade seems to handle the
multiple-top-levels-in-one-glade-file thing a little easier, though
that could just be my lack of understanding,
>
> Tadej
>
> --
> Tadej Borovšak
> tadeboro.blogspot.com
> tadeboro gmail com
> tadej borovsak gmail com
>
--
Gerald Britton
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]