Fix warning/crash when libnotify enabled and server is not present. Bug 768911.
* src/client/notification/libnotify.vala (Libnotify): Allow for the server capabilities being null.
This commit is contained in:
parent
bcfb0716d5
commit
8c22ce6727
2 changed files with 9 additions and 4 deletions
|
|
@ -59,7 +59,7 @@ namespace Notify {
|
|||
[CCode (cheader_filename = "libnotify/notify.h")]
|
||||
public static unowned string get_app_name ();
|
||||
[CCode (cheader_filename = "libnotify/notify.h")]
|
||||
public static GLib.List<string> get_server_caps ();
|
||||
public static GLib.List<string>? get_server_caps ();
|
||||
[CCode (cheader_filename = "libnotify/notify.h")]
|
||||
public static bool get_server_info (out unowned string ret_name, out unowned string ret_vendor, out unowned string ret_version, out unowned string ret_spec_version);
|
||||
[CCode (cheader_filename = "libnotify/notify.h")]
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public class Libnotify : Geary.BaseObject {
|
|||
private Notify.Notification? error_notification = null;
|
||||
private Geary.Folder? folder = null;
|
||||
private Geary.Email? email = null;
|
||||
private List<string> caps;
|
||||
private List<string>? caps = null;
|
||||
|
||||
public signal void invoked(Geary.Folder? folder, Geary.Email? email);
|
||||
|
||||
|
|
@ -31,8 +31,10 @@ public class Libnotify : Geary.BaseObject {
|
|||
}
|
||||
|
||||
init_sound();
|
||||
caps = Notify.get_server_caps();
|
||||
|
||||
// This will return null if no notification server is present
|
||||
this.caps = Notify.get_server_caps();
|
||||
|
||||
monitor.new_messages_arrived.connect(on_new_messages_arrived);
|
||||
}
|
||||
|
||||
|
|
@ -148,8 +150,11 @@ public class Libnotify : Geary.BaseObject {
|
|||
|
||||
}
|
||||
|
||||
private Notify.Notification issue_notification(string category, string summary,
|
||||
private Notify.Notification? issue_notification(string category, string summary,
|
||||
string body, Gdk.Pixbuf? icon, string? sound) {
|
||||
if (this.caps == null)
|
||||
return null;
|
||||
|
||||
// Avoid constructor due to ABI change
|
||||
Notify.Notification notification = (Notify.Notification) GLib.Object.new(
|
||||
typeof (Notify.Notification),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue