diff --git a/src/WebWindow.vala b/src/WebWindow.vala index ff676fe..3d3f50d 100644 --- a/src/WebWindow.vala +++ b/src/WebWindow.vala @@ -66,31 +66,6 @@ namespace Webpin { }); headerbar.pack_start (stay_open); - var mute_notifications = new Gtk.ToggleButton (); - mute_notifications.active = desktop_file.mute_notifications; - if (mute_notifications.active) { - mute_notifications.image = new Gtk.Image.from_icon_name ("notification-disabled-symbolic", Gtk.IconSize.MENU); - mute_notifications.tooltip_text = _("Unmute notifications"); - } else { - mute_notifications.image = new Gtk.Image.from_icon_name ("notification-symbolic", Gtk.IconSize.MENU); - mute_notifications.tooltip_text = _("Mute notifications"); - } - mute_notifications.toggled.connect (() => { - desktop_file.edit_propertie ("WebpinMuteNotifications", mute_notifications.active.to_string ()); - desktop_file.save_to_file (); - if (mute_notifications.active) { - mute_notifications.image = new Gtk.Image.from_icon_name ("notification-disabled-symbolic", Gtk.IconSize.MENU); - mute_notifications.tooltip_text = _("Unmute notifications"); - } else { - mute_notifications.image = new Gtk.Image.from_icon_name ("notification-symbolic", Gtk.IconSize.MENU); - mute_notifications.tooltip_text = _("Mute notifications"); - desktop_notification.set_title (desktop_file.name); - desktop_notification.set_body (_("Desktop notifications are enabled")); - WebpinApp.instance.send_notification (null, desktop_notification); - } - }); - headerbar.pack_start (mute_notifications); - this.set_titlebar (headerbar); var width = desktop_file.info.get_string ("WebpinWindowWidth"); @@ -129,12 +104,11 @@ namespace Webpin { } }); - web_app.desktop_notification.connect ((title, body) => { - if (!desktop_file.mute_notifications) { - desktop_notification.set_title (title); - desktop_notification.set_body (body); - WebpinApp.instance.send_notification (null, desktop_notification); - } + web_app.desktop_notification.connect ((title, body, icon) => { + desktop_notification.set_title (title); + desktop_notification.set_body (body); + desktop_notification.set_icon (icon); + WebpinApp.instance.send_notification (null, desktop_notification); }); web_app.request_begin.connect (() => { diff --git a/src/Widgets/WebApp.vala b/src/Widgets/WebApp.vala index e128e18..b8eaa00 100644 --- a/src/Widgets/WebApp.vala +++ b/src/Widgets/WebApp.vala @@ -37,11 +37,12 @@ namespace Webpin { private WebKit.CookieManager cookie_manager; private Gtk.Box container; Granite.Widgets.Toast app_notification; + GLib.Icon icon_for_notification; public signal void external_request (WebKit.NavigationAction action); public signal void request_begin (); public signal void request_finished (); - public signal void desktop_notification (string title, string body); + public signal void desktop_notification (string title, string body, GLib.Icon icon); public WebApp (string app_url) { @@ -106,6 +107,7 @@ namespace Webpin { if (icon_file.query_exists ()) { try { icon = new Gtk.Image.from_pixbuf (new Gdk.Pixbuf.from_file_at_scale (file.icon, 48, 48, true)); + icon_for_notification = GLib.Icon.new_for_string (file.icon); } catch (Error e) { warning (e.message); @@ -113,6 +115,7 @@ namespace Webpin { } } else { icon = new Gtk.Image.from_icon_name (file.icon, Gtk.IconSize.DIALOG); + icon_for_notification = new GLib.ThemedIcon (file.icon); } container.pack_start(icon, true, true, 0); @@ -134,8 +137,8 @@ namespace Webpin { }); app_view.show_notification.connect ((notification) => { - desktop_notification (notification.title, notification.body); - return false; + desktop_notification (notification.title, notification.body, icon_for_notification); + return true; }); app_view.permission_request.connect ((permission) => {