[smuxi/stable] Frontend-GNOME: fix Gtk-CRITICAL message (closes: #826)
- From: Mirco M. M. Bauer <mmmbauer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [smuxi/stable] Frontend-GNOME: fix Gtk-CRITICAL message (closes: #826)
- Date: Tue, 23 Feb 2016 11:53:00 +0000 (UTC)
commit 65d052558113094a9b7f4ea073fbf56435c46741
Author: Mirco Bauer <meebey meebey net>
Date: Tue Feb 23 12:48:31 2016 +0100
Frontend-GNOME: fix Gtk-CRITICAL message (closes: #826)
GTK+ writes an assertion failed message when setting a value that is out of
range like this:
(smuxi-frontend-gnome:31653): Gtk-CRITICAL **: IA__gtk_progress_set_percentage: assertion `percentage
= 0 && percentage <= 1.0' failed
src/Frontend-GNOME/MainWindow.cs | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/Frontend-GNOME/MainWindow.cs b/src/Frontend-GNOME/MainWindow.cs
index 3ff9531..95c1fc4 100644
--- a/src/Frontend-GNOME/MainWindow.cs
+++ b/src/Frontend-GNOME/MainWindow.cs
@@ -647,7 +647,14 @@ namespace Smuxi.Frontend.Gnome
{
var totalChatCount = ChatViewManager.Chats.Count;
var syncedChatCount = ChatViewManager.SyncedChats.Count;
- ProgressBar.Fraction = (double)syncedChatCount / totalChatCount;
+ var fraction = (double) syncedChatCount / totalChatCount;
+ // clamp value to avoid Gtk-CRITICAL assert failed messages
+ if (fraction < 0) {
+ fraction = 0;
+ } else if (fraction > 1) {
+ fraction = 1;
+ }
+ ProgressBar.Fraction = fraction;
ProgressBar.Text = String.Format("{0} / {1}",
syncedChatCount,
totalChatCount);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]