fixed .desktop properties

This commit is contained in:
Artem Anufrij 2017-11-19 00:49:02 +01:00
parent f7b4eeb2d8
commit 58674f1217
5 changed files with 25 additions and 35 deletions

View file

@ -32,6 +32,14 @@
</screenshot>
</screenshots>
<releases>
<release version="0.2.2" date="2017-11-18">
<description>
<p>Fix:</p>
<ul>
<li>Custom settings in .desktop</li>
</ul>
</description>
</release>
<release version="0.2.1" date="2017-11-18">
<description>
<p>Fix:</p>

5
debian/changelog~ vendored
View file

@ -1,5 +0,0 @@
com.github.artemanufrij.webpin (0.1.3) xenial; urgency=low
* Initial Release.
-- Artem Anufrij <artem.anufrij@live.de> Mon, 31 Jul 2017 04:53:39 +0100

View file

@ -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) {

View file

@ -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;
}

View file

@ -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);