2 * vim:ts=4:sw=4:et:cindent:cino=(0
5 #include <hildon-cp-plugin/hildon-cp-plugin-interface.h>
7 #include <hildon/hildon-note.h>
9 #include "maemo-tweaks-types.h"
10 #include "libmaemo-tweaks-section/maemo-tweaks-section.h"
11 #include "maemo-tweaks-module-manager.h"
13 GtkWidget *create_dialog (GtkWindow *parent)
17 dialog = gtk_dialog_new_with_buttons
20 GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR,
30 osso_return_t execute (osso_context_t *osso, gpointer data,
31 gboolean user_activated)
36 MaemoTweaksModuleManager *manager;
39 GList *sections = NULL;
41 gboolean requires_restart = FALSE;
43 manager = g_object_new (MAEMO_TWEAKS_TYPE_MODULE_MANAGER,
44 "module-path", MODULES_DIR,
47 section_types = g_type_children (MAEMO_TWEAKS_TYPE_SECTION, &n_sections);
49 dialog = create_dialog (GTK_WINDOW (data));
51 for (i = 0; i < n_sections; i++)
53 MaemoTweaksSection *section;
54 MaemoTweaksSectionClass *klass;
56 klass = g_type_class_ref (section_types[i]);
57 section = maemo_tweaks_section_new (section_types[i]);
59 sections = g_list_prepend (sections, section);
60 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
61 maemo_tweaks_section_get_widget (section),
64 g_type_class_unref (klass);
67 gtk_widget_show_all (GTK_DIALOG (dialog)->vbox);
68 response = gtk_dialog_run (GTK_DIALOG (dialog));
69 if (response == GTK_RESPONSE_OK)
71 /* Save all settings */
72 g_list_foreach (sections, (GFunc) maemo_tweaks_section_save,
76 gtk_widget_destroy (GTK_WIDGET (dialog));
77 g_object_unref (manager);
80 g_list_foreach (sections, (GFunc) g_object_unref, NULL);
81 g_list_free (sections);
88 note = hildon_note_new_information
89 (GTK_WINDOW (data), "Some of the settings you have changed"
90 " will take effect only after you restart your device.");
91 gtk_dialog_run (GTK_DIALOG (note));
92 gtk_widget_destroy (note);