A simple choice dialog won't work...



I wanted to pop up two buttons for the user to choose between two
options ("primary" and "secondary"), returning true or false depending
which was chosen. I tried this

gboolean
choose_option (gchar *title, gchar * primary, gchar * secondary)
{
  GtkWidget *dialog;
  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);
  
  return (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT);
}

but it seems to return 0 for both button presses. What am I doing wrong?

I'm using GTK3 on a Debian stable installation.

Richard




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