[f-spot/FSPOT_0_6_0_STABLE] Set the properties of the ProgressDialog atomically
- From: Stephane Delcroix <sdelcroix src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [f-spot/FSPOT_0_6_0_STABLE] Set the properties of the ProgressDialog atomically
- Date: Thu, 24 Sep 2009 07:08:08 +0000 (UTC)
commit 8fad148d31b1f627fa1b3f82bd76eb062ae6c1ce
Author: Stephane Delcroix <stephane delcroix org>
Date: Thu Sep 17 10:12:16 2009 +0200
Set the properties of the ProgressDialog atomically
this fixes bgo #595228
src/CameraFileSelectionDialog.cs | 5 +--
src/UI.Dialog/ThreadProgressDialog.cs | 81 ++++++++++++++++++---------------
2 files changed, 45 insertions(+), 41 deletions(-)
---
diff --git a/src/CameraFileSelectionDialog.cs b/src/CameraFileSelectionDialog.cs
index f39ee65..b60fe55 100644
--- a/src/CameraFileSelectionDialog.cs
+++ b/src/CameraFileSelectionDialog.cs
@@ -241,10 +241,7 @@ namespace FSpot {
saved_files = (string []) saved.ToArray (typeof (string));
- progress_dialog.Message = Catalog.GetString ("Done Copying Files");
- progress_dialog.Fraction = 1.0;
- progress_dialog.ProgressText = Catalog.GetString ("Download Complete");
- progress_dialog.ButtonLabel = Gtk.Stock.Ok;
+ progress_dialog.SetProperties (Catalog.GetString ("Download Complete"), Gtk.Stock.Ok, Catalog.GetString ("Done Copying Files"), 1.0);
}
}
diff --git a/src/UI.Dialog/ThreadProgressDialog.cs b/src/UI.Dialog/ThreadProgressDialog.cs
index ec31676..d41087e 100644
--- a/src/UI.Dialog/ThreadProgressDialog.cs
+++ b/src/UI.Dialog/ThreadProgressDialog.cs
@@ -5,7 +5,9 @@
* Larry Ewing <lewing novell com>
* Stephane Delcroix <stephane delcroix org>
*
- * This is free software. See COPYING for details.
+ * Copyright (c) 2004-2009 Novell, Inc.
+ *
+ * This is open source software. See COPYING for details.
*/
using System;
@@ -15,17 +17,19 @@ namespace FSpot.UI.Dialog {
public class ThreadProgressDialog : Gtk.Dialog {
FSpot.Delay delay;
- private Gtk.ProgressBar progress_bar;
- private Gtk.Label message_label;
- private Gtk.Button button;
+ Gtk.ProgressBar progress_bar;
+ Gtk.Label message_label;
+ Gtk.Button button;
+
+ Gtk.Button retry_button;
+ Gtk.Button skip_button;
+ Gtk.ResponseType error_response;
+ AutoResetEvent error_response_event;
+ AutoResetEvent error_response_ack_event;
- private Gtk.Button retry_button;
- private Gtk.Button skip_button;
- private Gtk.ResponseType error_response;
- private AutoResetEvent error_response_event;
- private AutoResetEvent error_response_ack_event;
+ object syncHandle = new object ();
- private Thread thread;
+ Thread thread;
public ThreadProgressDialog (Thread thread, int total) {
/*
@@ -63,60 +67,63 @@ namespace FSpot.UI.Dialog {
Destroyed += HandleDestroy;
}
- private string progress_text;
+ string progress_text;
public string ProgressText {
- get {
- return progress_text;
- }
+ get { return progress_text; }
set {
- lock (this) {
+ lock (syncHandle) {
progress_text = value;
delay.Start ();
}
}
}
- private string button_label;
+ string button_label;
public string ButtonLabel {
- get {
- return button_label;
- }
+ get { return button_label; }
set {
- lock (this) {
+ lock (syncHandle) {
button_label = value;
delay.Start ();
}
}
}
- private string message;
+ string message;
public string Message {
- get {
- return message;
- }
+ get { return message; }
set {
- lock (this) {
+ lock (syncHandle) {
message = value;
delay.Start ();
}
}
}
- private double fraction;
+ double fraction;
public double Fraction {
- get {
- return Fraction;
- }
+ get { return Fraction; }
set {
- lock (this) {
+ lock (syncHandle) {
fraction = value;
delay.Start ();
}
}
}
- private bool retry_skip;
- private bool RetrySkipVisible {
+ internal void SetProperties (string progress_text, string button_label, string message, double fraction)
+ {
+ lock (syncHandle) {
+ this.progress_text = progress_text;
+ this.button_label = button_label;
+ this.message = message;
+ this.fraction = fraction;
+ delay.Start ();
+ }
+ }
+
+ bool retry_skip;
+ bool RetrySkipVisible {
set {
retry_skip = value;
delay.Start ();
@@ -137,11 +144,11 @@ namespace FSpot.UI.Dialog {
return (error_response == Gtk.ResponseType.Yes);
}
- private void HandleResponse (object obj, Gtk.ResponseArgs args) {
+ void HandleResponse (object obj, Gtk.ResponseArgs args) {
this.Destroy ();
}
- private bool HandleUpdate ()
+ bool HandleUpdate ()
{
message_label.Text = message;
progress_bar.Text = progress_text;
@@ -152,7 +159,7 @@ namespace FSpot.UI.Dialog {
return false;
}
- private void HandleDestroy (object sender, EventArgs args)
+ void HandleDestroy (object sender, EventArgs args)
{
delay.Stop ();
if (thread.IsAlive) {
@@ -160,13 +167,13 @@ namespace FSpot.UI.Dialog {
}
}
- private void HandleRetryClicked (object obj, EventArgs args)
+ void HandleRetryClicked (object obj, EventArgs args)
{
error_response = Gtk.ResponseType.Yes;
error_response_event.Set ();
}
- private void HandleSkipClicked (object obj, EventArgs args)
+ void HandleSkipClicked (object obj, EventArgs args)
{
error_response = Gtk.ResponseType.No;
error_response_event.Set ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]