From 4457ec2a7463e263863a98a1b62360a31fe682e1 Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Wed, 24 Feb 2010 18:17:22 +0100 Subject: [PATCH] Use the LED pattern helper to overwrite mce.ini and restart MCE --- src/led-pattern-editor.vala | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/led-pattern-editor.vala b/src/led-pattern-editor.vala index b008040..a528c43 100644 --- a/src/led-pattern-editor.vala +++ b/src/led-pattern-editor.vala @@ -28,6 +28,28 @@ public static Osso.Status execute (Osso.Context osso, void* data, bool user_acti dialog.destroy (); if (response == Gtk.ResponseType.OK) { mce_ini_store (list); + var note = new Hildon.Note.confirmation (window, "WARNING! Apply changes without further inspection? Let's hope there is no bug in this program. Writing a broken /etc/mce/mce.ini can brick the device. If unsure, select No and apply the changes manually after inspection."); + response = note.run (); + note.destroy (); + if (response == Gtk.ResponseType.OK) { + Hildon.Banner.show_information (window, null, "Applying changes and restarting MCE ..."); + try { + int exit_status; + string error; + var command = "sudo /usr/bin/led-pattern-helper save /tmp/mce.ini"; + Process.spawn_command_line_sync (command, null, out error, out exit_status); + if (exit_status != 0) { + var information = "Exit status: %d\n%s".printf (exit_status, error); + note = new Hildon.Note.information (window, information); + note.run (); + } + } catch (SpawnError e) { + Hildon.Banner.show_information (null, null, e.message); + } + } else { + note = new Hildon.Note.information (window, "The modified LED patterns are stored in /tmp/mce.ini. You have to manually copy this file to /etc/mce/mce.ini and restart MCE for the changes to take effect:\n\nmv /tmp/mce.ini /etc/mce/mce.ini\ninitctl stop mce; sleep 2; initctl start mce"); + note.run (); + } } return Osso.Status.OK; -- 1.7.9.5