[longomatch] Handle the case where the user cancels the query dialog
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Handle the case where the user cancels the query dialog
- Date: Tue, 11 Nov 2014 17:58:20 +0000 (UTC)
commit c904bfa94bd1324ba1e6a34c20859be7da9bf6b6
Author: Julien Moutte <julien fluendo com>
Date: Thu Nov 6 16:22:00 2014 +0100
Handle the case where the user cancels the query dialog
LongoMatch.GUI/Gui/Panel/SportsTemplatesPanel.cs | 30 ++++++++++++++-------
1 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/LongoMatch.GUI/Gui/Panel/SportsTemplatesPanel.cs
b/LongoMatch.GUI/Gui/Panel/SportsTemplatesPanel.cs
index cf4f320..256ca72 100644
--- a/LongoMatch.GUI/Gui/Panel/SportsTemplatesPanel.cs
+++ b/LongoMatch.GUI/Gui/Panel/SportsTemplatesPanel.cs
@@ -313,23 +313,33 @@ namespace LongoMatch.Gui.Panel
Dashboard new_dashboard = Dashboard.Load (fileName);
if (new_dashboard != null) {
- while (provider.Exists (new_dashboard.Name)) {
- new_dashboard.Name = Config.GUIToolkit.QueryMessage
(Catalog.GetString ("Dashboard name:"),
+ bool abort = false;
+
+ while (provider.Exists (new_dashboard.Name) && !abort) {
+ string name = Config.GUIToolkit.QueryMessage
(Catalog.GetString ("Dashboard name:"),
Catalog.GetString ("Name conflict"),
new_dashboard.Name + "#");
+ if (name == null) {
+ abort = true;
+ }
+ else {
+ new_dashboard.Name = name;
+ }
}
- Pixbuf img;
+ if (!abort) {
+ Pixbuf img;
- provider.Save (new_dashboard);
+ provider.Save (new_dashboard);
- if (new_dashboard.Image != null)
- img = new_dashboard.Image.Value;
- else
- img = Helpers.Misc.LoadIcon ("longomatch", 20,
IconLookupFlags.ForceSvg);
+ if (new_dashboard.Image != null)
+ img = new_dashboard.Image.Value;
+ else
+ img = Helpers.Misc.LoadIcon ("longomatch", 20,
IconLookupFlags.ForceSvg);
- string name = new_dashboard.Name;
+ string name = new_dashboard.Name;
- templates.AppendValues (img, name, new_dashboard,
!new_dashboard.Static);
+ templates.AppendValues (img, name, new_dashboard,
!new_dashboard.Static);
+ }
}
}
catch (Exception ex) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]