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 endif
SOURCES = \ SOURCES = \
Program.cs \
SparkleAbout.cs \ SparkleAbout.cs \
SparkleAboutController.cs \ SparkleAboutController.cs \
SparkleBubbles.cs \ SparkleBubbles.cs \
@ -25,7 +26,6 @@ SOURCES = \
SparkleSetup.cs \ SparkleSetup.cs \
SparkleSetupController.cs \ SparkleSetupController.cs \
SparkleSetupWindow.cs \ SparkleSetupWindow.cs \
Program.cs \
SparkleSpinner.cs \ SparkleSpinner.cs \
SparkleStatusIcon.cs \ SparkleStatusIcon.cs \
SparkleStatusIconController.cs \ SparkleStatusIconController.cs \

View file

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