Re: how to prevent multiple instances of the same window.



On Sun, Jun 19, 2005 at 10:00:38AM -0700, mohan kumar wrote:
I have developed a gtk application having several
dialog windows. One of the dialogs is the About
dialog. Whenever i click the about menu item, a new
instance of the about dialog pops up. Is there a easy
gtk api, which restricts the creation of multilple
instances of the same dialog.

void
show_about_dialog(...)
{
    static GtkWidget *dialog = NULL;
    ...
    if (dialog) {
        gtk_window_present(GTK_WINDOW(dialog));
        return;
    }
    ...
    dialog = ...
    g_object_add_weak_pointer(G_OBJECT(dialog), &dialog);
    ...
}

Yeti


--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?



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