Re: [gtk2] window closing



You can connect the "delete_event" from a gtk_window to your own callback that returns a TRUE value.  Here is an example:

GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect( G_OBJECT(window), "delete_event",
                           G_CALLBACK(some_func), NULL);


gint some_func(GtkWidget *widget, GdkEvent *event,
                      gpointer data)
{
    /* Someone tried to close the window with 'X' button in top right corner.
     * Tell them to go away...
     * Returning TRUE will not allow this, returning FALSE will...
     */
    g_print("GO AWAY, I'M NOT CLOSING!!!");
    return(TRUE);
}

You get the idea....

Cheers,

Michael H.


On Tue, 2002-12-10 at 13:50, Andreas Volz wrote:
Hello,

how could I forbid that someone could close a window? Is it possible to
remove the "close-button" from the window? Or is this windowmanager
specific?

Andreas
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


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