Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

Commit

Permalink
Make settings restart indicator after 'apply'
Browse files Browse the repository at this point in the history
  • Loading branch information
Steeven Lopes committed Jul 18, 2017
1 parent 8301cc2 commit 21c7cc2
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion data/settings/com.bajoja.indicator-kdeconnect.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</key>

<key name="visibilitiy" type="b">
<default>true</default>
<default>false</default>
<summary>Show only paired devices</summary>
<description>
Show only paired devie on the indicator
Expand Down
55 changes: 55 additions & 0 deletions src/settings/Settings.vala
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,67 @@ namespace KDEConnectIndicator {

this.ok_button.clicked.connect (() => {
this.settings.apply ();
restart();
this.window.close ();
});


}

private void restart () {
string std_out;

message("Getting PID");

try{
Process.spawn_sync (null,
new string[]{"pidof",
"indicator-kdeconnect"},
null,
SpawnFlags.SEARCH_PATH,
null,
out std_out,
null,
null);
} catch (Error e){
message (e.message);
}


if (std_out != ""){
message("Kill PID");

int pid = int.parse(std_out);

try{
Process.spawn_sync (null,
new string[]{"kill",
pid.to_string()},
null,
SpawnFlags.SEARCH_PATH,
null,
out std_out,
null,
null);
} catch (Error e){
message (e.message);
}


message("Restart process");
try{
Process.spawn_async (null,
new string[]{"indicator-kdeconnect"},
null,
SpawnFlags.SEARCH_PATH,
null,
null);
} catch (Error e) {
message (e.message);
}
}
}

private Box create_visibility_setts () {
Label label1 = new Label (_("Show only paired devices: "));

Expand Down

0 comments on commit 21c7cc2

Please sign in to comment.