gnome bubbles: Call notifications from the main thread. #1362
This commit is contained in:
parent
f874c1c70b
commit
34e4afa806
|
@ -34,17 +34,7 @@ namespace SparkleShare {
|
||||||
if (!Program.Controller.NotificationsEnabled)
|
if (!Program.Controller.NotificationsEnabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try {
|
Application.Invoke (delegate {
|
||||||
// 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) + "...";
|
|
||||||
}
|
|
||||||
|
|
||||||
Notification notification = new Notification () {
|
Notification notification = new Notification () {
|
||||||
Summary = title,
|
Summary = title,
|
||||||
Body = subtext,
|
Body = subtext,
|
||||||
|
@ -62,11 +52,13 @@ namespace SparkleShare {
|
||||||
Controller.BubbleClicked ();
|
Controller.BubbleClicked ();
|
||||||
};
|
};
|
||||||
|
|
||||||
notification.Show ();
|
try {
|
||||||
|
notification.Show ();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SparkleLogger.LogInfo ("Notification", "Error showing notification: ", e);
|
SparkleLogger.LogInfo ("Notification", "Error showing notification: ", e);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ namespace SparkleShare {
|
||||||
this.indicator.Status = Status.Attention;
|
this.indicator.Status = Status.Attention;
|
||||||
this.indicator.Status = Status.Active;
|
this.indicator.Status = Status.Active;
|
||||||
#else
|
#else
|
||||||
this.status_icon.IconName = icon_name
|
this.status_icon.IconName = icon_name;
|
||||||
#endif
|
#endif
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue