}
void
-maemo_tweaks_section_save (MaemoTweaksSection *section)
+maemo_tweaks_section_save (MaemoTweaksSection *section,
+ gboolean *requires_restart)
{
g_return_if_fail (MAEMO_TWEAKS_IS_SECTION (section));
if (MAEMO_TWEAKS_SECTION_GET_CLASS (section)->save)
- MAEMO_TWEAKS_SECTION_GET_CLASS (section)->save (section);
+ MAEMO_TWEAKS_SECTION_GET_CLASS (section)->save (section,
+ requires_restart);
else
g_warning ("%s: section class %s doesn't implement "
"MaemoTweaksSection::filter ()\n",
const gchar *name;
- void (*save) (MaemoTweaksSection *section);
+ void (*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);
+void maemo_tweaks_section_save (MaemoTweaksSection *section,
+ gboolean *requires_restart);
G_END_DECLS
#include <hildon-cp-plugin/hildon-cp-plugin-interface.h>
#include <gtk/gtk.h>
+#include <hildon/hildon-note.h>
#include "maemo-tweaks-types.h"
#include "libmaemo-tweaks-section/maemo-tweaks-section.h"
guint n_sections;
GList *sections = NULL;
gint i;
+ gboolean requires_restart = FALSE;
manager = g_object_new (MAEMO_TWEAKS_TYPE_MODULE_MANAGER,
"module-path", MODULES_DIR,
if (response == GTK_RESPONSE_OK)
{
/* Save all settings */
- g_list_foreach (sections, (GFunc) maemo_tweaks_section_save, NULL);
+ g_list_foreach (sections, (GFunc) maemo_tweaks_section_save,
+ &requires_restart);
}
-
gtk_widget_destroy (GTK_WIDGET (dialog));
g_object_unref (manager);
if (sections)
g_list_free (sections);
}
+ if (requires_restart)
+ {
+ GtkWidget *note;
+
+ note = hildon_note_new_information
+ (GTK_WINDOW (data), "Some of the settings you have changed"
+ " will take effect only after you restart your device.");
+ gtk_dialog_run (GTK_DIALOG (note));
+ gtk_widget_destroy (note);
+ }
+
return OSSO_OK;
}
(MaemoTweaksDesktopSection *section);
static void maemo_tweaks_desktop_section_dispose (GObject *obj);
-static void _save (MaemoTweaksSection *section);
+static void _save (MaemoTweaksSection *section, gboolean *requires_restart);
static GType maemo_tweaks_desktop_section_type = 0;
static MaemoTweaksSectionClass *
}
-static void _save (MaemoTweaksSection *section)
+static void _save (MaemoTweaksSection *section, gboolean *requires_restart)
{
gchar *argv[3];
gint active;
GKeyFile *ini;
GtkWidget *short_power_key;
+
+ guint value_changed : 1;
};
struct _MaemoTweaksMceSectionClass
(MaemoTweaksMceSection *section);
static void maemo_tweaks_mce_section_dispose (GObject *obj);
-static void _save (MaemoTweaksSection *section);
+static void _save (MaemoTweaksSection *section, gboolean *requires_restart);
static GType maemo_tweaks_mce_section_type = 0;
static MaemoTweaksSectionClass *
object_class->dispose = maemo_tweaks_mce_section_dispose;
}
-GtkWidget * _build_short_power_key (void)
+static void _value_changed (HildonPickerButton *b, gpointer user_data)
+{
+ MaemoTweaksMceSection *section = MAEMO_TWEAKS_MCE_SECTION (user_data);
+
+ section->value_changed = TRUE;
+}
+
+GtkWidget * _build_short_power_key (MaemoTweaksMceSection *section)
{
gint i;
GtkWidget *button, *selector;
hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button),
HILDON_TOUCH_SELECTOR (selector));
+ g_signal_connect (G_OBJECT (button), "value-changed",
+ G_CALLBACK (_value_changed), section);
+
gtk_widget_show (button);
return button;
}
gchar *short_power_key_value;
gint i;
- section->short_power_key = _build_short_power_key ();
+ section->short_power_key = _build_short_power_key (section);
section->ini = g_key_file_new ();
}
}
+ section->value_changed = FALSE;
iface = MAEMO_TWEAKS_SECTION (section);
iface->widget = gtk_vbox_new (FALSE, 0);
}
-static void _save (MaemoTweaksSection *section)
+static void _save (MaemoTweaksSection *section, gboolean *requires_restart)
{
gchar *argv[3];
gint active;
+ if (!MAEMO_TWEAKS_MCE_SECTION (section)->value_changed)
+ return;
+
+ *requires_restart = TRUE;
+
active = hildon_picker_button_get_active
(HILDON_PICKER_BUTTON (MAEMO_TWEAKS_MCE_SECTION
(section)->short_power_key));