diff --git a/desmume/src/gtk-glade/callbacks.c b/desmume/src/gtk-glade/callbacks.c index 98ceeaf6f..78c8838a6 100755 --- a/desmume/src/gtk-glade/callbacks.c +++ b/desmume/src/gtk-glade/callbacks.c @@ -191,9 +191,29 @@ void on_menu_controls_activate (GtkMenuItem *menuitem, gpointer user_data) void on_menu_joy_controls_activate (GtkMenuItem *menuitem, gpointer user_data) { - GtkDialog * dlg = (GtkDialog*)glade_xml_get_widget(xml, "wJoyConfDlg"); - init_joy_labels(); - gtk_dialog_run(dlg); + GtkDialog * dlg; + GtkDialog * msgbox; + + if(nbr_joy>0) /* At least one joystick */ + { + dlg = (GtkDialog*)glade_xml_get_widget(xml, "wJoyConfDlg"); + init_joy_labels(); + gtk_dialog_run(dlg); + } + else + { + dlg = (GtkDialog*)glade_xml_get_widget(xml, "wMainW"); + msgbox = + gtk_message_dialog_new(dlg, + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_INFO, + GTK_BUTTONS_CLOSE, + "You don't have any joystick!" + ); + g_signal_connect(G_OBJECT(msgbox), "response", G_CALLBACK(gtk_widget_destroy), NULL); + + gtk_dialog_run( msgbox ); + } } void on_menu_audio_on_activate (GtkMenuItem *menuitem, gpointer user_data) {