restore position for hidden windows

This commit is contained in:
Artem Anufrij 2018-04-20 21:13:02 +02:00
parent 0a17ae4dcb
commit 404f5ee056
2 changed files with 25 additions and 2 deletions

View file

@ -139,13 +139,13 @@ namespace Webpin {
}
}
public bool edit_property (string propertie, string val) {
public bool edit_property (string property, string val) {
bool return_value = false;
try {
string filename = GLib.Environment.get_user_data_dir () + "/applications/" + file.get_string ("Desktop Entry", "Name") + "-webpin.desktop";
file = new GLib.KeyFile ();
file.load_from_file (filename, KeyFileFlags.NONE);
file.set_string ("Desktop Entry", propertie, val);
file.set_string ("Desktop Entry", property, val);
return_value = file.save_to_file (filename);
} catch (Error err) {
warning (err.message);
@ -154,6 +154,20 @@ namespace Webpin {
return return_value;
}
public new string get_property (string property) {
string return_value = "";
try {
string filename = GLib.Environment.get_user_data_dir () + "/applications/" + file.get_string ("Desktop Entry", "Name") + "-webpin.desktop";
file = new GLib.KeyFile ();
file.load_from_file (filename, KeyFileFlags.NONE);
return_value = file.get_string ("Desktop Entry", property);
} catch (Error err) {
warning (err.message);
}
return return_value;
}
public GLib.DesktopAppInfo save_to_file () {
GLib.DesktopAppInfo return_value = null;
try {

View file

@ -135,6 +135,15 @@ namespace Webpin.Windows {
load_settings ();
this.show_all ();
this.show.connect (
() => {
var x = desktop_file.get_property ("X-Webpin-WindowX");
var y = desktop_file.get_property ("X-Webpin-WindowY");
if (x != null && y != null) {
this.move (int.parse (x), int.parse (y));
}
});
}
private void set_color (Gdk.RGBA color) {