Update changelog and bump version to 0.0.17-2.
[tweakr] / modules / tweakr-mce.c
index 2450009..cda4562 100644 (file)
@@ -3,6 +3,7 @@
  */ 
 
 #include <config.h>
+#include <glib/gi18n-lib.h>
 
 #include <gtk/gtk.h>
 #include <hildon/hildon-picker-button.h>
         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
         TWEAKR_TYPE_MCE_SECTION))
 
-#define DISABLE_LABEL "Disable"
-#define SHOW_MENU_LABEL "Show menu"
-#define POWER_OFF_LABEL "Power off"
-#define LOCK_LABEL "Lock"
+#define DISABLE_LABEL _("Do nothing")
+#define SHOW_MENU_LABEL _("Show menu")
+#define POWER_OFF_LABEL _("Power off")
+#define LOCK_LABEL _("Lock device")
 
 enum {
     SHORT_POWER_KEY_DISABLED,
@@ -63,25 +64,9 @@ typedef struct _picker_t
     const gchar *label;
 } picker_t;
 
-static picker_t spk [] = {
-    {SHORT_POWER_KEY_DISABLED, "disabled", DISABLE_LABEL},
-    {SHORT_POWER_KEY_MENU, "menu", SHOW_MENU_LABEL},
-    {SHORT_POWER_KEY_OFF, "poweroff", POWER_OFF_LABEL}
-};
-
-static picker_t lpk [] = {
-    {LONG_POWER_KEY_DISABLED, "disabled", DISABLE_LABEL},
-    {LONG_POWER_KEY_MENU, "menu", SHOW_MENU_LABEL},
-    {LONG_POWER_KEY_OFF, "poweroff", POWER_OFF_LABEL}
-};
-
-static picker_t dpk [] = {
-    {DOUBLE_POWER_KEY_DISABLED, "disabled", DISABLE_LABEL},
-    {DOUBLE_POWER_KEY_MENU, "menu", SHOW_MENU_LABEL},
-    {DOUBLE_POWER_KEY_OFF, "poweroff", POWER_OFF_LABEL},
-    {DOUBLE_POWER_KEY_LOCK, "tklock", LOCK_LABEL}
-};
-
+static picker_t spk [SHORT_POWER_KEY_N];
+static picker_t lpk [LONG_POWER_KEY_N];
+static picker_t dpk [DOUBLE_POWER_KEY_N];
 
 typedef struct _TweakrMceSection TweakrMceSection;
 typedef struct _TweakrMceSectionClass
@@ -195,6 +180,18 @@ GtkWidget * _build_short_power_key (TweakrMceSection *section)
     gint i;
     GtkWidget *button, *selector;
 
+    spk[0].index = SHORT_POWER_KEY_DISABLED;
+    spk[0].value = "disabled";
+    spk[0].label = DISABLE_LABEL;
+
+    spk[1].index = SHORT_POWER_KEY_MENU;
+    spk[1].value = "menu";
+    spk[1].label = SHOW_MENU_LABEL;
+
+    spk[2].index = SHORT_POWER_KEY_OFF;
+    spk[2].value = "poweroff";
+    spk[2].label = POWER_OFF_LABEL;
+
     selector = hildon_touch_selector_new_text ();
     for (i = 0; i < SHORT_POWER_KEY_N; i++)
     {
@@ -207,7 +204,7 @@ GtkWidget * _build_short_power_key (TweakrMceSection *section)
     hildon_gtk_widget_set_theme_size (button, HILDON_SIZE_FINGER_HEIGHT);
 
     hildon_button_set_title (HILDON_BUTTON (button),
-                             "Power key: short press");
+                             _("Power key short press"));
     gtk_button_set_alignment (GTK_BUTTON (button), 0.0f, 0.5f);
     hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button),
                                        HILDON_TOUCH_SELECTOR (selector));
