linux bubbles: Clean up
This commit is contained in:
parent
d105a1d105
commit
ed07fc6254
|
@ -30,36 +30,41 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public SparkleBubbles ()
|
public SparkleBubbles ()
|
||||||
{
|
{
|
||||||
Controller.ShowBubbleEvent += delegate (string title, string subtext, string image_path) {
|
Controller.ShowBubbleEvent += ShowBubbleEvent;
|
||||||
if (!Program.Controller.NotificationsEnabled)
|
}
|
||||||
return;
|
|
||||||
|
|
||||||
Application.Invoke (delegate {
|
|
||||||
Notification notification = new Notification () {
|
|
||||||
Summary = title,
|
|
||||||
Body = subtext,
|
|
||||||
Timeout = 5 * 1000,
|
|
||||||
Urgency = Urgency.Low
|
|
||||||
};
|
|
||||||
|
|
||||||
if (image_path != null)
|
private void ShowBubbleEvent (string title, string subtext, string image_path)
|
||||||
notification.Icon = new Gdk.Pixbuf (image_path);
|
{
|
||||||
else
|
if (!Program.Controller.NotificationsEnabled)
|
||||||
notification.IconName = "folder-sparkleshare";
|
return;
|
||||||
|
|
||||||
notification.Closed += delegate (object o, EventArgs args) {
|
Application.Invoke (delegate {
|
||||||
if ((args as CloseArgs).Reason == CloseReason.User)
|
Notification notification = new Notification () {
|
||||||
Controller.BubbleClicked ();
|
Summary = title,
|
||||||
};
|
Body = subtext,
|
||||||
|
Timeout = 5 * 1000,
|
||||||
|
Urgency = Urgency.Low
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
if (image_path != null)
|
||||||
notification.Show ();
|
notification.Icon = new Gdk.Pixbuf (image_path);
|
||||||
|
else
|
||||||
|
notification.IconName = "folder-sparkleshare";
|
||||||
|
|
||||||
} catch (Exception e) {
|
notification.Closed += delegate (object o, EventArgs args) {
|
||||||
SparkleLogger.LogInfo ("Notification", "Error showing notification: ", e);
|
if ((args as CloseArgs).Reason == CloseReason.User)
|
||||||
}
|
Controller.BubbleClicked ();
|
||||||
});
|
};
|
||||||
};
|
|
||||||
|
try {
|
||||||
|
notification.Show ();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
SparkleLogger.LogInfo ("Notification", "Error showing notification: ", e);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue