On Fri, Jan 12, 2007 at 11:33:32PM +0200, Yucehan Kutlu wrote:
> >
> I solve my problem with hiding windows but i use to use that type of
> code previously
> 
> void on_showin_destroy                     (GtkObject       *object,
>                                         gpointer         user_data)
> {
>               gtk_main_quit();
> }

gtk_main_quit() terminates the Gtk+ main loop, in other
words no GUI is running afterwards (unless the main loop was
nested).  To have the GUI working again you would have to
run gtk_main() again.

> It gives error when user recreate "showin" window

However, the object system still works normally.  Therefore
to get errors as you list, you have to attempt to use
widgets that no longer exist.

> Then i use that code for hiding;
> 
> void on_showin_destroy                     (GtkObject       *object,
>                                         gpointer         user_data)
> {
>       // Get showin's pointer
>     GtkWidget * showin = gtk_widget_get_toplevel(GTK_WIDGET(object));
> 
>     // Hide the showin window
>     gtk_widget_hide(showin);
> }

So, a window is being *destroyed*.  That is it will cease to
exist.  Hiding it immediately before it goes out of
existence can hardly have any observable effect.

Again, if you get the errors you listed, you have to attempt
to use the window after it was destroyed.

> But it doesnt help too and finaly i connect the code to a button like;
> 
> void
> on_ok1_clicked                         (GtkButton       *button,
>                                         gpointer         user_data)
> {
>       // Get changewin's pointer
>     GtkWidget * changewin = gtk_widget_get_toplevel(GTK_WIDGET(button));
> 
>     // Hide the changewin window
>     gtk_widget_hide(changewin);
> }

This indeed hides the window, but...

> With this when user recreate the window, (s)he doesnt take any errors
> but i wonder how i make it with destroy signal and reason of the error

...then you definitely do not want to recreate it (== create
again), because it already exists, so the windows would pile
up consuming resources for no good reason.  Instead, you
want to *show* it again with gtk_widget_show() (or maybe
gtk_window_present()).

There is a big difference between destruction (the widget
no longer exists afterwards) and hiding (the widget just is
not displayed on screen); likewise between creation (of
widgets that do not exist) and showing (of widgets that
exist, but are not being displayed).  I'm afraid you use
these terms in different meanings which makes a discussion
hard and confusing.

Yeti


--
Whatever.
_______________________________________________
gtk-app-devel-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to