Commit 19bfa058 authored by Vivien Kraus's avatar Vivien Kraus
Browse files

Disable the saving of games and browsing the games directory

Since we disable XML, we also need to stop storing the games.
parent 83bd66de
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: tarot 0.4.2.83-ebdc-dirty\n"
"Report-Msgid-Bugs-To: vivien@planete-kraus.eu\n"
"POT-Creation-Date: 2020-01-09 20:59+0000\n"
"POT-Creation-Date: 2020-01-11 15:44+0100\n"
"PO-Revision-Date: 2020-01-02 19:27+0100\n"
"Last-Translator: Vivien Kraus <vivien@planete-kraus.eu>\n"
"Language-Team: French\n"
......@@ -35,16 +35,16 @@ msgstr "Erreur : ni XDG_DATA_HOME ni HOME ne sont définiies.\n"
msgid "Error: environment variable '%s' is not set.\n"
msgstr "Erreur : la variable d'environnement '%s' n'est pas définie.\n"
#: src/tarot-app/main.vala:86 src/tarot-app/program_commons.c:45
#: src/tarot-app/main.vala:84 src/tarot-app/program_commons.c:45
#, c-format
msgid "ERROR: could not initialize libtarot.\n"
msgstr "ERREUR : impossible d'initialiser libtarot.\n"
#: src/tarot-app/main.vala:98
#: src/tarot-app/main.vala:96
msgid "Print version information and exit"
msgstr "Affiche l'information de version et quitte"
#: src/tarot-app/main.vala:100 src/tarot-app/main.vala:110
#: src/tarot-app/main.vala:98 src/tarot-app/main.vala:108
#: src/tarot-app/tarot_deal.c:70 src/tarot-app/tarot_mcts.c:88
#: src/tarot-app/tarot_stacking.c:80 src/tarot-app/tarot_features.c:62
#: src/tarot-app/tarot_cnn_features.c:58
......@@ -52,7 +52,7 @@ msgstr "Affiche l'information de version et quitte"
msgid "version"
msgstr "version"
#: src/tarot-app/main.vala:117 src/tarot-app/tarot_status.c:57
#: src/tarot-app/main.vala:115 src/tarot-app/tarot_status.c:57
#: src/tarot-app/tarot_deal.c:112 src/tarot-app/tarot_mcts.c:136
#: src/tarot-app/tarot_stacking.c:112 src/tarot-app/tarot_features.c:93
#: src/tarot-app/tarot_cnn_features.c:89
......@@ -93,6 +93,10 @@ msgstr ""
msgid "Playing tarot against the AI"
msgstr "Jouer au tarot contre l'IA"
#: eu.planete_kraus.Tarot.appdata.xml.in:27
msgid "Vivien Kraus"
msgstr "Vivien Kraus"
#: src/libtarot/cards/tarot/cards_private_impl.h:93
msgid "AH"
msgstr "AC"
......@@ -463,20 +467,10 @@ msgstr ""
"Erreur : l'en-tête ARFF installé (%s/features-header.txt) n'est pas "
"compatible avec cette version (%s).\n"
#: src/tarot-app/gui/window.vala:191
#: src/tarot-app/gui/window.vala:188
msgid "Copyright © 2019, 2020 Vivien Kraus"
msgstr "Copyright © 2019, 2020 Vivien Kraus"
#: src/tarot-app/gui/window.vala:282
#, c-format
msgid "Error: could not log the game: %s\n"
msgstr "Erreur : impossible d'enregistrer la partie : %s\n"
#: src/tarot-app/gui/window.vala:388
#, c-format
msgid "Error: could not run explorer.exe: %s\n"
msgstr "Erreur : impossible d'exécuter explorer.exe : %s\n"
#: src/tarot-app/gui/widget.vala:321
#, c-format
msgid ""
......@@ -1400,30 +1394,26 @@ msgstr ""
"- -h, --aide : affiche ce message et quitte ;\n"
"- -v, --version : affiche la version du programme et quitte.\n"
#: src/tarot-app/gui/window.ui:34
#: src/tarot-app/gui/window.ui:33
msgid "Tarot"
msgstr "Tarot"
#: src/tarot-app/gui/window.ui:75
#: src/tarot-app/gui/window.ui:74
msgid "page0"
msgstr "page0"
#: src/tarot-app/gui/window.ui:93
#: src/tarot-app/gui/window.ui:92
msgid "3 players"
msgstr "3 joueurs"
#: src/tarot-app/gui/window.ui:116
#: src/tarot-app/gui/window.ui:115
msgid "4 players"
msgstr "4 joueurs"
#: src/tarot-app/gui/window.ui:139
#: src/tarot-app/gui/window.ui:138
msgid "5 players"
msgstr "5 joueurs"
#: src/tarot-app/gui/window.ui:192
msgid "Game files"
msgstr "Fichiers de parties"
#: src/tarot-app/gui/widget.ui:74
msgid "Call: [card]"
msgstr "Appel : [carte]"
......@@ -1559,8 +1549,16 @@ msgstr ""
"Erreur : la %d-ième dimension doit être un entier strictement positif,\n"
"et pas « %s ».\n"
#~ msgid "Vivien Kraus"
#~ msgstr "Vivien Kraus"
#, c-format
#~ msgid "Error: could not log the game: %s\n"
#~ msgstr "Erreur : impossible d'enregistrer la partie : %s\n"
#, c-format
#~ msgid "Error: could not run explorer.exe: %s\n"
#~ msgstr "Erreur : impossible d'exécuter explorer.exe : %s\n"
#~ msgid "Game files"
#~ msgstr "Fichiers de parties"
#~ msgid ""
#~ "If you find that the AI is too weak, send me your game files at "
......
......@@ -14,7 +14,6 @@ General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkImage" id="image1">
......@@ -157,11 +156,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</object>
</child>
</template>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="stock">gtk-open</property>
</object>
<object class="GtkPopoverMenu" id="menu_popover">
<property name="can_focus">False</property>
<property name="relative_to">menu_button</property>
......@@ -187,22 +181,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLinkButton" id="button_browse_games">
<property name="label" translatable="yes">Game files</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">image2</property>
<property name="relief">none</property>
<property name="always_show_image">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="submenu">main</property>
......
......@@ -129,9 +129,6 @@ namespace Tarot {
[GtkChild]
private Gtk.PopoverMenu menu_popover;
[GtkChild]
private Gtk.LinkButton button_browse_games;
private Tarot.Solo my_game;
private EventQueue m_queue;
// Events transfered from my_game to the queue:
......@@ -268,20 +265,6 @@ namespace Tarot {
stderr.printf ("Asking card");
tarot_widget.ask_play (playable);
}
int[] score;
if (game_shown.get_scores_alloc (out score) == Tarot.GameError.OK) {
var date_now = new GLib.DateTime.now_utc ().format ("%F_%H_%M_%S");
var myself_str = myself.to_string_alloc ();
var filename = (GLib.Environment.get_variable ("SAVEDGAMESDIR") + "/" + date_now + "_" + myself_str + ".tarot");
var contents = my_game.get_alloc ().save_to_xml_alloc ();
var file = GLib.File.new_for_path (filename);
try {
var output = new DataOutputStream (file.create (FileCreateFlags.REPLACE_DESTINATION));
output.put_string (contents);
} catch (Error e) {
stderr.printf (_ ("Error: could not log the game: %s\n"), e.message);
}
}
}
construct {
......@@ -375,21 +358,6 @@ namespace Tarot {
var provider = new Gtk.CssProvider ();
provider.load_from_resource ("/eu/planete_kraus/Tarot/style.css");
Gtk.StyleContext.add_provider_for_screen (screen, provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
var savedgamesdir = GLib.Environment.get_variable ("SAVEDGAMESDIR");
button_browse_games.uri = "file://" + savedgamesdir;
if (!starts_with (savedgamesdir, "/")) {
// Windows...
button_browse_games.activate_link.connect (() => {
string[] cmd = { "explorer.exe", "." };
string[] env = Environ.get ();
try {
GLib.Process.spawn_sync (savedgamesdir, cmd, env, SpawnFlags.SEARCH_PATH, null, null, null, null);
} catch (Error e) {
stderr.printf (_ ("Error: could not run explorer.exe: %s\n"), e.message);
}
return true;
});
}
show_new_game_page ();
}
}
......
// tarot implements the rules of the tarot game
// Copyright (C) 2019 Vivien Kraus
// Copyright (C) 2019, 2020 Vivien Kraus
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
......@@ -77,10 +77,8 @@ namespace Tarot {
GLib.Environment.set_variable ("SYSCONFDIR", absolute_sysconfdir, true);
GLib.Environment.set_variable ("LOCALEDIR", absolute_localedir, true);
GLib.Environment.set_variable ("DATADIR", absolute_datadir, true);
GLib.Environment.set_variable ("SAVEDGAMESDIR", absolute_localdatadir + "/" + PACKAGE + "/games", true);
stderr.printf ("Sysconfdir: '%s'\nLocaledir: '%s'\nDatadir: '%s'\nLocaldatadir: '%s'\n",
absolute_sysconfdir, absolute_localedir, absolute_datadir, absolute_localdatadir);
GLib.DirUtils.create_with_parents (GLib.Environment.get_variable ("SAVEDGAMESDIR"), 0755);
Tarot.set_datadir (absolute_datadir);
if (Tarot.init (absolute_localedir) != 0) {
stderr.printf (_ ("ERROR: could not initialize libtarot.\n"));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment