RE: FW: Dialog closing prematurely with response code of 0



Evidentally nothing, I don't know how many people have a GtkWindow kicking
off a GtkDialog which then kicks off another GtkDialog...

DispenserLoadDialog::load_button_clicked() kicks off DispenserLoadingDialog.
When either DispenserLoadingDialog::ok_button_clicked() or
DispenserLoadingDialog::cancel_button_clicked() are pressed the
DispenserLoadingDialog is removed and
DispenserLoadDialog::load_button_clicked() finishes executing but then the
gtk_dialog_run in DispenserLoadDialog returns with a response id of 0.

Kevin

-----Original Message-----
From: gtk-app-devel-list-bounces gnome org
[mailto:gtk-app-devel-list-bounces gnome org] On Behalf Of David Neèas
(Yeti)
Sent: Wednesday, March 21, 2007 5:46 PM
To: gtk-app-devel-list gnome org
Subject: Re: FW: Dialog closing prematurely with response code of 0


On Wed, Mar 21, 2007 at 04:42:39PM -0400, Kevin Lambert wrote:
Does anybody have any ideas about this?  It looks like the response 
from gtk_dialog_response is being captured by dialogs that don't match 
the GtkDialog pointer that was passed in.

Post some code.  Evidently it works for everyone else.

Yeti

--
http://gwyddion.net/


==========================================================================
#include <gtk/gtk.h>

static gint
next_dialog(GtkWindow *parent,
            gint level)
{
    GtkWidget *dialog, *label;
    gint response;
    gchar *s;

    level++;
    s = g_strdup_printf("Dialog %d", level);
    dialog = gtk_dialog_new_with_buttons(s, parent, GTK_DIALOG_MODAL,
                                         GTK_STOCK_YES, GTK_RESPONSE_YES,
                                         GTK_STOCK_NO, GTK_RESPONSE_NO,
                                         NULL);
    gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
    gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_NO);
    g_free(s);

    s = g_strdup_printf("This is dialog level %d.\n"
                        "Do you want to go one level deeper?", level);
    label = gtk_label_new(s);
    gtk_misc_set_padding(GTK_MISC(label), 12, 12);
    g_free(s);

    gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label);

    gtk_widget_show_all(dialog);
    gtk_window_present(GTK_WINDOW(dialog));
    do {
        response = gtk_dialog_run(GTK_DIALOG(dialog));
        if (response == GTK_RESPONSE_YES)
            next_dialog(GTK_WINDOW(dialog), level);
    } while (response == GTK_RESPONSE_YES);

    gtk_widget_destroy(dialog);

    return response;
}

int
main(int argc, char *argv[])
{
    gtk_init(&argc, &argv);
    next_dialog(NULL, 0);
    return 0;
}
_______________________________________________
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]