bubbles: catch exceptions from libnotify. Fixes #331

This commit is contained in:
Hylke Bons 2011-09-08 13:12:07 +02:00
parent f35a24164f
commit 0734951b95
2 changed files with 16 additions and 10 deletions

View file

@ -12,6 +12,7 @@ BUILD_DEFINES="-define:HAVE_APP_INDICATOR"
endif
SOURCES = \
Program.cs \
SparkleAbout.cs \
SparkleAboutController.cs \
SparkleBubbles.cs \
@ -25,7 +26,6 @@ SOURCES = \
SparkleSetup.cs \
SparkleSetupController.cs \
SparkleSetupWindow.cs \
Program.cs \
SparkleSpinner.cs \
SparkleStatusIcon.cs \
SparkleStatusIconController.cs \

View file

@ -30,17 +30,23 @@ namespace SparkleShare {
public SparkleBubbles ()
{
Controller.ShowBubbleEvent += delegate (string title, string subtext, string image_path) {
Notification notification = new Notification () {
Timeout = 5 * 1000,
Urgency = Urgency.Low
};
try {
Notification notification = new Notification () {
Timeout = 5 * 1000,
Urgency = Urgency.Low
};
if (image_path != null)
notification.Icon = new Gdk.Pixbuf (image_path);
else
notification.IconName = "folder-sparkleshare";
if (image_path != null)
notification.Icon = new Gdk.Pixbuf (image_path);
else
notification.IconName = "folder-sparkleshare";
notification.Show ();
notification.Show ();
} catch (Exception) {
// Ignore exceptions thrown by libnotify,
// they're not important enough to crash
}
};
}
}