From 34e4afa806bb6386c45a71a926d5ce1228fe7a05 Mon Sep 17 00:00:00 2001 From: Hylke Bons Date: Fri, 11 Oct 2013 21:57:41 +0200 Subject: [PATCH] gnome bubbles: Call notifications from the main thread. #1362 --- SparkleShare/Linux/SparkleBubbles.cs | 24 ++++++++---------------- SparkleShare/Linux/SparkleStatusIcon.cs | 2 +- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/SparkleShare/Linux/SparkleBubbles.cs b/SparkleShare/Linux/SparkleBubbles.cs index dac64f95..999877d9 100755 --- a/SparkleShare/Linux/SparkleBubbles.cs +++ b/SparkleShare/Linux/SparkleBubbles.cs @@ -34,24 +34,14 @@ namespace SparkleShare { if (!Program.Controller.NotificationsEnabled) return; - try { - // Debug information for https://github.com/hbons/SparkleShare/issues/1362 - if (title.Length > 255) { - SparkleLogger.LogInfo ("Notification", "Long string detected, truncating 'title'"); - title = title.Substring (0, 255) + "..."; - - } else if (subtext.Length > 255) { - SparkleLogger.LogInfo ("Notification", "Long string detected, truncating 'subtext'"); - title = title.Substring (0, 255) + "..."; - } - + Application.Invoke (delegate { Notification notification = new Notification () { Summary = title, Body = subtext, Timeout = 5 * 1000, Urgency = Urgency.Low }; - + if (image_path != null) notification.Icon = new Gdk.Pixbuf (image_path); else @@ -62,11 +52,13 @@ namespace SparkleShare { Controller.BubbleClicked (); }; - notification.Show (); + try { + notification.Show (); - } catch (Exception e) { - SparkleLogger.LogInfo ("Notification", "Error showing notification: ", e); - } + } catch (Exception e) { + SparkleLogger.LogInfo ("Notification", "Error showing notification: ", e); + } + }); }; } } diff --git a/SparkleShare/Linux/SparkleStatusIcon.cs b/SparkleShare/Linux/SparkleStatusIcon.cs index 327c8e0b..089976e5 100644 --- a/SparkleShare/Linux/SparkleStatusIcon.cs +++ b/SparkleShare/Linux/SparkleStatusIcon.cs @@ -79,7 +79,7 @@ namespace SparkleShare { this.indicator.Status = Status.Attention; this.indicator.Status = Status.Active; #else - this.status_icon.IconName = icon_name + this.status_icon.IconName = icon_name; #endif }); };