@@ -223,6 +220,18 @@ GtkWidget * _build_long_power_key (TweakrMceSection *section)
 {
     gint i;
     GtkWidget *button, *selector;
+    
+    lpk[0].index = LONG_POWER_KEY_DISABLED;
+    lpk[0].value = "disabled";
+    lpk[0].label = DISABLE_LABEL;
+
+    lpk[1].index = LONG_POWER_KEY_MENU;
+    lpk[1].value = "menu";
+    lpk[1].label = SHOW_MENU_LABEL;
+
+    lpk[2].index = LONG_POWER_KEY_OFF;
+    lpk[2].value = "poweroff";
+    lpk[2].label = POWER_OFF_LABEL;
 
     selector = hildon_touch_selector_new_text ();
     for (i = 0; i < LONG_POWER_KEY_N; i++)
@@ -236,7 +245,7 @@ GtkWidget * _build_long_power_key (TweakrMceSection *section)
     hildon_gtk_widget_set_theme_size (button, HILDON_SIZE_FINGER_HEIGHT);
 
     hildon_button_set_title (HILDON_BUTTON (button),
-                             "Power key: long press");
+                             _("Power key long press"));
     gtk_button_set_alignment (GTK_BUTTON (button), 0.0f, 0.5f);
     hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button),
                                        HILDON_TOUCH_SELECTOR (selector));
@@ -253,6 +262,22 @@ GtkWidget * _build_double_power_key (TweakrMceSection *section)
     gint i;
     GtkWidget *button, *selector;
 
+    dpk[0].index = DOUBLE_POWER_KEY_DISABLED;
+    dpk[0].value = "disabled";
+    dpk[0].label = DISABLE_LABEL;
+
+    dpk[1].index = DOUBLE_POWER_KEY_MENU;
+    dpk[1].value = "menu";
+    dpk[1].label = SHOW_MENU_LABEL;
+
+    dpk[2].index = DOUBLE_POWER_KEY_OFF;
+    dpk[2].value = "poweroff";
+    dpk[2].label = POWER_OFF_LABEL;
+
+    dpk[3].index = DOUBLE_POWER_KEY_LOCK;
+    dpk[3].value = "tklock";
+    dpk[3].label = LOCK_LABEL;
+
     selector = hildon_touch_selector_new_text ();
     for (i = 0; i < DOUBLE_POWER_KEY_N; i++)
     {
@@ -265,7 +290,7 @@ GtkWidget * _build_double_power_key (TweakrMceSection *section)
     hildon_gtk_widget_set_theme_size (button, HILDON_SIZE_FINGER_HEIGHT);
 
     hildon_button_set_title (HILDON_BUTTON (button),
-                             "Power key: double press");
+                             _("Power key double press"));
     gtk_button_set_alignment (GTK_BUTTON (button), 0.0f, 0.5f);
     hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button),
                                        HILDON_TOUCH_SELECTOR (selector));
@@ -284,7 +309,7 @@ GtkWidget *_build_lens_cover (TweakrMceSection *section)
     button = hildon_check_button_new (HILDON_SIZE_AUTO);
     hildon_gtk_widget_set_theme_size (button, HILDON_SIZE_FINGER_HEIGHT);
     gtk_button_set_label (GTK_BUTTON (button),
-                          "Opening lens cover unlocks device");
+                          _("Opening camera lens cover unlocks device"));
 
     g_signal_connect (G_OBJECT (button), "toggled",
                       G_CALLBACK (_lens_cover_changed), section);
@@ -362,7 +387,7 @@ tweakr_mce_section_init (TweakrMceSection *section)
     section->value_changed = FALSE;
 
     iface = TWEAKR_SECTION (section);
-    iface->name = "Mce";
+    iface->name = _("Hardware keys");
     iface->widget = gtk_vbox_new (FALSE, 0);
     gtk_box_pack_start (GTK_BOX (iface->widget), section->short_power_key,
                         FALSE, FALSE, 0);
@@ -422,9 +447,10 @@ static gboolean _save (TweakrSection *section,
         gint retcode;
 
         note = hildon_note_new_confirmation
-            (NULL, "Setting all Power Key options to \"Disabled\" means "
-             "that the only way to turn the device off is the removal of "
-             "the battery. Do you want to continue?");
+            (NULL,
+             _("Setting all Power Key options to \"Do nothing\" means "
+               "that the only way to turn the device off is the removal of "
+               "the battery. Do you want to continue?"));
         retcode = gtk_dialog_run (GTK_DIALOG (note));
         gtk_widget_destroy (note);
 
@@ -438,7 +464,7 @@ static gboolean _save (TweakrSection *section,
     argv[1] = g_strdup_printf ("%s", spk[short_active].value);
     argv[2] = g_strdup_printf ("%s", lpk[long_active].value);
     argv[3] = g_strdup_printf ("%s", dpk[double_active].value);
-    argv[4] = g_strdup_printf ("%s", lens_cover_value);
+    argv[4] = g_strdup_printf ("%d", lens_cover_value);
     argv[5] = NULL;
 
     g_spawn_sync ("/home/user", argv, NULL,