#include <hildon/hildon-picker-button.h>
#include <hildon/hildon-touch-selector.h>
#include <hildon/hildon-note.h>
+#include <hildon/hildon-check-button.h>
#include "libtweakr-section/tweakr-section.h"
#include "libtweakr-section/tweakr-module.h"
GtkWidget *short_power_key;
GtkWidget *long_power_key;
GtkWidget *double_power_key;
+ GtkWidget *lens_cover;
guint value_changed : 1;
};
section->value_changed = TRUE;
}
+static void _lens_cover_changed (HildonCheckButton *b, gpointer user_data)
+{
+ TweakrMceSection *section = TWEAKR_MCE_SECTION (user_data);
+
+ section->value_changed = TRUE;
+}
+
GtkWidget * _build_short_power_key (TweakrMceSection *section)
{
gint i;
return button;
}
+GtkWidget *_build_lens_cover (TweakrMceSection *section)
+{
+ GtkWidget *button;
+
+ 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");
+
+ g_signal_connect (G_OBJECT (button), "toggled",
+ G_CALLBACK (_lens_cover_changed), section);
+
+ gtk_widget_show (button);
+ return button;
+}
static void
tweakr_mce_section_init (TweakrMceSection *section)
gchar *long_power_key_value;
gchar *double_power_key_value;
gint i;
+ gboolean lens_cover_value;
section->short_power_key = _build_short_power_key (section);
section->long_power_key = _build_long_power_key (section);
section->double_power_key = _build_double_power_key (section);
+ section->lens_cover = _build_lens_cover (section);
section->ini = g_key_file_new ();
double_power_key_value = g_key_file_get_string (section->ini, "PowerKey",
"PowerKeyDoubleAction",
NULL);
+ lens_cover_value = g_key_file_get_boolean (section->ini, "TKLock",
+ "LensCoverUnlock", NULL);
for (i = 0; i < SHORT_POWER_KEY_N; i++)
{
}
}
+ hildon_check_button_set_active
+ (HILDON_CHECK_BUTTON (section->lens_cover), lens_cover_value);
+
section->value_changed = FALSE;
iface = TWEAKR_SECTION (section);
FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (iface->widget), section->double_power_key,
FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (iface->widget), section->lens_cover,
+ FALSE, FALSE, 0);
}
static void
static gboolean _save (TweakrSection *section,
gboolean *requires_restart)
{
- gchar *argv[5];
+ gchar *argv[6];
gint short_active, long_active, double_active;
gint i;
+ gboolean lens_cover_value;
if (!TWEAKR_MCE_SECTION (section)->value_changed)
return TRUE;
(HILDON_PICKER_BUTTON (TWEAKR_MCE_SECTION
(section)->double_power_key));
+ lens_cover_value = hildon_check_button_get_active
+ (HILDON_CHECK_BUTTON (TWEAKR_MCE_SECTION (section)->lens_cover));
+
if (short_active == SHORT_POWER_KEY_DISABLED &&
long_active == LONG_POWER_KEY_DISABLED &&
double_active == DOUBLE_POWER_KEY_DISABLED)
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] = NULL;
+ argv[4] = g_strdup_printf ("%s", lens_cover_value);
+ argv[5] = NULL;
g_spawn_sync ("/home/user", argv, NULL,
G_SPAWN_STDOUT_TO_DEV_NULL | G_SPAWN_STDERR_TO_DEV_NULL,