Package: led-pattern-editor
Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, osso-icons-default
+Depends: ${shlibs:Depends}, ${misc:Depends}, osso-icons-default, mceledpattern
XB-Description: A control panel applet to edit notification LED blinking patterns
Can graphically edit the blinking patterns and LED colors, preview the
LED patterns and save the configuration and restart MCE to apply changes.
var vbox = new Gtk.VBox (false, 0);
foreach (LedPattern pattern in list) {
+ // Skip PatternInhibit, which the LED Pattern Editor uses
+ // internally to make MCE keep its hands off the LEDs.
+ if (pattern.name == "PatternInhibit")
+ continue;
+
var button = new LedPatternButton (pattern);
Hildon.gtk_widget_set_theme_size (button, Hildon.SizeType.FINGER_HEIGHT);
button.set_data ("pattern", pattern);
*/
class LedProgramDialog : Gtk.Dialog {
+ private const string MCE_SERVICE = "com.nokia.mce";
+ private const string MCE_REQUEST_IF = "com.nokia.mce.request";
+ private const string MCE_REQUEST_PATH = "/com/nokia/mce/request";
+
+ private enum ResponseType {
+ TEST = 1,
+ COPY = 2
+ }
+
LedPatternView lpv;
LedPatternRX51 pattern;
LedColorButton led_color2;
Gtk.Widget list1;
Gtk.Widget list2;
+ Gtk.ToggleButton test_button;
+
+ DBus.Connection bus;
+ dynamic DBus.Object mce;
public LedProgramDialog (LedPatternRX51 _pattern) {
pattern = _pattern;
add_action_widget (hbox, 2);
action_area.set_child_secondary (hbox, true);
- action_area.show_all ();
+ test_button = (Gtk.ToggleButton) Hildon.gtk_toggle_button_new (Hildon.SizeType.FINGER_HEIGHT);
+ test_button.set_label (_("Test"));
+ add_action_widget (test_button, ResponseType.TEST);
- add_button (_("Copy"), 2);
- add_button (_("Test"), 1);
+ add_button (_("Copy"), ResponseType.COPY);
add_button (_("Done"), Gtk.ResponseType.ACCEPT);
+ action_area.show_all ();
+
+ test_button.toggled.connect (on_test_toggled);
key_press_event.connect (on_key_pressed);
response.connect (on_response);
+
+ bus = DBus.Bus.get (DBus.BusType.SYSTEM);
+ mce = bus.get_object (MCE_SERVICE, MCE_REQUEST_PATH, MCE_REQUEST_IF);
}
private bool on_key_pressed (Gdk.EventKey event) {
}
void on_response (int response) {
- if (response == 1) {
- Timeout.add (200, delayed_spawn);
- } else if (response == 2) {
+ if (response == ResponseType.COPY) {
copy ();
+ return;
} else if (response == Gtk.ResponseType.ACCEPT) {
if (pattern.dump () != lpv.pattern.dump ()) {
pattern.replace_with (lpv.pattern);
}
+ test_button.set_active (false);
+ } else if (response == Gtk.ResponseType.CANCEL) {
+ test_button.set_active (false);
}
}
}
}
+ void on_test_toggled (Gtk.ToggleButton source) {
+ if (source.get_active ()) {
+ try {
+ mce.req_led_pattern_activate ("PatternError");
+ } catch (DBus.Error e) {
+ Hildon.Banner.show_information (null, null, e.message);
+ }
+ Timeout.add (200, delayed_spawn);
+ } else {
+ try {
+ mce.req_led_pattern_deactivate ("PatternError");
+ } catch (DBus.Error e) {
+ Hildon.Banner.show_information (null, null, e.message);
+ }
+ }
+ }
+
bool delayed_spawn () {
try {
int exit_status;