gnome bubbles: Call notifications from the main thread. #1362

This commit is contained in:
Hylke Bons 2013-10-11 21:57:41 +02:00
parent f874c1c70b
commit 34e4afa806
2 changed files with 9 additions and 17 deletions

View file

@ -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);
}
});
};
}
}

View file

@ -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
});
};