Re: A simple choice dialog won't work...



On Thu, 2015-05-07 at 16:21 +0200, Stefan Salewski wrote:
On Thu, 2015-05-07 at 13:02 +0100, Richard Shann wrote:

From https://developer.gnome.org/gtk3/stable/GtkDialog.html

GTK_RESPONSE_REJECT Generic response id, not used by GTK+ dialogs
GTK_RESPONSE_ACCEPT Generic response id, not used by GTK+ dialogs

Maybe try

GTK_RESPONSE_OK and GTK_RESPONSE_CANCEL

Hmm, I wonder what that means - "Generic response id" ... I understood
that the idea of the pairs in the trailing arguments of
gtk_dialog_new_with_buttons () was that the button with the given text
would return the paired response id. I tried the ones you suggested, and
also two positive values with the same result.

After experimenting with a different bit of code, I think I've found the
cause of the problem: doing the widget destroy by responding to the
"response" signal seems to be ruining the return value.
So, I seem to be back on track - the code that works is below.
Thank you for your prompt response!

Richard

gboolean
choose_option (gchar *title, gchar * primary, gchar * secondary)
{
  GtkWidget *dialog;
  gboolean r;
  dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (Denemo.window), (GtkDialogFlags) (GTK_DIALOG_MODAL 
| GTK_DIALOG_DESTROY_WITH_PARENT), 
                                                      primary, GTK_RESPONSE_ACCEPT, secondary, 
GTK_RESPONSE_REJECT, NULL);
  //g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
  r = (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT);
  gtk_widget_destroy (dialog);
  return r; 
}



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