[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Beaver-devel] Closing tool windows
From: |
Tobias Heinzen |
Subject: |
Re: [Beaver-devel] Closing tool windows |
Date: |
Sat, 21 Jun 2008 17:43:35 +0200 |
User-agent: |
Thunderbird 2.0.0.14 (X11/20080505) |
Double 12 wrote:
Well, I started off with the Color Picker dialog. When I used the
"response" signal, everything was connected: also the Insert button.
So when I clicked the Insert button, the dialog was closed and no
color was inserted.
There already was an existing signal handler , connecting the
"delete_event" signal to gtk_widget_destroy and to the function
color_picker_not_visible. I changed the signals to "destroy" and now
it all works. But, before I apply this to other windows, is this the
right way?
I've now read a little bit about it in the gtk documentation. You were
right about the "response" signal. This signal get's triggered whenever
a response of the user happens (like pressing buttons etc). So bad idead
from me to do a destroy there ^^
Well I know found out what the problem was. The signal "delete-event" is
the correct way, but it does not work for the following reason:
the signal "delete-event" is attached twice: once for the
gtk_widget_destroy function and once for the so called
color_picker_not_visible
and that's the problem. because when the "delete-event" occurs when
clicking the x in the upper right corner the color_picker_not_visible
routine get's called and that's it apparently. gtk_widget_destroy never
get's called (so when you comment out
g_signal_connect (G_OBJECT(ColorWindow), "delete_event",
(GtkSignalFunc) color_picker_not_visible, NULL);
everything works)
_BUT_: You see there is a variable called "ColorIsVisible" and what it
does is the following: when it is true you can't open another "Color
Picker" from the Tools Menu. It only get's set to false when the window
get's killed. You can use this fact and the fact from above to trigger a
bug:
1) make sure you've got the old code (the one were clicking on the x in
the top right corner didn't work)
2) run beaver
3) create new document
4) open the color picker
5) try to close the color picker by clicking on the x
6) open another color picker (the old one should still be there)
and voilĂ you've got two color pickers. That's because the Variable was
set to false by color_picker_not_visible (which get's called from the
"delete-event" signal).
The obvious better way to avoid having two ColorPickers on is to set the
ColorPicker in Modal mode. This means: As long as the ColorPicker is on
all other windows can't be used until the ColorPicker is destroyed (not
using means I can't click on buttons or menues, which is pretty much we
want). I commited the fixed ColorPicker to the CVS.
greets
Tobias