g_signal_swapped



I am converting a GTK+ version 1.2 program I wrote in version to 2.4 and I am having a few problems with the "response" signal from a gtk dialog window. I want to 'catch' the response signal and determine if the OK or Cancel button were clicked. Here is what I have tried:

  Unit_Options_wnd = gtk_dialog_new_with_buttons("Units",
                                                 NULL,
                                                 GTK_DIALOG_MODAL,
                                                 GTK_STOCK_CANCEL,
                                                 GTK_RESPONSE_NONE,
                                                 GTK_STOCK_OK,
                                                 GTK_RESPONSE_NONE,
                                                 NULL);

  g_signal_connect_swapped(GTK_DIALOG(Unit_Options_wnd),
                           "response",
                           G_CALLBACK(on_Unit_Options_button_clicked),
                           Unit_Options_wnd);

.........

void on_Unit_Options_button_clicked(GtkDialog* dialog,gint response_ID,gpointer user_data)
{
if(response_ID==GTK_RESPONSE_CANCEL)
        gtk_widget_destroy(user_data);
else
        //do other stuff
}

But when the cancel button is pressed the window does not close.  Any ideas??

Richard.




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