return section->widget;
}
-void
+gboolean
maemo_tweaks_section_save (MaemoTweaksSection *section,
gboolean *requires_restart)
{
- g_return_if_fail (MAEMO_TWEAKS_IS_SECTION (section));
+ g_return_val_if_fail (MAEMO_TWEAKS_IS_SECTION (section), TRUE);
if (MAEMO_TWEAKS_SECTION_GET_CLASS (section)->save)
- MAEMO_TWEAKS_SECTION_GET_CLASS (section)->save (section,
- requires_restart);
+ return MAEMO_TWEAKS_SECTION_GET_CLASS (section)->save
+ (section, requires_restart);
else
g_warning ("%s: section class %s doesn't implement "
"MaemoTweaksSection::filter ()\n",
G_STRFUNC, g_type_name (G_TYPE_FROM_INSTANCE (section)));
+
+ return TRUE;
}
const gchar *name;
- void (*save) (MaemoTweaksSection *section, gboolean *requires_restart);
+ gboolean (*save) (MaemoTweaksSection *section,
+ gboolean *requires_restart);
};
MaemoTweaksSection * maemo_tweaks_section_new (GType type);
GtkWidget * maemo_tweaks_section_get_widget (MaemoTweaksSection *section);
-void maemo_tweaks_section_save (MaemoTweaksSection *section,
- gboolean *requires_restart);
+gboolean maemo_tweaks_section_save (MaemoTweaksSection *section,
+ gboolean *requires_restart);
G_END_DECLS
#include "libmaemo-tweaks-section/maemo-tweaks-section.h"
#include "maemo-tweaks-module-manager.h"
+static gboolean save_ret;
+
GtkWidget *create_dialog (GtkWindow *parent)
{
GtkWidget *dialog;
return dialog;
}
+void _save (MaemoTweaksSection *section, gboolean *requires_restart)
+{
+ save_ret &= maemo_tweaks_section_save (section, requires_restart);
+}
+
osso_return_t execute (osso_context_t *osso, gpointer data,
gboolean user_activated)
{
}
gtk_widget_show_all (GTK_DIALOG (dialog)->vbox);
- response = gtk_dialog_run (GTK_DIALOG (dialog));
- if (response == GTK_RESPONSE_OK)
+
+ for (;;)
{
- /* Save all settings */
- g_list_foreach (sections, (GFunc) maemo_tweaks_section_save,
- &requires_restart);
+ save_ret = TRUE;
+ response = gtk_dialog_run (GTK_DIALOG (dialog));
+ if (response == GTK_RESPONSE_OK)
+ {
+ /* Save all settings */
+ g_list_foreach (sections, (GFunc) _save, &requires_restart);
+ }
+ if (save_ret)
+ break;
}
gtk_widget_destroy (GTK_WIDGET (dialog));
(MaemoTweaksDesktopSection *section);
static void maemo_tweaks_desktop_section_dispose (GObject *obj);
-static void _save (MaemoTweaksSection *section, gboolean *requires_restart);
+static gboolean _save (MaemoTweaksSection *section,
+ gboolean *requires_restart);
static GType maemo_tweaks_desktop_section_type = 0;
static MaemoTweaksSectionClass *
}
-static void _save (MaemoTweaksSection *section, gboolean *requires_restart)
+static gboolean _save (MaemoTweaksSection *section,
+ gboolean *requires_restart)
{
gchar *argv[3];
gint active;
g_free (argv[0]);
g_free (argv[1]);
+
+ return TRUE;
}
#include <gtk/gtk.h>
#include <hildon/hildon-picker-button.h>
#include <hildon/hildon-touch-selector.h>
+#include <hildon/hildon-note.h>
#include "libmaemo-tweaks-section/maemo-tweaks-section.h"
#include "libmaemo-tweaks-section/maemo-tweaks-module.h"
(MaemoTweaksMceSection *section);
static void maemo_tweaks_mce_section_dispose (GObject *obj);
-static void _save (MaemoTweaksSection *section, gboolean *requires_restart);
+static gboolean _save (MaemoTweaksSection *section,
+ gboolean *requires_restart);
static GType maemo_tweaks_mce_section_type = 0;
static MaemoTweaksSectionClass *
(obj);
}
-static void _save (MaemoTweaksSection *section, gboolean *requires_restart)
+static gboolean _save (MaemoTweaksSection *section,
+ gboolean *requires_restart)
{
gchar *argv[5];
gint short_active, long_active, double_active;
gint i;
if (!MAEMO_TWEAKS_MCE_SECTION (section)->value_changed)
- return;
-
- *requires_restart = TRUE;
+ return TRUE;
short_active = hildon_picker_button_get_active
(HILDON_PICKER_BUTTON (MAEMO_TWEAKS_MCE_SECTION
(HILDON_PICKER_BUTTON (MAEMO_TWEAKS_MCE_SECTION
(section)->double_power_key));
+ if (short_active == SHORT_POWER_KEY_DISABLED &&
+ long_active == LONG_POWER_KEY_DISABLED &&
+ double_active == DOUBLE_POWER_KEY_DISABLED)
+ {
+ GtkWidget *note;
+ 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?");
+ retcode = gtk_dialog_run (GTK_DIALOG (note));
+ gtk_widget_destroy (note);
+
+ if (retcode == GTK_RESPONSE_CANCEL)
+ return FALSE;
+ }
+
+ *requires_restart = TRUE;
+
argv[0] = g_strdup ("/usr/bin/maemo-tweaks-mce-save");
argv[1] = g_strdup_printf ("%s", spk[short_active].value);
argv[2] = g_strdup_printf ("%s", lpk[long_active].value);
for (i = 0; i < (sizeof (argv) / sizeof (gchar *)) - 1; i++)
g_free (argv[i]);
+
+ return TRUE;
}