From 58674f1217ee807a860faaa05fdb633934a1331c Mon Sep 17 00:00:00 2001 From: Artem Anufrij Date: Sun, 19 Nov 2017 00:49:02 +0100 Subject: [PATCH] fixed .desktop properties --- ...com.github.artemanufrij.webpin.appdata.xml | 8 +++++++ debian/changelog~ | 5 ---- src/Objects/DesktopFile.vala | 21 ++++------------ src/WebWindow.vala | 24 +++++++++---------- src/Widgets/WebApp.vala | 2 +- 5 files changed, 25 insertions(+), 35 deletions(-) delete mode 100644 debian/changelog~ diff --git a/data/com.github.artemanufrij.webpin.appdata.xml b/data/com.github.artemanufrij.webpin.appdata.xml index 7fff5df..d7218e3 100644 --- a/data/com.github.artemanufrij.webpin.appdata.xml +++ b/data/com.github.artemanufrij.webpin.appdata.xml @@ -32,6 +32,14 @@ + + +

Fix:

+
    +
  • Custom settings in .desktop
  • +
+
+

Fix:

diff --git a/debian/changelog~ b/debian/changelog~ deleted file mode 100644 index 4dcf9ad..0000000 --- a/debian/changelog~ +++ /dev/null @@ -1,5 +0,0 @@ -com.github.artemanufrij.webpin (0.1.3) xenial; urgency=low - - * Initial Release. - - -- Artem Anufrij Mon, 31 Jul 2017 04:53:39 +0100 diff --git a/src/Objects/DesktopFile.vala b/src/Objects/DesktopFile.vala index 99ae289..2d3f129 100644 --- a/src/Objects/DesktopFile.vala +++ b/src/Objects/DesktopFile.vala @@ -55,7 +55,7 @@ namespace Webpin { this.file = new GLib.KeyFile(); try { file.load_from_file (info.filename, KeyFileFlags.NONE); - return file.get_string ("Desktop Entry", "WebpinStayOpen") == "true"; + return file.get_string ("Desktop Entry", "X-Webpin-StayOpen") == "true"; } catch (Error e) { warning (e.message); } @@ -69,7 +69,7 @@ namespace Webpin { this.file = new GLib.KeyFile(); try { file.load_from_file (info.filename, KeyFileFlags.NONE); - var property = file.get_string ("Desktop Entry", "WebpinPrimaryColor"); + var property = file.get_string ("Desktop Entry", "X-Webpin-PrimaryColor"); if (property == "" || !return_value.parse (property)) { return null; } @@ -81,24 +81,11 @@ namespace Webpin { } set { if (value != null) { var color = "#%02x%02x%02x".printf ((int)(value.red * 255), (int)(value.green * 255), (int)(value.blue * 255)); - edit_propertie ("WebpinPrimaryColor", color); + edit_propertie ("X-Webpin-PrimaryColor", color); } } } - public bool mute_notifications { - get { - this.file = new GLib.KeyFile(); - try { - file.load_from_file (info.filename, KeyFileFlags.NONE); - return file.get_string ("Desktop Entry", "WebpinMuteNotifications") == "true"; - } catch (Error e) { - warning (e.message); - } - return false; - } - } - public DesktopFile (string name, string url, string icon, bool stay_open) { this.name = name; this.url = url.replace ("%", "%%"); @@ -117,7 +104,7 @@ namespace Webpin { file.set_string ("Desktop Entry", "Exec", "com.github.artemanufrij.webpin " + url); file.set_string ("Desktop Entry", "Icon", icon); file.set_string ("Desktop Entry", "StartupWMClass", url); - file.set_string ("Desktop Entry", "WebpinStayOpen", stay_open.to_string ()); + file.set_string ("Desktop Entry", "X-Webpin-StayOpen", stay_open.to_string ()); } public DesktopFile.from_desktopappinfo(GLib.DesktopAppInfo info) { diff --git a/src/WebWindow.vala b/src/WebWindow.vala index 1ecf628..3688ae4 100644 --- a/src/WebWindow.vala +++ b/src/WebWindow.vala @@ -72,17 +72,17 @@ namespace Webpin { stay_open.tooltip_text = _("Run in background when closed"); stay_open.image = new Gtk.Image.from_icon_name ("view-pin-symbolic", Gtk.IconSize.MENU); stay_open.toggled.connect (() => { - desktop_file.edit_propertie ("WebpinStayOpen", stay_open.active.to_string ()); + desktop_file.edit_propertie ("X-Webpin-StayOpen", stay_open.active.to_string ()); desktop_file.save_to_file (); }); headerbar.pack_start (stay_open); this.set_titlebar (headerbar); - var width = desktop_file.info.get_string ("WebpinWindowWidth"); - var height = desktop_file.info.get_string ("WebpinWindowHeight"); - var state = desktop_file.info.get_string ("WebpinWindowMaximized"); - var zoom = desktop_file.info.get_string ("WebpinWindowZoom"); + var width = desktop_file.info.get_string ("X-Webpin-WindowWidth"); + var height = desktop_file.info.get_string ("X-Webpin-WindowHeight"); + var state = desktop_file.info.get_string ("X-Webpin-WindowMaximized"); + var zoom = desktop_file.info.get_string ("X-Webpin-WindowZoom"); if (width != null && height != null) { set_default_size (int.parse(width), int.parse(height)); @@ -159,11 +159,11 @@ namespace Webpin { var file = web_app.get_desktop_file(); if (is_maximized) { - file.edit_propertie ("WebpinWindowMaximized", "max"); + file.edit_propertie ("X-Webpin-WindowMaximized", "max"); } else { - file.edit_propertie ("WebpinWindowWidth", width.to_string()); - file.edit_propertie ("WebpinWindowHeight", height.to_string()); - file.edit_propertie ("WebpinWindowMaximized", "norm"); + file.edit_propertie ("X-Webpin-WindowWidth", width.to_string()); + file.edit_propertie ("X-Webpin-WindowHeight", height.to_string()); + file.edit_propertie ("X-Webpin-WindowMaximized", "norm"); } } @@ -180,7 +180,7 @@ namespace Webpin { case Gdk.Key.plus: if (Gdk.ModifierType.CONTROL_MASK in event.state) { web_app.app_view.zoom_level += 0.1; - web_app.get_desktop_file().edit_propertie ("WebpinWindowZoom", web_app.app_view.zoom_level.to_string ()); + web_app.get_desktop_file().edit_propertie ("X-Webpin-WindowZoom", web_app.app_view.zoom_level.to_string ()); } else { handled = false; } @@ -189,7 +189,7 @@ namespace Webpin { case Gdk.Key.minus: if (Gdk.ModifierType.CONTROL_MASK in event.state) { web_app.app_view.zoom_level -= 0.1; - web_app.get_desktop_file().edit_propertie ("WebpinWindowZoom", web_app.app_view.zoom_level.to_string ()); + web_app.get_desktop_file().edit_propertie ("X-Webpin-WindowZoom", web_app.app_view.zoom_level.to_string ()); } else { handled = false; } @@ -198,7 +198,7 @@ namespace Webpin { case Gdk.Key.@0: if (Gdk.ModifierType.CONTROL_MASK in event.state) { web_app.app_view.zoom_level = 1; - web_app.get_desktop_file().edit_propertie ("WebpinWindowZoom", web_app.app_view.zoom_level.to_string ()); + web_app.get_desktop_file().edit_propertie ("X-Webpin-WindowZoom", web_app.app_view.zoom_level.to_string ()); } else { handled = false; } diff --git a/src/Widgets/WebApp.vala b/src/Widgets/WebApp.vala index 45adb15..f277b74 100644 --- a/src/Widgets/WebApp.vala +++ b/src/Widgets/WebApp.vala @@ -110,7 +110,7 @@ namespace Webpin { icon_for_notification = GLib.Icon.new_for_string (file.icon); } catch (Error e) { warning (e.message); - icon = new Gtk.Image.from_icon_name ("artemanufrij.webpin", Gtk.IconSize.DIALOG); + icon = new Gtk.Image.from_icon_name ("com.github.artemanufrij.webpin", Gtk.IconSize.DIALOG); } } else { icon = new Gtk.Image.from_icon_name (file.icon, Gtk.IconSize.DIALOG);