Remove the scary message before saving mce.ini
authorPhilipp Zabel <philipp.zabel@gmail.com>
Fri, 11 Jun 2010 15:33:18 +0000 (17:33 +0200)
committerPhilipp Zabel <philipp.zabel@gmail.com>
Tue, 10 Aug 2010 16:27:50 +0000 (18:27 +0200)
This might have been appropriate for the first extras-devel release,
but it certainly isn't for extras.

src/led-pattern-editor.vala

index 09e832d..fa1d4d0 100644 (file)
@@ -26,36 +26,19 @@ public static Osso.Status execute (Osso.Context osso, void* data, bool user_acti
 
        int response = dialog.run ();
        dialog.destroy ();
+       string command = null;
        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 ();
-               }
-       } else if (response == LedPatternDialog.Response.RESTORE) {
                Hildon.Banner.show_information (window, null, "Applying changes and restarting MCE ...");
+               command = "sudo /usr/bin/led-pattern-helper save %s".printf ("/tmp/mce.ini");
+       } else if (response == LedPatternDialog.Response.RESTORE) {
+               Hildon.Banner.show_information (window, null, "Restoring defaults and restarting MCE ...");
+               command = "sudo /usr/bin/led-pattern-helper save %s".printf ("/etc/mce/mce.ini.orig");
+       }
+       if (command != null) {
                try {
                        int exit_status;
                        string error;
-                       var command = "sudo /usr/bin/led-pattern-helper save /etc/mce/mce.ini.orig";
                        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);