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



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

If that does not help, I may test your code next weekend --guess I have
to add a few lines to get a working example.

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


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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