[gnome-2048] Remove Preferences.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-2048] Remove Preferences.
- Date: Sun, 3 Feb 2019 15:52:55 +0000 (UTC)
commit cfe03d5b361d11670ec1d3b64a1442190ad2b18f
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Sun Feb 3 16:41:54 2019 +0100
Remove Preferences.
The Preferences dialog is quite
small, and it does not increase
fun at all. Now with #7 solved,
proposing a change of the speed
is mostly useless (there's only
accessibility that may be taken
in consideration, but then that
would not be a great solution);
the Undo functionality does not
feel right in a game randomized
at each move; and the option to
show congrats is conceptually a
big mistake. So just remove it.
Closes #8.
data/help-overlay.ui | 16 ----
data/preferences.ui | 126 ---------------------------
src/application.vala | 80 -----------------
src/org.gnome.TwentyFortyEight.gresource.xml | 3 +-
4 files changed, 1 insertion(+), 224 deletions(-)
---
diff --git a/data/help-overlay.ui b/data/help-overlay.ui
index 5fa936b..e961cee 100644
--- a/data/help-overlay.ui
+++ b/data/help-overlay.ui
@@ -35,14 +35,6 @@
<property name="accelerator">Left Up Right Down</property>
</object>
</child>
- <child>
- <object class="GtkShortcutsShortcut">
- <property name="visible">True</property>
- <!-- Translators: undo is not allowed by default, it is an option available in the
Preferences dialog -->
- <property name="title" translatable="yes" context="shortcut window">Undo (if
enabled)</property>
- <property name="accelerator"><Primary>z</property>
- </object>
- </child>
</object>
</child>
<child>
@@ -81,14 +73,6 @@
<property name="accelerator">F10 Menu</property>
</object>
</child>
- <child>
- <object class="GtkShortcutsShortcut">
- <property name="visible">True</property>
- <!-- Translators: shortcut that opens Prefences dialog -->
- <property name="title" translatable="yes" context="shortcut window">Preferences</property>
- <property name="accelerator"><Primary>e</property>
- </object>
- </child>
<child>
<object class="GtkShortcutsShortcut">
<property name="visible">True</property>
diff --git a/src/application.vala b/src/application.vala
index cae37f5..e61fa53 100644
--- a/src/application.vala
+++ b/src/application.vala
@@ -53,7 +53,6 @@ private class Application : Gtk.Application
{ "new-game", new_game_cb },
{ "toggle-new-game", toggle_new_game_cb },
{ "new-game-sized", new_game_sized_cb, "(ii)" },
- { "animations-speed", _animations_speed, "s" }, // no way to make it take a double
{ "quit", quit_cb },
@@ -61,7 +60,6 @@ private class Application : Gtk.Application
{ "toggle-hamburger", toggle_hamburger_menu },
{ "scores", scores_cb },
- { "preferences", preferences_cb },
{ "about", about_cb },
};
@@ -125,7 +123,6 @@ private class Application : Gtk.Application
_create_scores_dialog (); // the library forbids to delay the dialog creation
- set_accels_for_action ("app.preferences", { "<Primary>e" });
set_accels_for_action ("app.toggle-new-game", { "<Primary>n" });
set_accels_for_action ("app.new-game", { "<Shift><Primary>n" });
set_accels_for_action ("app.quit", { "<Primary>q" });
@@ -313,9 +310,6 @@ private class Application : Gtk.Application
{
GLib.Menu section = new GLib.Menu ();
- /* Translators: entry in the hamburger menu; opens a window for configuring application */
- section.append (_("Preferences"), "app.preferences");
-
/* Translators: usual menu entry of the hamburger menu */
section.append (_("Keyboard Shortcuts"), "win.show-help-overlay");
@@ -509,80 +503,6 @@ private class Application : Gtk.Application
return false;
}
- /*\
- * * preferences dialog
- \*/
-
- private Dialog _preferences_dialog;
- private MenuButton _animations_button;
-
- private bool _should_create_preferences_dialog = true;
- private inline void _create_preferences_dialog ()
- {
- Builder builder = new Builder.from_resource ("/org/gnome/TwentyFortyEight/ui/preferences.ui");
-
- _preferences_dialog = (Dialog) builder.get_object ("preferencesdialog");
- _preferences_dialog.set_application (this); // else we cannot use "app." actions in the dialog
- _preferences_dialog.set_transient_for (_window);
-
- _preferences_dialog.response.connect ((dialog, response_id) => { dialog.hide_on_delete (); });
- _preferences_dialog.delete_event.connect ((dialog, event) => { return dialog.hide_on_delete (); });
-
- Object? congratswitch = builder.get_object ("congratswitch");
- Object? undoswitch = builder.get_object ("undoswitch");
- if (congratswitch == null || undoswitch == null)
- assert_not_reached ();
- _settings.bind ("do-congrat", (!) congratswitch, "active", GLib.SettingsBindFlags.DEFAULT);
- _settings.bind ("allow-undo", (!) undoswitch, "active", GLib.SettingsBindFlags.DEFAULT);
-
- _animations_button = (MenuButton) builder.get_object ("animations-button");
- _settings.changed ["animations-speed"].connect (_set_animations_button_label);
- _set_animations_button_label (_settings, "animations-speed");
- }
- private inline void _set_animations_button_label (GLib.Settings settings, string key_name)
- {
- double speed = settings.get_double (key_name);
- string _animations_button_label;
- _get_animations_button_label (ref speed, out _animations_button_label);
- _animations_button.set_label (_animations_button_label);
- }
- private static inline void _get_animations_button_label (ref double speed, out string
_animations_button_label)
- {
- if (speed == 130.0)
- /* Translators: in the preferences dialog; possible label of the MenuButton to choose animation
speed */
- _animations_button_label = _("Normal");
-
- else if (speed == 65.0)
- /* Translators: in the preferences dialog; possible label of the MenuButton to choose animation
speed */
- _animations_button_label = _("Fast");
-
- else if (speed == 260.0)
- /* Translators: in the preferences dialog; possible label of the MenuButton to choose animation
speed */
- _animations_button_label = _("Slow");
-
- else
- /* Translators: in the preferences dialog; possible label of the MenuButton to choose animation
speed */
- _animations_button_label = _("Custom");
- }
-
- private inline void _animations_speed (SimpleAction action, Variant? variant)
- requires (variant != null)
- {
- double speed = double.parse (((!) variant).get_string ());
- _settings.set_double ("animations-speed", speed);
- }
-
- private inline void preferences_cb (/* SimpleAction action, Variant? variant */)
- {
- if (_should_create_preferences_dialog)
- {
- _create_preferences_dialog ();
- _should_create_preferences_dialog = false;
- }
-
- _preferences_dialog.present ();
- }
-
/*\
* * congratulations dialog
\*/
diff --git a/src/org.gnome.TwentyFortyEight.gresource.xml b/src/org.gnome.TwentyFortyEight.gresource.xml
index c82a388..9892b57 100644
--- a/src/org.gnome.TwentyFortyEight.gresource.xml
+++ b/src/org.gnome.TwentyFortyEight.gresource.xml
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/TwentyFortyEight/ui">
- <file preprocess="xml-stripblanks" alias="mainwindow.ui">data/mainwindow.ui</file>
- <file preprocess="xml-stripblanks" alias="preferences.ui">data/preferences.ui</file>
<file preprocess="xml-stripblanks" alias="congrats.ui">data/congrats.ui</file>
+ <file preprocess="xml-stripblanks" alias="mainwindow.ui">data/mainwindow.ui</file>
<!-- file>data/style.css</file -->
</gresource>
<gresource prefix="/org/gnome/TwentyFortyEight/gtk">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]