[quadrapassel] Fix to ensure keys are always unique (defect 752889)
- From: John Ward <jward src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [quadrapassel] Fix to ensure keys are always unique (defect 752889)
- Date: Mon, 17 Feb 2020 14:05:32 +0000 (UTC)
commit 69fa5448aa00a5c7a9ebb928f62fdffdbe9535d1
Author: John Ward <john johnward net>
Date: Mon Feb 17 14:00:36 2020 +0000
Fix to ensure keys are always unique (defect 752889)
src/quadrapassel.vala | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/src/quadrapassel.vala b/src/quadrapassel.vala
index c0037e0..efdfca5 100644
--- a/src/quadrapassel.vala
+++ b/src/quadrapassel.vala
@@ -490,13 +490,31 @@ public class Quadrapassel : Gtk.Application
if (!controls_model.get_iter (out iter, path))
return;
- string? key = null;
- controls_model.get (iter, 0, out key);
- if (key == null)
+
+ if (keyval == settings.get_int ("key-left")||
+ keyval == settings.get_int ("key-right") ||
+ keyval == settings.get_int ("key-down") ||
+ keyval == settings.get_int ("key-drop") ||
+ keyval == settings.get_int ("key-rotate") ||
+ keyval == settings.get_int ("key-pause"))
+ {
+ // Throw up a dialog
+ var dialog = new Gtk.MessageDialog (null, Gtk.DialogFlags.MODAL, Gtk.MessageType.WARNING,
Gtk.ButtonsType.OK, _("Unable to change key, as this key already exists"));
+ dialog.set_title (Environment.get_application_name ());
+ dialog.run ();
+ dialog.destroy ();
return;
+ }
+ else
+ {
+ string? key = null;
+ controls_model.get (iter, 0, out key);
+ if (key == null)
+ return;
- controls_model.set (iter, 2, keyval);
- settings.set_int (key, (int) keyval);
+ controls_model.set (iter, 2, keyval);
+ settings.set_int (key, (int) keyval);
+ }
}
private void accel_cleared_cb (Gtk.CellRendererAccel cell, string path_string)
@@ -834,7 +852,7 @@ public class Quadrapassel : Gtk.Application
private void about_cb ()
{
- string[] authors = { "GNOME Games Team", null };
+ string[] authors = { "GNOME Games Team", "Maintainer: John Ward<john johnward net>", null };
string[] documenters = { "Angela Boyle", null };
Gtk.show_about_dialog (window,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]